dotfiles/modules/programs/nix.nix

69 lines
1.3 KiB
Nix
Raw Normal View History

2022-07-15 13:11:54 +02:00
{ config
, lib
, inputs
2023-05-12 15:14:08 +02:00
, self
2023-05-29 12:48:43 +02:00
, pkgs
2022-07-15 13:11:54 +02:00
, ...
}:
with lib;
let
cfg = config.my.programs.nix;
2022-07-15 13:11:54 +02:00
in
{
options.my.programs.nix = {
2022-10-15 20:00:09 +02:00
gc = {
enable = mkEnableOption "nix-gc";
minimumFreedGB = mkOption {
default = 32;
type = types.int;
apply = number: toString (number * 1024 * 1024 * 1024);
};
2022-07-15 13:11:54 +02:00
};
2022-10-15 20:00:09 +02:00
optimise.enable = mkEnableOption "nix-optimise";
2022-07-15 13:11:54 +02:00
};
config.nix = {
2023-09-06 08:36:16 +02:00
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
2023-05-29 12:48:43 +02:00
package = pkgs.nix-super;
2023-05-12 15:13:27 +02:00
extraOptions = "experimental-features = nix-command flakes";
2022-07-15 13:11:54 +02:00
gc = {
automatic = cfg.gc.enable;
2022-10-15 20:00:09 +02:00
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
2022-07-15 13:11:54 +02:00
dates = "weekly";
};
optimise = {
automatic = cfg.optimise.enable;
dates = [ "weekly" ];
};
registry = {
master-upstream.to = {
type = "github";
owner = "nixos";
repo = "nixpkgs";
};
master.flake = inputs.master;
nixpkgs.flake = inputs.nixpkgs;
stable.flake = inputs.stable;
2023-05-12 15:14:08 +02:00
dotfiles.flake = self;
2023-05-29 12:48:43 +02:00
default.flake = self;
};
2022-07-15 13:11:54 +02:00
settings = {
substituters = [
"https://cache.nixos.org/"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
trusted-users = [ "root" "@wheel" ];
};
};
}