nixos module
This commit is contained in:
parent
29cd9152e4
commit
9bbcddfb74
1 changed files with 33 additions and 0 deletions
33
flake.nix
33
flake.nix
|
@ -28,7 +28,40 @@
|
|||
|
||||
vendorHash = "sha256-PbGOT36n1gyHr0OK0GqZL7B04WHJv+781nGJZIj9LgY=";
|
||||
};
|
||||
|
||||
default = self.packages.${system}.sortseer;
|
||||
});
|
||||
|
||||
# https://wiki.nixos.org/wiki/NixOS_modules
|
||||
nixosModules = {
|
||||
sortseer = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.sortseer;
|
||||
in {
|
||||
options.services.sortseer = {
|
||||
enable = lib.mkEnableOption "sortseer service";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.sortseer = {
|
||||
after = ["network.target"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
serviceConfig = {
|
||||
ExecStart = "${self.packages.${pkgs.system}.sortseer}/bin/sortseer";
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
# Allow binding to privileged ports
|
||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
default = self.nixosModules.sortseer;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue