zhaofengli/colmena

Nix diff when nix store path is not valid anymore

Closed this issue · 1 comments

I usually run nix-diff on my recent profile vs the one deployed to know what changed. I do it with:

nix run nixpkgs#nix-diff /nix/store/mk6vs8zfnm48adqn3pz52c4jsdlsv2z4-nixos-system... /nix/store/77n1hwhgmr9z0x3gs8z2g6cfx8gkr4nm-nixos-system...

But, if I didn't deploy since some time and the garbage collector kicks in, I get:

error: path '/nix/store/mk6vs8zfnm48adqn3pz52c4jsdlsv2z4-nixos-system...' is not valid

So I don't have available anymore what I deployed.

Is there a way to copy over the profile from the target machine?

FWIW I know which profile I need to copy over with:

nix run nixpkgs#colmena -- exec -v --on <machine> readlink -f /run/current-system

Actually, found out how:

nix-copy-closure --from <machine> /nix/store/mk6vs8zfnm48adqn3pz52c4jsdlsv2z4-nixos-system...

Also, I had the following colmena config:

deployment.targetUser = "myuser";

So I needed to add, on the machine I wanted to copy to - the one where I ran nix-copy-closure:

nix.settings.trusted-users = [ "myuser" ];