Provide an implementation for systemd-tmpfiles.

Co-authored-by: aanderse <aaron@fosslib.net>
Co-authored-by: jfroche <jfroche@pyxel.be>
This commit is contained in:
r-vdp 2023-10-12 11:13:08 +02:00
parent 549bc38339
commit e51a1d3ed0
No known key found for this signature in database
6 changed files with 88 additions and 3 deletions

View file

@ -9,6 +9,7 @@
./environment.nix
./etc.nix
./systemd.nix
./tmpfiles.nix
./upstream/nixpkgs
];

27
nix/modules/tmpfiles.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, lib, ... }:
let
inherit (lib) types;
in
{
options = {
systemd.tmpfiles.rules = lib.mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "d /tmp 1777 root root 10d" ];
description = lib.mdDoc ''
Rules for creation, deletion and cleaning of volatile and temporary files
automatically. See
{manpage}`tmpfiles.d(5)`
for the exact format.
'';
};
};
config = {
environment.etc."tmpfiles.d/00-system-manager.conf".text = ''
# This file is created automatically and should not be modified.
# Please change the option systemd.tmpfiles.rules instead.
${lib.concatStringsSep "\n" config.systemd.tmpfiles.rules}
'';
};
}