-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
53 lines (49 loc) · 1.4 KB
/
default.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
49
50
51
52
53
let
pkgs = let
hostPkgs = import <nixpkgs> {};
pinnedVersion = hostPkgs.lib.importJSON ./nixpkgs-version.json;
pinnedPkgs = hostPkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
inherit (pinnedVersion) rev sha256;
};
in import pinnedPkgs {};
dependencies = import (import ./nodeDependencies.nix { pkgs = pkgs;
srcPath = ./.;
}) {};
kamo =
pkgs.stdenv.mkDerivation {
name = "kamo";
buildInputs = [
pkgs.nodejs-14_x
pkgs.nodePackages.webpack
pkgs.nodePackages.webpack-cli
];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
src = [
(pkgs.lib.sourceFilesBySuffices ./source [ ".js" ".ts" ".tsx" ".css" ".pug" ])
(builtins.path { path = ./.eslintrc.js; name = "eslintrc"; })
./migrations
./package.json
./package-lock.json
./tsconfig.json
./webpack.config.js
];
unpackPhase = ''
for srcFile in $src; do
cp -r $srcFile $(stripHash $srcFile)
done
cp -r ${dependencies.nodeDependencies}/lib/node_modules .
'';
buildPhase = ''
${pkgs.nodejs}/bin/npx webpack
'';
installPhase = ''
cp -r dist $out/
'';
};
in
{
nodejs = pkgs.nodejs-14_x;
kamo = kamo;
}