Merge pull request #505 from KoviRobi/crane

Use crane instead of naersk
This commit is contained in:
Clément DOUIN
2024-11-22 11:51:06 +01:00
committed by GitHub
2 changed files with 25 additions and 35 deletions
Generated
+16 -21
View File
@@ -1,5 +1,20 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1731974733,
"narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=",
"owner": "ipetkov",
"repo": "crane",
"rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
@@ -57,26 +72,6 @@
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1721727458,
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
"owner": "nix-community",
"repo": "naersk",
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1731797254,
@@ -95,10 +90,10 @@
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"naersk": "naersk",
"nixpkgs": "nixpkgs"
}
},
+9 -14
View File
@@ -13,17 +13,14 @@
url = "github:soywod/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, gitignore, fenix, naersk, ... }:
outputs = { self, nixpkgs, gitignore, fenix, crane, ... }:
let
inherit (nixpkgs) lib;
inherit (gitignore.lib) gitignoreSource;
@@ -72,11 +69,6 @@
x86_64-darwin.x86_64-darwin = {
rustTarget = "x86_64-apple-darwin";
mkPackage = { pkgs, ... }: package:
let inherit (pkgs.darwin.apple_sdk_11_0.frameworks) Security;
in package // {
NIX_LDFLAGS = "-F${Security}/Library/Frameworks -framework Security";
};
};
aarch64-darwin.aarch64-darwin = {
@@ -118,10 +110,7 @@
inherit pkgs buildSystem;
targetSystem = targetConfig.rustTarget;
};
rust = naersk.lib.${buildSystem}.override {
cargo = toolchain;
rustc = toolchain;
};
rust = (crane.mkLib pkgs).overrideToolchain toolchain;
mkPackage' = targetConfig.mkPackage or (_: p: p);
himalaya = "./himalaya";
runner = targetConfig.runner or (_: himalaya) { inherit pkgs himalaya; };
@@ -131,6 +120,10 @@
strictDeps = true;
doCheck = false;
auditable = false;
buildInputs = lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk_11_0.frameworks.Security
];
nativeBuildInputs = with pkgs; [ pkg-config ];
CARGO_BUILD_TARGET = targetConfig.rustTarget;
CARGO_BUILD_RUSTFLAGS = [ "-Ctarget-feature=+crt-static" ];
@@ -157,6 +150,8 @@
${pkgs.zip}/bin/zip -r himalaya.zip himalaya* share
mv himalaya.zip ../
'';
meta.mainProgram = "himalaya";
};
in
rust.buildPackage package;