diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..8392d159f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index fe8147e83b..65522c3057 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target +/result iroh.config.toml diff --git a/Cargo.toml b/Cargo.toml index 593f1d0ec7..b7d6b060b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "iroh-relay", ] resolver = "2" +package.version = "0.35.0" [profile.release] debug = true diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..b1ce90c767 --- /dev/null +++ b/flake.lock @@ -0,0 +1,112 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1746291859, + "narHash": "sha256-DdWJLA+D5tcmrRSg5Y7tp/qWaD05ATI4Z7h22gd1h7Q=", + "owner": "ipetkov", + "repo": "crane", + "rev": "dfd9a8dfd09db9aad544c4d3b6c47b12562544a5", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747060738, + "narHash": "sha256-ByfPRQuqj+nhtVV0koinEpmJw0KLzNbgcgi9EF+NVow=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eaeed9530c76ce5f1d2d8232e08bec5e26f18ec1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1747190175, + "narHash": "sha256-s33mQ2s5L/2nyllhRTywgECNZyCqyF4MJeM3vG/GaRo=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "58160be7abad81f6f8cb53120d5b88c16e01c06d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..7477306138 --- /dev/null +++ b/flake.nix @@ -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 ]; + }; + } + ); +} \ No newline at end of file diff --git a/iroh-base/Cargo.toml b/iroh-base/Cargo.toml index 868061bc62..b091e70b52 100644 --- a/iroh-base/Cargo.toml +++ b/iroh-base/Cargo.toml @@ -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" diff --git a/iroh-dns-server/Cargo.toml b/iroh-dns-server/Cargo.toml index c0c85f6c95..922f6abaac 100644 --- a/iroh-dns-server/Cargo.toml +++ b/iroh-dns-server/Cargo.toml @@ -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" diff --git a/iroh-relay/Cargo.toml b/iroh-relay/Cargo.toml index 0e56551fb9..5d42ff0ed8 100644 --- a/iroh-relay/Cargo.toml +++ b/iroh-relay/Cargo.toml @@ -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" diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index 91e9dd5e8b..ff888eeaad 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -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" diff --git a/iroh/bench/Cargo.toml b/iroh/bench/Cargo.toml index b274fe91f5..a87158b82d 100644 --- a/iroh/bench/Cargo.toml +++ b/iroh/bench/Cargo.toml @@ -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