jupyter works through uv command in devenv shell

This commit is contained in:
John Lancaster
2024-12-28 23:54:16 -06:00
parent 77098ae071
commit 1a3dcb516a
3 changed files with 36 additions and 25 deletions

View File

@@ -1,15 +1,21 @@
NixOS Configuration for AppDaemon Development # NixOS Configuration for AppDaemon Development
Needs a `git.nix` file. Example below: ## Objectives
```shell - Use flakes
{ ... }: - `devenv`-based workflow
{ - Shell
programs.git = { - Build
enable = true; - SSH remote with VSCode
extraConfig.credential.helper = "store --file ~/.git-credentials"; - Jupyter through VSCode
userName = "John Lancaster"; - `autoreload` must work with editable install of the dev version
userEmail = "32917998+jsl12@users.noreply.github.com";
}; ## Usage
}
``` ### `nfs`
Used to rebuild the ad-nix system.
### `ads`
Used to enter the development shell. Be careful, as this will create a `.devenv` directory and venv wherever it's entered.

View File

@@ -15,6 +15,8 @@ in
nix.settings.trusted-users = [ "root" "@wheel" ]; nix.settings.trusted-users = [ "root" "@wheel" ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
programs.nix-ld.enable = true;
sops.defaultSopsFile = ./secrets/secrets.yaml; sops.defaultSopsFile = ./secrets/secrets.yaml;
sops.defaultSopsFormat = "yaml"; sops.defaultSopsFormat = "yaml";

View File

@@ -72,6 +72,7 @@
]; ];
}; };
# https://devenv.sh/guides/using-with-flakes/#the-flakenix-file
packages.${systemSettings.system} = { packages.${systemSettings.system} = {
devenv-up = self.devShells.${systemSettings.system}.default.config.procfileScript; devenv-up = self.devShells.${systemSettings.system}.default.config.procfileScript;
devenv-test = self.devShells.${systemSettings.system}.default.config.test; devenv-test = self.devShells.${systemSettings.system}.default.config.test;
@@ -87,16 +88,19 @@
({ pkgs, config, ... }: { ({ pkgs, config, ... }: {
# This is your devenv configuration # This is your devenv configuration
# https://devenv.sh/reference/options/#pre-commithooks
pre-commit.hooks = { pre-commit.hooks = {
end-of-file-fixer.enable = true; end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true; trim-trailing-whitespace.enable = true;
}; };
# https://devenv.sh/supported-languages/python/
languages.python = { languages.python = {
enable = true; enable = true;
version = systemSettings.pythonVersion; version = systemSettings.pythonVersion;
uv = { uv = {
enable = true; enable = true;
package = pkgs.uv;
sync = { sync = {
enable = true; enable = true;
allExtras = true; allExtras = true;
@@ -107,20 +111,19 @@
packages = with pkgs; [ packages = with pkgs; [
git git
# (writeShellScriptBin "full-build" '' (pkgs.python312.withPackages (python-pkgs: with python-pkgs; [
# cd ${adPath} pip
# ${pkgs.uv}/bin/uv build --wheel setuptools
# docker build -t acockburn/appdaemon:local-dev ${adPath} wheel
# '') notebook
# (pkgs.python312.withPackages (python-pkgs: with python-pkgs; [ rich
# pip ]))
# setuptools
# wheel
# ipykernel
# rich
# ]))
]; ];
processes = {
my-jup.exec = "uv run jupyter notebook";
};
enterShell = '' enterShell = ''
alias appdaemon="${pkgs.uv}/bin/uv run --frozen python -m appdaemon" alias appdaemon="${pkgs.uv}/bin/uv run --frozen python -m appdaemon"
alias ad="appdaemon" alias ad="appdaemon"