10 (mkRenamedOptionModule [ "boot" "cleanTmpDir" ] [ "boot" "tmp" "cleanOnBoot" ])
11 (mkRenamedOptionModule [ "boot" "tmpOnTmpfs" ] [ "boot" "tmp" "useTmpfs" ])
12 (mkRenamedOptionModule [ "boot" "tmpOnTmpfsSize" ] [ "boot" "tmp" "tmpfsSize" ])
17 cleanOnBoot = mkOption {
20 description = lib.mdDoc ''
21 Whether to delete all files in {file}`/tmp` during boot.
25 tmpfsSize = mkOption {
26 type = types.oneOf [ types.str types.types.ints.positive ];
28 description = lib.mdDoc ''
29 Size of tmpfs in percentage.
30 Percentage is defined by systemd.
37 description = lib.mdDoc ''
38 Whether to mount a tmpfs on {file}`/tmp` during boot.
41 Large Nix builds can fail if the mounted tmpfs is not large enough.
42 In such a case either increase the tmpfsSize or disable this option.
50 # When changing remember to update /tmp mount in virtualisation/qemu-vm.nix
51 systemd.mounts = mkIf cfg.useTmpfs [
56 mountConfig.Options = concatStringsSep "," [
62 "size=${toString cfg.tmpfsSize}"
67 systemd.tmpfiles.rules = optional cfg.cleanOnBoot "D! /tmp 1777 root root";