restructuring for new nix-home flake

This commit is contained in:
John Lancaster
2025-06-16 14:05:08 -05:00
parent 83db5f51ce
commit fbda875a6f
4 changed files with 124 additions and 104 deletions

127
flake.nix
View File

@@ -18,6 +18,10 @@
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-home = {
url = "git+https://gitea.john-stream.com/john/nix-home";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
@@ -25,10 +29,10 @@
extra-substituters = "https://devenv.cachix.org";
};
outputs = { self, ... }@args:
outputs = { self, ... }@inputs:
let
inherit (self) outputs;
nixosSystem = args.nixpkgs.lib.nixosSystem;
nixosSystem = inputs.nixpkgs.lib.nixosSystem;
userSettings = {
gitUserName = "John Lancaster";
@@ -46,26 +50,23 @@
# pythonVersion = "3.11.10"; # This is largely irrelevant because uv will handle it
};
pkgs = args.nixpkgs.legacyPackages.${systemSettings.system};
pkgs = inputs.nixpkgs.legacyPackages.${systemSettings.system};
in
{
nixosConfigurations.${systemSettings.hostName} = nixosSystem {
system = systemSettings.system;
specialArgs =
let
inputs = args;
in
{
specialArgs = {
inherit inputs;
inherit systemSettings;
inherit userSettings;
};
modules = [
(args.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
args.home-manager.nixosModules.default
args.vscode-server.nixosModules.default
args.sops-nix.nixosModules.sops
(inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
inputs.home-manager.nixosModules.default
inputs.nix-home.nixosModules.default { user = "appdaemon"; }
inputs.vscode-server.nixosModules.default
inputs.sops-nix.nixosModules.sops
./configuration.nix
];
};
@@ -76,71 +77,67 @@
devenv-test = self.devShells.${systemSettings.system}.default.config.test;
};
devShells.${systemSettings.system}.default =
let
inputs = args;
in
args.devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({ pkgs, config, ... }: {
# This is your devenv configuration
devShells.${systemSettings.system}.default = inputs.devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({ pkgs, config, ... }: {
# This is your devenv configuration
# https://devenv.sh/reference/options/#pre-commithooks
git-hooks.hooks = {
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
};
# https://devenv.sh/reference/options/#pre-commithooks
git-hooks.hooks = {
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
};
# https://devenv.sh/supported-languages/python/
languages.python = {
# https://devenv.sh/supported-languages/python/
languages.python = {
enable = true;
# version = systemSettings.pythonVersion;
uv = {
enable = true;
# version = systemSettings.pythonVersion;
uv = {
package = pkgs.uv;
sync = {
enable = true;
package = pkgs.uv;
sync = {
enable = true;
allExtras = true;
arguments = [ "-U" ];
};
allExtras = true;
arguments = [ "-U" ];
};
};
};
packages = with pkgs; [
git
packages = with pkgs; [
git
gdbm
# (python312.withPackages (python-pkgs: with python-pkgs; [ gdbm ]))
(python312.withPackages (python-pkgs: with python-pkgs; [
gdbm
# (python312.withPackages (python-pkgs: with python-pkgs; [ gdbm ]))
(python312.withPackages (python-pkgs: with python-pkgs; [
gdbm
notebook # kinda hacky, but needed so that jupyter notebook has some shared library it needs?
]))
(writeShellScriptBin "docs" "${pkgs.uv}/bin/uv run sphinx-autobuild -E ./docs/ ./docs_build --port 9999")
(writeShellScriptBin "ab" "${pkgs.uv}/bin/uv build --wheel --refresh")
(writeShellScriptBin "adb" "ab && ${pkgs.docker}/bin/docker build -t acockburn/appdaemon:local-dev .")
# (writeShellScriptBin "ad-nb" "cd $(readlink -f /etc/nixos) && devenv up")
];
notebook # kinda hacky, but needed so that jupyter notebook has some shared library it needs?
]))
(writeShellScriptBin "docs" "${pkgs.uv}/bin/uv run sphinx-autobuild -E ./docs/ ./docs_build --port 9999")
(writeShellScriptBin "ab" "${pkgs.uv}/bin/uv build --wheel --refresh")
(writeShellScriptBin "adb" "ab && ${pkgs.docker}/bin/docker build -t acockburn/appdaemon:local-dev .")
# (writeShellScriptBin "ad-nb" "cd $(readlink -f /etc/nixos) && devenv up")
];
# processes = {
# my-jup.exec = "uv run jupyter notebook";
# };
# processes = {
# my-jup.exec = "uv run jupyter notebook";
# };
enterShell = ''
alias fix="${pkgs.uv}/bin/uv run ruff check --fix"
alias appdaemon="${pkgs.uv}/bin/uv run --frozen appdaemon"
# alias ad="appdaemon"
enterShell = ''
alias fix="${pkgs.uv}/bin/uv run ruff check --fix"
alias appdaemon="${pkgs.uv}/bin/uv run --frozen appdaemon"
# alias ad="appdaemon"
export PS1="\[\e[0;34m\](AppDaemon)\[\e[0m\] \[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] "
export PS1="\[\e[0;34m\](AppDaemon)\[\e[0m\] \[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] "
export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT
export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT
echo -e "URL: \e[34m$(${pkgs.git}/bin/git config --get remote.origin.url)\e[0m"
echo -e "Branch/Tag: \e[32m$(${pkgs.git}/bin/git describe --tags --exact-match 2>/dev/null || ${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)\e[0m"
echo -e "Hash: \e[33m$(${pkgs.git}/bin/git rev-parse --short HEAD)\e[0m"
echo "AppDaemon v$(${pkgs.uv}/bin/uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started"
'';
})
];
};
echo -e "URL: \e[34m$(${pkgs.git}/bin/git config --get remote.origin.url)\e[0m"
echo -e "Branch/Tag: \e[32m$(${pkgs.git}/bin/git describe --tags --exact-match 2>/dev/null || ${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)\e[0m"
echo -e "Hash: \e[33m$(${pkgs.git}/bin/git rev-parse --short HEAD)\e[0m"
echo "AppDaemon v$(${pkgs.uv}/bin/uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started"
'';
})
];
};
};
}