Skip to content

Commit

Permalink
Merge pull request fedimint#4347 from dpc/24-02-16-export-overlays
Browse files Browse the repository at this point in the history
refactor(flake): export our overlays
  • Loading branch information
justinmoon authored Feb 16, 2024
2 parents 86c532f + c1138ae commit d183dbd
Showing 1 changed file with 91 additions and 85 deletions.
176 changes: 91 additions & 85 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,95 +15,101 @@
};

outputs = { self, nixpkgs, flake-utils, flakebox, advisory-db }:
let
overlays = [
(final: prev: {

wasm-bindgen-cli = final.rustPlatform.buildRustPackage rec {
pname = "wasm-bindgen-cli";
version = "0.2.89";
hash = "sha256-IPxP68xtNSpwJjV2yNMeepAS0anzGl02hYlSTvPocz8=";
cargoHash = "sha256-pBeQaG6i65uJrJptZQLuIaCb/WCQMhba1Z1OhYqA8Zc=";

src = final.fetchCrate {
inherit pname version hash;
};

nativeBuildInputs = [ final.pkg-config ];

buildInputs = [ final.openssl ] ++ final.lib.optionals final.stdenv.isDarwin [
final.curl
final.darwin.apple_sdk.frameworks.Security
];

nativeCheckInputs = [ final.nodejs ];

# tests require it to be ran in the wasm-bindgen monorepo
doCheck = false;
};

rocksdb_7_10 = prev.rocksdb_7_10.overrideAttrs (oldAttrs:
final.lib.optionalAttrs final.stdenv.isDarwin {
# C++ and its damn super-fragie compilation
env = oldAttrs.env // {
NIX_CFLAGS_COMPILE = oldAttrs.env.NIX_CFLAGS_COMPILE + " -Wno-error=unused-but-set-variable";
};
});

rocksdb_6_23 = prev.rocksdb_6_23.overrideAttrs (oldAttrs:
final.lib.optionalAttrs final.stdenv.isDarwin {
# C++ and its damn super-fragie compilation
env = oldAttrs.env // {
NIX_CFLAGS_COMPILE = oldAttrs.env.NIX_CFLAGS_COMPILE + " -Wno-error=unused-but-set-variable -Wno-error=deprecated-copy";
};
});

esplora-electrs = prev.callPackage ./nix/esplora-electrs.nix {
inherit (prev.darwin.apple_sdk.frameworks) Security;
};

bitcoind = prev.bitcoind.overrideAttrs (oldAttrs: {
# tests broken on Mac for some reason
doCheck = !prev.stdenv.isDarwin;
});

# syncing channels doesn't work right on newer versions, exactly like described here
# https://bitcoin.stackexchange.com/questions/84765/how-can-channel-policy-be-missing
# note that config-time `--enable-developer` turns into run-time `--developer` at some
# point
clightning = prev.clightning.overrideAttrs (oldAttrs: rec {
version = "23.05.2";
src = prev.fetchurl {
url = "https://github.com/ElementsProject/lightning/releases/download/v${version}/clightning-v${version}.zip";
sha256 = "sha256-Tj5ybVaxpk5wmOw85LkeU4pgM9NYl6SnmDG2gyXrTHw=";
};
makeFlags = [ "VERSION=v${version}" ];
configureFlags = [ "--enable-developer" "--disable-valgrind" ];
NIX_CFLAGS_COMPILE = "-w";
});

# Note: shell script adding DYLD_FALLBACK_LIBRARY_PATH because of: https://github.com/nextest-rs/nextest/issues/962
cargo-nextest = final.writeShellScriptBin "cargo-nextest" "exec env DYLD_FALLBACK_LIBRARY_PATH=\"$(dirname $(${final.which}/bin/which rustc))/../lib\" ${prev.cargo-nextest}/bin/cargo-nextest \"$@\"";

cargo-llvm-cov = prev.rustPlatform.buildRustPackage rec {
pname = "cargo-llvm-cov";
version = "0.5.31";
buildInputs = [ ];

src = final.fetchCrate {
inherit pname version;
sha256 = "sha256-HjnP9H1t660PJ5eXzgAhrdDEgqdzzb+9Dbk5RGUPjaQ=";
};
doCheck = false;
cargoHash = "sha256-p6zpRRNX4g+jESNSwouWMjZlFhTBFJhe7LirYtFrZ1g=";
};
})
];
in
{
overlays = {
fedimint = overlays;
};
} //
flake-utils.lib.eachDefaultSystem
(system:
let

pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {

wasm-bindgen-cli = final.rustPlatform.buildRustPackage rec {
pname = "wasm-bindgen-cli";
version = "0.2.89";
hash = "sha256-IPxP68xtNSpwJjV2yNMeepAS0anzGl02hYlSTvPocz8=";
cargoHash = "sha256-pBeQaG6i65uJrJptZQLuIaCb/WCQMhba1Z1OhYqA8Zc=";

src = final.fetchCrate {
inherit pname version hash;
};

nativeBuildInputs = [ final.pkg-config ];

buildInputs = [ final.openssl ] ++ lib.optionals stdenv.isDarwin [
final.curl
final.darwin.apple_sdk.frameworks.Security
];

nativeCheckInputs = [ final.nodejs ];

# tests require it to be ran in the wasm-bindgen monorepo
doCheck = false;
};

rocksdb_7_10 = prev.rocksdb_7_10.overrideAttrs (oldAttrs:
pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
# C++ and its damn super-fragie compilation
env = oldAttrs.env // {
NIX_CFLAGS_COMPILE = oldAttrs.env.NIX_CFLAGS_COMPILE + " -Wno-error=unused-but-set-variable";
};
});

