From 30d698ee226bf3c20abfbd14af2689625b31d0b1 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Sun, 30 Jun 2024 18:22:09 +0300 Subject: [PATCH 1/3] crate2nix: 0.14.0 -> 0.14.1 Diff: https://github.com/nix-community/crate2nix/compare/0.14.0...0.14.1 --- pkgs/development/tools/rust/crate2nix/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/rust/crate2nix/default.nix b/pkgs/development/tools/rust/crate2nix/default.nix index a32a76aeb898..f8de08eeeade 100644 --- a/pkgs/development/tools/rust/crate2nix/default.nix +++ b/pkgs/development/tools/rust/crate2nix/default.nix @@ -10,18 +10,18 @@ rustPlatform.buildRustPackage rec { pname = "crate2nix"; - version = "0.14.0"; + version = "0.14.1"; src = fetchFromGitHub { owner = "nix-community"; repo = pname; rev = version; - hash = "sha256-rGT3CW64cJS9nlnWPFWSc1iEa3dNZecVVuPVGzcsHe8="; + hash = "sha256-esWhRnt7FhiYq0CcIxw9pvH+ybOQmWBfHYMtleaMhBE="; }; sourceRoot = "${src.name}/crate2nix"; - cargoHash = "sha256-YoE6wrQNQcRo/yaiVpASU2VOmHCPM4pDgTejn0ovOVY="; + cargoHash = "sha256-nQ1VUCFMmpWZWvKFbyJFIZUJ24N9ZPY8JCHWju385NE="; nativeBuildInputs = [ makeWrapper ]; From a8963a20604fa05e2f0546d13c28575a2b0cef1c Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Sun, 30 Jun 2024 18:26:08 +0300 Subject: [PATCH 2/3] crate2nix: move to pkgs/by-name --- .../crate2nix/default.nix => by-name/cr/crate2nix/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/tools/rust/crate2nix/default.nix => by-name/cr/crate2nix/package.nix} (100%) diff --git a/pkgs/development/tools/rust/crate2nix/default.nix b/pkgs/by-name/cr/crate2nix/package.nix similarity index 100% rename from pkgs/development/tools/rust/crate2nix/default.nix rename to pkgs/by-name/cr/crate2nix/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a04271b7fac7..f2c68b926c29 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16641,8 +16641,6 @@ with pkgs; cauwugo = callPackage ../development/tools/rust/cauwugo { }; - crate2nix = callPackage ../development/tools/rust/crate2nix { }; - critcmp = callPackage ../development/tools/rust/critcmp { }; devspace = callPackage ../development/tools/misc/devspace { }; From 62da9048d614e8c7f19657e58e9a02eff51a8ef2 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Sun, 30 Jun 2024 18:33:25 +0300 Subject: [PATCH 3/3] crate2nix: rewrite expression --- pkgs/by-name/cr/crate2nix/package.nix | 45 +++++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/cr/crate2nix/package.nix b/pkgs/by-name/cr/crate2nix/package.nix index f8de08eeeade..12ce3f76edeb 100644 --- a/pkgs/by-name/cr/crate2nix/package.nix +++ b/pkgs/by-name/cr/crate2nix/package.nix @@ -2,10 +2,11 @@ , rustPlatform , fetchFromGitHub , makeWrapper - , cargo , nix , nix-prefetch-git +, installShellFiles +, }: rustPlatform.buildRustPackage rec { @@ -19,26 +20,33 @@ rustPlatform.buildRustPackage rec { hash = "sha256-esWhRnt7FhiYq0CcIxw9pvH+ybOQmWBfHYMtleaMhBE="; }; - sourceRoot = "${src.name}/crate2nix"; + sourceRoot = "${src.name}/${pname}"; cargoHash = "sha256-nQ1VUCFMmpWZWvKFbyJFIZUJ24N9ZPY8JCHWju385NE="; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ + makeWrapper + installShellFiles + ]; - # Tests use nix(1), which tries (and fails) to set up /nix/var inside the - # sandbox + # Tests use nix(1), which tries (and fails) to set up /nix/var inside the sandbox. doCheck = false; - postFixup = '' - wrapProgram $out/bin/crate2nix \ - --suffix PATH ":" ${lib.makeBinPath [ cargo nix nix-prefetch-git ]} + postInstall = '' + wrapProgram $out/bin/${pname} \ + --prefix PATH ":" ${ + lib.makeBinPath [ + cargo + nix + nix-prefetch-git + ] + } - rm -rf $out/lib $out/bin/crate2nix.d - mkdir -p \ - $out/share/bash-completion/completions \ - $out/share/zsh/vendor-completions - $out/bin/crate2nix completions -s 'bash' -o $out/share/bash-completion/completions - $out/bin/crate2nix completions -s 'zsh' -o $out/share/zsh/vendor-completions + for shell in bash zsh fish + do + $out/bin/${pname} completions -s $shell + installShellCompletion ${pname}.$shell || installShellCompletion --$shell _${pname} + done ''; meta = with lib; { @@ -49,9 +57,12 @@ rustPlatform.buildRustPackage rec { so that you can build every crate individually in a Nix sandbox. ''; homepage = "https://github.com/nix-community/crate2nix"; + changelog = "https://nix-community.github.io/crate2nix/90_reference/90_changelog"; license = licenses.asl20; - maintainers = with maintainers; [ kolloch cole-h ]; - platforms = platforms.all; + maintainers = with maintainers; [ + kolloch + cole-h + kranzes + ]; }; } -