aboutsummaryrefslogtreecommitdiff
path: root/pkgs/chef/default.nix
blob: f4f2870059f299f6a0535892a61898cbcef2e8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ rustPlatform, fetchFromGitHub, lib, installShellFiles, gitUpdater, withWebserver ? true }:
rustPlatform.buildRustPackage rec {
  pname = "cooklang-chef";
  version = "0.10.1";
  src = fetchFromGitHub {
    owner = "Zheoni";
    repo = "cooklang-chef";
    rev = "v${version}";
    hash = "sha256-U/zEtDHIAjBakMjIqpJeFzTxof8SHSgLj9zjgND6q1Q=";
  };

  cargoLock.lockFile = "${src}/Cargo.lock";

  # optionally disable the webserver
  buildNoDefaultFeatures = !withWebserver;

  nativeBuildInputs = [
    installShellFiles
  ];

  postInstall = ''
    # Without setting $XDG_CONFIG_HOME, `chef` will complain when trying to generate completion scripts
    export XDG_CONFIG_HOME=$out/share

    for s in bash fish zsh; do
      installShellCompletion --cmd chef --$s <($out/bin/chef generate-completions $s)
    done
  '';

  passthru.updateScript = gitUpdater { rev-prefix = "v"; };

  meta = with lib; {
    homepage = "https://github.com/Zheoni/cooklang-chef";
    description = "A CLI to manage cooklang recipes with extensions";
    license = licenses.mit;
    mainProgram = "chef";
    maintainers = [{
      name = "Chris Wells";
      github = "the-mathematicaster";
      email = "chris@mathematicaster.org";
      githubId = 99217745;
    }];
  };
}