fastsa/flake.nix

41 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2023-08-22 23:24:17 +08:00
{
description = "Micro Optical Spectrum Analyzer";
2023-09-11 19:20:51 +08:00
inputs.nixpkgs.url = github:NixOS/nixpkgs;
2023-08-22 23:24:17 +08:00
outputs = { self, nixpkgs }:
let
2023-09-11 19:20:51 +08:00
pkgs = import nixpkgs {
system = "x86_64-linux";
#config = { replaceStdenv = ({ pkgs }: pkgs.gcc13Stdenv); };
};
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-11 19:20:51 +08:00
packages.x86_64-linux.fastsa = pkgs.gcc13Stdenv.mkDerivation {
2023-09-07 19:15:07 +08:00
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-09-11 19:20:51 +08:00
devShell.x86_64-linux = pkgs.mkShell.override { stdenv = pkgs.gcc13Stdenv; } {
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
};
}