92 lines
3.1 KiB
Nix
92 lines
3.1 KiB
Nix
|
{
|
||
|
description = "My Streamdeck";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs = {
|
||
|
url = "nixpkgs/nixos-22.11";
|
||
|
};
|
||
|
flake-utils = {
|
||
|
url = "github:numtide/flake-utils";
|
||
|
};
|
||
|
};
|
||
|
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||
|
flake-utils.lib.eachDefaultSystem
|
||
|
(system:
|
||
|
let
|
||
|
pkgs = import nixpkgs {
|
||
|
inherit system;
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
devShells.default =
|
||
|
let
|
||
|
python = pkgs.python310.withPackages (ps: with ps; [
|
||
|
poetry
|
||
|
]);
|
||
|
in
|
||
|
pkgs.mkShell {
|
||
|
buildInputs = [
|
||
|
python
|
||
|
pkgs.hidapi
|
||
|
pkgs.libusb1
|
||
|
];
|
||
|
shellHook = ''
|
||
|
export HIDAPI_HOME=${pkgs.hidapi}
|
||
|
export MAGICK_HOME=${pkgs.imagemagickBig}
|
||
|
export POETRY_VIRTUALENVS_IN_PROJECT=true
|
||
|
export PS1='\[\033[1;34m\][greendeck:\w]\$\[\033[0m\] '
|
||
|
export PATH=''$(pwd)/.venv/bin:$PATH
|
||
|
'';
|
||
|
};
|
||
|
packages = {
|
||
|
greendeck = pkgs.poetry2nix.mkPoetryApplication {
|
||
|
python = pkgs.python310;
|
||
|
projectDir = ./.;
|
||
|
propagatedBuildInputs = [
|
||
|
pkgs.hidapi
|
||
|
];
|
||
|
postPatch = ''
|
||
|
substituteInPlace greendeck/lib/hidapi/library.py \
|
||
|
--replace \
|
||
|
'os.getenv("HIDAPI_LIBRARY")' \
|
||
|
'"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"'
|
||
|
'';
|
||
|
overrides = pkgs.poetry2nix.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.python310Packages.setuptools ];
|
||
|
}
|
||
|
);
|
||
|
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (
|
||
|
old: {
|
||
|
buildInputs = old.buildInputs ++ [ pkgs.python310Packages.setuptools ];
|
||
|
}
|
||
|
);
|
||
|
pydocstringformatter = super.pydocstringformatter.overridePythonAttrs (
|
||
|
old: {
|
||
|
buildInputs = old.buildInputs ++ [ pkgs.python310Packages.setuptools ];
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
);
|
||
|
};
|
||
|
};
|
||
|
default = self.packages.${system}.greendeck;
|
||
|
}
|
||
|
);
|
||
|
}
|