diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index 57d515b..2340be6 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -1,5 +1,5 @@ { - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.git-hooks.url = "github:cachix/git-hooks.nix"; inputs.git-hooks.inputs.nixpkgs.follows = "nixpkgs"; outputs = inputs: let diff --git a/templates/rust/nix/packages.nix b/templates/rust/nix/packages.nix index 43327bd..bf515cf 100644 --- a/templates/rust/nix/packages.nix +++ b/templates/rust/nix/packages.nix @@ -1,8 +1,11 @@ {pkgs, ...}: let + inherit (builtins) fromTOML readFile; pname = "my-package"; + src = ./..; main-package = pkgs.rustPlatform.buildRustPackage { - inherit pname; - version = "0.1.0"; + inherit pname src; + version = (fromTOML (readFile "${src}/Cargo.toml")).package.version; + # or for workspaces: version = (fromTOML (readFile "${src}/${pname}/Cargo.toml")).package.version; /* nativeBuildInputs = with pkgs; [ @@ -14,8 +17,6 @@ ]; */ - src = ./..; - hash = pkgs.lib.fakeHash; cargoHash = pkgs.lib.fakeHash; useFetchCargoVendor = true; };