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

executables like sudo in NixOS come from /run/wrappers/bin #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shivaraj-bh
Copy link
Member

If not present, sudo command will fail to run in NixOS if someone is sharing this configuration across NixOS, macOS and other linux distro.

This is on my NixOS:

shivaraj in 🌐 nixos in nix-dev-home on ξ‚  export-wrappers-path
❯ which sudo
/run/wrappers/bin/sudo

If not present, sudo command will fail to run in NixOS if someone is sharing this
configuration across NixOS, macOS and other linux distro.
@shivaraj-bh
Copy link
Member Author

If not present, it might be symlinked elsewhere, like:

❯ which sudo
/run/current-system/sw/bin/sudo

Leading to:

❯ sudo
sudo: /run/current-system/sw/bin/sudo must be owned by uid 0 and have the setuid bit set

Copy link
Collaborator

@srid srid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not present, sudo command will fail to run in NixOS if someone is sharing this configuration across NixOS, macOS and other linux distro.

Why is this happening? I never had to face this myself in https://github.com/srid/nixos-config despite sharing like that (with the exception of other Linux distro which I do not use).

Copy link
Collaborator

@srid srid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's do this - but add this PATH only when we are on NixOS.

$ nix run nixpkgs#lsb-release -- -i -s
"NixOS"

(This command is unavailable on Darwin though)

@srid
Copy link
Collaborator

srid commented Mar 17, 2024

Alternatively, we can just test for stdenv.isLinux.

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

Successfully merging this pull request may close these issues.

None yet

2 participants