-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
99 lines (90 loc) · 2.66 KB
/
Copy pathflake.nix
File metadata and controls
99 lines (90 loc) · 2.66 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
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
{
inputs = {
nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay/master";
nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!!
};
outputs =
{
self,
nix-ros-overlay,
nixpkgs,
}:
nix-ros-overlay.inputs.flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ nix-ros-overlay.overlays.default ];
};
# Little hack for running CI on multiple distros
rosDistro =
let
envRosDistro = builtins.getEnv "ROS_DISTRO";
in
if envRosDistro != "" then envRosDistro else "rolling";
rosPkgs = pkgs.rosPackages.${rosDistro};
devTools = with pkgs; [
cargo
colcon
commitlint
bun
gcc
gh
git
git-lfs
prek
prettier
python3Packages.colcon-cargo
python3Packages.colcon-ros-cargo
rustc
rustfmt
];
# Define the ROS environment with all necessary dependencies
rosEnv = rosPkgs.buildEnv {
paths = with rosPkgs; [
ros-core
ament-lint-common
# Work around https://github.com/lopsided98/nix-ros-overlay/pull/624
ament-cmake-core
python-cmake-module
# Dependencies from package.xml files
rosidl-default-generators
rosidl-default-runtime
# Needed for rclrs, https://github.com/ros2-rust/ros2_rust/issues/557
example-interfaces
test-msgs
];
};
in
{
formatter = pkgs.nixfmt-tree;
legacyPackages = rosPkgs;
devShells.default = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
name = "rfdf-shell";
packages = [
devTools
rosEnv
];
shellHook = ''
# Setup ROS 2 shell completion
if [[ ! $DIRENV_IN_ENVRC ]]; then
eval "$(${pkgs.python3Packages.argcomplete}/bin/register-python-argcomplete ros2)"
eval "$(${pkgs.python3Packages.argcomplete}/bin/register-python-argcomplete colcon)"
fi
'';
};
}
);
nixConfig = {
extra-substituters = [
"https://spikonado.cachix.org"
"https://ros.cachix.org"
"https://attic.iid.ciirc.cvut.cz/ros"
];
extra-trusted-public-keys = [
"spikonado.cachix.org-1:MwA4hqRN0+DdP7/UnTn0yvJgVu65S1S0QVnAnsguev4="
"ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo="
"ros:JR95vUYsShSqfA1VTYoFt1Nz6uXasm5QrcOsGry9f6Q="
];
};
}