Skip to content

Instantly share code, notes, and snippets.

@Kiwi
Forked from lheckemann/auto-sign.nix
Created December 19, 2020 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiwi/c29a974e40077de2777246950a46be26 to your computer and use it in GitHub Desktop.
Save Kiwi/c29a974e40077de2777246950a46be26 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