Skip to content

Instantly share code, notes, and snippets.

@lheckemann
Created December 19, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lheckemann/a3b300cacf5f8633c3a54ee9e3281b92 to your computer and use it in GitHub Desktop.
Save lheckemann/a3b300cacf5f8633c3a54ee9e3281b92 to your computer and use it in GitHub Desktop.
{ config, pkgs, ...}: {
systemd.services.generate-nix-cache-key = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
path = [ pkgs.nix ];
script = ''
[[ -f /etc/nix/private-key ]] && exit
nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key
'';
};
nix.extraOptions = ''
secret-key-files = /etc/nix/private-key
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment