90 lines
2.6 KiB
Nix
90 lines
2.6 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 caveman-gatherer caveman-smokestack;
|
|
};
|
|
|
|
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 rec {
|
|
pname = "caveman-hunter";
|
|
version = self.lastModifiedDate;
|
|
src = ./.;
|
|
targets = [ pname ];
|
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
|
buildInputs = with pkgs; [ openssl systemd ];
|
|
};
|
|
packages.caveman-gatherer = naersk-lib.buildPackage rec {
|
|
pname = "caveman-gatherer";
|
|
version = self.lastModifiedDate;
|
|
src = ./.;
|
|
targets = [ pname ];
|
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
|
buildInputs = with pkgs; [ openssl systemd ];
|
|
postInstall = ''
|
|
mkdir -p $out/share/caveman/gatherer
|
|
cp -rv gatherer/{templates,assets} $out/share/caveman/gatherer/
|
|
'';
|
|
};
|
|
packages.caveman-smokestack = naersk-lib.buildPackage rec {
|
|
pname = "caveman-smokestack";
|
|
version = self.lastModifiedDate;
|
|
src = ./.;
|
|
targets = [ pname ];
|
|
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);
|
|
};
|
|
});
|
|
}
|