about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/ovmfvartool/default.nix
blob: 1367087e083252e26e21e6451800b9461fa6d69d (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
{ lib, stdenvNoCC, fetchFromGitHub, python3 }:

stdenvNoCC.mkDerivation rec {
  pname = "ovmfvartool";
  version = "unstable-2021-06-16";

  src = fetchFromGitHub {
    owner = "hlandau";
    repo = pname;
    rev = "c4c0c24dce1d201f95dfd69fd7fd9d51ea301377";
    hash = "sha256-3OvYAB41apPn1c2YTKBIEITmHSUMQ0oEijY5DhZWWGo=";
  };

  postPatch = let
    pythonPkg = python3.withPackages (p: with p; [ pyyaml ]);
  in ''
    # needed in build but /usr/bin/env is not available in sandbox
    substituteInPlace ovmfvartool \
      --replace "/usr/bin/env python3" "${pythonPkg.interpreter}"
  '';

  installPhase = ''
    mkdir -p $out/bin
    install -m 755 ovmfvartool $out/bin/
  '';

  meta = with lib; {
    description = "Parse and generate OVMF_VARS.fd from Yaml";
    homepage = "https://github.com/hlandau/ovmfvartool";
    license = licenses.gpl3;
    maintainers = with maintainers; [ baloo raitobezarius ];
  };
}