sortseer/flake.nix

68 lines
1.6 KiB
Nix
Raw Normal View History

2024-10-13 02:59:21 +02:00
{
description = "sortseer";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
};
outputs = {
self,
nixpkgs,
}: let
# https://github.com/ryantm/agenix/blob/main/flake.nix
eachSystem = nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
in {
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
packages = eachSystem (system: {
sortseer = nixpkgs.legacyPackages.${system}.buildGoModule {
pname = "sortseer";
version = "0.0.1";
src = ./.;
vendorHash = "sha256-PbGOT36n1gyHr0OK0GqZL7B04WHJv+781nGJZIj9LgY=";
};
2024-10-13 18:40:55 +02:00
2024-10-13 02:59:21 +02:00
default = self.packages.${system}.sortseer;
});
2024-10-13 18:40:55 +02:00
# 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;
};
2024-10-13 02:59:21 +02:00
};
}