docker and zfs option for nix service

This commit is contained in:
Robin Appelman 2022-07-01 23:09:30 +02:00
commit 0134a26ba3

View file

@ -56,6 +56,20 @@
example = default; example = default;
description = "The port to listen on"; description = "The port to listen on";
}; };
zfs = mkOption rec {
type = types.bool;
default = false;
example = true;
description = "enable zfs integration";
};
docker = mkOption rec {
type = types.bool;
default = false;
example = true;
description = "enable docker integration";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -66,13 +80,14 @@
users.users.palantir = { users.users.palantir = {
isSystemUser = true; isSystemUser = true;
group = "palantir"; group = "palantir";
extraGroups = ["powermonitoring"]; extraGroups = ["powermonitoring"] ++ lib.optional cfg.docker "docker";
}; };
services.udev.packages = [self.defaultPackage.${pkgs.system}]; services.udev.packages = [self.defaultPackage.${pkgs.system}];
systemd.services."palantir" = { systemd.services."palantir" = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
path = lib.optional cfg.zfs pkgs.zfs;
serviceConfig = let serviceConfig = let
pkg = self.defaultPackage.${pkgs.system}; pkg = self.defaultPackage.${pkgs.system};