Skip to content

Commit

Permalink
feat: add build-and-diff command per OS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed Aug 27, 2024
1 parent 1908492 commit 34031cd
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion modules/flake-parts/apps.git-push-/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,45 @@
inherit (config.config) hostName;
});
};

mkNvd= let
commonNixArgs = "nix build --print-out-paths --no-link";
in {
attrName,
config,
}:
pkgs.writeShellScript "build-and-diff-${config.hostName}" ''
set -Eeou pipefail
export PATH="${lib.makeBinPath ([
pkgs.nvd
])}:$PATH"
set -x
remote=''${1:-origin}
local_branch=''${2:-HEAD}
shift || :
shift || :
currentSystem=$(${commonNixArgs} github:holochain/holochain-infra/deploy/${attrName}#nixosConfigurations.${attrName}.config.system.build.toplevel)
nextSystem=$(${commonNixArgs} .#nixosConfigurations.${attrName}.config.system.build.toplevel)
nvd diff "$currentSystem" "$nextSystem"
'';

mkNvdApp = attrName: config:
lib.nameValuePair "build-and-diff-${attrName}" {
type = "app";
program = builtins.toString (mkNvd {
inherit attrName;
inherit (config) config;
});
};

in {
config.apps = lib.mapAttrs' mkGitPushApp (self.darwinConfigurations // self.nixosConfigurations);
config.apps = (lib.mapAttrs' mkGitPushApp (self.darwinConfigurations // self.nixosConfigurations)) //
(lib.mapAttrs' mkNvdApp (self.darwinConfigurations // self.nixosConfigurations))
;
};
}

0 comments on commit 34031cd

Please sign in to comment.