56d7e7492c
@poettering decided we only need a limited number of inodes in our /tmp, so why not limit that for every systemd user? That makes medium-sized nix builds impossible so this commit restores the old behaviour which is the kernel default of half the number of physical RAM pages which does not seem too unreasonable to me.
45 lines
830 B
Nix
45 lines
830 B
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
boot.cleanTmpDir = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to delete all files in <filename>/tmp</filename> during boot.
|
|
'';
|
|
};
|
|
|
|
boot.tmpOnTmpfs = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to mount a tmpfs on <filename>/tmp</filename> during boot.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = {
|
|
|
|
systemd.mounts = mkIf config.boot.tmpOnTmpfs [
|
|
{
|
|
what = "tmpfs";
|
|
where = "/tmp";
|
|
mountConfig.Options = [ "mode=1777" "strictatime" "rw" "nosuid" "nodev" "size=50%" ];
|
|
}
|
|
];
|
|
|
|
systemd.tmpfiles.rules = optional config.boot.cleanTmpDir "D! /tmp 1777 root root";
|
|
|
|
};
|
|
|
|
}
|