flake.nix: fix build and make the derivation more maintainable (github #21)

This commit is contained in:
Fernando Rodrigues 2024-12-18 07:51:48 +00:00 committed by GitHub
parent 229802cb93
commit fab8dffbb5
2 changed files with 12 additions and 17 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
result

View file

@ -10,8 +10,7 @@
genAttrs
importTOML
licenses
maintainers
sourceByRegex
cleanSource
;
eachSystem =
@ -29,39 +28,34 @@
packages = eachSystem (
pkgs:
let
src = sourceByRegex self [
"(core)(/.*)?"
"(module-runtime-rules)(/.*)?"
"(module-request-ai)(/.*)?"
"(rules)(/.*)?"
''Cargo\.(toml|lock)''
];
cargoPackage = (importTOML (src + "/core/Cargo.toml")).package;
src = cleanSource self;
inherit (pkgs)
rustPlatform
openssl
pkg-config
versionCheckHook
;
in
{
default = rustPlatform.buildRustPackage {
pname = "pay-respects";
inherit ((importTOML (src + "/core/Cargo.toml")).package) version;
pname = cargoPackage.name;
inherit (cargoPackage) version;
inherit src;
cargoLock = {
lockFile = src + "/Cargo.lock";
};
cargoLock.lockFile = src + "/Cargo.lock";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
nativeInstallCheckInputs = [ versionCheckHook ];
meta = {
description = "Command suggestions, command-not-found and thefuck replacement written in Rust";
inherit (cargoPackage) description homepage;
license = licenses.agpl3Plus;
homepage = "https://github.com/iffse/pay-respects";
maintainers = with maintainers; [ iff ];
mainProgram = "pay-respects";
};
};