module(pihole-container): make it a module factory; WIP: start adding systemd service
The factory function returns the pihole module and allows to pass the flake itself to refer to its outputs.
This commit is contained in:
parent
1b5d13c510
commit
7174f824d6
2 changed files with 16 additions and 3 deletions
|
@ -34,7 +34,7 @@
|
||||||
default = piholeImage;
|
default = piholeImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModule = import ./modules/pihole-container.nix;
|
nixosModules.default = import ./modules/pihole-container.factory.nix { piholeFlake = self; };
|
||||||
|
|
||||||
devShells.default = let
|
devShells.default = let
|
||||||
updatePiholeImageInfoScript = pkgs.writeShellScriptBin "update-pihole-image-info" ''
|
updatePiholeImageInfoScript = pkgs.writeShellScriptBin "update-pihole-image-info" ''
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{ config, pkgs, lib, ... }: with lib; let
|
{ piholeFlake }: { config, pkgs, lib, ... }: with lib; let
|
||||||
|
cfg = config.services.piholeRootlessContainer;
|
||||||
|
|
||||||
mkHostPortsOption = { service, publicDefaultPort }: {
|
mkHostPortsOption = { service, publicDefaultPort }: {
|
||||||
host-internal-port = mkOption {
|
host-internal-port = mkOption {
|
||||||
type = types.port;
|
type = types.port;
|
||||||
|
@ -235,6 +237,17 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services."pihole-rootless-container" = {
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.podman}/bin/podman run \
|
||||||
|
--rm \
|
||||||
|
--rmi \
|
||||||
|
docker-archive:${self.packages.piholeImage}
|
||||||
|
'';
|
||||||
|
User = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue