nix-managed-macbook/nix.nix

69 lines
1.7 KiB
Nix
Raw Permalink Normal View History

2024-09-07 18:27:38 +05:30
{ config, pkgs, inputs, ... }:
let
nixSettings = {
auto-optimise-store = true;
connect-timeout = 60;
download-attempts = 10;
cores = 4;
2024-09-07 18:27:38 +05:30
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
fallback = true;
keep-outputs = true;
keep-going = true;
log-lines = 25;
max-jobs = 3;
2024-09-07 18:27:38 +05:30
};
in {
2023-11-25 16:13:20 +05:30
services.nix-daemon.enable = true;
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
gc = {
automatic = true;
2024-09-07 12:38:30 +05:30
interval = {
Hour = 18;
Minute = 15;
};
options = "-d --delete-older-than 7d";
2023-11-25 16:13:20 +05:30
};
2024-09-07 18:27:38 +05:30
settings = nixSettings // {
2023-11-25 16:13:20 +05:30
max-free = 1000000000;
min-free = 128000000;
warn-dirty = false;
2024-01-31 19:23:23 +05:30
trusted-users = [ "@admin" ];
2024-09-14 09:23:05 +05:30
trusted-substituters =
[ "https://cache.nixos.org" "https://nix-community.cachix.org" ];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
2023-11-25 16:13:20 +05:30
};
2024-09-07 18:27:38 +05:30
distributedBuilds = true;
linux-builder = {
enable = true;
maxJobs = 3;
2024-09-07 18:27:38 +05:30
config = ({ pkgs, ... }: {
users.extraGroups.docker.members =
builtins.map (i: "nixbld" + builtins.toString i)
(pkgs.lib.genList (i: i + 1) 32);
virtualisation = {
docker.enable = true;
darwin-builder = {
2024-09-23 11:37:14 +05:30
diskSize = 50 * 1024;
2024-09-07 18:27:38 +05:30
memorySize = 8 * 1024;
};
2024-09-23 11:37:14 +05:30
cores = 8;
2024-09-07 18:27:38 +05:30
};
nix.settings = nixSettings // { sandbox = false; };
});
};
2023-11-25 16:13:20 +05:30
};
nixpkgs = {
hostPlatform = "x86_64-darwin";
config.allowUnfree = true;
2022-09-27 13:08:52 +05:30
};
}