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
|
||||
aliases = {
|
||||
upgrade = "nh os switch --update";
|
||||
|
|
@ -23,8 +28,15 @@ in
|
|||
(
|
||||
command: host:
|
||||
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" (
|
||||
name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@"; }''
|
||||
name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@" && keep; }''
|
||||
) aliases}
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
Loading…
Reference in a new issue