pay-respects/flake.nix

66 lines
1.4 KiB
Nix
Raw Normal View History

2024-12-11 16:02:24 +01:00
{
2024-12-11 17:34:15 +01:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
outputs =
{ self, nixpkgs }:
let
inherit (nixpkgs.lib)
genAttrs
importTOML
licenses
cleanSource
2024-12-11 17:34:15 +01:00
;
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
eachSystem =
f:
genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
] (system: f nixpkgs.legacyPackages.${system});
in
{
formatter = eachSystem (pkgs: pkgs.nixfmt-rfc-style);
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
packages = eachSystem (
pkgs:
let
cargoPackage = (importTOML (src + "/core/Cargo.toml")).package;
src = cleanSource self;
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
inherit (pkgs)
rustPlatform
openssl
pkg-config
versionCheckHook
2024-12-11 17:34:15 +01:00
;
in
{
default = rustPlatform.buildRustPackage {
pname = cargoPackage.name;
inherit (cargoPackage) version;
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
inherit src;
2024-12-11 16:02:24 +01:00
cargoLock.lockFile = src + "/Cargo.lock";
2024-12-11 16:02:24 +01:00
2024-12-11 17:34:15 +01:00
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
2024-12-11 16:02:24 +01:00
nativeInstallCheckInputs = [ versionCheckHook ];
2024-12-11 17:34:15 +01:00
meta = {
inherit (cargoPackage) description homepage;
2024-12-11 17:34:15 +01:00
license = licenses.agpl3Plus;
mainProgram = "pay-respects";
};
};
}
);
};
2024-12-11 16:02:24 +01:00
}