compose2nix

This commit is contained in:
2024-11-21 13:21:31 -06:00
parent fb0d7fed9d
commit e127cd0c0a
5 changed files with 392 additions and 64 deletions

View File

@@ -1,29 +1,21 @@
{ config, lib, pkgs, ... }: {
{ config, lib, ... }: {
options.sysconfig.opts.virtualization.pihole.enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
};
config = lib.mkIf config.sysconfig.opts.virtualization.pihole.enable {
sops.templates."pihole.env" = {
content = ''
WEBPASSWORD=${config.sops.placeholder."pihole/pass"}
'';
config = lib.mkIf config.sysconfig.opts.virtualization.pihole.enable (lib.mkMerge [
path = "/ssd1/Pihole/.env";
};
systemd.services.launchPihole = {
(import ./docker-compose.nix)
{
sops.templates."pihole.env" = {
content = ''
WEBPASSWORD=${config.sops.placeholder."pihole/pass"}
'';
enable = false;
wantedBy = [ "multi-user.target" ];
script = ''
cd /ssd1/Pihole
${pkgs.docker-compose}/bin/docker-compose up
'';
};
};
path = "/ssd1/Pihole/.env";
};
}
]);
}