Skip to content

Commit

Permalink
modules/nixos: small nit fixes
Browse files Browse the repository at this point in the history
Moved the `/var/tmp` configuration for the Nix daemon from the `/tmp` module to the nix module. Removed the desire for a zram writeback device since it would have no benefit on a tmpfs system anyways, unless I dedicated a drive to it. Lastly, changed the systemd-boot module to use `rec` in an isolated block.
  • Loading branch information
Frontear committed Jan 9, 2025
1 parent 4657d3a commit 44c1976
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
7 changes: 7 additions & 0 deletions modules/nixos/programs/nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ in {
# since the build is extremely small and fast, but why not.
my.toplevel.cachix = [ config.nix.package ];

# Instruct the daemon to use `/var/tmp` as the TMPDIR instead of `/tmp`.
# This is because `/tmp` can be a tmpfs (and honestly should). `/var/tmp`
# is designed to contain persistent, yet temporary files, a definition
# that fits Nix's usage of the TMPDIR perfectly.
my.persist.directories = [ "/var/tmp" ];
systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp";

# Use github:viperML/nh as our "nix wrapper" program.
programs.nh.enable = true;

Expand Down
4 changes: 2 additions & 2 deletions modules/nixos/system/boot/systemd-boot/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in {
editor = cfg.editor;
};
}
(lib.mkIf cfg.silent {
(lib.mkIf cfg.silent rec {
# https://wiki.archlinux.org/title/Silent_boot
boot.consoleLogLevel = 3;
boot.initrd.verbose = false;
Expand All @@ -35,7 +35,7 @@ in {
boot.kernelParams = [
"quiet"
"systemd.show_status=auto"
"udev.log_level=${toString config.boot.consoleLogLevel}"
"udev.log_level=${toString boot.consoleLogLevel}"
];
})
]);
Expand Down
1 change: 0 additions & 1 deletion modules/nixos/system/mounts/swap/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ in {
enable = true;
memoryPercent = 150; # https://unix.stackexchange.com/a/596929
priority = 100;
# TODO: writebackDevice?
};
})
];
Expand Down
4 changes: 0 additions & 4 deletions modules/nixos/system/mounts/tmp/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ in {

config = lib.mkMerge [
(lib.mkIf cfg.enableTmpfs {
# Force the Nix builder into a sane TMPDIR
my.persist.directories = [ "/var/tmp" ];
systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp";

# Use tmpfs for /tmp as it's just easier to use.
# Not using this means that cleaning on boot can
# take a few seconds, which is wasteful.
Expand Down

0 comments on commit 44c1976

Please sign in to comment.