NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

Package request: chef-workstation #222067

Open dylanmtaylor opened 1 year ago

dylanmtaylor commented 1 year ago

Project description

Chef Workstation is Chef's modern developer tool kit that includes Chef Infra, InSpec and Habitat plus a host of resources, helpers and testing tools that make automating infrastructure, application and security testing easier than ever. With Chef Workstation DevOps automators can create, test and deliver codified artifacts all within their preferred developer environment.

Metadata

WolfangAukang commented 11 months ago

I was able to package omnibus for this, but the problem is that I am not sure how does it recognize programs specified on config/software, as I'm getting a:

I could not find a software named `pkg-name' in any of the software locations:
/build/source/omnibus/config/software

I have curl on the nativeBuildInputs (shown below), but it is not being recognized:

{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, omnibus
, curl
}:

stdenv.mkDerivation rec {
  pname = "chef-workstation";
  version = "23.9.1049";

  src = fetchFromGitHub {
    owner = "chef";
    repo = "chef-workstation";
    rev = version;
    hash = "sha256-u0bDOXcJggPt+4VWAIq1xNnRofGZKXIp54aqbCgg4qk=";
  };

  nativeBuildInputs = [
    curl
    omnibus
  ];

  patches = [
    ./0001-omnibus-setup.patch
  ];

  preBuild = ''
    export HOME="$(mktemp -d)"
    cd omnibus
    substituteInPlace kitchen.yml \
      --replace "install_dir:         /opt/chef-workstation" "install_dir:         $out/opt/chef-workstation"
  '';

  buildPhase = ''
    runHook preBuild

    curl --help #Works
    omnibus build chef-workstation #Throws 'I could not find a software named `curl' in any of the software locations'

    runHook postBuild
  '';
}

Any help appreciated

rafaelsgirao commented 11 months ago

Hi @WolfangAukang ,

I managed to package chef-workstation for my personal use.

You can circumvent omnibus entirely by simply using this Gemfile . This is what omnibus itself uses to create chef-workstation .

I wanted to PR this package to nixpkgs, but unfortunately due to what I think are bugs in rubyEnv I could only get the package working with this external rubyEnv fork..

This said, here are the files I'm using to get a chef-workstation package:

https://gist.github.com/rafaelsgirao/48cbd9f9e4a71a095bb43c58dadc0188

Feel free attempt to package this on nixpkgs without relying on that external flake. And please mention me if you do :)

WolfangAukang commented 10 months ago

Thank you @rafaelsgirao. In the end, I saw you have it on your nixos-config repo, so I can simply pull it from there (nix build) in case I need it.