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
{ ... }:
{
programs.git = {
enable = true;
extraConfig.credential.helper = "store --file ~/.git-credentials";
userName = "John Lancaster";
userEmail = "32917998+jsl12@users.noreply.github.com";
};
}
```
- Use flakes
- `devenv`-based workflow
- Shell
- Build
- SSH remote with VSCode
- Jupyter through VSCode
- `autoreload` must work with editable install of the dev version
## 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.experimental-features = [ "nix-command" "flakes" ];
programs.nix-ld.enable = true;
sops.defaultSopsFile = ./secrets/secrets.yaml;
sops.defaultSopsFormat = "yaml";

View File

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