init
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
{
|
||||
description = "bore - QUIC tunnel service";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
nixpkgs,
|
||||
crane,
|
||||
flake-utils,
|
||||
rust-overlay,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
];
|
||||
};
|
||||
|
||||
inherit (pkgs) lib;
|
||||
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain (
|
||||
p:
|
||||
p.rust-bin.nightly.latest.default.override {
|
||||
extensions = [
|
||||
"rustc-codegen-cranelift-preview"
|
||||
"rust-analyzer"
|
||||
"rust-src"
|
||||
];
|
||||
}
|
||||
);
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
src = craneLib.cleanCargoSource ./.;
|
||||
commonArgs = {
|
||||
inherit src;
|
||||
strictDeps = true;
|
||||
};
|
||||
bore = craneLib.buildPackage (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
}
|
||||
);
|
||||
bore-server = pkgs.stdenv.mkDerivation {
|
||||
name = "bore-server";
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${bore}/bin/bore-server $out/bin/bore-server
|
||||
'';
|
||||
meta = {
|
||||
description = "bore server binary";
|
||||
mainProgram = "bore-server";
|
||||
};
|
||||
};
|
||||
bore-client = pkgs.stdenv.mkDerivation {
|
||||
name = "bore-client";
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${bore}/bin/bore-client $out/bin/bore-client
|
||||
'';
|
||||
meta = {
|
||||
description = "bore client binary";
|
||||
mainProgram = "bore-client";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = bore-client;
|
||||
inherit bore-client bore-server;
|
||||
};
|
||||
|
||||
devShells.default = craneLib.devShell {
|
||||
RUSTFLAGS = "-Clinker=clang -Clink-arg=-fuse-ld=mold -Z macro-backtrace";
|
||||
RUST_LOG = "debug";
|
||||
packages = with pkgs; [
|
||||
mold
|
||||
llvmPackages.clang
|
||||
llvmPackages.lld
|
||||
watchexec
|
||||
cargo-edit
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user