forked from adnelson/nixfromnpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.nix
48 lines (46 loc) · 1.85 KB
/
project.nix
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
{ mkDerivation, aeson, base, bytestring, classy-prelude, containers
, data-default, directory, unix, hnix, hspec, hspec-expectations
, MissingH, mtl, network-uri, parsec, shelly, stdenv
, system-filepath, text, text-render, unordered-containers
, optparse-applicative, curl, cabal-install, ansi-terminal
, temporary, SHA, pkgs, lifted-base, transformers, semver-range
, pcre-heavy
}:
let
inherit (builtins) filterSource;
inherit (pkgs.lib) any flip elem hasSuffix hasPrefix;
# We'll typically have a lot of files in this directory; we only want
# to take a few of them though.
filesToExclude = ["node_modules" "shell.nix" "project.nix" "dist" "scripts"];
suffixesToExclude = ["-test"];
filter = baseName: (!elem baseName filesToExclude) &&
(!hasPrefix "." baseName) &&
(!any (flip hasSuffix baseName) suffixesToExclude);
src = filterSource (path: _: filter (baseNameOf path)) ./.;
in
mkDerivation {
inherit src;
pname = "nixfromnpm";
version = "0.12.4";
isExecutable = true;
buildDepends = [
aeson base bytestring classy-prelude containers data-default
directory hnix MissingH mtl network-uri parsec shelly
system-filepath text text-render unordered-containers
optparse-applicative cabal-install curl SHA temporary lifted-base
transformers ansi-terminal semver-range pcre-heavy
];
executableHaskellDepends = with pkgs; [nix cacert silver-searcher];
testDepends = [
aeson base bytestring classy-prelude containers data-default
directory hnix hspec hspec-expectations
MissingH mtl network-uri parsec
shelly system-filepath text text-render unordered-containers
];
shellHook = ''
export SRC=${src}
export CURL_CA_BUNDLE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
'';
description = "Generate nix expressions from npm packages";
license = stdenv.lib.licenses.mit;
}