blockstream-electrs/flake.nix
2023-08-12 05:52:06 -04:00

63 lines
1.9 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
productVersion = "0.4.1";
productName = "blockstream-electrs";
myModule = import ./module.nix { inherit nixpkgs; };
in
flake-utils.lib.eachDefaultSystem (system:
with nixpkgs.legacyPackages.${system}; {
nixosModules = {
# add moduleA from flakeA as an output
# moduleA = flakeA.nixosModules.moduleA;
default = myModule;
};
packages.${productName} = rustPlatform.buildRustPackage {
name = "${productName}";
version = "${productVersion}";
src = lib.cleanSource ./.;
cargoSha256 = "sha256-d84QNj9SIRUwtlsa9sdYKuYf0oCptdGm7pDs3eGTcBg=";
preConfigure = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
'';
nativeBuildInputs = [ cargo clang cmake ];
};
defaultPackage = self.packages.${system}.${productName};
devShell = mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
shellHook = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
'';
# LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
# I'm never quite sure which one to use, but in this case neither
# result in a proper dev shell
buildInputs = [ cargo ];
nativeBuildInputs = [ cargo clang ];
};
modules = [
# Include the module in the system configuration
myModule
];
# nixosModules.${productName} = ./module.nix;
# nixosModules.default = nixosModules.${productName};
# nixosModules.default = { config, pkgs, lib, ... }: {
# imports = [ ./module.nix ];
# };
});
}