-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdefault.nix
More file actions
36 lines (31 loc) · 943 Bytes
/
default.nix
File metadata and controls
36 lines (31 loc) · 943 Bytes
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
let
pkgs =
import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/5ef6c425980847c78a80d759abc476e941a9bf42.tar.gz") {
};
fs = pkgs.lib.fileset;
in
with pkgs;
builtins.outputOf
(stdenvNoCC.mkDerivation {
name = "result.drv";
outputHashMode = "text";
outputHashAlgo = "sha256";
requiredSystemFeatures = ["recursive-nix"];
src = fs.toSource {
root = ./.;
fileset = fs.unions [
(fs.fromSource (lib.sources.sourceByRegex ./src [ ".*\.c$" ]))
(fs.fromSource (lib.sources.sourceByRegex ./src [ ".*\.h$" ]))
./parser
./Makefile
];
};
buildInputs = [nix go gcc];
buildPhase = ''
make deps
go run parser/parser.go > derivation.nix
'';
installPhase = ''
cp $(nix-instantiate derivation.nix --arg pkgs 'import ${pkgs.path} {}') $out
'';
}).outPath "out"