Skip to content

Commit

Permalink
tested using devenv.nix instead of flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrizzo1 committed Nov 23, 2024
1 parent 0e16153 commit 6928288
Show file tree
Hide file tree
Showing 14 changed files with 817 additions and 1,242 deletions.
11 changes: 2 additions & 9 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="

watch_file flake.nix
watch_file flake.lock
if ! use flake . --impure
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
use devenv
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ __pycache__/
.env.dev.local
.env.test.local
.env.prod.local
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
132 changes: 132 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1732107313,
"owner": "cachix",
"repo": "devenv",
"rev": "7ce658cd581bfc42e4646cb563ad2f340f8c63b6",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1731797254,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1731890469,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5083ec887760adfe12af64830a66807423a859a7",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1732021966,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
100 changes: 100 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{ pkgs, lib, config, inputs, ... }:

{
packages =
let
pkgs-stable = import inputs.nixpkgs {
inherit (pkgs.stdenv) system;

config.allowUnfree = true;
config.cudaSupport = true;
};

pkgs-unstable = import inputs.nixpkgs-unstable {
inherit (pkgs.stdenv) system;

config.allowUnfree = true;
config.cudaSupport = true;
};
in
with pkgs-stable; [
git
cudatoolkit
portaudio
(python3.withPackages (python-pkgs: with python-pkgs; [
accelerate
bitsandbytes
datasets
diffusers
ftfy
graphviz
ipykernel
ipympl
ipywidgets
jupyter-all
jupyter-server
jupyterlab
matplotlib
numpy
openai-whisper
pandas
peft
pip
pyaudio
python-dotenv
pyttsx3
requests
rich
scipy
seaborn
sounddevice
sqlalchemy
statsmodels
tensorboard
torch
torchaudio
torchvision
xformers
]))
pkgs-unstable.python311Packages.huggingface-hub
pkgs-unstable.python311Packages.langchain-community
pkgs-unstable.python311Packages.langchain-core
pkgs-unstable.python311Packages.langchain-ollama
pkgs-unstable.python311Packages.langchain-openai
pkgs-unstable.python311Packages.langchain-text-splitters
pkgs-unstable.python311Packages.langchainplus-sdk
pkgs-unstable.python311Packages.langgraph
pkgs-unstable.python311Packages.langgraph-checkpoint
pkgs-unstable.python311Packages.langgraph-checkpoint-postgres
pkgs-unstable.python311Packages.langgraph-checkpoint-sqlite
pkgs-unstable.python311Packages.llama-index
pkgs-unstable.python311Packages.llama-index-agent-openai
pkgs-unstable.python311Packages.nltk
];

languages.nix.enable = true;
languages.python = {
enable = true;
# uv.enable = true;
venv.enable = true;
venv.requirements = ''
bark
langchain-cli
llama-index-tools-google
llama-index-tools-wikipedia
'';
};

dotenv.enable = true;
difftastic.enable = true;
starship.enable = true;

enterShell = ''
git --version
echo -n "Cuda Enabled: "; python -c "import torch; print(torch.cuda.is_available())"
echo -n "llama google tools: "; python -c "import llama_index.tools.google"; [[ $? = 0 ]] && echo 'Imported' || echo 'Failed to import'
echo -n "Bark: "; python -c "import bark"; [[ $? = 0 ]] && echo 'Imported' || echo 'Failed to import'
'';

# See full reference at https://devenv.sh/reference/options/
}
5 changes: 5 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
nixpkgs-unstable:
url: github:nixos/nixpkgs/nixpkgs-unstable
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
10 changes: 0 additions & 10 deletions env.sample

This file was deleted.

Loading

0 comments on commit 6928288

Please sign in to comment.