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:
Christopher Bacher 2022-10-09 19:05:10 +02:00
parent 1b5d13c510
commit 7174f824d6
2 changed files with 16 additions and 3 deletions

View file

@ -34,7 +34,7 @@
default = piholeImage;
};
nixosModule = import ./modules/pihole-container.nix;
nixosModules.default = import ./modules/pihole-container.factory.nix { piholeFlake = self; };
devShells.default = let
updatePiholeImageInfoScript = pkgs.writeShellScriptBin "update-pihole-image-info" ''

View file

@ -1,4 +1,6 @@
{ config, pkgs, lib, ... }: with lib; let
{ piholeFlake }: { config, pkgs, lib, ... }: with lib; let
cfg = config.services.piholeRootlessContainer;
mkHostPortsOption = { service, publicDefaultPort }: {
host-internal-port = mkOption {
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;
};
};
};
}