diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..d92da84 --- /dev/null +++ b/.envrc @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Foundation Devices Inc. +# +# SPDX-License-Identifier: MIT + +use flake diff --git a/.reuse/dep5 b/.reuse/dep5 index b033d8c..e3101a5 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -34,3 +34,7 @@ License: MIT Files: CHANGELOG.md Copyright: 2024 Foundation Devices Inc. License: MIT + +Files: flake.lock +Copyright: 2024 Foundation Devices Inc. +License: MIT diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..87ca7ac --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "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": 1770689213, + "narHash": "sha256-N6JiSpfi0s8NjUTnjwo3c+YAmvYhCDzjCKCrTUC97xM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "49d75834011c94a120a9cb874ac1c4d8b7bfc767", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1770779462, + "narHash": "sha256-ykcXTKtV+dOaKlOidAj6dpewBHjni9/oy/6VKcqfzfY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "8a53b3ade61914cdb10387db991b90a3a6f3c441", + "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 0000000..59fd5df --- /dev/null +++ b/flake.nix @@ -0,0 +1,82 @@ +# SPDX-FileCopyrightText: 2024 Foundation Devices Inc. +# +# SPDX-License-Identifier: MIT +{ + description = "tor - Flutter plugin for managing a Tor proxy via arti"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + rust-overlay, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + + rustToolchain = pkgs.rust-bin.stable."1.87.0".default; + in + { + devShells.default = pkgs.mkShell { + buildInputs = + with pkgs; + [ + # Dart / Flutter + dart + flutter + + # Rust (pinned to rust-toolchain) + rustToolchain + + # Native build tools + cmake + ninja + pkg-config + + # For ffigen (libclang) + libclang + llvmPackages.libclang + + # Just (task runner) + just + + # Useful for Rust development + cargo-ndk + ] + ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ + # Linux desktop build deps (GTK runner) + gtk3 + pcre2 + util-linux + libselinux + libsepol + libthai + libdatrie + libxkbcommon + libxdmcp + lerc + libdeflate + at-spi2-core + dbus + libepoxy + ]; + + shellHook = '' + export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib" + ''; + }; + } + ); +} diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 91cae59..a5383fa 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1085,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357422a457ccb850dc8f1c1680e0670079560feaad6c2e247e3f345c4fab8a3f" dependencies = [ "heck 0.5.0", - "indexmap 1.9.3", + "indexmap 2.12.1", "itertools 0.14.0", "proc-macro-crate", "proc-macro2", @@ -1103,7 +1103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd5f2b7218a51c827a11d22d1439b598121fac94bf9b99452e4afffe512d78c9" dependencies = [ "heck 0.5.0", - "indexmap 1.9.3", + "indexmap 2.12.1", "itertools 0.14.0", "proc-macro-crate", "proc-macro2", @@ -3270,11 +3270,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ - "bitflags 2.9.1", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -3994,7 +3994,7 @@ checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" [[package]] name = "tor" -version = "0.0.9" +version = "0.1.1" dependencies = [ "anyhow", "arti", @@ -4003,6 +4003,7 @@ dependencies = [ "lazy_static", "log", "rlimit", + "security-framework", "time", "tokio", "tor-config",