forked from docker/labs-ai-tools-for-devs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
100 lines (91 loc) · 3.15 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
98
99
100
{
description = "The Docker LSP";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# can't update graal right now - this is from Aug '23
flake-utils.url = "github:numtide/flake-utils";
clj-nix = {
# for debugging the nix packages
# url = "path:/Users/slim/slimslenderslacks/clj-nix";
url = "github:jlesquembre/clj-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, clj-nix, devshell, ...}@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [
devshell.overlays.default
(self: super: {
clj-nix = clj-nix.packages."${system}";
})
];
# don't treat pkgs as meaning nixpkgs - treat it as all packages!
pkgs = import nixpkgs {
inherit overlays system;
};
in
{
packages = rec {
clj = pkgs.clj-nix.mkCljBin {
name = "agent-graph";
projectSrc = ./.;
main-ns = "docker.main";
buildCommand = "clj -T:build uber";
jdkRunner = pkgs.jdk17_headless;
};
deps-cache = pkgs.clj-nix.mk-deps-cache {
lockfile = ./deps-lock.json;
};
graal = pkgs.clj-nix.mkGraalBin {
# lazy lookup of a derivation that will exist
cljDrv = self.packages."${system}".clj;
graalvmXmx = "-J-Xmx8g";
graalvm = pkgs.graalvm-ce;
extraNativeImageBuildArgs = [
"--native-image-info"
"--initialize-at-build-time"
"--enable-http"
"--enable-https"
];
};
custom-jdk = pkgs.clj-nix.customJdk {
cljDrv = clj;
jdkBase = pkgs.jdk17_headless;
# locales = "en";
javaOpts = [];
extraJdkModules = ["java.security.jgss" "java.security.sasl" "jdk.crypto.ec"];
};
entrypoint = pkgs.writeShellScriptBin "entrypoint" ''
export PATH=${pkgs.lib.makeBinPath [pkgs.curl]}
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
${custom-jdk}/bin/agent-graph "$@"
'';
default = pkgs.buildEnv {
name = "agent-graph-env";
paths = [ entrypoint ];
};
};
devShells.default = pkgs.devshell.mkShell {
name = "agent-graph-shell";
packages = with pkgs; [ babashka clojure skopeo ];
commands = [
{
name = "lock-clojure-deps";
help = "update deps-lock.json whenever deps.edn changes";
command = "nix run github:jlesquembre/clj-nix#deps-lock";
}
{
name = "start";
help = "start the lsp server using deps.edn";
command = "clojure -M:main";
}
];
};
});
}