diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/simple/flake.lock.license | 3 | ||||
-rw-r--r-- | examples/simple/flake.nix | 16 | ||||
-rw-r--r-- | examples/system/README.md | 6 | ||||
-rw-r--r-- | examples/system/bare.nix | 4 | ||||
-rw-r--r-- | examples/system/common.nix | 4 | ||||
-rw-r--r-- | examples/system/configuration.nix | 6 | ||||
-rw-r--r-- | examples/system/flake.lock.license | 3 | ||||
-rw-r--r-- | examples/system/flake.nix | 17 | ||||
-rw-r--r-- | examples/system/hello.nix | 9 | ||||
-rw-r--r-- | examples/system/nix-pub.pem.license | 3 | ||||
-rw-r--r-- | examples/system/nix.key.license | 3 |
11 files changed, 57 insertions, 17 deletions
diff --git a/examples/simple/flake.lock.license b/examples/simple/flake.lock.license new file mode 100644 index 0000000..9e9897d --- /dev/null +++ b/examples/simple/flake.lock.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/> + +SPDX-License-Identifier: MPL-2.0
\ No newline at end of file diff --git a/examples/simple/flake.nix b/examples/simple/flake.nix index 6e516d3..800363f 100644 --- a/examples/simple/flake.nix +++ b/examples/simple/flake.nix @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/> +# +# SPDX-License-Identifier: MPL-2.0 + { description = "Deploy GNU hello to localhost"; @@ -5,19 +9,17 @@ deploy.nodes.example = { hostname = "localhost"; profiles.hello = { - user = "test_deploy"; + user = "balsoft"; path = nixpkgs.legacyPackages.x86_64-linux.hello; # Just to test that it's working activate = "$PROFILE/bin/hello"; }; }; - checks = builtins.mapAttrs - (_: pkgs: { - jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-simple" { } - "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${ + checks = builtins.mapAttrs (_: pkgs: { + jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-simple" { } + "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${ pkgs.writeText "deploy.json" (builtins.toJSON self.deploy) } ${../../interface/deploy.json} && touch $out"; - }) - nixpkgs.legacyPackages; + }) nixpkgs.legacyPackages; }; } 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 @@ +<!-- +SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/> + +SPDX-License-Identifier: MPL-2.0 +--> + # 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 <https://serokell.io/> +# +# 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 <https://serokell.io/> +# +# 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 <https://serokell.io/> +# +# 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 <https://serokell.io/> + +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 <https://serokell.io/> +# +# 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 <https://serokell.io/> +# +# 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 <https://serokell.io/> + +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 <https://serokell.io/> + +SPDX-License-Identifier: MPL-2.0
\ No newline at end of file |