2022-12-13 14:25:50 -06:00
|
|
|
{
|
|
|
|
description = "My Streamdeck";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs = {
|
2023-08-29 15:42:03 -05:00
|
|
|
url = "nixpkgs/nixos-23.05";
|
|
|
|
};
|
|
|
|
poetry2nix = {
|
|
|
|
url = "github:nix-community/poetry2nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2022-12-13 14:25:50 -06:00
|
|
|
};
|
|
|
|
flake-utils = {
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
};
|
2023-08-29 15:42:03 -05:00
|
|
|
bash = {
|
|
|
|
url = "git+https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git";
|
|
|
|
};
|
|
|
|
make-shell = {
|
|
|
|
url = "github:ursi/nix-make-shell";
|
|
|
|
};
|
2022-12-13 14:25:50 -06:00
|
|
|
};
|
2023-08-29 15:42:03 -05:00
|
|
|
outputs = { self, nixpkgs, poetry2nix, flake-utils, bash, make-shell, ... }@inputs:
|
2022-12-13 14:25:50 -06:00
|
|
|
flake-utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
2023-08-29 15:42:03 -05:00
|
|
|
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides;
|
2022-12-13 14:25:50 -06:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
devShells.default =
|
2023-08-29 15:42:03 -05:00
|
|
|
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
|
2023-02-11 10:22:58 -06:00
|
|
|
pkgs.poetry
|
2022-12-13 14:25:50 -06:00
|
|
|
pkgs.hidapi
|
|
|
|
pkgs.libusb1
|
|
|
|
];
|
2023-08-29 15:42:03 -05:00
|
|
|
env = {
|
|
|
|
HIDAPI_HOME = pkgs.hidapi;
|
|
|
|
MAGICK_HOME = pkgs.imagemagickBig;
|
|
|
|
POETRY_VIRTUALENVS_IN_PROJECT = "true";
|
|
|
|
PS1 = prompt;
|
|
|
|
};
|
|
|
|
setup = ''
|
2022-12-13 14:25:50 -06:00
|
|
|
export PATH=''$(pwd)/.venv/bin:$PATH
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
packages = {
|
2023-08-29 15:42:03 -05:00
|
|
|
greendeck = mkPoetryApplication {
|
|
|
|
python = pkgs.python311;
|
2022-12-13 14:25:50 -06:00
|
|
|
projectDir = ./.;
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pkgs.hidapi
|
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace greendeck/lib/hidapi/library.py \
|
|
|
|
--replace \
|
|
|
|
'os.getenv("HIDAPI_LIBRARY")' \
|
|
|
|
'"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"'
|
|
|
|
'';
|
2023-08-29 15:42:03 -05:00
|
|
|
overrides = overrides.withDefaults
|
2022-12-13 14:25:50 -06:00
|
|
|
(
|
|
|
|
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 ];
|
|
|
|
}
|
|
|
|
);
|
2023-08-29 15:42:03 -05:00
|
|
|
# types-deprecated = super.types-deprecated.overridePythonAttrs (
|
|
|
|
# old: {
|
|
|
|
# buildInputs = old.buildInputs ++ [ pkgs.python3Packages.setuptools ];
|
|
|
|
# }
|
|
|
|
# );
|
2022-12-13 14:25:50 -06:00
|
|
|
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (
|
|
|
|
old: {
|
2023-08-29 15:42:03 -05:00
|
|
|
buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools ];
|
2022-12-24 11:10:51 -06:00
|
|
|
}
|
|
|
|
);
|
2023-08-29 15:42:03 -05:00
|
|
|
# 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
|
|
|
|
# ];
|
|
|
|
# }
|
|
|
|
# );
|
2022-12-24 11:10:51 -06:00
|
|
|
asyncdbus = super.asyncdbus.overridePythonAttrs (
|
|
|
|
old: {
|
2023-08-29 15:42:03 -05:00
|
|
|
buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools-scm ];
|
2022-12-13 14:25:50 -06:00
|
|
|
}
|
|
|
|
);
|
2023-08-29 15:42:03 -05:00
|
|
|
# Pillow = super.Pillow.overridePythonAttrs (
|
|
|
|
# old: {
|
|
|
|
# buildInputs = old.buildInputs ++ [ pkgs.python311Packages.setuptools-scm ];
|
|
|
|
# }
|
|
|
|
# );
|
2022-12-13 14:25:50 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
default = self.packages.${system}.greendeck;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|