don't GC other profiles
This commit is contained in:
parent
28f7026ba0
commit
6e8da25d92
1 changed files with 14 additions and 2 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
{ pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
aliases = {
|
aliases = {
|
||||||
upgrade = "nh os switch --update";
|
upgrade = "nh os switch --update";
|
||||||
|
|
@ -23,8 +28,15 @@ in
|
||||||
(
|
(
|
||||||
command: host:
|
command: host:
|
||||||
pkgs.writeShellScriptBin command ''
|
pkgs.writeShellScriptBin command ''
|
||||||
|
# Stop other systems from getting GC'd
|
||||||
|
keep() {
|
||||||
|
path=$(nix build --no-link --print-out-paths \
|
||||||
|
"${config.programs.nh.flake}#nixosConfigurations.${host}.config.system.build.toplevel")
|
||||||
|
sudo nix-env --profile /nix/var/nix/profiles/${host} --set "$path"
|
||||||
|
}
|
||||||
|
|
||||||
${lib.concatMapAttrsStringSep "\n" (
|
${lib.concatMapAttrsStringSep "\n" (
|
||||||
name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@"; }''
|
name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@" && keep; }''
|
||||||
) aliases}
|
) aliases}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue