about summary refs log tree commit diff
path: root/pkgs/applications/system/mgmt/default.nix
blob: bfa85ef566fdf7501500c2a09aa69503c317a6d4 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ augeas
, buildGoModule
, fetchFromGitHub
, gotools
, lib
, libvirt
, libxml2
, nex
, pkg-config
, ragel
}:
buildGoModule rec {
  pname = "mgmt";
  version = "unstable-2022-10-24";

  src = fetchFromGitHub {
    owner = "purpleidea";
    repo = pname;
    rev = "d8820fa1855668d9e0f7a7829d9dd0d122b2c5a9";
    hash = "sha256-jurZvEtiaTjWeDkmCJDIFlTzR5EVglfoDxkFgOilo8s=";
  };

  # patching must be done in prebuild, so it is shared with goModules
  # see https://github.com/NixOS/nixpkgs/issues/208036
  preBuild = ''
    for file in `find -name Makefile -type f`; do
      substituteInPlace $file --replace "/usr/bin/env " ""
    done

    substituteInPlace lang/types/Makefile \
      --replace "unset GOCACHE && " ""
    patchShebangs misc/header.sh
    make lang funcgen
  '';

  buildInputs = [
    augeas
    libvirt
    libxml2
  ];

  nativeBuildInputs = [
    gotools
    nex
    pkg-config
    ragel
  ];


  ldflags = [
    "-s"
    "-w"
    "-X main.program=${pname}"
    "-X main.version=${version}"
  ];

  subPackages = [ "." ];

  vendorHash = "sha256-Dtqy4TILN+7JXiHKHDdjzRTsT8jZYG5sPudxhd8znXY=";

  meta = with lib; {
    description = "Next generation distributed, event-driven, parallel config management!";
    homepage = "https://mgmtconfig.com";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ urandom ];
    mainProgram = "mgmt";
  };
}