fix: ai notebook sentencepipe incompatibility with apple devices

This commit is contained in:
Rasyidan Akbar F. 2025-12-10 14:28:58 +07:00
commit 26c8423a47
4 changed files with 160 additions and 38 deletions

72
flake.lock generated
View file

@ -52,11 +52,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1764596563, "lastModified": 1765204341,
"narHash": "sha256-tH3AGDWlAN3ImVuBBCLmqaqD0EbkISiPCHGeMcd430k=", "narHash": "sha256-7xd45skcuLCu2DHxVvU+W/z+7CUOjyv+QPtT4PLZaIU=",
"owner": "chaotic-cx", "owner": "chaotic-cx",
"repo": "nyx", "repo": "nyx",
"rev": "0701ee838b0fb34a77b6dd4b35476b4bb09fbca9", "rev": "aacb796ccd42be1555196c20013b9b674b71df75",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,11 +73,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764161084, "lastModified": 1765065051,
"narHash": "sha256-HN84sByg9FhJnojkGGDSrcjcbeioFWoNXfuyYfJ1kBE=", "narHash": "sha256-b7W9WsvyMOkUScNxbzS45KEJp0iiqRPyJ1I3JBE+oEE=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "e95de00a471d07435e0527ff4db092c84998698e", "rev": "7e22bf538aa3e0937effcb1cee73d5f1bcc26f79",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -181,11 +181,11 @@
"zon2nix": "zon2nix" "zon2nix": "zon2nix"
}, },
"locked": { "locked": {
"lastModified": 1764605702, "lastModified": 1765256324,
"narHash": "sha256-ZGIKHORnvJ+6ghU/KjtXTesbRB4S75KwwAat7UFMpXU=", "narHash": "sha256-LB4FO4xP9XlmaxEzruiW88S2n6SEYqALdzKE3oybGkI=",
"owner": "ghostty-org", "owner": "ghostty-org",
"repo": "ghostty", "repo": "ghostty",
"rev": "5714ed07a1012573261b7b7e3ed2add9c1504496", "rev": "cf06417b7dfbd0daeb58a9143f9b6ee194cbce26",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -202,11 +202,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764194569, "lastModified": 1764998300,
"narHash": "sha256-iUM9ktarEzThkayyZrzQ7oycPshAY2XRQqVKz0xX/L0=", "narHash": "sha256-fZatn/KLfHLDXnF0wy7JxXqGaZmGDTVufT4o/AOlj44=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "9651819d75f6c7ffaf8a9227490ac704f29659f0", "rev": "27a6182347ccae90a88231ae0dc5dfa7d15815bb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -222,11 +222,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764636297, "lastModified": 1765337252,
"narHash": "sha256-S41K55kw+hWgDfgKmZ9/fMZ3F0BQDMvqFfE120fMHeE=", "narHash": "sha256-HuWQp8fM25fyWflbuunQkQI62Hg0ecJxWD52FAgmxqY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "ff067cfc619fdf6f82d50344e7d19ff2323f0827", "rev": "13cc1efd78b943b98c08d74c9060a5b59bf86921",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -244,11 +244,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764275117, "lastModified": 1764922999,
"narHash": "sha256-DRcv8Y0BnWm4ZhUQnaYk1dNzC6ZhA2W9Vv5Jl4n0RbE=", "narHash": "sha256-LSvUxKm6S6ZAd/otQSkAHd3+8KJhi8OwGJGSe0K//B8=",
"owner": "Jovian-Experiments", "owner": "Jovian-Experiments",
"repo": "Jovian-NixOS", "repo": "Jovian-NixOS",
"rev": "96023dcc9a0febaaa3b91f447b9ae2fbe86f2923", "rev": "9b9ead1b5591b68f4048e7205ba1397bc85ce6c4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -266,11 +266,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1764643925, "lastModified": 1765336700,
"narHash": "sha256-GLvOrqcAURAbLapyTLk9CHf30YXyllwMbouErByho0I=", "narHash": "sha256-xeqAm4VadgpfvyTBnIqoDTDcfLg0pEB0IOI8wCVr6gQ=",
"owner": "numtide", "owner": "numtide",
"repo": "nix-ai-tools", "repo": "nix-ai-tools",
"rev": "56de5ea7034968434a3a56f027ea6bacc19a4978", "rev": "6d53cb0335d2e3c39b8ec4f3d5808930679f2ae0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -304,11 +304,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1764517877, "lastModified": 1764950072,
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", "narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", "rev": "f61125a668a320878494449750330ca58b78c557",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -348,11 +348,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1764517877, "lastModified": 1765186076,
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", "narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", "rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -383,11 +383,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764211126, "lastModified": 1765075567,
"narHash": "sha256-p5y13PnMZYd5WdHk+XCzyUaLGBUCwnz2n4KYKEZM0Pw=", "narHash": "sha256-KFDCdQcHJ0hE3Nt5Gm5enRIhmtEifAjpxgUQ3mzSJpA=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "895935bff08cfcfb663fb9c8263c43596e7cd1ed", "rev": "769156779b41e8787a46ca3d7d76443aaf68be6f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -403,11 +403,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764483358, "lastModified": 1765231718,
"narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=", "narHash": "sha256-qdBzo6puTgG4G2RHG0PkADg22ZnQo1JmSVFRxrD4QM4=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "5aca6ff67264321d47856a2ed183729271107c9c", "rev": "7fd1416aba1865eddcdec5bb11339b7222c2363e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -490,11 +490,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764893252, "lastModified": 1765037997,
"narHash": "sha256-Ua2TYmHHsJCCse6Oo6jT7ZD7Ko73dd7a70PRqqhTd6w=", "narHash": "sha256-OULPSaxqO2HmUT+6Eprnf9A5nLrJ8WwGP1L/gqANsf4=",
"owner": "tobi", "owner": "tobi",
"repo": "try", "repo": "try",
"rev": "9babc916eb199148c5949e7e8dee318a3f3a4770", "rev": "08f70fa34761e308acc0546b723d038e41aa0fee",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -147,6 +147,7 @@
web-bun = importShell "web-bun"; web-bun = importShell "web-bun";
rust = importShell "rust"; rust = importShell "rust";
ai-agent = importShell "ai-agent"; ai-agent = importShell "ai-agent";
effect-ts = importShell "effect-ts";
}); });
formatter = forEachSystem (system: (mkPkgs system).nixfmt-classic); formatter = forEachSystem (system: (mkPkgs system).nixfmt-classic);

