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

52 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2023-11-27 12:34:49 +00:00
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" ];
2024-03-30 21:48:11 +00:00
wants = [ "network-online.target" ];
2023-11-27 12:34:49 +00:00
wantedBy = [ "multi-user.target" ];
2024-03-30 19:48:55 +00:00
environment.STAX_ARION_BIN = "${pkgs.arion}/bin/arion";
2023-11-27 12:34:49 +00:00
environment.STAX_DIR = cfg.stackDir;
environment.STAX_BIND = cfg.bindAddress;
serviceConfig = {
User = "root";
Group = "root";
Restart = "always";
ExecStart = "${getBin staxman}/bin/staxman";
};
};
};
}