5a4d076d84
Note: not the actual initial commit. I swear I will stop repeatedly force pushing to this single commit eventually ok.
40 lines
879 B
Nix
40 lines
879 B
Nix
{ config, lib, osConfig, ... }:
|
|
|
|
let
|
|
cfg = config.my.nix;
|
|
in {
|
|
options.my.nix = {
|
|
gc = lib.mkEnableOption null // {
|
|
default = true;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
xdg.configFile = {
|
|
"nixpkgs/config.nix".text = lib.generators.toPretty {multiline = true;} {
|
|
inherit (osConfig.nixpkgs.config) allowUnfree;
|
|
};
|
|
};
|
|
|
|
systemd.user = lib.mkIf cfg.gc {
|
|
services.nix-gc = {
|
|
Unit = {
|
|
Description = "Nix User Garbage Collector";
|
|
};
|
|
Service = {
|
|
ExecStart = "${osConfig.nix.package}/bin/nix-collect-garbage ${osConfig.nix.gc.options}";
|
|
};
|
|
};
|
|
|
|
timers = {
|
|
nix-gc = lib.mkIf osConfig.nix.gc.automatic {
|
|
Timer = osConfig.systemd.timers.nix-gc.timerConfig;
|
|
Install = {
|
|
WantedBy = [ "timers.target" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|