mount an atproto PDS repository as a FUSE filesystem

feat: flake.nix compliation and devShell

Adding a nix flake that perhaps is a little over-engineered for this, but does correctly build and run `pdsfs`. The flake exports a package and devShell, but not an overlay. Optionally can use latest rust using the rust-overlay to build if you want with the nightly-devShell. Only other dependency is flake-utils, but can remove. Haven't tested on any platform other than linux.

Tangled c0811193 df663fdf

Changed files
+188
+96
flake.lock
··· 1 + { 2 + "nodes": { 3 + "flake-utils": { 4 + "inputs": { 5 + "systems": "systems" 6 + }, 7 + "locked": { 8 + "lastModified": 1731533236, 9 + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 10 + "owner": "numtide", 11 + "repo": "flake-utils", 12 + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 13 + "type": "github" 14 + }, 15 + "original": { 16 + "owner": "numtide", 17 + "repo": "flake-utils", 18 + "type": "github" 19 + } 20 + }, 21 + "nixpkgs": { 22 + "locked": { 23 + "lastModified": 1757487488, 24 + "narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=", 25 + "owner": "NixOS", 26 + "repo": "nixpkgs", 27 + "rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0", 28 + "type": "github" 29 + }, 30 + "original": { 31 + "owner": "NixOS", 32 + "ref": "nixos-unstable", 33 + "repo": "nixpkgs", 34 + "type": "github" 35 + } 36 + }, 37 + "nixpkgs_2": { 38 + "locked": { 39 + "lastModified": 1744536153, 40 + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", 41 + "owner": "NixOS", 42 + "repo": "nixpkgs", 43 + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", 44 + "type": "github" 45 + }, 46 + "original": { 47 + "owner": "NixOS", 48 + "ref": "nixpkgs-unstable", 49 + "repo": "nixpkgs", 50 + "type": "github" 51 + } 52 + }, 53 + "root": { 54 + "inputs": { 55 + "flake-utils": "flake-utils", 56 + "nixpkgs": "nixpkgs", 57 + "rust-overlay": "rust-overlay" 58 + } 59 + }, 60 + "rust-overlay": { 61 + "inputs": { 62 + "nixpkgs": "nixpkgs_2" 63 + }, 64 + "locked": { 65 + "lastModified": 1757644300, 66 + "narHash": "sha256-bVIDYz31bCdZId441sqgkImnA7aYr2UQzQlyl+O2DWc=", 67 + "owner": "oxalica", 68 + "repo": "rust-overlay", 69 + "rev": "591c5ae84f066bdfc9797b217df392d58eafd088", 70 + "type": "github" 71 + }, 72 + "original": { 73 + "owner": "oxalica", 74 + "repo": "rust-overlay", 75 + "type": "github" 76 + } 77 + }, 78 + "systems": { 79 + "locked": { 80 + "lastModified": 1681028828, 81 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 82 + "owner": "nix-systems", 83 + "repo": "default", 84 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 85 + "type": "github" 86 + }, 87 + "original": { 88 + "owner": "nix-systems", 89 + "repo": "default", 90 + "type": "github" 91 + } 92 + } 93 + }, 94 + "root": "root", 95 + "version": 7 96 + }
+92
flake.nix
··· 1 + { 2 + description = "pdsfs - mount an atproto PDS repository as a FUSE filesystem"; 3 + 4 + inputs = { 5 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 + rust-overlay.url = "github:oxalica/rust-overlay"; 7 + flake-utils.url = "github:numtide/flake-utils"; 8 + }; 9 + 10 + outputs = { self, nixpkgs, rust-overlay, flake-utils }: 11 + flake-utils.lib.eachDefaultSystem (system: 12 + let 13 + overlays = [ (import rust-overlay) ]; 14 + pkgs = import nixpkgs { 15 + inherit system overlays; 16 + }; 17 + 18 + rustToolchain = 19 + if builtins.pathExists ./rust-toolchain.toml 20 + then pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml 21 + else pkgs.rust-bin.stable.latest.default.override { 22 + extensions = [ "rust-src" "rust-analyzer" ]; 23 + }; 24 + 25 + nativeBuildInputs = with pkgs; [ 26 + rustToolchain 27 + pkg-config 28 + ]; 29 + 30 + buildInputs = with pkgs; [ 31 + fuse3 32 + openssl 33 + ] ++ lib.optionals stdenv.isDarwin [ 34 + darwin.apple_sdk.frameworks.Security 35 + darwin.apple_sdk.frameworks.CoreServices 36 + ]; 37 + 38 + pdsfs = pkgs.rustPlatform.buildRustPackage { 39 + pname = "pdsfs"; 40 + version = "0.1.0"; 41 + 42 + src = ./.; 43 + 44 + cargoLock = { 45 + lockFile = ./Cargo.lock; 46 + }; 47 + 48 + inherit nativeBuildInputs buildInputs; 49 + 50 + # Skip tests that require network access or FUSE capabilities 51 + doCheck = false; 52 + 53 + meta = with pkgs.lib; { 54 + description = "Mount an atproto PDS repository as a FUSE filesystem"; 55 + homepage = "https://github.com/tangled/pdsfs"; # Update with actual repository URL 56 + license = licenses.mit; # Update with actual license 57 + maintainers = [ ]; # Add maintainers if desired 58 + platforms = platforms.linux ++ platforms.darwin; 59 + }; 60 + }; 61 + in 62 + { 63 + packages = { 64 + default = pdsfs; 65 + pdsfs = pdsfs; 66 + }; 67 + 68 + devShells.default = pkgs.mkShell { 69 + inherit buildInputs nativeBuildInputs; 70 + 71 + shellHook = '' 72 + echo "pdsfs development environment" 73 + echo "Run 'cargo build' to build the project" 74 + echo "Run 'cargo run -- <handle>' to mount a PDS repository" 75 + echo "" 76 + echo "FUSE development notes:" 77 + echo "- Ensure you have FUSE permissions (add user to 'fuse' group if needed)" 78 + echo "- Use 'fusermount -u <mountpoint>' to unmount if needed" 79 + ''; 80 + }; 81 + 82 + # Allow building with different Rust versions 83 + devShells.rust-nightly = pkgs.mkShell { 84 + buildInputs = buildInputs ++ [ 85 + (pkgs.rust-bin.nightly.latest.default.override { 86 + extensions = [ "rust-src" "rust-analyzer" ]; 87 + }) 88 + pkgs.pkg-config 89 + ]; 90 + }; 91 + }); 92 + }