1{ config, lib, ... }:
2
3with lib;
4
5{
6
7 ###### interface
8
9 options = {
10
11 boot.cleanTmpDir = mkOption {
12 type = types.bool;
13 default = false;
14 description = ''
15 Whether to delete all files in <filename>/tmp</filename> during boot.
16 '';
17 };
18
19 boot.tmpOnTmpfs = mkOption {
20 type = types.bool;
21 default = false;
22 description = ''
23 Whether to mount a tmpfs on <filename>/tmp</filename> during boot.
24 '';
25 };
26
27 };
28
29 ###### implementation
30
31 config = {
32
33 systemd.additionalUpstreamSystemUnits = optional config.boot.tmpOnTmpfs "tmp.mount";
34
35 systemd.tmpfiles.rules = optional config.boot.cleanTmpDir "D! /tmp 1777 root root";
36
37 };
38
39}