system: Add option to avoid cleaning /tmp on boot

This increases boot times quite a bit so I'd rather use tmpfs as /tmp
where possible. Note that this defaults to cleaning /tmp anyway since
I'd rather clean /tmp than not do so at all.

For future reference, the message that gets shown is the following:
"A start job is running for Create Volatile Files and Directories"
This commit is contained in:
Donovan Glover 2024-04-05 10:59:48 -04:00
parent 59f557a3e5
commit 01acf8197d
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -1,10 +1,10 @@
{ nix-config, pkgs, lib, config, ... }:
let
inherit (lib) mkOption;
inherit (lib) mkOption mkEnableOption mkIf;
inherit (lib.types) str listOf;
inherit (pkgs.nixVersions) nix_2_19;
inherit (cfg) username;
inherit (cfg) username iHaveLotsOfRam;
inherit (builtins) attrValues;
cfg = config.modules.system;
@ -39,11 +39,15 @@ in
type = str;
default = "22.11";
};
iHaveLotsOfRam = mkEnableOption "tmpfs on /tmp";
};
config = {
boot = {
tmp.cleanOnBoot = true;
tmp = if iHaveLotsOfRam
then { useTmpfs = true; }
else { cleanOnBoot = true; };
loader = {
systemd-boot = {