|
38 | 38 | overlays = [ |
39 | 39 | self.overlays.default |
40 | 40 | emacs-overlay.overlay |
41 | | - rust-overlay.overlay |
| 41 | + (import rust-overlay) |
42 | 42 | devshell.overlay |
43 | 43 | ]; |
44 | 44 | config = {}; |
|
92 | 92 | { |
93 | 93 | inherit |
94 | 94 | (pkgs) |
95 | | - emacsng-rust |
96 | 95 | emacsng |
97 | 96 | ; |
98 | 97 | default = pkgs.emacsng; |
|
111 | 110 | emacsng-source = emacsng-sources.emacsng.src; |
112 | 111 | locked-date = prev.lib.removePrefix "nightly-" (prev.lib.removeSuffix "\n" (builtins.readFile ./rust-toolchain)); |
113 | 112 | in { |
114 | | - emacsng-rust = with final; ( |
115 | | - let |
116 | | - installPhase = '' |
117 | | - tar --owner=0 --group=0 --numeric-owner --format=gnu \ |
118 | | - --sort=name --mtime="@$SOURCE_DATE_EPOCH" \ |
119 | | - -czf $out $name-versioned |
120 | | - ''; |
121 | | - doVersionedUpdate = '' |
122 | | - cargo vendor --versioned-dirs $name-versioned |
123 | | - ''; |
124 | | - |
125 | | - emacsngLibDeps = prev.rustPlatform.fetchCargoTarball { |
126 | | - src = emacsng-source + "/rust_src/remacs-lib"; |
127 | | - name = "emacsngLibDeps"; |
128 | | - cargoUpdateHook = let |
129 | | - pathDir = emacsng-source + "/rust_src/crates"; |
130 | | - in |
131 | | - '' |
132 | | - cp -r ${pathDir} crates |
133 | | - sed -i 's|../crates/lisp_util|./crates/lisp_util|' Cargo.toml |
134 | | - '' |
135 | | - + doVersionedUpdate; |
136 | | - sha256 = "sha256-ITFwTAKZoTkGBquxxay20r/H5638ndKpIcvQra2t4cg="; |
137 | | - inherit installPhase; |
138 | | - }; |
139 | | - |
140 | | - ngBindgen = prev.rustPlatform.fetchCargoTarball { |
141 | | - src = emacsng-source + "/rust_src/ng-bindgen"; |
142 | | - sourceRoot = null; |
143 | | - cargoUpdateHook = doVersionedUpdate; |
144 | | - name = "ngBindgen"; |
145 | | - sha256 = "sha256-MsMfcZ/Oni5dsOeuA37bSYscQLTZOJe5D4dB8KAgc5s="; |
146 | | - inherit installPhase; |
147 | | - }; |
148 | | - |
149 | | - emacsngSrc = prev.rustPlatform.fetchCargoTarball { |
150 | | - src = emacsng-source; |
151 | | - cargoUpdateHook = |
152 | | - '' |
153 | | - sed -e 's/@CARGO_.*@//' Cargo.in > Cargo.toml |
154 | | - sed -e 's/@WEBRENDER_.*@//' rust_src/crates/webrender/Cargo.in > rust_src/crates/webrender/Cargo.toml |
155 | | - '' |
156 | | - + doVersionedUpdate; |
157 | | - name = "emacsngSrc"; |
158 | | - sha256 = "sha256-nlzELzshSJWmSaWt5tewSbklnqnvdfWJeWfkdjCX1mo="; |
159 | | - inherit installPhase; |
160 | | - }; |
161 | | - |
162 | | - in |
163 | | - stdenv.mkDerivation { |
164 | | - name = "emacsng-rust"; |
165 | | - srcs = [ |
166 | | - emacsngLibDeps |
167 | | - ngBindgen |
168 | | - emacsngSrc |
169 | | - ]; |
170 | | - sourceRoot = "."; |
171 | | - phases = ["unpackPhase" "installPhase"]; |
172 | | - installPhase = '' |
173 | | - mkdir -p $out/.cargo/registry |
174 | | - cat > $out/.cargo/config.toml << EOF |
175 | | - [source.crates-io] |
176 | | - registry = "https://github.com/rust-lang/crates.io-index" |
177 | | - replace-with = "vendored-sources" |
178 | | - [source.vendored-sources] |
179 | | - directory = "$out/.cargo/registry" |
180 | | - EOF |
181 | | - cp -R emacsngLibDeps-vendor.tar.gz-versioned/* $out/.cargo/registry |
182 | | - cp -R ngBindgen-vendor.tar.gz-versioned/* $out/.cargo/registry |
183 | | - cp -R emacsngSrc-vendor.tar.gz-versioned/* $out/.cargo/registry |
184 | | - ''; |
185 | | - } |
186 | | - ); |
187 | | - |
188 | | - librusty_v8 = prev.callPackage ./nix/librusty_v8.nix {}; |
189 | | - |
190 | 113 | emacsng = with prev; let |
191 | 114 | withWebrender = true; |
192 | 115 | in |
193 | 116 | ( |
194 | | - final.emacsGcc.override |
| 117 | + final.emacsGit.override |
195 | 118 | { |
196 | 119 | withImageMagick = true; |
197 | 120 | inherit (prev) imagemagick; |
|
218 | 141 | name = "emacsng-" + version; |
219 | 142 | src = emacsng-source; |
220 | 143 | version = builtins.substring 0 7 emacsng-source.rev; |
| 144 | + # https://github.com/NixOS/nixpkgs/blob/22.11/pkgs/applications/networking/browsers/firefox/common.nix#L574 |
| 145 | + # Firefox use this. |
| 146 | + # guix has cargo-utils to fix checksum, won't be useful on nix though |
| 147 | + # https://github.com/ctrlcctrlv/revendor.guile |
| 148 | + dontFixLibtool = true; |
221 | 149 |
|
222 | 150 | preConfigure = |
223 | 151 | (old.preConfigure or "") |
|
236 | 164 | makeFlags = |
237 | 165 | (old.makeFlags or []) |
238 | 166 | ++ [ |
239 | | - "CARGO_FLAGS=--offline" #nightly channel |
| 167 | + # "CARGO_FLAGS=--offline" #nightly channel |
240 | 168 | ]; |
241 | 169 |
|
242 | 170 | #custom configure Flags Setting |
|
272 | 200 | "--with-dbus" |
273 | 201 | ]; |
274 | 202 |
|
275 | | - preBuild = let |
276 | | - arch = rust.toRustTarget stdenv.hostPlatform; |
277 | | - in |
278 | | - (old.preBuild or "") |
279 | | - + '' |
280 | | - _librusty_v8_setup() { |
281 | | - for v in "$@"; do |
282 | | - install -D ${final.librusty_v8} "target/$v/gn_out/obj/librusty_v8.a" |
283 | | - done |
284 | | - } |
285 | | - _librusty_v8_setup "debug" "release" "${arch}/release" |
286 | | - sed -i 's|deno = { git = "https://github.com/emacs-ng/deno", branch = "emacs-ng"|deno = { version = "1.9.2"|' rust_src/crates/js/Cargo.toml |
287 | | - sed -i 's|deno_runtime = { git = "https://github.com/emacs-ng/deno", branch = "emacs-ng"|deno_runtime = { version = "0.13.0"|' rust_src/crates/js/Cargo.toml |
288 | | - sed -i 's|deno_core = { git = "https://github.com/emacs-ng/deno", branch = "emacs-ng"|deno_core = { version = "0.86.0"|' rust_src/crates/js/Cargo.toml |
289 | | -
|
290 | | - sed -i 's|git = "https://github.com/servo/webrender.git", rev = ".*."|version = "0.61.0"|' rust_src/crates/webrender/Cargo.toml |
291 | | - export HOME=${final.emacsng-rust} |
292 | | - ''; |
293 | | - |
294 | 203 | postPatch = |
295 | 204 | (old.postPatch or "") |
296 | 205 | + '' |
|
0 commit comments