I’ve been thinkering with the idea of a way to copy my dotfiles folder and stash it away in some god forsaken folder for each system rebuild so that, in case of a git catastrophy (that happened because I am a dummy) I can rollback my system and then dig out this folder and be certain that I have the configuration that nixos used to build this “rolled back version”
The current “version” is a simple derivation that (given my dotfiles path) copies everything in /run/current-dotfiles
, the only problem is that it doesn’t, it builds the derivation and I even found it in the store (with all the right files stored) but it doesn’t systemlinkit to /run/current-dotfiles
Is it a reserved path of some sort or am I missing something?
Here’s the full derivation:
{ stdenv, settings }:
stdenv.mkDerivation {
name = "dotfiles-backup";
version = "1.0";
src = settings.dotfiles_path;
installPhase = ''
mkdir -p $out/run/current-dotfiles
cp -r . $out/run/current-dotfiles
'';
}
And if it can help, how I call the derivation
environment.systemPackages = let
dotfiles-backup =
(pkgs.callPackage ../../unofficial/dotfiles-backup.nix { inherit settings; });
in [ dotfiles-backup ];
edit:
here’s the result
Nix Store
/run