-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
97 lines (94 loc) · 2.62 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
92
93
94
95
96
97
{
description = "leJOS, Java for LEGO Mindstorms";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
};
outputs =
{
self,
nixpkgs,
systems,
...
}@inputs:
let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system});
in
{
packages = eachSystem (
system:
let
pkgs = pkgsFor.${system};
jdk = pkgs.jdk8;
in
builtins.mapAttrs (name: value: pkgs.callPackage ./packages/${name} value) {
lejos-nxj = {
inherit jdk;
};
}
);
devShells = eachSystem (
system:
let
pkgs = pkgsFor.${system};
in
(lib.attrsets.mergeAttrsList (
builtins.map (
name:
let
lejos = self.packages.${system}.${name};
utils = builtins.readFile ./packages/${name}/utils.sh;
in
{
${name} = pkgs.mkShell {
name = "${name}-shell";
buildInputs =
with pkgs;
[
jre
]
++ [ lejos ];
shellHook = utils;
};
"${name}-jdt" =
let
pom = ''
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>${name}-project</groupId>
<artifactId>${name}-project</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>${name}</groupId>
<artifactId>${name}</artifactId>
<scope>system</scope>
<version>1</version>
<systemPath>${lejos}/lib/nxt/classes.jar</systemPath>
</dependency>
</dependencies>
</project>'';
in
pkgs.mkShell {
name = "${name}-jdt-shell";
buildInputs =
with pkgs;
[
jre
jdt-language-server
]
++ [ lejos ];
shellHook = ''
cat <<EOF > pom.sample.xml
${pom}
EOF
${utils}
'';
};
}
) [ "lejos-nxj" ]
))
);
};
}