Merge pull request #226 from ciarandg/configurable-service-names

Add configurable systemd service name to NixOS module
This commit is contained in:
Robert Hensing 2023-12-30 16:22:27 +01:00 committed by GitHub
commit a27295cbf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -53,12 +53,15 @@ NOTE: This deployment method does NOT use an `arion-pkgs.nix` file, but reuses
virtualisation.arion = { virtualisation.arion = {
backend = "podman-socket"; # or "docker" backend = "podman-socket"; # or "docker"
projects.example.settings = { projects.example = {
serviceName = "example"; # optional systemd service name, defaults to arion-example in this case
settings = {
# Specify you project here, or import it from a file. # Specify you project here, or import it from a file.
# NOTE: This does NOT use ./arion-pkgs.nix, but defaults to NixOS' pkgs. # NOTE: This does NOT use ./arion-pkgs.nix, but defaults to NixOS' pkgs.
imports = [ ./arion-compose.nix ]; imports = [ ./arion-compose.nix ];
}; };
}; };
};
} }
``` ```

View file

@ -26,9 +26,14 @@ let
visible = "shallow"; visible = "shallow";
}; };
_systemd = mkOption { internal = true; }; _systemd = mkOption { internal = true; };
serviceName = mkOption {
description = "The name of the Arion project's systemd service";
type = types.str;
default = "arion-${name}";
};
}; };
config = { config = {
_systemd.services."arion-${name}" = { _systemd.services.${config.serviceName} = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "sockets.target" ]; after = [ "sockets.target" ];