better tmp handling
This commit is contained in:
parent
1104bb6af3
commit
0788d1aa4d
24
common.nix
24
common.nix
|
@ -123,21 +123,24 @@ in
|
||||||
environment.persistence."/nix/persistent" = {
|
environment.persistence."/nix/persistent" = {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
|
# tmp dir, don't fill our tmpfs root with that
|
||||||
|
{ directory = "/tmp"; user = "root"; group = "root"; mode = "1777"; }
|
||||||
|
|
||||||
# systemd timers
|
# systemd timers
|
||||||
{ directory = "/var/lib/systemd/timers"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
{ directory = "/var/lib/systemd/timers"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
||||||
|
|
||||||
# alsa state for persistent sound settings
|
# alsa state for persistent sound settings
|
||||||
{ directory = "/var/lib/alsa"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
{ directory = "/var/lib/alsa"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
||||||
|
|
||||||
# nix tmp dir for rebuilds, don't fill our tmpfs root with that
|
|
||||||
{ directory = "/var/cache/nix"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
|
||||||
|
|
||||||
# NetworkManager connections
|
# NetworkManager connections
|
||||||
{ directory = "/etc/NetworkManager"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
{ directory = "/etc/NetworkManager"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
||||||
{ directory = "/var/lib/NetworkManager"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
{ directory = "/var/lib/NetworkManager"; user = "root"; group = "root"; mode = "u=rwx,g=rx,o=rx"; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# kill the tmp content on reboots, we mount that to /nix/persistent to avoid memory fill-up
|
||||||
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
# ensure our data is not rotting
|
# ensure our data is not rotting
|
||||||
services.zfs.autoScrub = {
|
services.zfs.autoScrub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -253,20 +256,6 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# move nix tmp directory off the tmpfs for large updates
|
|
||||||
# for nixos-build we set that directory as tmp dir in the command
|
|
||||||
systemd.services.nix-daemon = {
|
|
||||||
environment = {
|
|
||||||
# Location for temporary files
|
|
||||||
TMPDIR = "/var/cache/nix";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
|
||||||
# Create /var/cache/nix automatically on Nix Daemon start
|
|
||||||
CacheDirectory = "nix";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
environment.variables.NIX_REMOTE = "daemon";
|
|
||||||
|
|
||||||
# auto update
|
# auto update
|
||||||
system.autoUpgrade = {
|
system.autoUpgrade = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -300,7 +289,6 @@ in
|
||||||
btop
|
btop
|
||||||
calibre
|
calibre
|
||||||
chromium
|
chromium
|
||||||
clamav
|
|
||||||
clinfo
|
clinfo
|
||||||
config.boot.kernelPackages.perf
|
config.boot.kernelPackages.perf
|
||||||
delta
|
delta
|
||||||
|
|
8
home.nix
8
home.nix
|
@ -31,10 +31,10 @@
|
||||||
# aliases
|
# aliases
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
# system build/update/cleanup
|
# system build/update/cleanup
|
||||||
update = "sudo TMPDIR=/var/cache/nix nixos-rebuild boot";
|
update = "sudo nixos-rebuild boot";
|
||||||
upgrade = "sudo TMPDIR=/var/cache/nix nixos-rebuild boot --upgrade";
|
upgrade = "sudo nixos-rebuild boot --upgrade";
|
||||||
updatenow = "sudo TMPDIR=/var/cache/nix nixos-rebuild switch";
|
updatenow = "sudo nixos-rebuild switch";
|
||||||
upgradenow = "sudo TMPDIR=/var/cache/nix nixos-rebuild switch --upgrade";
|
upgradenow = "sudo nixos-rebuild switch --upgrade";
|
||||||
gc = "sudo nix-collect-garbage --delete-older-than 7d";
|
gc = "sudo nix-collect-garbage --delete-older-than 7d";
|
||||||
verify = "sudo nix --extra-experimental-features nix-command store verify --all";
|
verify = "sudo nix --extra-experimental-features nix-command store verify --all";
|
||||||
optimize = "sudo nix --extra-experimental-features nix-command store optimise";
|
optimize = "sudo nix --extra-experimental-features nix-command store optimise";
|
||||||
|
|
Loading…
Reference in a new issue