caveman/flake.nix

67 lines
1.8 KiB
Nix

{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, utils, fenix, naersk }: {
overlay = final: prev: {
inherit (self.packages.${prev.system}) caveman-hunter;
};
nixosModule = self.nixosModules.caveman;
nixosModules.caveman = {
imports = [ ./nixos-module.nix ];
nixpkgs.overlays = [ self.overlay ];
};
nixosConfigurations.example = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ {
networking.hostName = "example";
users.users.root.initialPassword = "";
services.caveman.hunter = {
enable = true;
logLevel = "TRACE";
};
} self.nixosModule ];
};
} //
utils.lib.eachSystem (with utils.lib.system; [ x86_64-linux aarch64-linux ]) (system: let
pkgs = nixpkgs.legacyPackages.${system};
rust = fenix.packages.${system}.stable.withComponents [
"cargo"
"rustc"
"rust-src" # just for rust-analyzer
"clippy"
];
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
in rec {
packages.default = self.packages.${system}.caveman-hunter;
packages.caveman-hunter = naersk-lib.buildPackage {
src = ./hunter;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl systemd ];
};
# `nix develop`
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
fenix.packages.${system}.rust-analyzer
] ++
(with packages.default; nativeBuildInputs ++ buildInputs);
};
});
}