Skip to content

Instantly share code, notes, and snippets.

@whacked
Last active November 27, 2021 16:28
Show Gist options
  • Save whacked/b79407b3493d54639620fe0a71775d19 to your computer and use it in GitHub Desktop.
Save whacked/b79407b3493d54639620fe0a71775d19 to your computer and use it in GitHub Desktop.
nix shell env to build https://github.com/quiet/quiet
{ pkgs ? import <nixpkgs> {} }:
let
libfec = pkgs.stdenv.mkDerivation rec {
pname = "libfec";
version = "0.0.1";
src = pkgs.fetchFromGitHub {
owner = "quiet";
repo = "libfec";
rev = "master";
sha256 = "0i6jhrdswr1wglyb9h39idpz5v9z13yhidvlbj34vxpyngrkhlvs";
};
nativeBuildInputs = [ pkgs.cmake ];
};
liquidDspDev = pkgs.stdenv.mkDerivation rec {
pname = "liquid-dsp-dev";
version = "0.0.1";
src = pkgs.fetchFromGitHub {
owner = "quiet";
repo = "liquid-dsp";
rev = "devel";
sha256 = "17x3cvzc5nchrfw2nl70fx9q0hc0kcb8kwq3dm95qy70q63dij4m";
};
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [
libfec
];
};
in pkgs.mkShell {
buildInputs = [
pkgs.cmake
pkgs.jansson
pkgs.libsndfile
pkgs.portaudio
liquidDspDev
];
shellHook = ''
build-quiet() {
# ref bootstrap
project_dir=$(dirname ${__curPos.file})
build_dir=$project_dir/build
mkdir -p $build_dir
pushd $build_dir
# this appears to be hard-coded in CMakeLists.txt
mkdir -p share/quiet
cp $project_dir/quiet-profiles.json share/quiet/
cmake -DCMAKE_INSTALL_PREFIX=$build_dir ..
make -j$(nproc)
popd
}
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment