{ 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; }; in { devShells.default = let make-shell = import inputs.make-shell { inherit system; pkgs = pkgs; }; python = pkgs.python311.withPackages (ps: with ps; [ poetry-core ]); 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 = ./.; 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 ]; } ); # types-deprecated = super.types-deprecated.overridePythonAttrs ( # old: { # buildInputs = old.buildInputs ++ [ pkgs.python3Packages.setuptools ]; # } # ); pydantic-yaml = super.pydantic-yaml.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools ]; } ); # pydocstyle = super.pydocstyle.overridePythonAttrs ( # old: { # buildInputs = old.buildInputs ++ [ # # pkgs.python3Packages.poetry-core # ]; # } # ); # pydocstringformatter = super.pydocstringformatter.overridePythonAttrs ( # old: { # buildInputs = old.buildInputs ++ [ # pkgs.python3Packages.poetry-core # pkgs.python3Packages.setuptools # ]; # } # ); asyncdbus = super.asyncdbus.overridePythonAttrs ( old: { buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools-scm ]; } ); # Pillow = super.Pillow.overridePythonAttrs ( # old: { # buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools-scm ]; # } # ); } ); }; }; default = self.packages.${system}.greendeck; } ); }