summaryrefslogtreecommitdiffstats
path: root/default.nix
blob: 835144355728b5a64f5476ecba693e1fc07342d5 (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
{ pkgs ? (import <nixpkgs> {}) }:

let
  filterSource = builtins.filterSource
    (p: t: pkgs.lib.cleanSourceFilter p t && baseNameOf p != "build");
in
pkgs.stdenv.mkDerivation {
  name = "getif";
  src = filterSource ./.;

  nativeBuildInputs = with pkgs; [ cmake pkg-config ];
  buildInputs = with pkgs; [ docopt_cpp fmt_7 ];

  buildPhase = ''
    mkdir build
    cmake ..
    make
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp src/getif $out/bin/
  '';
}