try to move nix tmp dir

use rt kernel
This commit is contained in:
Christoph Cullmann 2024-05-31 21:05:43 +02:00
parent f9bdd238fb
commit 74351e7785

View file

@ -29,6 +29,19 @@ in
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ];
# more responsive kernel
boot.kernelPatches = [ {
name = "enable RT_FULL";
patch = null;
extraConfig = ''
PREEMPT y
PREEMPT_BUILD y
PREEMPT_VOLUNTARY n
PREEMPT_COUNT y
PREEMPTION y
'';
} ];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -75,7 +88,7 @@ in
{ device = "/data/home"; { device = "/data/home";
fsType = "none"; fsType = "none";
neededForBoot = true; neededForBoot = true;
options = [ "bind" ]; options = [ "bind" "x-gvfs-hide" ];
depends = [ "/data" ]; depends = [ "/data" ];
}; };
@ -84,7 +97,7 @@ in
{ device = "/data/root"; { device = "/data/root";
fsType = "none"; fsType = "none";
neededForBoot = true; neededForBoot = true;
options = [ "bind" ]; options = [ "bind" "x-gvfs-hide" ];
depends = [ "/data" ]; depends = [ "/data" ];
}; };
@ -93,7 +106,7 @@ in
{ device = "/data/nixos/${config.networking.hostName}"; { device = "/data/nixos/${config.networking.hostName}";
fsType = "none"; fsType = "none";
neededForBoot = true; neededForBoot = true;
options = [ "bind" ]; options = [ "bind" "x-gvfs-hide" ];
depends = [ "/data" ]; depends = [ "/data" ];
}; };
@ -106,6 +119,9 @@ in
# 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"; }
]; ];
}; };
@ -219,6 +235,19 @@ 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";
};
};
# auto update # auto update
system.autoUpgrade = { system.autoUpgrade = {
enable = true; enable = true;
@ -545,8 +574,8 @@ in
# aliases # aliases
shellAliases = { shellAliases = {
# system build/update/cleanup # system build/update/cleanup
update = "sudo nixos-rebuild boot"; update = "sudo TMPDIR=/var/cache/nix nixos-rebuild boot";
upgrade = "sudo nixos-rebuild boot --upgrade"; upgrade = "sudo TMPDIR=/var/cache/nix nixos-rebuild boot --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";