-
Notifications
You must be signed in to change notification settings - Fork 55
/
flake.nix
119 lines (110 loc) · 3.8 KB
/
flake.nix
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
description = "Dev environment for HULKs";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixgl.url = "github:guibou/nixGL";
};
outputs = { self, nixpkgs, flake-utils, naersk, nixgl }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ nixgl.overlay ];
};
naersk' = pkgs.callPackage naersk { };
nao_sdk_version = "5.9.0";
nao_sdk_environment_path = "$HOME/.naosdk/${nao_sdk_version}/environment-setup-corei7-64-aldebaran-linux";
buildInputs = with pkgs;[
# Tools
cargo
cmake
llvmPackages.clang
pkg-config
python312
rsync
rustc
rustfmt
# Libs
alsa-lib
hdf5
libGL
libogg
libxkbcommon
luajit
openssl
opusfile
pkgs.nixgl.auto.nixGLDefault
rustPlatform.bindgenHook
systemdLibs
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
mktool = manifest_path:
let
manifest = (pkgs.lib.importTOML manifest_path).package;
in
naersk'.buildPackage {
name = manifest.name;
version = manifest.version;
src = ./.;
inherit buildInputs;
cargoBuildOptions = x: x ++ [ "-p" manifest.name ];
cargoTestOptions = x: x ++ [ "-p" manifest.name ];
};
mktool_wrapper_gui = tool:
let
binary_name = pkgs.lib.strings.removeSuffix "-${tool.version}" tool.name;
wrapper = pkgs.writeShellScriptBin "${tool.name}-wrapper" ''
${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL ${tool}/bin/${binary_name} $@
'';
in
{
type = "app";
program = "${wrapper}/bin/${tool.name}-wrapper";
};
in
{
packages.twix = mktool ./tools/twix/Cargo.toml;
packages.pepsi = mktool ./tools/pepsi/Cargo.toml;
packages.fanta = mktool ./tools/fanta/Cargo.toml;
packages.annotato = mktool ./tools/annotato/Cargo.toml;
packages.behavior_simulator = mktool ./tools/behavior_simulator/Cargo.toml;
# Needed for non-nixos systems
apps.twix = mktool_wrapper_gui self.packages.${system}.twix;
# Needed for non-nixos systems
apps.annotato = mktool_wrapper_gui self.packages.${system}.annotato;
devShells = {
tools = pkgs.mkShell
rec {
inherit buildInputs;
env = {
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
};
robot = (pkgs.buildFHSUserEnv {
name = "hulk-robot-dev-env";
targetPkgs = pkgs: ([ ]);
extraOutputsToInstall = [ "dev" ];
runScript = "bash";
profile = ''
if [[ ! -f "${nao_sdk_environment_path}" ]]; then
echo "ERROR: nao sdk v${nao_sdk_version} not found! Please install it."
exit 1
fi
echo "Unsetting LD_LIBRARY_PATH..."
unset LD_LIBRARY_PATH
echo "Sourcing nao sdk v${nao_sdk_version}..."
source ${nao_sdk_environment_path}
'';
}).env;
};
}
);
}