git.delta.rocks / jrsonnet / refs/heads / trunk

difftreelog

source

modules/nixos/nix-sign.nix677 Bsourcehistory
1# Required for nix copy in build_systems.rs2{3  lib,4  config,5  ...6}:7let8  inherit (lib.modules) mkIf;9  hasPersistentHostname = config.networking.hostName != "";10in11{12  # https://github.com/NixOS/nix/issues/302313  systemd.services.generate-nix-cache-key = mkIf hasPersistentHostname {14    wantedBy = [ "multi-user.target" ];15    serviceConfig.Type = "oneshot";16    path = [ config.nix.package ];17    script = ''18      [[ -f /etc/nix/private-key ]] && exit19      nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key20    '';21  };22  nix.settings.secret-key-files = mkIf hasPersistentHostname "/etc/nix/private-key";23}