git.delta.rocks / jrsonnet / refs/commits / dfbdb4ac5bb1

difftreelog

source

modules/nixos/nix-sign.nix673 Bsourcehistory
1# Required for nix copy in build_systems.rs2{3  lib,4  config,5  ...6}: let7  inherit (lib.modules) mkIf;8  hasPersistentHostname = config.networking.hostName != "";9in {10  # https://github.com/NixOS/nix/issues/302311  systemd.services.generate-nix-cache-key = mkIf hasPersistentHostname {12    wantedBy = ["multi-user.target"];13    serviceConfig.Type = "oneshot";14    path = [config.nix.package];15    script = ''16      [[ -f /etc/nix/private-key ]] && exit17      nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key18    '';19  };20  nix.settings.secret-key-files = mkIf hasPersistentHostname "/etc/nix/private-key";21}