Hey, guys. I’m using deploy-rs to deploy remote NixOS servers.
But there’s one problem that has been bothering me. The relevant output generated during each deployment is cleaned up after executing the garbage collector. Let me outline the detailed steps for you in the following console output:
# 1. prepare a `nixosConfigurations` in my `flake.nix`. Let's say `my-machine`.
$ cat flake.nix
# ...
{
output = {
nixosConfigurations = {
my-machine = { ... };
};
};
}
# 2. deploy my-machine
$ deploy '.#my-machine'
# 3. check the outputs, and the outputs are there
$ ls -ld /nix/store/*my-machine*
-r--r--r-- 1 root nixbld 2277 Jan 1 1970 /nix/store/4fyd2zn6hgfirwiq6kly5llzjyx61yan-nixos-system-my-machine-23.05.20230917.5d017a8-activate-path.drv
dr-xr-xr-x 3 root nixbld 96 Jan 1 1970 /nix/store/a1p8503jkadc48nyj9r3b5x4l73jl66b-nixos-system-my-machine-23.05.20230917.5d017a8-activate-rs/
dr-xr-xr-x 22 root nixbld 704 Jan 1 1970 /nix/store/f11djylh3g2ggp53ix8p0hi9g0h7bln8-nixos-system-my-machine-23.05.20230917.5d017a8/
-r--r--r-- 1 root nixbld 40621 Jan 1 1970 /nix/store/g0i0macip6kimffcqdmbzhm5y2p0kivd-nixos-system-my-machine-23.05.20230917.5d017a8.drv
dr-xr-xr-x 3 root nixbld 96 Jan 1 1970 /nix/store/gns0fn8v082rkd1wd3i56px8j4hw412w-nixos-system-my-machine-23.05.20230917.5d017a8-activate-path/
-rw------- 1 root nixbld 0 Nov 15 10:33 /nix/store/gns0fn8v082rkd1wd3i56px8j4hw412w-nixos-system-my-machine-23.05.20230917.5d017a8-activate-path.lock
-r--r--r-- 1 root nixbld 2638 Jan 1 1970 /nix/store/l0ancxxsg0zy4957y7ifnm7n4lmjs6yq-activatable-nixos-system-my-machine-23.05.20230917.5d017a8.drv
dr-xr-xr-x 24 root nixbld 768 Jan 1 1970 /nix/store/l28lknxb6lq0xn8nszvhq21hp0q8cdxf-activatable-nixos-system-my-machine-23.05.20230917.5d017a8/
-r--r--r-- 1 root nixbld 2027 Jan 1 1970 /nix/store/svw1vgkqagnwys068mccm3f6g8s375ah-nixos-system-my-machine-23.05.20230917.5d017a8-activate-rs.drv
# 4. collecting garbage, then all above outputs are cleaned up, which are not what I expect
$ nix-collect-garbage -d
$ ls -ld /nix/store/*my-machine* # nothing found
ls: cannot access '/nix/store/*myMachine*': No such file or directory
My quesition: “Is there any way to prevent the output generated by deploy-rs being garbage collected?”