add a new updater output
this is so that we don't have to obfuscate store paths in systemConfiguration to avoid dragging in build system deps. breaking-ish change to workflows, docs updated
This commit is contained in:
36
modules/outputs/updater/default.nix
Normal file
36
modules/outputs/updater/default.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
o = config.system.outputs;
|
||||
inherit (pkgs) runCommand;
|
||||
inherit (lib) mkOption types;
|
||||
inherit (pkgs.buildPackages) min-copy-closure;
|
||||
in
|
||||
{
|
||||
imports = [ ../system-configuration.nix ];
|
||||
options.system.outputs.updater = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
updater
|
||||
******
|
||||
|
||||
For configurations with a writable filesystem, create a shell
|
||||
script that runs on the build system and updates the device
|
||||
over the network to the new configuration
|
||||
'';
|
||||
};
|
||||
|
||||
config.system.outputs.updater =
|
||||
runCommand "buildUpdater" { } ''
|
||||
mkdir -p $out/bin
|
||||
substitute ${./update.sh} $out/bin/update.sh \
|
||||
--subst-var-by toplevel ${o.systemConfiguration} \
|
||||
--subst-var-by min_copy_closure ${min-copy-closure}
|
||||
chmod +x $out/bin/update.sh
|
||||
'';
|
||||
}
|
Reference in New Issue
Block a user