rocksdb_6_23 = prev.rocksdb_6_23.overrideAttrs (oldAttrs:
pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
# C++ and its damn super-fragie compilation
env = oldAttrs.env // {
NIX_CFLAGS_COMPILE = oldAttrs.env.NIX_CFLAGS_COMPILE + " -Wno-error=unused-but-set-variable -Wno-error=deprecated-copy";
};
});

esplora-electrs = prev.callPackage ./nix/esplora-electrs.nix {
inherit (prev.darwin.apple_sdk.frameworks) Security;
};

bitcoind = prev.bitcoind.overrideAttrs (oldAttrs: {
# tests broken on Mac for some reason
doCheck = !prev.stdenv.isDarwin;
});

# syncing channels doesn't work right on newer versions, exactly like described here
# https://bitcoin.stackexchange.com/questions/84765/how-can-channel-policy-be-missing
# note that config-time `--enable-developer` turns into run-time `--developer` at some
# point
clightning = prev.clightning.overrideAttrs (oldAttrs: rec {
version = "23.05.2";
src = prev.fetchurl {
url = "https://github.com/ElementsProject/lightning/releases/download/v${version}/clightning-v${version}.zip";
sha256 = "sha256-Tj5ybVaxpk5wmOw85LkeU4pgM9NYl6SnmDG2gyXrTHw=";
};
makeFlags = [ "VERSION=v${version}" ];
configureFlags = [ "--enable-developer" "--disable-valgrind" ];
NIX_CFLAGS_COMPILE = "-w";
});

# Note: shell script adding DYLD_FALLBACK_LIBRARY_PATH because of: https://github.com/nextest-rs/nextest/issues/962
cargo-nextest = pkgs.writeShellScriptBin "cargo-nextest" "exec env DYLD_FALLBACK_LIBRARY_PATH=\"$(dirname $(${pkgs.which}/bin/which rustc))/../lib\" ${prev.cargo-nextest}/bin/cargo-nextest \"$@\"";

cargo-llvm-cov = prev.rustPlatform.buildRustPackage rec {
pname = "cargo-llvm-cov";
version = "0.5.31";
buildInputs = [ ];

src = pkgs.fetchCrate {
inherit pname version;
sha256 = "sha256-HjnP9H1t660PJ5eXzgAhrdDEgqdzzb+9Dbk5RGUPjaQ=";
};
doCheck = false;
cargoHash = "sha256-p6zpRRNX4g+jESNSwouWMjZlFhTBFJhe7LirYtFrZ1g=";
};
})
];
inherit system overlays;
};

lib = pkgs.lib;
Expand Down

0 comments on commit d183dbd

Please sign in to comment.