51 lines
1.3 KiB
Nix
51 lines
1.3 KiB
Nix
# Core Nix configuration
|
|
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
inputs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.aux.system;
|
|
in
|
|
{
|
|
options = {
|
|
aux.system.allowUnfree = lib.mkEnableOption (lib.mdDoc "Allow unfree packages to install.");
|
|
aux.system.retentionPeriod = lib.mkOption {
|
|
description = "How long to retain NixOS generations. Defaults to 30 days (30d).";
|
|
type = lib.types.str;
|
|
default = "30d";
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
(lib.mkIf cfg.allowUnfree { nixpkgs.config.allowUnfree = true; })
|
|
({
|
|
nix = {
|
|
# Enable Flakes
|
|
settings.experimental-features = [
|
|
"nix-command"
|
|
"flakes"
|
|
];
|
|
|
|
# Enable periodic nix store optimization
|
|
optimise.automatic = true;
|
|
|
|
# Enable weekly garbage collection. Delete generations that are older than two weeks.
|
|
gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
options = "--delete-older-than ${cfg.retentionPeriod}";
|
|
};
|
|
|
|
# Configure NixOS to use the same software channel as Flakes
|
|
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
|
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
|
|
};
|
|
|
|
# Support for standard, dynamically-linked executables
|
|
programs.nix-ld.enable = true;
|
|
})
|
|
];
|
|
}
|