From edaed825650eea32878441d3b8c7eb40e8877882 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Mon, 28 Sep 2020 16:17:31 -0700
Subject: Add examples
---
examples/system/README.md | 10 +++++++++
examples/system/bare.nix | 6 +++++
examples/system/common.nix | 30 +++++++++++++++++++++++++
examples/system/configuration.nix | 11 ++++++++++
examples/system/flake.lock | 25 +++++++++++++++++++++
examples/system/flake.nix | 46 +++++++++++++++++++++++++++++++++++++++
examples/system/hello.nix | 27 +++++++++++++++++++++++
examples/system/nix-pub.pem | 1 +
examples/system/nix.key | 1 +
9 files changed, 157 insertions(+)
create mode 100644 examples/system/README.md
create mode 100644 examples/system/bare.nix
create mode 100644 examples/system/common.nix
create mode 100644 examples/system/configuration.nix
create mode 100644 examples/system/flake.lock
create mode 100644 examples/system/flake.nix
create mode 100644 examples/system/hello.nix
create mode 100644 examples/system/nix-pub.pem
create mode 100644 examples/system/nix.key
(limited to 'examples/system')
diff --git a/examples/system/README.md b/examples/system/README.md
new file mode 100644
index 0000000..1dea41f
--- /dev/null
+++ b/examples/system/README.md
@@ -0,0 +1,10 @@
+# Example nixos system deployment
+
+This is an example of how to deploy a full nixos system with a separate user unit to a bare machine.
+
+1. Run bare system from `.#nixosConfigurations.bare`
+ - `nix build .#nixosConfigurations.bare.config.system.build.vm`
+ - `QEMU_NET_OPTS=hostfwd=tcp::2221-:22 ./result/bin/run-bare-system-vm`
+2. `nix run github:serokell/deploy --prime`
+3. ???
+4. PROFIT!!!
diff --git a/examples/system/bare.nix b/examples/system/bare.nix
new file mode 100644
index 0000000..282080f
--- /dev/null
+++ b/examples/system/bare.nix
@@ -0,0 +1,6 @@
+{
+ imports = [ ./common.nix ];
+
+ # Use that when deploy scripts asks you for a hostname
+ networking.hostName = "bare-system";
+}
diff --git a/examples/system/common.nix b/examples/system/common.nix
new file mode 100644
index 0000000..7e7448e
--- /dev/null
+++ b/examples/system/common.nix
@@ -0,0 +1,30 @@
+{
+ boot.loader.systemd-boot.enable = true;
+
+ fileSystems."/" = {
+ device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000";
+ fsType = "btrfs";
+ };
+
+ users.users.admin = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" "sudo" ];
+ password = "123";
+ };
+
+ services.openssh = { enable = true; };
+
+ # Another option would be root on the server
+ security.sudo.extraRules = [{
+ groups = [ "wheel" ];
+ commands = [{
+ command = "ALL";
+ options = [ "NOPASSWD" ];
+ }];
+ }];
+
+ nix.binaryCachePublicKeys = [
+ (builtins.readFile ./nix-pub.pem)
+ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
+ ];
+}
diff --git a/examples/system/configuration.nix b/examples/system/configuration.nix
new file mode 100644
index 0000000..b2b55cf
--- /dev/null
+++ b/examples/system/configuration.nix
@@ -0,0 +1,11 @@
+{
+ imports = [ ./common.nix ];
+
+ networking.hostName = "example-nixos-syyyystem";
+
+ users.users.hello = {
+ isNormalUser = true;
+ password = "";
+ uid = 1010;
+ };
+}
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
new file mode 100644
index 0000000..a57ff9d
--- /dev/null
+++ b/examples/system/flake.lock
@@ -0,0 +1,25 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1592491430,
+ "narHash": "sha256-7WNpr16iUyjG4caad137nCqxXNTdct202jy05lslZXA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "07299ff81e58e16b282fe602ce5e629854dfd544",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
new file mode 100644
index 0000000..383960b
--- /dev/null
+++ b/examples/system/flake.nix
@@ -0,0 +1,46 @@
+{
+ description = "Deploy a full system with hello service as a separate profile";
+
+
+ outputs = { self, nixpkgs }: {
+ nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./configuration.nix ];
+ };
+
+ nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
+ };
+
+ # This is the application we actually want to run
+ defaultPackage.x86_64-linux = import ./hello.nix nixpkgs;
+
+ deploy.nodes.example = {
+ sshOpts = [ "-p" "2221" ];
+ hostname = "localhost";
+ fastConnection = true;
+ profiles = {
+ system = {
+ sshUser = "admin";
+ activate = "$PROFILE/bin/switch-to-configuration switch";
+ path = self.nixosConfigurations.example-nixos-system.config.system.build.toplevel;
+ user = "root";
+ };
+ hello = {
+ sshUser = "hello";
+ activate = "$PROFILE/bin/activate";
+ path = self.defaultPackage.x86_64-linux;
+ user = "hello";
+ };
+ };
+ };
+
+ checks = builtins.mapAttrs (_: pkgs: {
+ jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { }
+ "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
+ pkgs.writeText "deploy.json" (builtins.toJSON self.deploy)
+ } ${../../interface/deploy.json} && touch $out";
+ }) nixpkgs.legacyPackages;
+ };
+}
diff --git a/examples/system/hello.nix b/examples/system/hello.nix
new file mode 100644
index 0000000..8c207f1
--- /dev/null
+++ b/examples/system/hello.nix
@@ -0,0 +1,27 @@
+nixpkgs:
+let
+ pkgs = nixpkgs.legacyPackages.x86_64-linux;
+ generateSystemd = type: name: config:
+ (nixpkgs.lib.nixosSystem {
+ modules = [{ systemd."${type}s".${name} = config; }];
+ system = "x86_64-linux";
+ }).config.systemd.units."${name}.${type}".text;
+
+ mkService = generateSystemd "service";
+
+ service = pkgs.writeTextFile {
+ name = "hello.service";
+ text = mkService "hello" {
+ unitConfig.WantedBy = [ "multi-user.target" ];
+ path = [ pkgs.hello ];
+ script = "hello -g lel; touch $HOME/oof";
+ };
+ };
+in
+pkgs.writeShellScriptBin "activate" ''
+ mkdir -p $HOME/.config/systemd/user
+ rm $HOME/.config/systemd/user/hello.service
+ ln -s ${service} $HOME/.config/systemd/user/hello.service
+ systemctl --user daemon-reload
+ systemctl --user restart hello
+''
diff --git a/examples/system/nix-pub.pem b/examples/system/nix-pub.pem
new file mode 100644
index 0000000..926f44c
--- /dev/null
+++ b/examples/system/nix-pub.pem
@@ -0,0 +1 @@
+cache.example.com:ic28PY7OIOQtoU282iaiizvA5WIOtYx5h6c9ePn3hDQ=
\ No newline at end of file
diff --git a/examples/system/nix.key b/examples/system/nix.key
new file mode 100644
index 0000000..9157587
--- /dev/null
+++ b/examples/system/nix.key
@@ -0,0 +1 @@
+cache.example.com:dPNdwv04QPIEpcWnGioZmX9dvaGe7GCo7BZJFymDBnSJzbw9js4g5C2hTbzaJqKLO8DlYg61jHmHpz14+feENA==
\ No newline at end of file
--
cgit v1.2.3
From 8d21dd335e5259dadf832a5d1a7c72b9dd1f4400 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Tue, 29 Sep 2020 15:10:06 -0700
Subject: Add license information, reformat Nix files, clean up
---
examples/system/README.md | 6 ++++++
examples/system/bare.nix | 4 ++++
examples/system/common.nix | 4 ++++
examples/system/configuration.nix | 6 +++++-
examples/system/flake.lock.license | 3 +++
examples/system/flake.nix | 17 +++++++++++------
examples/system/hello.nix | 9 ++++++---
examples/system/nix-pub.pem.license | 3 +++
examples/system/nix.key.license | 3 +++
9 files changed, 45 insertions(+), 10 deletions(-)
create mode 100644 examples/system/flake.lock.license
create mode 100644 examples/system/nix-pub.pem.license
create mode 100644 examples/system/nix.key.license
(limited to 'examples/system')
diff --git a/examples/system/README.md b/examples/system/README.md
index 1dea41f..daf649a 100644
--- a/examples/system/README.md
+++ b/examples/system/README.md
@@ -1,3 +1,9 @@
+
+
# Example nixos system deployment
This is an example of how to deploy a full nixos system with a separate user unit to a bare machine.
diff --git a/examples/system/bare.nix b/examples/system/bare.nix
index 282080f..46ba3b2 100644
--- a/examples/system/bare.nix
+++ b/examples/system/bare.nix
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2020 Serokell
+#
+# SPDX-License-Identifier: MPL-2.0
+
{
imports = [ ./common.nix ];
diff --git a/examples/system/common.nix b/examples/system/common.nix
index 7e7448e..83ea225 100644
--- a/examples/system/common.nix
+++ b/examples/system/common.nix
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2020 Serokell
+#
+# SPDX-License-Identifier: MPL-2.0
+
{
boot.loader.systemd-boot.enable = true;
diff --git a/examples/system/configuration.nix b/examples/system/configuration.nix
index b2b55cf..6d4234a 100644
--- a/examples/system/configuration.nix
+++ b/examples/system/configuration.nix
@@ -1,7 +1,11 @@
+# SPDX-FileCopyrightText: 2020 Serokell
+#
+# SPDX-License-Identifier: MPL-2.0
+
{
imports = [ ./common.nix ];
- networking.hostName = "example-nixos-syyyystem";
+ networking.hostName = "example-nixos-system";
users.users.hello = {
isNormalUser = true;
diff --git a/examples/system/flake.lock.license b/examples/system/flake.lock.license
new file mode 100644
index 0000000..9e9897d
--- /dev/null
+++ b/examples/system/flake.lock.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2020 Serokell
+
+SPDX-License-Identifier: MPL-2.0
\ No newline at end of file
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
index 383960b..5179258 100644
--- a/examples/system/flake.nix
+++ b/examples/system/flake.nix
@@ -1,7 +1,10 @@
+# SPDX-FileCopyrightText: 2020 Serokell
+#
+# SPDX-License-Identifier: MPL-2.0
+
{
description = "Deploy a full system with hello service as a separate profile";
-
outputs = { self, nixpkgs }: {
nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@@ -10,7 +13,8 @@
nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
- modules = [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
+ modules =
+ [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
};
# This is the application we actually want to run
@@ -24,7 +28,8 @@
system = {
sshUser = "admin";
activate = "$PROFILE/bin/switch-to-configuration switch";
- path = self.nixosConfigurations.example-nixos-system.config.system.build.toplevel;
+ path =
+ self.nixosConfigurations.example-nixos-system.config.system.build.toplevel;
user = "root";
};
hello = {
@@ -38,9 +43,9 @@
checks = builtins.mapAttrs (_: pkgs: {
jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { }
- "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
- pkgs.writeText "deploy.json" (builtins.toJSON self.deploy)
- } ${../../interface/deploy.json} && touch $out";
+ "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
+ pkgs.writeText "deploy.json" (builtins.toJSON self.deploy)
+ } ${../../interface/deploy.json} && touch $out";
}) nixpkgs.legacyPackages;
};
}
diff --git a/examples/system/hello.nix b/examples/system/hello.nix
index 8c207f1..df57308 100644
--- a/examples/system/hello.nix
+++ b/examples/system/hello.nix
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2020 Serokell
+#
+# SPDX-License-Identifier: MPL-2.0
+
nixpkgs:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
@@ -14,11 +18,10 @@ let
text = mkService "hello" {
unitConfig.WantedBy = [ "multi-user.target" ];
path = [ pkgs.hello ];
- script = "hello -g lel; touch $HOME/oof";
+ script = "hello";
};
};
-in
-pkgs.writeShellScriptBin "activate" ''
+in pkgs.writeShellScriptBin "activate" ''
mkdir -p $HOME/.config/systemd/user
rm $HOME/.config/systemd/user/hello.service
ln -s ${service} $HOME/.config/systemd/user/hello.service
diff --git a/examples/system/nix-pub.pem.license b/examples/system/nix-pub.pem.license
new file mode 100644
index 0000000..9e9897d
--- /dev/null
+++ b/examples/system/nix-pub.pem.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2020 Serokell
+
+SPDX-License-Identifier: MPL-2.0
\ No newline at end of file
diff --git a/examples/system/nix.key.license b/examples/system/nix.key.license
new file mode 100644
index 0000000..9e9897d
--- /dev/null
+++ b/examples/system/nix.key.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2020 Serokell
+
+SPDX-License-Identifier: MPL-2.0
\ No newline at end of file
--
cgit v1.2.3
From 5674670a59168fb05f26e5b4fb41dd2662810e94 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Fri, 2 Oct 2020 12:58:11 -0700
Subject: General improvements, deprecate `activate` profile option in favor of
executing $PROFILE/activate (Wrap It Yourself) to ensure successful rollback
activations
---
examples/system/flake.nix | 88 ++++++++++++++++++++++++++++-------------------
1 file changed, 53 insertions(+), 35 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
index 5179258..68cf3ce 100644
--- a/examples/system/flake.nix
+++ b/examples/system/flake.nix
@@ -5,47 +5,65 @@
{
description = "Deploy a full system with hello service as a separate profile";
- outputs = { self, nixpkgs }: {
- nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [ ./configuration.nix ];
- };
+ outputs = { self, nixpkgs }:
+ let
+ setActivate = base: activate: nixpkgs.legacyPackages.x86_64-linux.symlinkJoin {
+ name = ("activatable-" + base.name);
+ paths = [
+ base
+ (nixpkgs.legacyPackages.x86_64-linux.writeTextFile {
+ name = base.name + "-activate-path";
+ text = ''
+ #!${nixpkgs.legacyPackages.x86_64-linux.runtimeShell}
+ ${activate}
+ '';
+ executable = true;
+ destination = "/activate";
+ })
+ ];
+ };
+ in
+ {
+ nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./configuration.nix ];
+ };
- nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules =
- [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
- };
+ nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules =
+ [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
+ };
- # This is the application we actually want to run
- defaultPackage.x86_64-linux = import ./hello.nix nixpkgs;
+ # This is the application we actually want to run
+ defaultPackage.x86_64-linux = import ./hello.nix nixpkgs;
- deploy.nodes.example = {
- sshOpts = [ "-p" "2221" ];
- hostname = "localhost";
- fastConnection = true;
- profiles = {
- system = {
- sshUser = "admin";
- activate = "$PROFILE/bin/switch-to-configuration switch";
- path =
- self.nixosConfigurations.example-nixos-system.config.system.build.toplevel;
- user = "root";
- };
- hello = {
- sshUser = "hello";
- activate = "$PROFILE/bin/activate";
- path = self.defaultPackage.x86_64-linux;
- user = "hello";
+ deploy.nodes.example = {
+ sshOpts = [ "-p" "2221" ];
+ hostname = "localhost";
+ fastConnection = true;
+ profiles = {
+ system = {
+ sshUser = "admin";
+ path =
+ setActivate self.nixosConfigurations.example-nixos-system.config.system.build.toplevel "./bin/switch-to-configuration switch";
+ user = "root";
+ };
+ hello = {
+ sshUser = "hello";
+ path = setActivate self.defaultPackage.x86_64-linux "./bin/activate";
+ user = "hello";
+ };
};
};
- };
- checks = builtins.mapAttrs (_: pkgs: {
- jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { }
- "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
+ checks = builtins.mapAttrs
+ (_: pkgs: {
+ jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { }
+ "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
pkgs.writeText "deploy.json" (builtins.toJSON self.deploy)
} ${../../interface/deploy.json} && touch $out";
- }) nixpkgs.legacyPackages;
- };
+ })
+ nixpkgs.legacyPackages;
+ };
}
--
cgit v1.2.3
From 7c00fd2761e6efffe763ece5d08d9a6d3fb95092 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Mon, 5 Oct 2020 19:46:28 -0700
Subject: Add interface with json schema, fix flake-less issues, put
setActivate and jsonSchema check in flake lib
---
examples/system/flake.lock | 85 +++++++++++++++++++++++++++++++++++++++++++-
examples/system/flake.nix | 87 +++++++++++++++++-----------------------------
2 files changed, 116 insertions(+), 56 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index a57ff9d..d3e489a 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -1,6 +1,73 @@
{
"nodes": {
+ "deploy-rs": {
+ "inputs": {
+ "naersk": "naersk",
+ "nixpkgs": "nixpkgs_2",
+ "utils": "utils"
+ },
+ "locked": {
+ "lastModified": 1601668691,
+ "narHash": "sha256-HvzPMsgSOQfCRoPtkwLRv09CkNjOsLHjcZtyHF+8Zbs=",
+ "type": "git",
+ "url": "file:///home/notgne2/Dev/Serokell/deploy-rs"
+ },
+ "original": {
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "type": "github"
+ }
+ },
+ "naersk": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ },
+ "locked": {
+ "lastModified": 1597138680,
+ "narHash": "sha256-3pDN/W17wjVDbrkgo60xQSb24+QAPQ7ulsUq5atNni0=",
+ "owner": "nmattia",
+ "repo": "naersk",
+ "rev": "529e910a3f423a8211f8739290014b754b2555b6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nmattia",
+ "ref": "master",
+ "repo": "naersk",
+ "type": "github"
+ }
+ },
"nixpkgs": {
+ "locked": {
+ "lastModified": 1601091160,
+ "narHash": "sha256-26UI9LGjRO8Sv253zJZkoapP260QkJPQ2+vRyC1i+kI=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "2768436826543af2b1540e4fe6b5afa15850e155",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1600387253,
+ "narHash": "sha256-WtdpHuiunPF9QMlcXrWJkESuIjSSjP9WMOKvYQS/D7M=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "72b9660dc18ba347f7cd41a9504fc181a6d87dc3",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_3": {
"locked": {
"lastModified": 1592491430,
"narHash": "sha256-7WNpr16iUyjG4caad137nCqxXNTdct202jy05lslZXA=",
@@ -16,7 +83,23 @@
},
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "deploy-rs": "deploy-rs",
+ "nixpkgs": "nixpkgs_3"
+ }
+ },
+ "utils": {
+ "locked": {
+ "lastModified": 1600209923,
+ "narHash": "sha256-zoOWauTliFEjI++esk6Jzk7QO5EKpddWXQm9yQK24iM=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "3cd06d3c1df6879c9e41cb2c33113df10566c760",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
}
}
},
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
index 68cf3ce..32fefa1 100644
--- a/examples/system/flake.nix
+++ b/examples/system/flake.nix
@@ -5,65 +5,42 @@
{
description = "Deploy a full system with hello service as a separate profile";
- outputs = { self, nixpkgs }:
- let
- setActivate = base: activate: nixpkgs.legacyPackages.x86_64-linux.symlinkJoin {
- name = ("activatable-" + base.name);
- paths = [
- base
- (nixpkgs.legacyPackages.x86_64-linux.writeTextFile {
- name = base.name + "-activate-path";
- text = ''
- #!${nixpkgs.legacyPackages.x86_64-linux.runtimeShell}
- ${activate}
- '';
- executable = true;
- destination = "/activate";
- })
- ];
- };
- in
- {
- nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [ ./configuration.nix ];
- };
+ inputs.deploy-rs.url = "github:serokell/deploy-rs";
- nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules =
- [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
- };
+ outputs = { self, nixpkgs, deploy-rs }: {
+ nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./configuration.nix ];
+ };
- # This is the application we actually want to run
- defaultPackage.x86_64-linux = import ./hello.nix nixpkgs;
+ nixosConfigurations.bare = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules =
+ [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ];
+ };
- deploy.nodes.example = {
- sshOpts = [ "-p" "2221" ];
- hostname = "localhost";
- fastConnection = true;
- profiles = {
- system = {
- sshUser = "admin";
- path =
- setActivate self.nixosConfigurations.example-nixos-system.config.system.build.toplevel "./bin/switch-to-configuration switch";
- user = "root";
- };
- hello = {
- sshUser = "hello";
- path = setActivate self.defaultPackage.x86_64-linux "./bin/activate";
- user = "hello";
- };
+ # This is the application we actually want to run
+ defaultPackage.x86_64-linux = import ./hello.nix nixpkgs;
+
+ deploy.nodes.example = {
+ sshOpts = [ "-p" "2221" ];
+ hostname = "localhost";
+ fastConnection = true;
+ profiles = {
+ system = {
+ sshUser = "admin";
+ path =
+ deploy-rs.lib.x86_64-linux.setActivate self.nixosConfigurations.example-nixos-system.config.system.build.toplevel "./bin/switch-to-configuration switch";
+ user = "root";
+ };
+ hello = {
+ sshUser = "hello";
+ path = deploy-rs.lib.x86_64-linux.setActivate self.defaultPackage.x86_64-linux "./bin/activate";
+ user = "hello";
};
};
-
- checks = builtins.mapAttrs
- (_: pkgs: {
- jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { }
- "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
- pkgs.writeText "deploy.json" (builtins.toJSON self.deploy)
- } ${../../interface/deploy.json} && touch $out";
- })
- nixpkgs.legacyPackages;
};
+
+ checks = { "x86_64-linux" = { jsonSchema = deploy-rs.lib.x86_64-linux.checkSchema self.deploy; }; };
+ };
}
--
cgit v1.2.3
From aabcf6b77d4159100a49b143cbb8da4bad194f14 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Mon, 5 Oct 2020 20:10:41 -0700
Subject: Improve schema a bit, fix flake locks for examples
---
examples/system/flake.lock | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index d3e489a..8f4ca88 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -7,10 +7,12 @@
"utils": "utils"
},
"locked": {
- "lastModified": 1601668691,
- "narHash": "sha256-HvzPMsgSOQfCRoPtkwLRv09CkNjOsLHjcZtyHF+8Zbs=",
- "type": "git",
- "url": "file:///home/notgne2/Dev/Serokell/deploy-rs"
+ "lastModified": 1601952901,
+ "narHash": "sha256-6U0JIlh6GLqkxdyUiVRbph9k1lVCtWLno2uM/Fd/ZzI=",
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "rev": "1de1ad5ff893bfcabdf2bfa20d8c93a8cdbb0156",
+ "type": "github"
},
"original": {
"owner": "serokell",
--
cgit v1.2.3
From 3a92593bf9c4ca07a2b09888e4a3f7dff6c9c510 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Tue, 6 Oct 2020 11:08:40 -0700
Subject: Add skip-push flag
---
examples/system/flake.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index 8f4ca88..b54c929 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -71,11 +71,11 @@
},
"nixpkgs_3": {
"locked": {
- "lastModified": 1592491430,
- "narHash": "sha256-7WNpr16iUyjG4caad137nCqxXNTdct202jy05lslZXA=",
+ "lastModified": 1601994071,
+ "narHash": "sha256-J1TNrQI3Gb5Yl9b4+O6eh1Zp1ha4YhI7ewsN1M/9x68=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "07299ff81e58e16b282fe602ce5e629854dfd544",
+ "rev": "6f90e1df4f27326c52b805cfd01fc79a49208e5c",
"type": "github"
},
"original": {
--
cgit v1.2.3
From f2e5b9b39303ec66142caadad6aea74ee56a4c93 Mon Sep 17 00:00:00 2001
From: notgne2
Date: Sun, 11 Oct 2020 15:09:37 -0700
Subject: Update lock files
---
examples/system/flake.lock | 53 +++++++++++++++++++++++++---------------------
1 file changed, 29 insertions(+), 24 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index b54c929..ff339a8 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -2,16 +2,17 @@
"nodes": {
"deploy-rs": {
"inputs": {
+ "flake-compat": "flake-compat",
"naersk": "naersk",
- "nixpkgs": "nixpkgs_2",
+ "nixpkgs": "nixpkgs",
"utils": "utils"
},
"locked": {
- "lastModified": 1601952901,
- "narHash": "sha256-6U0JIlh6GLqkxdyUiVRbph9k1lVCtWLno2uM/Fd/ZzI=",
+ "lastModified": 1602454082,
+ "narHash": "sha256-nx6ULJCys3u+nLFHrt9+zux3fsfTloLTRd/FpJcL//Q=",
"owner": "serokell",
"repo": "deploy-rs",
- "rev": "1de1ad5ff893bfcabdf2bfa20d8c93a8cdbb0156",
+ "rev": "e463c62922ad09f016e4f1dd1d6d0cabccb0ff79",
"type": "github"
},
"original": {
@@ -20,9 +21,27 @@
"type": "github"
}
},
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1600853454,
+ "narHash": "sha256-EgsgbcJNZ9AQLVhjhfiegGjLbO+StBY9hfKsCwc8Hw8=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "94cf59784c73ecec461eaa291918eff0bfb538ac",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
"naersk": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "nixpkgs": [
+ "nixpkgs"
+ ]
},
"locked": {
"lastModified": 1597138680,
@@ -40,20 +59,6 @@
}
},
"nixpkgs": {
- "locked": {
- "lastModified": 1601091160,
- "narHash": "sha256-26UI9LGjRO8Sv253zJZkoapP260QkJPQ2+vRyC1i+kI=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "2768436826543af2b1540e4fe6b5afa15850e155",
- "type": "github"
- },
- "original": {
- "id": "nixpkgs",
- "type": "indirect"
- }
- },
- "nixpkgs_2": {
"locked": {
"lastModified": 1600387253,
"narHash": "sha256-WtdpHuiunPF9QMlcXrWJkESuIjSSjP9WMOKvYQS/D7M=",
@@ -69,13 +74,13 @@
"type": "github"
}
},
- "nixpkgs_3": {
+ "nixpkgs_2": {
"locked": {
- "lastModified": 1601994071,
- "narHash": "sha256-J1TNrQI3Gb5Yl9b4+O6eh1Zp1ha4YhI7ewsN1M/9x68=",
+ "lastModified": 1602453019,
+ "narHash": "sha256-bEzkPMG5JTFpd7xsl73/K/hZ9jBgiRKMdkpmwAG4lwI=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "6f90e1df4f27326c52b805cfd01fc79a49208e5c",
+ "rev": "a6fec75d0472670448b9708e1619fef2c36af9d5",
"type": "github"
},
"original": {
@@ -86,7 +91,7 @@
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
- "nixpkgs": "nixpkgs_3"
+ "nixpkgs": "nixpkgs_2"
}
},
"utils": {
--
cgit v1.2.3
From 898bb2814b51fb76ef3d54164768512ed13016be Mon Sep 17 00:00:00 2001
From: notgne2
Date: Sun, 11 Oct 2020 15:19:34 -0700
Subject: Update lockfiles
---
examples/system/flake.lock | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index ff339a8..a6a3fa9 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -8,11 +8,11 @@
"utils": "utils"
},
"locked": {
- "lastModified": 1602454082,
- "narHash": "sha256-nx6ULJCys3u+nLFHrt9+zux3fsfTloLTRd/FpJcL//Q=",
+ "lastModified": 1602454749,
+ "narHash": "sha256-wSPZEl6xyqewPrNQg9k6z3DLshn2Fwha8mDv8ECWMf8=",
"owner": "serokell",
"repo": "deploy-rs",
- "rev": "e463c62922ad09f016e4f1dd1d6d0cabccb0ff79",
+ "rev": "e5bd558c5b6505621d3b5a27e9b39bf54f6788a1",
"type": "github"
},
"original": {
@@ -44,11 +44,11 @@
]
},
"locked": {
- "lastModified": 1597138680,
- "narHash": "sha256-3pDN/W17wjVDbrkgo60xQSb24+QAPQ7ulsUq5atNni0=",
+ "lastModified": 1602173141,
+ "narHash": "sha256-m6wU6lP0wf2OMw3KtJqn27ITtg29+ftciGHicLiVSGE=",
"owner": "nmattia",
"repo": "naersk",
- "rev": "529e910a3f423a8211f8739290014b754b2555b6",
+ "rev": "22b96210b2433228d42bce460f3befbdcfde7520",
"type": "github"
},
"original": {
@@ -60,11 +60,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1600387253,
- "narHash": "sha256-WtdpHuiunPF9QMlcXrWJkESuIjSSjP9WMOKvYQS/D7M=",
+ "lastModified": 1601961544,
+ "narHash": "sha256-uuh9CkDWkXlXse8IcergqoIM5JffqfQDKsl1uHB7XJI=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "72b9660dc18ba347f7cd41a9504fc181a6d87dc3",
+ "rev": "89281dd1dfed6839610f0ccad0c0e493606168fe",
"type": "github"
},
"original": {
@@ -96,11 +96,11 @@
},
"utils": {
"locked": {
- "lastModified": 1600209923,
- "narHash": "sha256-zoOWauTliFEjI++esk6Jzk7QO5EKpddWXQm9yQK24iM=",
+ "lastModified": 1601282935,
+ "narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "3cd06d3c1df6879c9e41cb2c33113df10566c760",
+ "rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
--
cgit v1.2.3
From 7ec0bc21cd3678e39270d7ea59bccaefa288abfa Mon Sep 17 00:00:00 2001
From: notgne2
Date: Mon, 26 Oct 2020 12:27:20 -0700
Subject: Update example flakes
---
examples/system/flake.lock | 12 ++++++------
examples/system/flake.nix | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
(limited to 'examples/system')
diff --git a/examples/system/flake.lock b/examples/system/flake.lock
index a6a3fa9..fc92f40 100644
--- a/examples/system/flake.lock
+++ b/examples/system/flake.lock
@@ -8,11 +8,11 @@
"utils": "utils"
},
"locked": {
- "lastModified": 1602454749,
- "narHash": "sha256-wSPZEl6xyqewPrNQg9k6z3DLshn2Fwha8mDv8ECWMf8=",
+ "lastModified": 1603740297,
+ "narHash": "sha256-yeTrA8AaLzDFICApX725gQhKoHNI2TCqWAeOl9axVZE=",
"owner": "serokell",
"repo": "deploy-rs",
- "rev": "e5bd558c5b6505621d3b5a27e9b39bf54f6788a1",
+ "rev": "426fb3c489dcbb4ccbf98a3ab6a7fe25e71b95ca",
"type": "github"
},
"original": {
@@ -76,11 +76,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1602453019,
- "narHash": "sha256-bEzkPMG5JTFpd7xsl73/K/hZ9jBgiRKMdkpmwAG4lwI=",
+ "lastModified": 1603739127,
+ "narHash": "sha256-mdLESpo4jXrAynLp7ypRaqkx6IS1jx2l78f1tg9iiJU=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "a6fec75d0472670448b9708e1619fef2c36af9d5",
+ "rev": "d699505277b99e4698d90563c5eb1b62ba5ba0ea",
"type": "github"
},
"original": {
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
index 32fefa1..021f9db 100644
--- a/examples/system/flake.nix
+++ b/examples/system/flake.nix
@@ -41,6 +41,6 @@
};
};
- checks = { "x86_64-linux" = { jsonSchema = deploy-rs.lib.x86_64-linux.checkSchema self.deploy; }; };
+ checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}
--
cgit v1.2.3