{ description = "AppDaemon development"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; devenv.url = "github:cachix/devenv"; }; # nixConfig = { # extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; # extra-substituters = "https://devenv.cachix.org"; # }; outputs = { self, nixpkgs, devenv, ... } @ inputs: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; python = pkgs.python312; adPath = "/usr/src/app"; # uv = "${pkgs.uv}/bin/uv"; in { packages.${system}.devenv-up = self.devShells.${system}.default.config.procfileScript; packages.${system}.devenv-test = self.devShells.${system}.default.config.test; devShells.${system}.default = devenv.lib.mkShell { inherit inputs pkgs; modules = [ ./devenv.nix ]; }; devShells.${system}.native = pkgs.mkShell { nativeBuildInputs = with pkgs; [ git uv python ]; packages = with pkgs; [ (writeShellScriptBin "cd-ad" "cd ${adPath}") (writeShellScriptBin "full-build" '' rm -rf ${adPath}/build ${adPath}/dist ${pkgs.uv}/bin/uv build --wheel ${adPath} docker build -t acockburn/appdaemon:local-dev ${adPath} '') ]; shellHook = '' cd ${adPath} echo "URL: $(${pkgs.git}/bin/git config --get remote.origin.url)" echo "Branch: $(${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)" echo "Hash: $(${pkgs.git}/bin/git rev-parse --short HEAD)" ${pkgs.uv}/bin/uv sync -U --all-extras export UV_PYTHON="${adPath}/.venv/bin/python" alias clean="rm -rf ${adPath}/dist ${adPath}/build" alias appdaemon="${pkgs.uv}/bin/uv run --frozen python -m appdaemon" alias ad="appdaemon" export PS1="\[\033[01;34m\](AppDaemon)\[\033[00m\] \[\]\[\]\n\[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] \[\]\[\]" echo "AppDaemon v$(uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started" ''; UV_LINK_MODE = "copy"; }; }; }