1
0
Fork 0

Modules: Tweak fever dream merging for autostart attribute

This commit is contained in:
Aires 2024-07-02 16:19:15 -04:00
parent 20212e406c
commit 84885450a2
4 changed files with 137 additions and 156 deletions

View file

@ -32,8 +32,7 @@ in
}; };
}; };
config = lib.mkMerge [ config = lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
aux.system.users.media.enable = true; aux.system.users.media.enable = true;
users.users.airsonic.extraGroups = [ "media" ]; users.users.airsonic.extraGroups = [ "media" ];
@ -63,10 +62,7 @@ in
}; };
systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ]; systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ];
}) # Disable autostart if configured
(lib.mkIf (!cfg.autostart) { systemd.services.airsonic = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
# Disable autostart if needed };
systemd.services.airsonic.wantedBy = lib.mkForce [ ];
})
];
} }

View file

@ -28,15 +28,14 @@ rec {
}; };
}; };
config = lib.mkMerge [ config = lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = [ duplicacy-web ]; environment.systemPackages = [ duplicacy-web ];
networking.firewall.allowedTCPPorts = [ 3875 ]; networking.firewall.allowedTCPPorts = [ 3875 ];
# Install systemd service. # Install systemd service.
systemd.services."duplicacy-web" = { systemd.services.duplicacy-web = {
enable = true; enable = true;
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ after = [
@ -54,13 +53,6 @@ rec {
environment = { environment = {
HOME = cfg.environment; HOME = cfg.environment;
}; };
} // lib.optionalAttrs (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
}; };
})
(lib.mkIf (!cfg.autostart) {
# Disable autostart if needed
systemd.services.duplicacy-web.wantedBy = lib.mkForce [ ];
})
];
} }

View file

@ -55,8 +55,7 @@ in
}; };
}; };
config = lib.mkMerge [ config = lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
forgejo-cli forgejo-cli
pkgs.podman-tui pkgs.podman-tui
@ -126,10 +125,7 @@ in
allowedTCPPorts = [ 53 ]; allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 ]; allowedUDPPorts = [ 53 ];
}; };
}) # Disable autostart if configured
(lib.mkIf (!cfg.autostart) { systemd.services.forgejo = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
# Disable autostart if needed };
systemd.services.forgejo.wantedBy = lib.mkForce [ ];
})
];
} }

View file

@ -17,8 +17,7 @@ in
}; };
}; };
config = lib.mkMerge [ config = lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
services.nginx = { services.nginx = {
enable = true; enable = true;
@ -38,10 +37,8 @@ in
443 443
]; ];
}; };
})
(lib.mkIf (!cfg.autostart) { # Disable autostart if configured
# Disable autostart if needed systemd.services.nginx = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
systemd.services.nginx.wantedBy = lib.mkForce [ ]; };
})
];
} }