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 /target
result

View file

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