summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/crx/default.nix
blob: 429a471df098f36032e722228886dc97e2048cb3 (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
45
46
47
48
49
50
{ lib, pkgs, stdenv }:

stdenv.mkDerivation rec {
  pname = "crx";
  version = "1.1.0";

  src = pkgs.fetchgit {
    url = https://cgit.krebsco.de/crx;
    rev = "refs/tags/v${version}";
    sha256 = "10xwrdxwbvqydayg6a4jcl3cfp4wi9ssm7a0dlnclkc4rmf6sv4a";
  };

  phases = [
    "unpackPhase"
    "installPhase"
  ];

  installPhase = ''
    mkdir -p $out/bin

    ${lib.concatStrings
      (lib.mapAttrsToList
        (name: path: /* sh */ ''
          sed \
            's,^set -efu$,&\nPATH=${lib.makeBinPath path}; export PATH,' \
            < ./${name} \
            > $out/bin/${name}
          chmod +x $out/bin/${name}
        '')
        {
          crxid = [
            pkgs.bc
            pkgs.coreutils
            pkgs.file
            pkgs.gnused
            pkgs.openssl
            pkgs.xxd
          ];
          crxmake = [
            pkgs.coreutils
            pkgs.gnused
            pkgs.openssl
            pkgs.xxd
            pkgs.zip
          ];
        }
      )
    }
  '';
}