diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fc1f008 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "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": 1757487488, + "narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-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": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1757644300, + "narHash": "sha256-bVIDYz31bCdZId441sqgkImnA7aYr2UQzQlyl+O2DWc=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "591c5ae84f066bdfc9797b217df392d58eafd088", + "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..5ca3600 --- /dev/null +++ b/flake.nix @@ -0,0 +1,92 @@ +{ + description = "pdsfs - mount an atproto PDS repository as a FUSE filesystem"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + + rustToolchain = + if builtins.pathExists ./rust-toolchain.toml + then pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml + else pkgs.rust-bin.stable.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + }; + + nativeBuildInputs = with pkgs; [ + rustToolchain + pkg-config + ]; + + buildInputs = with pkgs; [ + fuse3 + openssl + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.CoreServices + ]; + + pdsfs = pkgs.rustPlatform.buildRustPackage { + pname = "pdsfs"; + version = "0.1.0"; + + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + inherit nativeBuildInputs buildInputs; + + # Skip tests that require network access or FUSE capabilities + doCheck = false; + + meta = with pkgs.lib; { + description = "Mount an atproto PDS repository as a FUSE filesystem"; + homepage = "https://github.com/tangled/pdsfs"; # Update with actual repository URL + license = licenses.mit; # Update with actual license + maintainers = [ ]; # Add maintainers if desired + platforms = platforms.linux ++ platforms.darwin; + }; + }; + in + { + packages = { + default = pdsfs; + pdsfs = pdsfs; + }; + + devShells.default = pkgs.mkShell { + inherit buildInputs nativeBuildInputs; + + shellHook = '' + echo "pdsfs development environment" + echo "Run 'cargo build' to build the project" + echo "Run 'cargo run -- ' to mount a PDS repository" + echo "" + echo "FUSE development notes:" + echo "- Ensure you have FUSE permissions (add user to 'fuse' group if needed)" + echo "- Use 'fusermount -u ' to unmount if needed" + ''; + }; + + # Allow building with different Rust versions + devShells.rust-nightly = pkgs.mkShell { + buildInputs = buildInputs ++ [ + (pkgs.rust-bin.nightly.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + }) + pkgs.pkg-config + ]; + }; + }); +}