summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/github-hosts-sync/default.nix
blob: 60dd58ee7224aa0ddd4a47549602cf883c0cea2c (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
{ lib, pkgs, stdenv }:

stdenv.mkDerivation rec {
  name = "github-hosts-sync-${version}";
  version = "2.0.0";

  src = ./src;

  phases = [
    "unpackPhase"
    "installPhase"
  ];

  installPhase = let
    ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
    path = lib.makeBinPath [
      pkgs.git
      pkgs.nettools
      pkgs.openssh
      pkgs.rsync
    ];
  in
    ''
      mkdir -p $out/bin

      cp hosts-sync $out/bin/github-hosts-sync

      sed -i \
        '1s,$,\nPATH=${path}''${PATH+:$PATH} GIT_SSL_CAINFO=${ca-bundle},' \
        $out/bin/github-hosts-sync
    '';
}