aboutsummaryrefslogtreecommitdiff
path: root/examples/simple
diff options
context:
space:
mode:
authornotgne22020-10-02 12:58:11 -0700
committernotgne22020-10-02 12:58:11 -0700
commit5674670a59168fb05f26e5b4fb41dd2662810e94 (patch)
tree621f526c3f4a53fbd0165d351e5ce74ce37f1b58 /examples/simple
parent05803e0ebaf417d9ba40645b6548a48bf51f9213 (diff)
General improvements, deprecate `activate` profile option in favor of executing $PROFILE/activate (Wrap It Yourself) to ensure successful rollback activations
Diffstat (limited to 'examples/simple')
-rw-r--r--examples/simple/flake.nix47
1 files changed, 33 insertions, 14 deletions
diff --git a/examples/simple/flake.nix b/examples/simple/flake.nix
index 800363f..f53352b 100644
--- a/examples/simple/flake.nix
+++ b/examples/simple/flake.nix
@@ -5,21 +5,40 @@
{
description = "Deploy GNU hello to localhost";
- outputs = { self, nixpkgs }: {
- deploy.nodes.example = {
- hostname = "localhost";
- profiles.hello = {
- user = "balsoft";
- path = nixpkgs.legacyPackages.x86_64-linux.hello;
- # Just to test that it's working
- activate = "$PROFILE/bin/hello";
+ 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";
+ })
+ ];
};
- };
- checks = builtins.mapAttrs (_: pkgs: {
- jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-simple" { }
- "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${
+ in
+ {
+
+ deploy.nodes.example = {
+ hostname = "localhost";
+ profiles.hello = {
+ user = "balsoft";
+ path = setActivate nixpkgs.legacyPackages.x86_64-linux.hello "./bin/hello";
+ };
+ };
+ 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;
+ };
}