|
18 | 18 |
|
19 | 19 | # Helper to provide system-specific attributes |
20 | 20 | forAllSystems = f: |
21 | | - lib.genAttrs (builtins.attrNames burritoExe) (system: let |
| 21 | + lib.genAttrs systems (system: let |
22 | 22 | pkgs = nixpkgs.legacyPackages.${system}; |
23 | 23 | beamPackages = pkgs.beam_minimal.packages.erlang_26; |
24 | | - beam = fetchTarball beams.${system}; |
25 | | - rawmusl = musls.${system}; |
26 | | - musl = lib.optionals nixpkgs.legacyPackages.${system}.stdenv.isLinux (builtins.fetchurl (nixpkgs.lib.attrsets.getAttrs ["url" "sha256"] musls.${system})); |
27 | 24 | otp = (pkgs.beam.packagesWith beamPackages.erlang).extend (final: prev: { |
28 | 25 | elixir_1_17 = prev.elixir_1_16.override { |
29 | 26 | rev = "e3b6a91b173f7e836401a6a75c3906c26bd7fd39"; |
|
39 | 36 | }); |
40 | 37 | elixir = otp.elixir; |
41 | 38 | in |
42 | | - f {inherit system pkgs beamPackages elixir beam rawmusl musl;}); |
43 | | - |
44 | | - burritoExe = { |
45 | | - "aarch64-darwin" = "darwin_arm64"; |
46 | | - "x86_64-darwin" = "darwin_amd64"; |
47 | | - "x86_64-linux" = "linux_amd64"; |
48 | | - "aarch64-linux" = "linux_arm64"; |
49 | | - }; |
50 | | - |
51 | | - beams = { |
52 | | - "aarch64-darwin" = { |
53 | | - url = "https://beam-machine-universal.b-cdn.net/OTP-26.2.1/macos/universal/otp_26.2.1_macos_universal_ssl_3.1.4.tar.gz?please-respect-my-bandwidth-costs=thank-you"; |
54 | | - sha256 = "0sdadkl80pixj9q3l71zxamh9zgmnmawsc4hpllgvx9r9hl30f40"; |
55 | | - }; |
56 | | - "x86_64-darwin" = { |
57 | | - url = "https://beam-machine-universal.b-cdn.net/OTP-26.2.1/macos/universal/otp_26.2.1_macos_universal_ssl_3.1.4.tar.gz?please-respect-my-bandwidth-costs=thank-you"; |
58 | | - sha256 = "0sdadkl80pixj9q3l71zxamh9zgmnmawsc4hpllgvx9r9hl30f40"; |
59 | | - }; |
60 | | - "x86_64-linux" = { |
61 | | - url = "https://beam-machine-universal.b-cdn.net/OTP-26.2.1/linux/x86_64/any/otp_26.2.1_linux_any_x86_64_ssl_3.1.4.tar.gz?please-respect-my-bandwidth-costs=thank-you"; |
62 | | - sha256 = "11z50xrmngsn0bzg7vn7w5h76iwmhscx01vij9ir2ivybjc8niky"; |
63 | | - }; |
64 | | - "aarch64-linux" = { |
65 | | - url = "https://beam-machine-universal.b-cdn.net/OTP-26.2.1/linux/aarch64/any/otp_26.2.1_linux_any_aarch64_ssl_3.1.4.tar.gz?please-respect-my-bandwidth-costs=thank-you"; |
66 | | - sha256 = "0ich3xkhbb3sb82m7sncg0pr1d3z92klpwrlh8csr8i1qjhg40h5"; |
67 | | - }; |
68 | | - }; |
69 | | - |
70 | | - musls = { |
71 | | - "x86_64-linux" = { |
72 | | - url = "https://beam-machine-universal.b-cdn.net/musl/libc-musl-17613ec13d9aa9e5e907e6750785c5bbed3ad49472ec12281f592e2f0f2d3dbd.so?please-respect-my-bandwidth-costs=thank-you"; |
73 | | - sha256 = "1g9x5l7jybjr3wl15v3jjka3mvdvqn2hfxg60zlybacs7p0kwq8p"; |
74 | | - file = "libc-musl-17613ec13d9aa9e5e907e6750785c5bbed3ad49472ec12281f592e2f0f2d3dbd.so"; |
75 | | - }; |
76 | | - "aarch64-linux" = { |
77 | | - url = "https://beam-machine-universal.b-cdn.net/musl/libc-musl-939d11dcd3b174a8dee05047f2ae794c5c43af54720c352fa946cd8b0114627a.so?please-respect-my-bandwidth-costs=thank-you"; |
78 | | - sha256 = "0yk22h0qpka6m4pka33jajpl6p2cg6pg4ishw3gahx5isgf137ck"; |
79 | | - file = "libc-musl-939d11dcd3b174a8dee05047f2ae794c5c43af54720c352fa946cd8b0114627a.so"; |
80 | | - }; |
81 | | - }; |
| 39 | + f {inherit system pkgs beamPackages elixir;}); |
| 40 | + |
| 41 | + systems = [ |
| 42 | + "aarch64-darwin" |
| 43 | + "x86_64-darwin" |
| 44 | + "x86_64-linux" |
| 45 | + "aarch64-linux" |
| 46 | + ]; |
82 | 47 | in { |
83 | 48 | packages = forAllSystems ({ |
84 | 49 | pkgs, |
85 | 50 | system, |
86 | 51 | beamPackages, |
87 | | - beam, |
88 | | - musl, |
89 | | - rawmusl, |
90 | 52 | elixir, |
91 | | - }: let |
92 | | - aliased_7zz = pkgs.symlinkJoin { |
93 | | - name = "7zz-aliased"; |
94 | | - paths = [pkgs._7zz]; |
95 | | - postBuild = '' |
96 | | - ln -s ${pkgs._7zz}/bin/7zz $out/bin/7z |
97 | | - ''; |
98 | | - }; |
99 | | - in { |
| 53 | + }: { |
100 | 54 | default = lib.makeOverridable ({ |
101 | 55 | localBuild, |
102 | 56 | beamPackages, |
|
106 | 60 | pname = "next-ls"; |
107 | 61 | src = self.outPath; |
108 | 62 | mixEnv = "prod"; |
| 63 | + removeCookie = false; |
109 | 64 | inherit version elixir; |
110 | 65 | inherit (beamPackages) erlang; |
111 | 66 |
|
112 | | - nativeBuildInputs = [pkgs.xz pkgs.zig_0_11 aliased_7zz beam]; |
113 | | - |
114 | 67 | mixFodDeps = beamPackages.fetchMixDeps { |
115 | 68 | src = self.outPath; |
116 | 69 | inherit version elixir; |
|
119 | 72 | mixEnv = "prod"; |
120 | 73 | }; |
121 | 74 |
|
122 | | - BURRITO_ERTS_PATH = "/tmp/beam/"; |
123 | | - BURRITO_TARGET = lib.optional localBuild burritoExe.${system}; |
124 | | - |
125 | | - preBuild = |
126 | | - '' |
127 | | - export HOME="$TEMPDIR" |
128 | | - mkdir -p /tmp/beam/otp |
129 | | - cp -r --no-preserve=ownership,timestamps ${beam}/. /tmp/beam/otp |
130 | | - '' |
131 | | - + ( |
132 | | - if (pkgs.stdenv.isLinux) |
133 | | - then '' |
134 | | - cp --no-preserve=ownership,timestamps ${musl} /tmp/${rawmusl.file} |
135 | | - chmod +x /tmp/${rawmusl.file} |
136 | | - '' |
137 | | - else "" |
138 | | - ); |
139 | | - |
140 | | - postInstall = '' |
141 | | - chmod +x ./burrito_out/* |
142 | | - cp -r ./burrito_out "$out" |
143 | | - rm -rf "$out/bin" |
144 | | - mv "$out/burrito_out" "$out/bin" |
145 | | - mv "$out/bin/next_ls_${burritoExe.${system}}" "$out/bin/nextls" |
| 75 | + installPhase = '' |
| 76 | + mix release --no-deps-check --path $out plain |
| 77 | + echo "$out/bin/plain eval \"System.no_halt(true); Application.ensure_all_started(:next_ls)\" \"\$@\"" > "$out/bin/nextls" |
| 78 | + chmod +x "$out/bin/nextls" |
146 | 79 | ''; |
147 | 80 |
|
148 | 81 | meta = with lib; { |
|
155 | 88 | inherit beamPackages elixir; |
156 | 89 | localBuild = true; |
157 | 90 | }; |
158 | | - |
159 | | - ci = self.packages.${system}.default.override {localBuild = false;}; |
160 | 91 | }); |
161 | 92 |
|
162 | 93 | devShells = forAllSystems ({ |
|
0 commit comments