dotfiles/modules/home/nix.nix
eriedaberrie 70e6f97fbc Initial commit
Note: not the actual initial commit.

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-08-20 11:10:16 -07:00

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" ];
};
};
};
};
};
}