{ description = "My Streamdeck"; inputs = { nixpkgs = { url = "nixpkgs/nixos-23.05"; }; poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils = { url = "github:numtide/flake-utils"; }; bash = { url = "git+https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git"; }; make-shell = { url = "github:ursi/nix-make-shell"; }; }; outputs = { self, nixpkgs, poetry2nix, flake-utils, bash, make-shell, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: let inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides; pkgs = import nixpkgs { inherit system; }; python = pkgs.python311.withPackages (ps: with ps; [ poetry-core ]); in { devShells.default = let make-shell = import inputs.make-shell { inherit system; pkgs = pkgs; }; project = "greendeck"; prompt = ( bash.build_prompt bash.ansi_normal_blue "${project} - ${bash.username}@${bash.hostname_short}: ${bash.current_working_directory}" "${project}:${bash.current_working_directory}" ); in make-shell { packages = [ python pkgs.poetry pkgs.hidapi pkgs.libusb1 ]; env = { HIDAPI_HOME = pkgs.hidapi; MAGICK_HOME = pkgs.imagemagickBig; POETRY_VIRTUALENVS_IN_PROJECT = "true"; PS1 = prompt; }; setup = '' export PATH=''$(pwd)/.venv/bin:$PATH ''; }; packages = { greendeck = mkPoetryApplication { python = pkgs.python311; projectDir = ./.; groups = [ ]; propagatedBuildInputs = [ pkgs.hidapi ]; postPatch = '' substituteInPlace greendeck/lib/hidapi/library.py \ --replace \ 'os.getenv("HIDAPI_LIBRARY")' \ '"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"' ''; overrides = overrides.withDefaults ( self: super: { wand = super.wand.overridePythonAttrs ( old: { postPatch = '' substituteInPlace wand/api.py \ --replace \ "os.environ.get('MAGICK_HOME')" \ "'${pkgs.imagemagickBig}'" ''; propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.imagemagickBig ]; } ); # attrs = super.pydantic-yaml.overridePythonAttrs ( # old: { # buildInputs = old.buildInputs ++ [ self.hatchling ]; # } # ); # pytest = super.pytest.overridePythonAttrs ( # old: { # buildInputs = [ self.attrs ]; # } # ); pydantic-yaml = super.pydantic-yaml.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ self.setuptools ]; } ); asyncdbus = super.asyncdbus.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ self.setuptools-scm ]; } ); } ); }; }; default = self.packages.${system}.greendeck; } ); }