ha-mqtt-agent/flake.nix

73 lines
2 KiB
Nix

{
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { self', system, lib, config, pkgs, ... }: {
overlayAttrs = {
inherit (config.packages) ha-mqtt-agent;
};
packages.ha-mqtt-agent = pkgs.python3Packages.buildPythonApplication {
pname = "ha-mqtt-agent";
version = "0.3.12";
src = ./.;
build-system = with pkgs.python3Packages; [ setuptools ];
pythonImportsCheck = [ "ha_mqtt_agent" ];
propagatedBuildInputs = with pkgs.python3Packages; [
pkgs.wirelesstools
pkgs.xorg.xset
aiofiles
coloredlogs
configargparse
evdev
ha-mqtt-discoverable
psutil
];
};
checks = let
fmt-check = pkgs.stdenvNoCC.mkDerivation {
name = "nixfmt-check";
src = ./.;
nativeBuildInputs = with pkgs; [ black treefmt ];
doCheck = true;
dontBuild = true;
checkPhase = ''
treefmt --no-cache --on-unmatched info --fail-on-change
'';
installPhase = ''
mkdir "$out"
'';
};
in {
inherit fmt-check;
};
devShells.default = pkgs.mkShell {
name = "development shell";
nativeBuildInputs = with pkgs.python3Packages; [
pkgs.black
pkgs.treefmt
pkgs.wirelesstools
pkgs.xorg.xset
aiofiles
coloredlogs
configargparse
evdev
ha-mqtt-discoverable
psutil
];
};
};
} // {nixosModules.default = ./module.nix;};
}