Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I bring up roscore if the ros packages are installed using homemanager #380

Open
konnpaku-youmu opened this issue Mar 27, 2024 · 0 comments

Comments

@konnpaku-youmu
Copy link

Hi, I'm pretty new to NixOS and I'm trying to work with ROS1 on NixOS. After successfully installed ros-core with Home Manager, I'm wondering how I can bring up roscore as in other Linux distributions. Has anyone tried the same thing? Thanks in advance.

Here are my nix files:

Home Manager: default.nix

{ config, lib, pkgs, ... }:
{
        imports = [
                ./wayland
                ./modules
        ];
        home.username = "xxx";
        home.homeDirectory = "/home/xxx";
        home.packages = with pkgs; [
                pulseaudio
                pavucontrol

                telegram-desktop

                bottom
                lm_sensors
                pciutils
                usbutils

                yosys

                jp2a
                catimg

                rosPackages.rosbash
                rosPackages.ros-core
                rosPackages.catkin
                rosPackages.gazebo-ros
                rosPackages.rviz
                rosPackages.turtlebot3-gazebo
        ];

        home.stateVersion = "23.11";
        programs.home-manager.enable = true;
}

flake.nix

{
  inputs = {
    # NOTE: Replace "nixos-23.11" with that which is in system.stateVersion of
    # configuration.nix. You can also use latter versions if you wish to
    # upgrade.
    nixpkgs.url = "github:lopsided98/nixpkgs/nix-ros";
    flake-utils.url = "github:numtide/flake-utils";
    nurpkgs.url = "github:nix-community/NUR";
    nixos-hardware.url = "github:NixOS/nixos-hardware";
    nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay";

    home-manager = {
      url = "github:nix-community/home-manager/release-23.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland.url = "github:hyprwm/Hyprland";

    nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
  };

  outputs = { self, nur, home-manager, nixpkgs, flake-utils, nix-ros-overlay , ... }@inputs:
    let
      user = "xxx";
      hostname = "nixHome";
      overlay = final: prev: {
        rosPackages = prev.rosPackages.noetic.overrideScope
          (rosSelf: rosSuper: {
            rosgraph = rosSuper.rosgraph.overrideAttrs
              ({ patches ? [ ], ... }: {
                patches = patches ++ [ ./rosgraph-2353.patch ];
              });
          });
      };
    in {
      overlays.default = (nixpkgs.lib.composeManyExtensions [
        nix-ros-overlay.overlays.default
        overlay
      ]);

      
          nixosConfigurations.${hostname} = inputs.nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        specialArgs.flake-inputs = inputs;

                modules = [
          ./configuration.nix
          { nixpkgs.overlays = [ self.overlays.default ]; }
          home-manager.nixosModules.home-manager
          {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.extraSpecialArgs = { inherit inputs user; };
            home-manager.users.${user}.imports = [ ./home ];
          }

        ];
      };
    };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant