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 {
2023-09-07 19:15:07 +08:00
packages.x86_64-linux.fastsa = pkgs.stdenv.mkDerivation {
name = "fastsa";
2023-08-23 11:08:54 +08:00
src = self;
nativeBuildInputs = [ pkgs.pkg-config ];
2023-09-07 20:17:02 +08:00
propagatedBuildInputs = [ pkgs.wayland pkgs.glfw-wayland pkgs.libffi pkgs.libbladeRF ];
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
2023-09-07 19:15:07 +08:00
cp fastsa $out/bin
2023-08-23 11:08:54 +08:00
'';
};
2023-08-22 23:24:17 +08:00
devShell.x86_64-linux = pkgs.mkShell {
2023-09-07 19:15:07 +08:00
name = "fastsa-dev-shell";
buildInputs = packages.x86_64-linux.fastsa.nativeBuildInputs ++ packages.x86_64-linux.fastsa.propagatedBuildInputs;
shellHook = packages.x86_64-linux.fastsa.preBuild;
2023-08-22 23:24:17 +08:00
};
2023-09-07 19:15:07 +08:00
defaultPackage.x86_64-linux = packages.x86_64-linux.fastsa;
2023-08-22 23:24:17 +08:00
};
}