2022-12-13 14:25:50 -06:00
|
|
|
{
|
|
|
|
description = "My Streamdeck";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs = {
|
2023-08-30 22:07:52 -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-30 22:07:52 -05:00
|
|
|
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides;
|
2022-12-13 14:25:50 -06:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
2023-08-29 21:25:39 -05:00
|
|
|
python = pkgs.python311.withPackages (ps: with ps; [
|
|
|
|
poetry-core
|
|
|
|
]);
|
2022-12-13 14:25:50 -06:00
|
|
|
in
|
|
|
|
{
|
|
|
|
devShells.default =
|
2023-08-29 15:42:03 -05:00
|
|
|
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
|
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-30 22:07:52 -05:00
|
|
|
greendeck = mkPoetryApplication {
|
2023-08-29 15:42:03 -05:00
|
|
|
python = pkgs.python311;
|
2022-12-13 14:25:50 -06:00
|
|
|
projectDir = ./.;
|
2023-08-29 21:25:39 -05:00
|
|
|
groups = [ ];
|
2022-12-13 14:25:50 -06:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pkgs.hidapi
|
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace greendeck/lib/hidapi/library.py \
|
|
|
|
--replace \
|
|
|
|
'os.getenv("HIDAPI_LIBRARY")' \
|
|
|
|
'"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"'
|
|
|
|
'';
|
2023-08-30 22:07:52 -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-30 22:07:52 -05:00
|
|
|
# attrs = super.pydantic-yaml.overridePythonAttrs (
|
|
|
|
# old: {
|
|
|
|
# buildInputs = old.buildInputs ++ [ self.hatchling ];
|
|
|
|
# }
|
|
|
|
# );
|
|
|
|
# pytest = super.pytest.overridePythonAttrs (
|
|
|
|
# old: {
|
|
|
|
# buildInputs = [ self.attrs ];
|
|
|
|
# }
|
|
|
|
# );
|
2022-12-13 14:25:50 -06:00
|
|
|
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (
|
|
|
|
old: {
|
2023-08-30 22:07:52 -05:00
|
|
|
buildInputs = old.buildInputs ++ [ self.setuptools ];
|
2022-12-24 11:10:51 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
asyncdbus = super.asyncdbus.overridePythonAttrs (
|
|
|
|
old: {
|
2023-08-30 22:07:52 -05:00
|
|
|
buildInputs = old.buildInputs ++ [ self.setuptools-scm ];
|
2022-12-13 14:25:50 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
default = self.packages.${system}.greendeck;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|