[nix] Make own module
This commit is contained in:
parent
401d667acf
commit
e55d4b46dd
5 changed files with 55 additions and 18 deletions
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
networking.openconnect-sso.enable = true;
|
networking.openconnect-sso.enable = true;
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
flakes.enable = true;
|
||||||
|
gc.onFull.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
sops.enable = true;
|
sops.enable = true;
|
||||||
|
@ -61,23 +66,11 @@
|
||||||
time.timeZone = "Europe/Brussels";
|
time.timeZone = "Europe/Brussels";
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
# Allow Nix Flakes
|
|
||||||
# Keep derivations so shells don't break (direnv)
|
# Keep derivations so shells don't break (direnv)
|
||||||
# If the disk has less than 100MiB, free up to 2GiB by garbage-collecting.
|
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
experimental-features = nix-command flakes
|
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
min-free = ${toString (100 * 1024 * 1024)}
|
|
||||||
max-free = ${toString (2048 * 1024 * 1024)}
|
|
||||||
'';
|
'';
|
||||||
# Scheduled garbage-collect
|
|
||||||
gc = {
|
|
||||||
automatic = true;
|
|
||||||
dates = "weekly";
|
|
||||||
options = "--delete-older-than 30d";
|
|
||||||
};
|
|
||||||
package = pkgs.nixFlakes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i18n.defaultLocale = "en_GB.UTF-8";
|
i18n.defaultLocale = "en_GB.UTF-8";
|
||||||
|
|
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
networking.openconnect-sso.enable = true;
|
networking.openconnect-sso.enable = true;
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
flakes.enable = true;
|
||||||
|
gc.onFull.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
sops.enable = true;
|
sops.enable = true;
|
||||||
|
@ -94,17 +99,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
# Allow Nix Flakes
|
|
||||||
# Keep derivations so shells don't break (direnv)
|
# Keep derivations so shells don't break (direnv)
|
||||||
# If the disk has less than 100MiB, free up to 2GiB by garbage-collecting.
|
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
experimental-features = nix-command flakes
|
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
min-free = ${toString (100 * 1024 * 1024)}
|
|
||||||
max-free = ${toString (2048 * 1024 * 1024)}
|
|
||||||
'';
|
'';
|
||||||
package = pkgs.nixFlakes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i18n.defaultLocale = "en_GB.UTF-8";
|
i18n.defaultLocale = "en_GB.UTF-8";
|
||||||
|
|
6
nixos/modules/nix/default.nix
Normal file
6
nixos/modules/nix/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./flakes
|
||||||
|
./gc
|
||||||
|
];
|
||||||
|
}
|
14
nixos/modules/nix/flakes/default.nix
Normal file
14
nixos/modules/nix/flakes/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.sisyphus.nix.flakes;
|
||||||
|
in {
|
||||||
|
options.sisyphus.nix.flakes.enable = lib.mkEnableOption "Nix Flakes";
|
||||||
|
|
||||||
|
config.nix = lib.mkIf cfg.enable {
|
||||||
|
extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
'';
|
||||||
|
package = pkgs.nixFlakes;
|
||||||
|
};
|
||||||
|
}
|
25
nixos/modules/nix/gc/default.nix
Normal file
25
nixos/modules/nix/gc/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.sisyphus.nix.gc;
|
||||||
|
in {
|
||||||
|
options.sisyphus.nix.gc = {
|
||||||
|
weekly.enable = lib.mkEnableOption "Scheduled Nix garbage-collection";
|
||||||
|
onFull.enable = lib.mkEnableOption "Nix garbage-collection when disk is almost full";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.nix = {
|
||||||
|
# If the disk has less than 100MiB, free up to 2GiB by garbage-collecting.
|
||||||
|
extraOptions = lib.mkIf cfg.onFull.enable ''
|
||||||
|
min-free = ${toString (100 * 1024 * 1024)}
|
||||||
|
max-free = ${toString (2048 * 1024 * 1024)}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Scheduled garbage-collect
|
||||||
|
gc = lib.mkIf cfg.weekly.enable {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 30d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue