Skip to content

Commit

Permalink
nix(flake): Update nix-ros-workspace
Browse files Browse the repository at this point in the history
Provides the environment variable for the previous commit
  • Loading branch information
RandomSpaceship committed Dec 12, 2024
1 parent c562e73 commit 73c63b0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
15 changes: 11 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 17 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
inputs = {
# ros inputs
# TODO: Currently can't be updated till after issue #540 is resolved
nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay";
nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!!
nix-ros-workspace = {
url = "github:RandomSpaceship/nix-ros-workspace";
flake = false;
inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-ros-overlay.follows = "nix-ros-overlay";
};
# docs inputs
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
Expand Down Expand Up @@ -63,7 +65,7 @@
# fix colcon (silence warnings, add extensions)
(import ./software/ros_ws/colcon/overlay.nix)
# add ros workspace functionality
(import nix-ros-workspace { }).overlay
nix-ros-workspace.overlays.default
# import ros workspace packages + fixes
(import ./software/overlay.nix rosDistro)
(final: prev: {
Expand All @@ -78,6 +80,11 @@
# Freeimage is blocked by default since it has a whole bunch of CVEs.
# This means we have to explicitly permit Freeimage to allow Gazebo to run.
config.permittedInsecurePackages = [ "freeimage-unstable-2021-11-01" ];
config.allowUnfreePredicate =
pkg:
builtins.elem (pkgs.lib.getName pkg) [
"drawio"
];
};
# we don't need to apply overlays here since pkgs-unstable is only for pure python stuff
pkgs-unstable = import nixpkgs-unstable {
Expand Down Expand Up @@ -122,25 +129,13 @@
inherit devPackages name;
prebuiltPackages = standardPkgs // additionalPkgs;
prebuiltShellPackages = devShellPkgs // formatters;
releaseDomainId = productionDomainId;
environmentDomainId = devDomainId;
forceReleaseDomainId = true;
};
env = workspace.env.overrideAttrs (
{
shellHook ? "",
...
}:
{
# override the shell hook to set some environment variables
shellHook =
shellHook
+ ''
# set the ROS_DOMAIN_ID to the development ID, since by default it's set to the production ID
export ROS_DOMAIN_ID=${toString devDomainId}
'';
}
);
in
# override the env attribute (cli environment) with our modifications
workspace // { inherit env; };
workspace;

# Actually build the workspaces
default = mkWorkspace {
Expand Down Expand Up @@ -191,7 +186,7 @@
packages = {
inherit default simulation docs;

# Output the entire package set to make certain debugging easier
# Output the entire package set to make certain debugging easier
# Note that it needs to be a derivation though to make nix flake commands happy, so we just touch the output file
# so that it can "build" successfully
pkgs = pkgs.runCommand "roar-all-pkgs" { passthru = pkgs; } ''
Expand Down Expand Up @@ -241,18 +236,18 @@
}
);
nixConfig = {
# note from James Nichol - I set up a custom cache at https://qutrc-roar.cachix.org
# note from James Nichol - I set up a custom cache at https://qutrc-roar.cachix.org
# Currently I'm compiling for x86-64 and aarch64 on my machine and pushing to it whenever I make changes
# to the Nix config - contact me if you want an auth token to push your own builds
extra-substituters = [
"https://qutrc-roar.cachix.org"
"https://roar-qutrc.cachix.org"
"https://ros.cachix.org"
"https://qutrc-roar.cachix.org"
];
extra-trusted-public-keys = [
"qutrc-roar.cachix.org-1:lARPhJL+PLuGd021HeN8CQOGGiYVEVGws5za+39M1Z0="
"roar-qutrc.cachix.org-1:ZKgHZSSHH2hOAN7+83gv1gkraXze5LSEzdocPAEBNnA="
"ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo="
"qutrc-roar.cachix.org-1:lARPhJL+PLuGd021HeN8CQOGGiYVEVGws5za+39M1Z0="
];
# note that this is normally a VERY BAD IDEA but it may be needed so the docs can have internet access,
# with certain configurations. Currently, everything is configured to work offline with cached files in the git repo.
Expand Down

0 comments on commit 73c63b0

Please sign in to comment.