From 590d0a0e8c1ef2a87b420e54b2a94482314a3993 Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Thu, 21 Nov 2024 22:15:13 +0000 Subject: [PATCH 1/2] Fix warning about getExe deprecation --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index beb13975..5457b8ee 100644 --- a/flake.nix +++ b/flake.nix @@ -157,6 +157,8 @@ ${pkgs.zip}/bin/zip -r himalaya.zip himalaya* share mv himalaya.zip ../ ''; + + meta.mainProgram = "himalaya"; }; in rust.buildPackage package; From 90c3bef1728f7df982c1066b21cd270685352bf0 Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Thu, 21 Nov 2024 21:09:29 +0000 Subject: [PATCH 2/2] Use Crane instead of Naersk See https://github.com/ipetkov/crane/blob/3cb338ce81076ce5e461cf77f7824476addb0e1c/examples/quick-start/flake.nix Fixes pimalaya/himalaya#483 --- flake.lock | 37 ++++++++++++++++--------------------- flake.nix | 21 +++++++-------------- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/flake.lock b/flake.lock index 5dd29d6f..7e172473 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } }, diff --git a/flake.nix b/flake.nix index 5457b8ee..84ef1cc6 100644 --- a/flake.nix +++ b/flake.nix @@ -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" ];