sync-containers3: add startComamnd option

This commit is contained in:
lassulus 2023-10-05 21:25:37 +02:00
parent 5cc5e2d1e6
commit 84818541d5

View file

@ -32,6 +32,17 @@ in {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
}; };
startCommand = lib.mkOption {
type = lib.types.str;
default = ''
set -efu
mkdir -p /var/state/var_src
ln -Tfrs /var/state/var_src /var/src
if test -e /var/src/nixos-config; then
/run/current-system/sw/bin/nixos-rebuild -I /var/src switch || :
fi
'';
};
}; };
})); }));
}; };
@ -52,14 +63,7 @@ in {
NIX_REMOTE = "daemon"; NIX_REMOTE = "daemon";
}; };
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = pkgs.writers.writeDash "autoswitch" '' serviceConfig.ExecStart = pkgs.writers.writeDash "autoswitch" ctr.startCommand;
set -efu
mkdir -p /var/state/var_src
ln -Tfrs /var/state/var_src /var/src
if test -e /var/src/nixos-config; then
/run/current-system/sw/bin/nixos-rebuild -I /var/src switch || :
fi
'';
unitConfig.X-StopOnRemoval = false; unitConfig.X-StopOnRemoval = false;
}; };
}; };