fastsa/flake.nix

38 lines
1.3 KiB
Nix
Raw Normal View History

2023-08-22 23:24:17 +08:00
{
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"; };
2023-08-23 11:08:54 +08:00
imgui_dir = "${pkgs.imgui}/include/imgui";
2023-08-23 19:57:01 +08:00
pocketfft = pkgs.fetchgit {
url = "https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git";
rev = "ecd78caa1c862e18fb1a55bcd4e30a05430b01f6";
hash = "sha256-xl7Tr1A1cqXhAL1Bljfk68R3AB1xOgkH15LHKxjYoSc=";
};
2023-08-23 11:08:54 +08:00
in rec {
packages.x86_64-linux.microsa = pkgs.stdenv.mkDerivation {
name = "microsa";
src = self;
nativeBuildInputs = [ pkgs.pkg-config ];
2023-08-23 19:46:36 +08:00
propagatedBuildInputs = [ pkgs.wayland pkgs.glfw-wayland pkgs.libffi pkgs.alsa-lib ];
2023-08-23 11:08:54 +08:00
preBuild = ''
export IMGUI_DIR=${imgui_dir}
2023-08-23 19:57:01 +08:00
export POCKETFFT_DIR=${pocketfft}
2023-08-23 11:08:54 +08:00
'';
installPhase = ''
mkdir -p $out/bin
cp microsa $out/bin
'';
};
2023-08-22 23:24:17 +08:00
devShell.x86_64-linux = pkgs.mkShell {
name = "microsa-dev-shell";
2023-08-23 19:56:50 +08:00
buildInputs = packages.x86_64-linux.microsa.nativeBuildInputs ++ packages.x86_64-linux.microsa.propagatedBuildInputs;
2023-08-23 11:08:54 +08:00
shellHook = packages.x86_64-linux.microsa.preBuild;
2023-08-22 23:24:17 +08:00
};
2023-08-23 11:08:54 +08:00
defaultPackage.x86_64-linux = packages.x86_64-linux.microsa;
2023-08-22 23:24:17 +08:00
};
}