Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132{ # Dev shell only (not a package build): `nix develop` for the pinned toolchain. description = "Synapse - local-first study workspace";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; };
outputs = { nixpkgs, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
# Rust with the mobile cross-targets. iOS targets are macOS-only. rustTargets = [ "aarch64-linux-android" "armv7-linux-androideabi" "i686-linux-android" "x86_64-linux-android" ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ "aarch64-apple-ios" "aarch64-apple-ios-sim" "x86_64-apple-ios" ]; # Built from the minimal profile plus only the components we use. The # default profile pulls rust-docs, whose download stalls the whole # toolchain install on some MDM-managed Macs; the minimal profile skips # it. cargo, clippy, rustfmt, rust-analyzer and rust-src are added back. rust = pkgs.rust-bin.stable.latest.minimal.override { extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ]; targets = rustTargets; };
# The Android SDK is unfree and needs its licence accepted, so it gets # its own nixpkgs import (the base one stays free-only). Pinned here, it # builds identically on any machine - no host Android Studio install. androidPkgs = import nixpkgs { inherit system; config = { allowUnfree = true; android_sdk.accept_license = true; }; }; androidSdk = (androidPkgs.androidenv.composeAndroidPackages { platformVersions = [ "36" ]; buildToolsVersions = [ "36.0.0" ]; includeNDK = true; # This pinned nixpkgs only ships the stable 29 NDK at this patch; # tauri reads the NDK from NDK_HOME (exported below), so no Gradle # pin needs to match a specific build number. ndkVersions = [ "29.0.14206865" ]; includeSystemImages = false; includeEmulator = false; }).androidsdk; androidSdkRoot = "${androidSdk}/libexec/android-sdk";
# Shared by every platform. common = with pkgs; [ nodejs_22 pnpm rust pkg-config # Docs: mkdocs + plugins live in a venv (see docs/requirements.txt), # so we only need Python here. python312 # Gradle needs a JDK; the SDK/NDK come from androidSdk above. jdk21 ];
# Tauri's Linux build needs the webkit2gtk stack; macOS uses the system # WebKit, so these are Linux-only. linuxTauriDeps = with pkgs; [ webkitgtk_4_1 gtk3 libsoup_3 librsvg gdk-pixbuf glib cairo pango atk openssl ]; in { devShells.default = pkgs.mkShell { packages = common ++ [ androidSdk ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux linuxTauriDeps;
# The Android toolchain is fully Nix-pinned; point tauri/Gradle at it. JAVA_HOME = "${pkgs.jdk21}"; ANDROID_HOME = androidSdkRoot; ANDROID_SDK_ROOT = androidSdkRoot; NDK_HOME = "${androidSdkRoot}/ndk/29.0.14206865";
# pnpm comes from nixpkgs (no corepack: it tries to symlink into the # read-only Nix store and fails). shellHook = '' echo "Synapse dev shell - node $(node --version), pnpm $(pnpm --version), rust $(rustc --version | cut -d' ' -f2)" # iOS signing needs an Apple development team. Set yours (find it in # Xcode > Settings > Accounts, or `security find-identity -v -p # codesigning`) in a gitignored .env.local as APPLE_DEVELOPMENT_TEAM; # tauri reads it for `tauri ios dev/build`. [ -f .env.local ] && set -a && . ./.env.local && set +a || true ''; }; } );}