69 lines
1.4 KiB
Nix
Raw Normal View History

2025-03-08 18:08:17 -05:00
{
config,
pkgs,
lib,
...
}:
let
inherit (config.nmasur.settings) username;
2025-03-08 18:08:17 -05:00
cfg = config.nmasur.presets.services.nix;
in
{
options.nmasur.presets.services.nix.enable = lib.mkEnableOption "Nix settings and presets";
config = lib.mkIf cfg.enable {
nix = {
# Set channel to flake packages, used for nix-shell commands
nixPath = [ "nixpkgs=${pkgs.path}" ];
# For security, only allow specific users
settings.allowed-users = [
"@wheel" # Anyone in the wheel group
username # The current user
2025-03-08 18:08:17 -05:00
];
# Enable features in Nix commands
extraOptions = ''
experimental-features = nix-command flakes
warn-dirty = false
'';
# Set automatic generation cleanup for home-manager
gc = {
automatic = true;
options = "--delete-older-than 10d";
};
settings = {
2025-03-09 04:46:34 +00:00
# Trust users for messing with Nix stuff
trusted-users = [
"root"
"@wheel"
2025-03-10 02:43:31 +00:00
username
2025-03-09 04:46:34 +00:00
];
2025-03-08 18:08:17 -05:00
# Add community Cachix to binary cache
# Don't use at work because blocked by corporate firewall
builders-use-substitutes = true;
substituters = [
2025-03-08 18:08:17 -05:00
"https://nix-community.cachix.org"
];
trusted-public-keys = [
2025-03-08 18:08:17 -05:00
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
2025-03-10 02:43:31 +00:00
auto-optimise-store = true;
2025-03-08 18:08:17 -05:00
};
};
};
}