Merge pull request #136471 from Artturin/tmpontmpfssize

Artturi 74b3e9ff ba99865d

Changed files
+16 -3
nixos
modules
system
boot
virtualisation
+15 -2
nixos/modules/system/boot/tmp.nix
···
with lib;
{
###### interface
···
'';
};
};
###### implementation
config = {
-
systemd.mounts = mkIf config.boot.tmpOnTmpfs [
{
what = "tmpfs";
where = "/tmp";
type = "tmpfs";
-
mountConfig.Options = [ "mode=1777" "strictatime" "rw" "nosuid" "nodev" "size=50%" ];
}
];
···
with lib;
+
let
+
cfg = config.boot;
+
in
{
###### interface
···
'';
};
+
boot.tmpOnTmpfsSize = mkOption {
+
type = types.oneOf [ types.str types.types.ints.positive ];
+
default = "50%";
+
description = ''
+
Size of tmpfs in percentage.
+
Percentage is defined by systemd.
+
'';
+
};
+
};
###### implementation
config = {
+
# When changing remember to update /tmp mount in virtualisation/qemu-vm.nix
+
systemd.mounts = mkIf cfg.tmpOnTmpfs [
{
what = "tmpfs";
where = "/tmp";
type = "tmpfs";
+
mountConfig.Options = [ "mode=1777" "strictatime" "rw" "nosuid" "nodev" "size=${toString cfg.tmpOnTmpfsSize}" ];
}
];
+1 -1
nixos/modules/virtualisation/qemu-vm.nix
···
fsType = "tmpfs";
neededForBoot = true;
# Sync with systemd's tmp.mount;
-
options = [ "mode=1777" "strictatime" "nosuid" "nodev" ];
};
"/tmp/xchg" =
{ device = "xchg";
···
fsType = "tmpfs";
neededForBoot = true;
# Sync with systemd's tmp.mount;
+
options = [ "mode=1777" "strictatime" "nosuid" "nodev" "size=${toString config.boot.tmpOnTmpfsSize}" ];
};
"/tmp/xchg" =
{ device = "xchg";