This repository has been archived on 2024-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
staxman-old/nixos.nix
Hamcha 2aa53823fa
All checks were successful
Build and push Docker image / build-and-publish (push) Successful in 6m29s
build: fix systemd dependency
2024-03-30 22:48:11 +01:00

51 lines
1.2 KiB
Nix

flake: { config
, lib
, pkgs
, ...
}:
let
inherit (lib) mkIf getBin types mkEnableOption mkOption;
inherit (flake.packages.${pkgs.stdenv.hostPlatform.system}) staxman;
cfg = config.services.staxman;
in
{
options.services.staxman = {
enable = mkEnableOption "staxman";
stackDir = mkOption {
type = types.path;
defaultText = "/stacks";
example = "/stacks";
description = ''
Directory containing Arion stacks
'';
};
bindAddress = mkOption
{
type = types.str;
default = "127.0.0.1:3000";
description = ''
Bind address
'';
};
};
config = mkIf cfg.enable {
systemd.services.staxman = {
description = "Scatting system management";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
environment.STAX_ARION_BIN = "${pkgs.arion}/bin/arion";
environment.STAX_DIR = cfg.stackDir;
environment.STAX_BIND = cfg.bindAddress;
serviceConfig = {
User = "root";
Group = "root";
Restart = "always";
ExecStart = "${getBin staxman}/bin/staxman";
};
};
};
}