diff options
author | Artturin <Artturin@artturin.com> | 2021-09-02 16:20:50 +0300 |
---|---|---|
committer | Artturin <Artturin@artturin.com> | 2021-09-08 19:30:52 +0300 |
commit | f45e8d560e391ac1a846cf89388ed3d6279d49af (patch) | |
tree | 998561d97324c3bdd92ad9292109b63798dad623 | |
parent | 6b369a4de7e6b5ed7d4519581de3bc3d7a3cd5be (diff) | |
download | nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar.gz nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar.bz2 nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar.lz nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar.xz nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.tar.zst nixpkgs-f45e8d560e391ac1a846cf89388ed3d6279d49af.zip |
nixos/tmp: add tmpOnTmpfsSize
-rw-r--r-- | nixos/modules/system/boot/tmp.nix | 17 | ||||
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/nixos/modules/system/boot/tmp.nix b/nixos/modules/system/boot/tmp.nix index 5bb299adb15..6edafd6695b 100644 --- a/nixos/modules/system/boot/tmp.nix +++ b/nixos/modules/system/boot/tmp.nix @@ -2,6 +2,9 @@ with lib; +let + cfg = config.boot; +in { ###### interface @@ -24,18 +27,28 @@ with lib; ''; }; + 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 = { - systemd.mounts = mkIf config.boot.tmpOnTmpfs [ + # 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=50%" ]; + mountConfig.Options = [ "mode=1777" "strictatime" "rw" "nosuid" "nodev" "size=${toString cfg.tmpOnTmpfsSize}" ]; } ]; diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index d9935bcafb7..b51c29f83d6 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -686,7 +686,7 @@ in fsType = "tmpfs"; neededForBoot = true; # Sync with systemd's tmp.mount; - options = [ "mode=1777" "strictatime" "nosuid" "nodev" ]; + options = [ "mode=1777" "strictatime" "nosuid" "nodev" "size=${toString config.boot.tmpOnTmpfsSize}" ]; }; "/tmp/xchg" = { device = "xchg"; |