add optimize for nix store
This commit is contained in:
parent
f211553743
commit
b2bf85dc3d
|
@ -66,6 +66,8 @@
|
||||||
# makes nix search nixpkgs <example>
|
# makes nix search nixpkgs <example>
|
||||||
# ALOT faster
|
# ALOT faster
|
||||||
search.enable = true;
|
search.enable = true;
|
||||||
|
# optimize store
|
||||||
|
optimize.enable = true;
|
||||||
};
|
};
|
||||||
zsh.enable = true;
|
zsh.enable = true;
|
||||||
newsboat.enable = true;
|
newsboat.enable = true;
|
||||||
|
@ -88,13 +90,6 @@
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
# garbage collection
|
|
||||||
nix.gc = {
|
|
||||||
automatic = true;
|
|
||||||
dates = "weekly";
|
|
||||||
options = "--delete-older-than 7d";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
# services.openssh.enable = true;
|
# services.openssh.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./search.nix
|
./search.nix
|
||||||
|
./optimization.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
30
modules/shell/nix/optimization.nix
Normal file
30
modules/shell/nix/optimization.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{ inputs, options, config, lib, pkgs, ...}:
|
||||||
|
# this automatically optimizes stuff like nix-store
|
||||||
|
# and cleans out garbage weekly
|
||||||
|
# also limits generations
|
||||||
|
with lib;
|
||||||
|
let cfg = config.modules.shell.nix.optimize;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.shell.nix.optimize = {
|
||||||
|
enable = mkEnableOption false;
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
nix = {
|
||||||
|
# garbage collection
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 1w";
|
||||||
|
};
|
||||||
|
# optimizes store to reduce storage space :)
|
||||||
|
# does do alot on the cpu though :p
|
||||||
|
# shouldnt be a problem on high core cpus
|
||||||
|
# but might be a little problem on
|
||||||
|
# low end machines
|
||||||
|
# who cares though free storage woohoo
|
||||||
|
settings.auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue