{ description = "My Streamdeck"; inputs = { nixpkgs = { url = "nixpkgs/nixos-unstable"; }; poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils = { url = "github:numtide/flake-utils"; }; make-shell = { url = "github:ursi/nix-make-shell"; }; }; outputs = { self, nixpkgs, poetry2nix, flake-utils, ... } @ inputs: flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; }; inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication overrides; 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"; 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"; name = project; }; 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; } ); }