Use Cargo.toml version in Nix package

This commit is contained in:
Luc Perkins 2024-05-24 12:28:14 -03:00
parent 18f457e56e
commit bc92ad7f9f
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
2 changed files with 13 additions and 5 deletions

View file

@ -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;
});

View file

@ -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
]);