modules/systemd-extras: init

This commit is contained in:
Max Headroom 2023-08-23 18:03:02 +02:00
parent a79b829da5
commit 5e755ea855
4 changed files with 24 additions and 4 deletions

View file

@ -8,10 +8,6 @@ with lib;
{ {
options.systemd.services = mkOption { options.systemd.services = mkOption {
type = with types; attrsOf (submodule ({ config, ... }: { type = with types; attrsOf (submodule ({ config, ... }: {
options.strictMounts = mkOption {
type = with types; listOf path;
default = [];
};
config = mkIf (config.strictMounts != []) (let config = mkIf (config.strictMounts != []) (let
findFilesystemsFor = mount: pipe cfg.fileSystems [ findFilesystemsFor = mount: pipe cfg.fileSystems [
(filterAttrs (_: fs: hasPrefix "${fs.mountpoint}/" "${mount}/")) (filterAttrs (_: fs: hasPrefix "${fs.mountpoint}/" "${mount}/"))

View file

@ -29,6 +29,7 @@ in
ssh = ./ssh; ssh = ./ssh;
system-info = ./system-info; system-info = ./system-info;
system-recovery = ./system-recovery; system-recovery = ./system-recovery;
systemd-extras = ./systemd-extras;
tested = ./tested; tested = ./tested;
machineBase = group [ machineBase = group [
@ -38,6 +39,7 @@ in
minimal minimal
port-magic port-magic
ssh ssh
systemd-extras
]; ];
serverBase = group [ serverBase = group [

View file

@ -0,0 +1,5 @@
{
imports = [
./strict-mounts.nix
];
}

View file

@ -0,0 +1,17 @@
{ lib, ... }:
with lib;
{
options.systemd.services = mkOption {
type = with types; attrsOf (submodule ({ config, ... }: {
options.strictMounts = mkOption {
description = "Mount points which this service strictly depends on. What that means is up to other modules.";
type = with types; listOf path;
default = [];
};
config = mkIf (config.strictMounts != []) {
unitConfig.RequiresMountsFor = config.strictMounts;
};
}));
};
}