This repository was archived by the owner on Jan 15, 2026. It is now read-only.
forked from OxfordIonTrapGroup/nix-oitg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
67 lines (60 loc) · 2.32 KB
/
flake.nix
File metadata and controls
67 lines (60 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
nixConfig = {
extra-trusted-public-keys = "nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=";
extra-substituters = "https://nixbld.m-labs.hk";
};
inputs.extrapkg.url = "git+https://git.m-labs.hk/M-Labs/artiq-extrapkg.git"; #?ref=release-8";
outputs = { self, extrapkg }:
let
pkgs = extrapkg.pkgs;
artiq = extrapkg.packages.x86_64-linux;
python-env = pkgs.python3.withPackages(ps : [
artiq.artiq
ps.pandas
ps.matplotlib
]);
artiq-lab-tmux = pkgs.writeShellApplication {
name = "artiq-lab-tmux";
runtimeInputs = [ pkgs.tmux pkgs.bash ];
text = builtins.readFile ./src/artiq-lab-tmux.sh;
};
aqctl-andor-wrapper = pkgs.writeShellApplication {
name = "aqctl-andor-emccd-wrapped";
runtimeInputs = [ pkgs.libxml2 ]; # The camera needs this
text = ''
set -euo pipefail
# Vendor lib (Andor so)
ANDOR_LIB=/usr/local/lib
# Nix-provided deps for those vendor libs
NIX_LIBS="${pkgs.lib.makeLibraryPath [ pkgs.libxml2 ]}"
export LD_LIBRARY_PATH="$ANDOR_LIB:$NIX_LIBS''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Use whichever python is first on PATH (your activated venv inside nix shell)
exec python -m dnamic_andor_host.aqctl_andor_emccd "$@"
'';
};
artiq-master-dev = pkgs.mkShell {
name = "artiq-master-dev";
buildInputs = [
python-env
artiq-lab-tmux
aqctl-andor-wrapper
];
shellHook = ''
if [ -z "$SCRATCH_DIR" ]; then
echo "SCRATCH_DIR environment variable not set, defaulting to ~/scratch."
export SCRATCH_DIR=$HOME/scratch
export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix}
export QML2_IMPORT_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtQmlPrefix}
fi
${
./src/setup-artiq-master-dev.sh
} ${python-env} ${python-env.sitePackages} || exit 1
source $SCRATCH_DIR/nix-artiq-venvs/artiq-master-dev/bin/activate || exit 1
export PYTHONPATH="''${SCRATCH_DIR:-}''${PYTHONPATH:+:$PYTHONPATH}"
'';
};
in {
inherit artiq-master-dev;
devShells.x86_64-linux.default = artiq-master-dev;
};
}