Move version inference logic into package.nix

This commit is contained in:
Luc Perkins 2024-05-24 12:59:43 -03:00
parent bc92ad7f9f
commit 824e740fe8
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
2 changed files with 2 additions and 6 deletions

View file

@ -21,7 +21,6 @@
outputs = { self, nixpkgs, nix, ... }@inputs: outputs = { self, nixpkgs, nix, ... }@inputs:
let let
mncMeta = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package;
overlays = [ inputs.rust-overlay.overlays.default nix.overlays.default ]; overlays = [ inputs.rust-overlay.overlays.default nix.overlays.default ];
supportedSystems = [ supportedSystems = [
"aarch64-linux" "aarch64-linux"
@ -41,9 +40,7 @@
in in
{ {
packages = forEachSupportedSystem ({ pkgs, cranePkgs, ... }: rec { 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; #inherit (cranePkgs) magic-nix-cache;
default = magic-nix-cache; default = magic-nix-cache;
}); });

View file

@ -9,12 +9,11 @@
, rust-analyzer , rust-analyzer
, clippy , clippy
, rustfmt , rustfmt
, version
}: }:
let let
ignoredPaths = [ ".github" "target" "book" ]; ignoredPaths = [ ".github" "target" "book" ];
version = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package.version;
in in
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "magic-nix-cache"; pname = "magic-nix-cache";