View file

@ -22,12 +22,11 @@ let
scikit-image scikit-image
scikit-learn scikit-learn
seaborn seaborn
sentencepiece
tokenizers tokenizers
transformers transformers
]; ];
linuxOnlyPackages = lib.optionals pkgs.stdenv.isLinux linuxOnlyPackages = lib.optionals pkgs.stdenv.isLinux
(with ps; [ torch torchaudio torchvision ]); (with ps; [ sentencepiece torch torchaudio torchvision ]);
in basePackages ++ linuxOnlyPackages); in basePackages ++ linuxOnlyPackages);
in pkgs.mkShell { in pkgs.mkShell {
name = "ai-notebook"; name = "ai-notebook";

122
shells/effect-ts.nix Normal file
View file

@ -0,0 +1,122 @@
{ pkgs, ... }:
let
effectInit = pkgs.writeShellScriptBin "effect-init" ''
set -e
PROJECT_NAME="''${1:-.}"
if [ "$PROJECT_NAME" != "." ]; then
mkdir -p "$PROJECT_NAME"
cd "$PROJECT_NAME"
echo "Creating Effect project in $PROJECT_NAME..."
else
PROJECT_NAME=$(basename "$PWD")
echo "Initializing Effect project in current directory..."
fi
# Generate package.json
cat > package.json << 'PACKAGE_EOF'
{
"name": "PROJECT_NAME_PLACEHOLDER",
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "biome check .",
"format": "biome format --write .",
"es": "effect-solutions"
},
"dependencies": {
"effect": "latest"
},
"devDependencies": {
"@effect/language-service": "latest",
"effect-solutions": "latest",
"typescript": "latest"
}
}
PACKAGE_EOF
# Replace placeholder with actual project name
${pkgs.gnused}/bin/sed -i "s/PROJECT_NAME_PLACEHOLDER/$PROJECT_NAME/" package.json
# Generate tsconfig.json
cat > tsconfig.json << 'TSCONFIG_EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"noEmit": true,
"skipLibCheck": true,
"plugins": [{ "name": "@effect/language-service" }]
},
"include": ["src/**/*"]
}
TSCONFIG_EOF
# Generate biome.json
cat > biome.json << 'BIOME_EOF'
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": { "enabled": true },
"linter": { "enabled": true },
"formatter": { "enabled": true, "indentStyle": "space", "indentWidth": 2 }
}
BIOME_EOF
# Create src directory with starter file
mkdir -p src
cat > src/index.ts << 'SRC_EOF'
import { Effect, Console } from "effect"
const program = Console.log("Hello, Effect!")
Effect.runPromise(program)
SRC_EOF
# Install dependencies
echo ""
echo "Installing dependencies..."
${pkgs.bun}/bin/bun install
echo ""
echo "Effect project initialized successfully!"
echo ""
echo "Next steps:"
echo " bun run src/index.ts - Run the starter program"
echo " bun typecheck - Check types"
echo " bun lint - Lint code"
echo " bun es list - Browse Effect patterns"
'';
in pkgs.mkShell {
name = "effect-ts";
packages = with pkgs; [
bun
typescript
biome
vscode-langservers-extracted
effectInit
];
shellHook = ''
mkdir -p "$PWD/.cache/bun"
export BUN_INSTALL_CACHE="$PWD/.cache/bun"
es() { ${pkgs.bun}/bin/bunx effect-solutions "$@"; }
export -f es
echo "Effect TypeScript shell ready"
echo " Bun: ${pkgs.bun.version} | TypeScript: ${pkgs.typescript.version} | Biome: ${pkgs.biome.version}"
echo ""
echo "Commands:"
echo " effect-init [name] - Scaffold new Effect project"
echo " es <command> - Run effect-solutions CLI (via bunx)"
echo " bun typecheck - Run TypeScript type checking"
echo " bun lint - Run Biome linter"
echo " bun format - Format code with Biome"
'';
}