mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-04-14 04:03:20 +00:00
refactor how nim compiler is provided in nix
This commit is contained in:
parent
f76e50b081
commit
b1ae7a894f
@ -2,8 +2,6 @@
|
||||
|
||||
let
|
||||
deps = import ./deps.nix { inherit pkgs; };
|
||||
nimSrc = pkgs.callPackage ./nim.nix {};
|
||||
nimbleSrc = pkgs.callPackage ./nimble.nix {};
|
||||
|
||||
# nat_traversal is excluded from the static pathArgs; it is handled
|
||||
# separately in buildPhase (its bundled C libs must be compiled first).
|
||||
@ -62,8 +60,6 @@ pkgs.stdenv.mkDerivation {
|
||||
${pathArgs} \
|
||||
--path:$NAT_TRAV \
|
||||
--path:$NAT_TRAV/src \
|
||||
--lib:${nimSrc}/lib \
|
||||
--nimblePath:${nimbleSrc} \
|
||||
--passL:"-L${zerokitRln}/lib -lrln" \
|
||||
--define:disable_libbacktrace \
|
||||
--out:build/liblogosdelivery.${libExt} \
|
||||
@ -83,8 +79,6 @@ pkgs.stdenv.mkDerivation {
|
||||
${pathArgs} \
|
||||
--path:$NAT_TRAV \
|
||||
--path:$NAT_TRAV/src \
|
||||
--lib:${nimSrc}/lib \
|
||||
--nimblePath:${nimbleSrc} \
|
||||
--passL:"-L${zerokitRln}/lib -lrln" \
|
||||
--define:disable_libbacktrace \
|
||||
--out:build/liblogosdelivery.a \
|
||||
|
||||
19
nix/nim.nix
19
nix/nim.nix
@ -1,19 +0,0 @@
|
||||
# Fetches the Nim source tree at the exact revision declared in waku.nimble.
|
||||
# The compiler binary is still pkgs.nim-2_2 (pre-built); this source is
|
||||
# used to pin the stdlib to the same commit.
|
||||
# Regenerate sha256 with:
|
||||
# nix shell nixpkgs#nix-prefetch-git --command \
|
||||
# nix-prefetch-git --url https://github.com/nim-lang/Nim.git --rev v<version> --fetch-submodules
|
||||
{ pkgs }:
|
||||
let
|
||||
lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble);
|
||||
versionLine = builtins.head (builtins.filter
|
||||
(l: builtins.match "^const NimVersion.*" l != null) lines);
|
||||
version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine);
|
||||
in
|
||||
pkgs.fetchgit {
|
||||
url = "https://github.com/nim-lang/Nim.git";
|
||||
rev = "v${version}";
|
||||
sha256 = "1g4nxbwbc6h174gbpa3gcs47xwk6scbmiqlp0nq1ig3af8fcqcnj";
|
||||
fetchSubmodules = true;
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
# Fetches Nimble at the exact revision declared in waku.nimble.
|
||||
# Regenerate hash with:
|
||||
# nix store prefetch-file --hash-type sha256 --unpack \
|
||||
# https://github.com/nim-lang/nimble/archive/v<version>.tar.gz
|
||||
# or set hash = "" and let Nix report the correct value.
|
||||
{ pkgs }:
|
||||
let
|
||||
lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble);
|
||||
versionLine = builtins.head (builtins.filter
|
||||
(l: builtins.match "^const NimbleVersion.*" l != null) lines);
|
||||
version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine);
|
||||
in
|
||||
pkgs.fetchgit {
|
||||
url = "https://github.com/nim-lang/nimble";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-wgzFhModFkwB8st8F5vSkua7dITGGC2cjoDvgkRVZMs=";
|
||||
}
|
||||
@ -14,6 +14,7 @@ pkgs.mkShell {
|
||||
rustup
|
||||
rustc
|
||||
cmake
|
||||
nim-unwrapped-2_2
|
||||
nim-2_2
|
||||
nimble
|
||||
];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user