aboutsummaryrefslogtreecommitdiff
path: root/examples/system/flake.nix
diff options
context:
space:
mode:
authornotgne22020-10-26 21:05:03 -0700
committernotgne22020-10-26 21:05:03 -0700
commit997d1151fd3d303eaa9c2c41312ff87eee986418 (patch)
tree229deae6687a5b454cf2417fcb022a78f8ac20b8 /examples/system/flake.nix
parent30197f8a352c879f0070e059ebc117dc17e8270f (diff)
parentdf002c31a64409350a3cb8825364542c65a4d00a (diff)
Merge branch 'master' into review
Diffstat (limited to 'examples/system/flake.nix')
-rw-r--r--examples/system/flake.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/system/flake.nix b/examples/system/flake.nix
new file mode 100644
index 0000000..021f9db
--- /dev/null
+++ b/examples/system/flake.nix
@@ -0,0 +1,46 @@
+# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
+#
+# SPDX-License-Identifier: MPL-2.0
+
+{
+ description = "Deploy a full system with hello service as a separate profile";
+
+ inputs.deploy-rs.url = "github:serokell/deploy-rs";
+
+ outputs = { self, nixpkgs, deploy-rs }: {
+ 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";
+ 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 (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
+ };
+}