nixos module

This commit is contained in:
Casper V. Kristensen 2024-10-13 18:40:55 +02:00
parent 29cd9152e4
commit 9bbcddfb74

View file

@ -28,7 +28,40 @@
vendorHash = "sha256-PbGOT36n1gyHr0OK0GqZL7B04WHJv+781nGJZIj9LgY="; vendorHash = "sha256-PbGOT36n1gyHr0OK0GqZL7B04WHJv+781nGJZIj9LgY=";
}; };
default = self.packages.${system}.sortseer; 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;
};
}; };
} }