From bc92ad7f9f8f8f668ccc93ebeb2ee5a58adc2c94 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Fri, 24 May 2024 12:28:14 -0300 Subject: [PATCH] Use Cargo.toml version in Nix package --- flake.nix | 5 ++++- package.nix | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 560d87c..b8b4cc1 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,7 @@ outputs = { self, nixpkgs, nix, ... }@inputs: let + mncMeta = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package; overlays = [ inputs.rust-overlay.overlays.default nix.overlays.default ]; supportedSystems = [ "aarch64-linux" @@ -40,7 +41,9 @@ in { packages = forEachSupportedSystem ({ pkgs, cranePkgs, ... }: rec { - magic-nix-cache = pkgs.callPackage ./package.nix { }; + magic-nix-cache = pkgs.callPackage ./package.nix { + inherit (mncMeta) version; + }; #inherit (cranePkgs) magic-nix-cache; default = magic-nix-cache; }); diff --git a/package.nix b/package.nix index 6103341..f9617ad 100644 --- a/package.nix +++ b/package.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, rustPlatform +{ lib +, stdenv +, rustPlatform , pkg-config , installShellFiles , nix @@ -7,14 +9,16 @@ , rust-analyzer , clippy , rustfmt +, version }: let ignoredPaths = [ ".github" "target" "book" ]; -in rustPlatform.buildRustPackage rec { +in +rustPlatform.buildRustPackage rec { pname = "magic-nix-cache"; - version = "0.1.0"; + inherit version; src = lib.cleanSourceWith { filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) ignoredPaths); @@ -30,7 +34,8 @@ in rustPlatform.buildRustPackage rec { ]; buildInputs = [ - nix boost + nix + boost ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ SystemConfiguration ]);