1
0
Fork 0

Modules: Fix autostarting services

This commit is contained in:
Aires 2024-07-02 14:40:49 -04:00
parent c1308f9ef4
commit fa6157c228
4 changed files with 156 additions and 137 deletions

View file

@ -32,7 +32,8 @@ in
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkMerge [
(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" ];
@ -61,8 +62,11 @@ in
} // lib.optionalAttrs (cfg.home != "") { home = cfg.home; }; } // lib.optionalAttrs (cfg.home != "") { home = cfg.home; };
}; };
systemd.services = { systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ];
nginx.wants = [ config.systemd.services.airsonic.name ]; })
} // lib.optionalAttrs (!cfg.autostart) { airsonic.wantedBy = lib.mkForce [ ]; }; (lib.mkIf (!cfg.autostart) {
}; # Disable autostart if needed
systemd.services.airsonic.wantedBy = lib.mkForce [ ];
})
];
} }

View file

@ -28,7 +28,8 @@ rec {
}; };
}; };
config = mkIf cfg.enable { config = lib.mkMerge [
(lib.mkIf cfg.enable {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = [ duplicacy-web ]; environment.systemPackages = [ duplicacy-web ];
@ -53,6 +54,13 @@ rec {
environment = { environment = {
HOME = cfg.environment; HOME = cfg.environment;
}; };
} // optionalAttrs cfg.autostart { wantedBy = [ "multi-user.target" ]; }; # Start at boot if autostart is enabled.
}; };
})
(lib.mkIf (!cfg.autostart) {
# Disable autostart if needed
systemd.services.duplicacy-web.wantedBy = lib.mkForce [ ];
})
];
} }

View file

@ -55,7 +55,8 @@ in
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkMerge [
(lib.mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
forgejo-cli forgejo-cli
pkgs.podman-tui pkgs.podman-tui
@ -104,9 +105,7 @@ in
}; };
}; };
systemd.services = { systemd.services.nginx.wants = [ config.systemd.services.forgejo.name ];
nginx.wants = [ config.systemd.services.forgejo.name ];
} // lib.optionalAttrs (!cfg.autostart) { forgejo.wantedBy = lib.mkForce [ ]; };
# Enable Podman for running...uh, runners. # Enable Podman for running...uh, runners.
virtualisation = lib.mkIf cfg.actions.enable { virtualisation = lib.mkIf cfg.actions.enable {
@ -127,5 +126,10 @@ in
allowedTCPPorts = [ 53 ]; allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 ]; allowedUDPPorts = [ 53 ];
}; };
}; })
(lib.mkIf (!cfg.autostart) {
# Disable autostart if needed
systemd.services.forgejo.wantedBy = lib.mkForce [ ];
})
];
} }

View file

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