Closed etu closed 2 years ago
cc @nicknovitski
I also ran into this; I tried to debug and build it myself locally but it never seemed to rebuild when I ran nix-build -A chefdk -v
in my local copy of nixpkgs. Even so, ls result/bin
showed just the chef
binary and nothing else.
Eventually I tried the following diff to force a new build:
diff --git a/pkgs/development/tools/chefdk/default.nix b/pkgs/development/tools/chefdk/default.nix
index d5c74201418..102885866d6 100644
--- a/pkgs/development/tools/chefdk/default.nix
+++ b/pkgs/development/tools/chefdk/default.nix
@@ -1,7 +1,7 @@
{ lib, bundlerEnv, bundlerUpdateScript, ruby_2_4, perl, autoconf }:
bundlerEnv {
- pname = "chef-dk";
+ name = "chef-dk-2.4.17-1";
ruby = ruby_2_4;
gemdir = ./.;
Which caused nix-build
to actually rebuild, and for some reason the rest of the binaries showed up in result/bin
even with no other changes:
enorris:nixpkgs enorris$ ls result/bin/
berks knife
bundle ldiff
bundler minitar
chef mixlib-install
chef-apply nokogiri
chef-client ohai
chef-shell pirb
chef-solo pruby
chef-vault pry
chef-zero rackup
coderay rake
cucumber-tag-expressions rspec
erubis rubocop
fauxhai ruby-parse
ffi-yajl-bench ruby-rewrite
foodcritic rwinrm
gherkin-ruby rwinrmcp
htmldiff safe_yaml
httpclient serverspec-init
inspec thor
kitchen tt
I'm relatively new to nix, so not sure why bumping the version changes anything.
@ericnorris Interesting find!
Just changing pname
to name
makes it work as well, even without adding a version to the end of it.
I tried keeping pname
and adding a separate version
attribute but no such luck.
There's something odd going on with bundlerEnv
I'd say.
@ericnorris So what seems to happen is that bundlerEnv is two different things depending if you have a name
or a pname
.
Maybe there's a bug in there somewhere: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/ruby-modules/bundler-env/default.nix#L38-L60
But I made PR's to revert to using name
instead for now.
Seems like this is still/again a problem (knife
missing) on NixOS 21.11 since it has been again mass-replaced in https://github.com/NixOS/nixpkgs/commit/6f04cd0e6967bc2a426b209fa700b3a3dbb1dbc3
After initial testing this seems to work. Are there any downsides to using bundlerApp
here? (except for the fact that we need to list out executables to be exposed)
--- /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/development/tools/chefdk/default.nix 1970-01-01 01:00:01.000000000 +0100
+++ default.nix 2021-12-15 14:14:56.060127603 +0100
@@ -1,16 +1,17 @@
-{ lib, bundlerEnv, bundlerUpdateScript, ruby, perl, autoconf }:
+{ lib, bundlerApp, bundlerUpdateScript, ruby, perl, autoconf }:
-bundlerEnv {
+bundlerApp {
pname = "chef-dk";
- version = "4.13.3";
inherit ruby;
gemdir = ./.;
buildInputs = [ perl autoconf ];
+ exes = [ "berks" "chef" "chef-cli" "chef-vault" "chef-zero" "foodcritic" "kitchen" "knife" "ohai" ];
+
passthru.updateScript = bundlerUpdateScript "chefdk";
meta = with lib; {
description = "A streamlined development and deployment workflow for Chef platform";
homepage = "https://downloads.chef.io/chef-dk/";
@Informatic I don't know the ruby tooling in nix enough to know if there's any downsides or upsides of making that change. however, I'm not sure why version is removed? If you would make a PR of that we could ask someone with more ruby insights.
Sure, I can do that next week. IIRC bundlerApp
/bundlerEnv
changes behaviour depending on existence of version
param. If it is missing, it'll be pulled in from relevant gemfiles in gemdir
anyways.
Sounds good to me, I'm currently running my knife
install from nixos 19.09, because it was the latest release where I found it working :wink: I guess that's the power of Nix, but it's not a good thing to have broken packages like this.
So ping me when you have that PR open and I'll test it it and possibly merge it :)
Heyho, any updates on this? :)
I finally also migrated my work laptop to NixOS and just ran into this because the berks
binary is missing.
I am not at all experienced with neither Nix or NixOS but just renaming pname
to name
in the default.nix appears to fix the problem, the presence of the version variable apparently doesn't have any impact on the result.
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior The chef executable is there but is broken, the knife executable isn't even present.
Additional context 7136e0d0a6f61734994c566e2cc72fd75733b873 broke chef, it worked before that commit. I've bisected it down to that changeset.
Problem for me is that I don't know ruby or the ruby ecosystem...
This is a problem in 19.09 as well.
Metadata
"x86_64-linux"
Linux 4.19.74, NixOS, 20.03pre193829.f0fec244ca3 (Markhor)
yes
yes
nix-env (Nix) 2.3
"nixos-20.03pre193829.f0fec244ca3"
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information: