{ 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 ]; }; }); }