forked from just-defi/just-link
-
Notifications
You must be signed in to change notification settings - Fork 25
/
flake.nix
91 lines (88 loc) · 2.75 KB
/
flake.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: CC0-1.0
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
devshell = {
url = "github:numtide/devshell";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
npmlock2nix = {
url = "github:nix-community/npmlock2nix";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, devshell, npmlock2nix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlay
(final: prev: {
npmlock2nix = import npmlock2nix { pkgs = prev; };
})
];
config.allowUnfree = true;
};
in {
packages = {
default = pkgs.callPackage ./default.nix { };
front-end = pkgs.npmlock2nix.build {
src = ./node/webapp;
installPhase = "cp -r ../src/main/resources/static $out";
buildCommands = [ "npm run build" ];
node_modules_attrs = { nativeBuildInputs = [ pkgs.python2 ]; };
};
};
devShell = pkgs.devshell.mkShell {
env = [
{
name = "JAVA_HOME";
value = "${pkgs.openjdk8}";
}
{
name = "NIX_LD_LIBRARY_PATH";
value = pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
}
{
name = "NIX_LD";
value = builtins.readFile
"${pkgs.stdenv.cc}/nix-support/dynamic-linker";
}
];
commands = [
{
category = "Programming language support";
package = pkgs.openjdk8;
help = ''
1. use gradle assemble to install dependency first
2. use gradle build -x test for dev build
3. go to node/build/lib to find jars
'';
}
{
category = "Java package manager";
package = pkgs.gradle.override { java = pkgs.openjdk8; };
name = "gradle";
help = ''
1. use gradle assemble to install dependency first
2. use gradle build -x test for dev build
3. go to node/build/lib to find jars
'';
}
{
category = "Java package manager";
package = pkgs.nodejs-14_x;
name = "nodejs";
}
{ package = pkgs.python2; }
];
};
});
}