Skip to content

feat: add nix packages and dev shell #3316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/result
iroh.config.toml
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"iroh-relay",
]
resolver = "2"
package.version = "0.35.0"

[profile.release]
debug = true
Expand Down
112 changes: 112 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
description = "Iroh workspace flake (with crane, workspace build)";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = { self, nixpkgs, flake-utils, crane, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
craneLib = crane.mkLib pkgs;

src = craneLib.cleanCargoSource ./.;

commonArgs = {
inherit src;
strictDeps = true;
cargoExtraArgs = "--features server";
};

workspace-artifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "iroh-workspace";
});

iroh-relay = craneLib.buildPackage (commonArgs // {
pname = "iroh-relay";
cargoArtifacts = workspace-artifacts;
doCheck = false;
cargoBuildCommand = "cargo build --release --bin iroh-relay";
installPhase = ''
mkdir -p $out/bin
cp target/release/iroh-relay $out/bin/
'';
});

iroh-dns-server = craneLib.buildPackage (commonArgs // {
pname = "iroh-dns-server";
cargoArtifacts = workspace-artifacts;
doCheck = false;
cargoBuildCommand = "cargo build --release --bin iroh-dns-server";
installPhase = ''
mkdir -p $out/bin
cp target/release/iroh-dns-server $out/bin/
'';
});
in {
packages.iroh-relay = iroh-relay;
packages.iroh-dns-server = iroh-dns-server;
devShells.default = craneLib.devShell {
checks = { workspace = workspace-artifacts; };
packages = [ pkgs.rust-analyzer pkgs.bashInteractive ];
};
}
);
}
2 changes: 1 addition & 1 deletion iroh-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh-base"
version = "0.35.0"
version = { workspace = true }
edition = "2021"
readme = "README.md"
description = "base type and utilities for Iroh"
Expand Down
2 changes: 1 addition & 1 deletion iroh-dns-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh-dns-server"
version = "0.35.0"
version = { workspace = true }
edition = "2021"
description = "A pkarr relay and DNS server"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion iroh-relay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh-relay"
version = "0.35.0"
version = { workspace = true }
edition = "2021"
readme = "README.md"
description = "Iroh's relay server and client"
Expand Down
2 changes: 1 addition & 1 deletion iroh/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh"
version = "0.35.0"
version = { workspace = true }
edition = "2021"
readme = "README.md"
description = "p2p quic connections dialed by public key"
Expand Down
2 changes: 1 addition & 1 deletion iroh/bench/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh-bench"
version = "0.35.0"
version = { workspace = true }
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false
Expand Down