fastsa/flake.nix

38 lines
1.3 KiB
Nix

{
description = "Micro Optical Spectrum Analyzer";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
imgui_dir = "${pkgs.imgui}/include/imgui";
pocketfft = pkgs.fetchgit {
url = "https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git";
rev = "ecd78caa1c862e18fb1a55bcd4e30a05430b01f6";
hash = "sha256-xl7Tr1A1cqXhAL1Bljfk68R3AB1xOgkH15LHKxjYoSc=";
};
in rec {
packages.x86_64-linux.microsa = pkgs.stdenv.mkDerivation {
name = "microsa";
src = self;
nativeBuildInputs = [ pkgs.pkg-config ];
propagatedBuildInputs = [ pkgs.wayland pkgs.glfw-wayland pkgs.libffi pkgs.alsa-lib ];
preBuild = ''
export IMGUI_DIR=${imgui_dir}
export POCKETFFT_DIR=${pocketfft}
'';
installPhase = ''
mkdir -p $out/bin
cp microsa $out/bin
'';
};
devShell.x86_64-linux = pkgs.mkShell {
name = "microsa-dev-shell";
buildInputs = packages.x86_64-linux.microsa.nativeBuildInputs ++ packages.x86_64-linux.microsa.propagatedBuildInputs;
shellHook = packages.x86_64-linux.microsa.preBuild;
};
defaultPackage.x86_64-linux = packages.x86_64-linux.microsa;
};
}