feat: update nix config module

This commit is contained in:
Leon Schwarzäugl 2025-06-11 02:30:20 +02:00
parent a11c7854d1
commit 6b33a182d8
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
11 changed files with 167 additions and 239 deletions

View file

@ -1,12 +0,0 @@
{ lib, config, ... }:
{
options.swarselsystems.modules.gc = lib.mkEnableOption "garbage collection config";
config = lib.mkIf config.swarselsystems.modules.gc {
nix.gc = {
automatic = true;
randomizedDelaySec = "14m";
dates = "weekly";
options = "--delete-older-than 10d";
};
};
}

View file

@ -1,4 +1,4 @@
{ lib, config, outputs, inputs, ... }:
{ lib, pkgs, config, outputs, inputs, ... }:
{
options.swarselsystems.modules.general = lib.mkEnableOption "general nix settings";
config = lib.mkIf config.swarselsystems.modules.general {
@ -9,6 +9,11 @@
};
};
environment.etc."nixos/configuration.nix".source = pkgs.writeText "configuration.nix" ''
assert builtins.trace "This location is not used. The config is found in ${config.swarselsystems.flakePath}!" false;
{ }
'';
nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
@ -35,11 +40,24 @@
max-jobs = 1;
use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 10d";
};
optimise = {
automatic = true;
dates = "weekly";
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
registry = rec {
nixpkgs.flake = inputs.nixpkgs;
p = nixpkgs;
};
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
services.dbus.implementation = "broker";
system.stateVersion = lib.mkDefault "23.05";
};
}

View file

@ -1,10 +0,0 @@
{ lib, config, ... }:
{
options.swarselsystems.modules.storeOptimize = lib.mkEnableOption "store optimization config";
config = lib.mkIf config.swarselsystems.modules.storeOptimize {
nix.optimise = {
automatic = true;
dates = [ "weekly" ];
};
};
}

View file

@ -9,8 +9,6 @@ in
"${modulesPath}/nixos/common/home-manager.nix"
"${modulesPath}/nixos/common/home-manager-extra.nix"
"${modulesPath}/nixos/common/xserver.nix"
"${modulesPath}/nixos/common/gc.nix"
"${modulesPath}/nixos/common/store.nix"
"${modulesPath}/nixos/common/time.nix"
"${modulesPath}/nixos/common/users.nix"
"${modulesPath}/nixos/common/nix-ld.nix"