mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-06-06 07:41:41 +00:00
102 lines
2.4 KiB
Nix
102 lines
2.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
crane.url = "github:ipetkov/crane";
|
|
crane.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
|
|
|
nix-filter.url = "github:numtide/nix-filter";
|
|
};
|
|
|
|
outputs =
|
|
{ self
|
|
, crane
|
|
, flake-utils
|
|
, nix-filter
|
|
, ...
|
|
}@inputs:
|
|
{
|
|
overlays.default = final: prev: {
|
|
mycelium =
|
|
let
|
|
craneLib = crane.lib.${final.system};
|
|
|
|
inherit (final) lib stdenv darwin;
|
|
|
|
manifest = builtins.fromTOML (lib.readFile ./mycelium/Cargo.toml);
|
|
in
|
|
lib.makeOverridable craneLib.buildPackage {
|
|
src = nix-filter {
|
|
root = ./.;
|
|
|
|
# If no include is passed, it will include all the paths.
|
|
include = [
|
|
./Cargo.toml
|
|
./Cargo.lock
|
|
./mycelium
|
|
./myceliumd
|
|
./mobile
|
|
];
|
|
};
|
|
pname = manifest.package.name;
|
|
inherit (manifest.package) version;
|
|
|
|
doCheck = false;
|
|
|
|
cargoExtraArgs = "--bin mycelium";
|
|
|
|
nativeBuildInputs = [
|
|
final.pkg-config
|
|
# openssl base library
|
|
final.openssl
|
|
# required by openssl-sys
|
|
final.perl
|
|
];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
final.libiconv
|
|
];
|
|
|
|
meta = {
|
|
mainProgram = "mycelium";
|
|
};
|
|
};
|
|
};
|
|
} //
|
|
flake-utils.lib.eachSystem
|
|
[
|
|
flake-utils.lib.system.x86_64-linux
|
|
flake-utils.lib.system.aarch64-linux
|
|
flake-utils.lib.system.x86_64-darwin
|
|
flake-utils.lib.system.aarch64-darwin
|
|
]
|
|
(system:
|
|
let
|
|
craneLib = crane.lib.${system};
|
|
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [ self.overlays.default ];
|
|
};
|
|
in
|
|
{
|
|
devShells.default = craneLib.devShell {
|
|
packages = [
|
|
pkgs.rust-analyzer
|
|
];
|
|
|
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
|
};
|
|
|
|
packages = {
|
|
default = self.packages.${system}.mycelium;
|
|
|
|
inherit (pkgs) mycelium;
|
|
};
|
|
});
|
|
}
|