rework features, add abi support, add fd args
This commit is contained in:
parent
ab083b07e4
commit
72e1a493ec
6 changed files with 174 additions and 61 deletions
45
nix/package.nix
Normal file
45
nix/package.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
features ? [ "cli" ],
|
||||
abi ? 6,
|
||||
...
|
||||
}:
|
||||
let
|
||||
details = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package;
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = details.name;
|
||||
inherit (details) version;
|
||||
src = lib.cleanSourceWith {
|
||||
src = lib.cleanSource ../.;
|
||||
filter =
|
||||
path_t: type:
|
||||
let
|
||||
path = toString path_t;
|
||||
baseName = baseNameOf path;
|
||||
parentDir = baseNameOf (dirOf path);
|
||||
matchesSuffix = lib.any (suffix: lib.hasSuffix suffix baseName) [
|
||||
".rs"
|
||||
".toml"
|
||||
];
|
||||
isCargoFile = baseName == "Cargo.lock";
|
||||
isCargoConf = parentDir == ".cargo" && baseName == "config";
|
||||
in
|
||||
type == "directory" || matchesSuffix || isCargoFile || isCargoConf;
|
||||
};
|
||||
cargoLock.lockFile = ../Cargo.lock;
|
||||
buildNoDefaultFeatures = true;
|
||||
buildFeatures = features ++ [
|
||||
"nix"
|
||||
"abi-${toString abi}"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = details.description;
|
||||
homepage = details.repository;
|
||||
license = lib.licenses.gpl3Plus;
|
||||
maintainers = [ lib.maintainers.atagen ];
|
||||
mainProgram = details.name;
|
||||
};
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue