{ lib , pkgs , config , ... }: with lib; let cfg = config.eboskma.nix-common; in { options.eboskma.nix-common = { enable = mkEnableOption "activate nix-common"; remote-builders = mkEnableOption "enable remote builders"; }; imports = [ (mkRemovedOptionModule ["eboskma" "nix-common" "disable-cache" ] "The option `disable-cache` is no longer used") ]; config = mkIf cfg.enable { nixpkgs = { config.allowUnfree = true; }; nix = { package = pkgs.nixFlakes; extraOptions = '' experimental-features = nix-command flakes ''; buildMachines = mkIf cfg.remote-builders [ { hostName = "loki"; systems = [ "x86_64-linux" ]; maxJobs = 8; speedFactor = 2; supportedFeatures = [ "kvm" "big-parallel" "nixos-test" "benchmark" ]; } ]; distributedBuilds = cfg.remote-builders; settings = { auto-optimise-store = true; allowed-users = [ "root" ]; trusted-users = [ "root" ]; substituters = [ "https://nix-community.cachix.org" "https://marcus7070.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "marcus7070.cachix.org-1:JawxHSgnYsgNYJmNqZwvLjI4NcOwrcEZDToWlT3WwXw=" ]; }; gc = { automatic = true; dates = "daily"; options = "--delete-older-than=30d"; }; }; programs.ssh.extraConfig = mkIf cfg.remote-builders '' Host loki HostName 10.0.0.4 Port 22 User builder IdentitiesOnly yes IdentityFile /root/.ssh/id_builder ''; }; }