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

difftreelog

source

nixos/nix-sign.nix665 Bsourcehistory
1# Required for nix copy in build_systems.rs2{lib, config, ...}:3let4  inherit (lib.modules) mkIf;5  hasPersistentHostname = config.networking.hostName != "";6in7{8  # https://github.com/NixOS/nix/issues/30239  systemd.services.generate-nix-cache-key = mkIf hasPersistentHostname {10    wantedBy = ["multi-user.target"];11    serviceConfig.Type = "oneshot";12    path = [config.nix.package];13    script = ''14      [[ -f /etc/nix/private-key ]] && exit15      nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key16    '';17  };18  nix.settings.secret-key-files = mkIf hasPersistentHostname "/etc/nix/private-key";19}