-
-
Save dasJ/f55d106229d0a78196d664fca12837dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, modulesPath, ... }: let | |
systemdLib = import "${modulesPath}/system/boot/systemd-lib.nix" { inherit config lib pkgs; }; | |
# Apply a list of overrideAttrs functions to a drv | |
applyOverrides = drv: overrides: lib.foldl' (drv': override: lib.extendDerivation true (override drv') drv') drv overrides; | |
in { | |
options.systemd.units = lib.mkOption { | |
type = lib.types.attrsOf (lib.types.submodule ({ name, config, ... }: { | |
options = { | |
overrides = lib.mkOption { | |
description = "Overrides to apply to the unit file derivation"; | |
# TOREM 21.05 | |
#type = lib.types.listOf (lib.types.functionTo lib.types.attrs); | |
type = lib.types.listOf lib.types.unspecified; | |
default = []; | |
example = [ (oA: { | |
patches = (oA.patches or []) ++ [ "$somepatch" ]; | |
}) ]; | |
}; | |
}; | |
config = { | |
unit = applyOverrides (systemdLib.makeUnit name config) config.overrides; | |
}; | |
})); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment