2023-12-15 15:18:36 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
2023-12-15 16:08:47 +00:00
|
|
|
inputs,
|
2023-12-15 15:18:36 +00:00
|
|
|
...
|
|
|
|
}: {
|
2023-05-16 19:10:41 +00:00
|
|
|
# restrict nix command to sudoers
|
2023-12-15 15:18:36 +00:00
|
|
|
nix.settings.allowed-users = ["root" "@wheel"];
|
|
|
|
nix.settings.trusted-users = ["root" "@wheel"];
|
2023-05-16 19:10:41 +00:00
|
|
|
|
|
|
|
# experimental features
|
2023-12-15 15:18:36 +00:00
|
|
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
2023-05-16 19:10:41 +00:00
|
|
|
|
2023-11-08 15:22:24 +00:00
|
|
|
# limit number of cores when building
|
|
|
|
nix.settings.max-jobs = 6;
|
|
|
|
|
2023-05-16 19:10:41 +00:00
|
|
|
# optimizations
|
|
|
|
nix.settings.auto-optimise-store = true;
|
|
|
|
|
|
|
|
# garbage collection
|
|
|
|
nix.gc = {
|
|
|
|
automatic = true;
|
|
|
|
dates = "weekly";
|
|
|
|
options = "--delete-older-than 30d";
|
|
|
|
};
|
|
|
|
|
2023-09-17 14:01:59 +00:00
|
|
|
# pin nixpkgs registry
|
2023-12-15 16:08:47 +00:00
|
|
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
2023-09-17 14:01:59 +00:00
|
|
|
|
2023-06-19 18:51:00 +00:00
|
|
|
# list of allowed unfree packages
|
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
|
|
|
builtins.elem (lib.getName pkg) [
|
2023-09-22 14:47:43 +00:00
|
|
|
"obsidian"
|
2023-06-19 18:51:00 +00:00
|
|
|
"vscode"
|
|
|
|
"vscode-extension-github-copilot"
|
|
|
|
"vscode-extension-github-copilot-chat"
|
|
|
|
"vscode-extension-ms-vsliveshare-vsliveshare"
|
|
|
|
];
|
2023-07-09 16:20:58 +00:00
|
|
|
|
2023-11-29 14:39:56 +00:00
|
|
|
# print diff between two generations
|
2023-07-09 16:20:58 +00:00
|
|
|
system.activationScripts.nvd-report-changes = ''
|
2023-12-15 15:18:36 +00:00
|
|
|
PATH=$PATH:${lib.makeBinPath [pkgs.nvd pkgs.nix]}
|
2023-07-09 16:20:58 +00:00
|
|
|
nvd diff $(ls -dv /nix/var/nix/profiles/system-*-link | tail -2)
|
|
|
|
'';
|
2023-05-16 19:10:41 +00:00
|
|
|
}
|