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}