boardie/flake.nix
2023-04-22 23:03:47 +01:00

73 lines
1.7 KiB
Nix

{
description = "Linux soundboard";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, flake-utils, devshell, poetry2nix }:
let
inherit (nixpkgs.lib) composeManyExtensions;
inherit (flake-utils.lib) eachDefaultSystem;
pyOverrides = pkgs: pkgs.poetry2nix.overrides.withDefaults (self: super: {
pyaudio = super.pyaudio.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.portaudio ];
});
});
in
{
overlays = rec {
boardie = composeManyExtensions [
poetry2nix.overlay
(final: prev: {
boardie = prev.poetry2nix.mkPoetryApplication {
projectDir = ./.;
overrides = pyOverrides prev;
makeWrapperArgs = [
''--prefix PATH ':' "${prev.ffmpeg}/bin"''
];
meta.mainProgram = "boardie";
};
})
];
default = boardie;
};
} // (eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlays.default
self.overlays.default
];
};
in
{
devShells.default = pkgs.devshell.mkShell {
packages = with pkgs; [
ffmpeg
poetry
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
overrides = pyOverrides pkgs;
})
];
};
packages = rec {
inherit (pkgs) boardie;
default = boardie;
};
apps = rec {
inherit (pkgs) boardie;
default = boardie;
};
}));
}