Files
status-app/nix/devshell.nix
T
2026-08-24 13:30:42 +03:00

93 lines
2.3 KiB
Nix

{pkgs}: let
# NOTE: llvm19+ has an issue with zxing-cpp
llvm18 = pkgs.llvmPackages_18;
mkShell18 = pkgs.mkShell.override {
inherit (llvm18) stdenv;
};
mkShell =
if pkgs.stdenv.isDarwin
then mkShell18
else pkgs.mkShell;
qt6-env = with pkgs.qt6;
env "qt6-env" [
qtbase
qtdeclarative
qtmultimedia
qtsvg
qttools
qtwebchannel
qtwebengine
qtwebview
# runtime
qt5compat
qtscxml
# storybook
qthttpserver
qtwebsockets
# statusq-tests
qtpositioning
];
in
mkShell {
packages = with pkgs;
[
cmake # 4.1.2
gcc # for nim compilation
git
go-bindata
# go_1_24 # 1.24.13
go_1_26 # 1.2
libglvnd
mockgen # v0.6.0
nim # 2.2.4
openssl
pcre
pkg-config
protobuf_21
protoc-gen-go # v1.36.10
qt6-env # 6.10.2
which
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
# TODO:
# - apple-sdk version
unstablePkgs.python313Packages.dmgbuild
fileicon
])
++ pkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
# Darwin requires system pcsclite for keycard-go
pcsclite # version? need 2.2.3
# nixGLIntel works in pure shell
# auto.nixGLDefault requires impure shell
nixgl.nixGLIntel
]);
shellHook = ''
case "$OSTYPE" in
darwin*)
# nix stdenv adds find incompatible with macos build
export PATH="/usr/bin:$PATH"
;;
esac
# Sanitizing env vars enforcing Go to use Nix provided toolchain
# GOPATH, GOCACHE, GOMODCACHE will be used from user home
unset GOROOT
export GOENV=off
export GOTOOLCHAIN=local
'';
# NOTE: LD_LIBRARY_PATH is a last resort tool
# Prefer binary RPATH, which is easy to fix with mkDerivation
LD_LIBRARY_PATH = with pkgs;
lib.makeLibraryPath [
# NOTE: RPATH is missing it
openssl
];
# NOTE: smth incorrectly sets import path during build time, this is a workaround
# QML_IMPORT_TRACE=1
# qt.qml.import: addImportPath: "/nix/store/5q4mjar3r9v4drb7wv4rfrw2cgpdp8b4-qtbase-6.9.3/lib/qt-6/qml"
QML_IMPORT_PATH = "${qt6-env}/lib/qt-6/qml";
}