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

Modify library_checking to play nicely on NixOS #125

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

Conversation

DAlperin
Copy link

Nixos does not follow conventional FHS meaning the assumptions about library paths can't be trusted. This patch fixes that. I'm working on packaging Yugabyte for Nixos, so this is my first patch towards that end. The next patch is an equally small change to the yugabyte db proper that I will file sometime soon.

Also in the interest of making less assumptions, this patch makes sure that the env is set correctly.

@mbautin
Copy link
Contributor

mbautin commented Aug 1, 2022

Thanks for the contribution and sorry for the delay! Can you share some of the instructions of how to set up and configure NixOS to run the build?

@mbautin
Copy link
Contributor

mbautin commented Aug 1, 2022

Also what is FHS?

@DAlperin
Copy link
Author

DAlperin commented Aug 1, 2022

@mbautin here is an example of how I built YugabyteDB on NixOS, the instructions are in comments at the top of each file: https://gist.github.com/DAlperin/b63cf1d383d7e4108d0241c69f12918a

FHS is the filesystem standard most systems use. For example,
/bin
/lib
/usr
/opt
/sys
etc...
NixOS does not conform to this standard, thus breaking software which assumes the FHS is present. For a better explanation, see here https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

@mbautin
Copy link
Contributor

mbautin commented Aug 1, 2022

@DAlperin thanks for the clarification. What is a good way to get a usable NixOS development environment in a Docker container? I tried docker run. -it nixos/nix but I am not sure if that gives me the environment that would allow to use the .nix files you provided.

return capture_all_output(
['patchelf', '--print-needed', file_path],
env=env,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to remove all environment variables except PATH?

Copy link
Author

Choose a reason for hiding this comment

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

We don't per se, but in my use case the PATH variable was not being picked up unless I explicitly included it, like so

@@ -317,6 +319,9 @@ def __init__(self) -> None:
"^.* => /lib/",
"^.* => /usr/lib/x86_64-linux-gnu/",
"^.* => /opt/yb-build/brew/linuxbrew",
"^.* => /nix/store/",
"/bin/sh:",
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to understand where this pattern comes from.

Copy link
Author

Choose a reason for hiding this comment

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

/nix/store is where everything in nixos lives including libraries, the /bin/sh: pattern is to exclude warnings generated by the tooling attempting to use /bin/sh which was doing something weird on nixos IIRC

@DAlperin
Copy link
Author

What is a good way to get a usable NixOS development environment in a Docker container?

I don't know that you can run nixos itself under docker. But it might work with just the nix package manager as provided by the docker image? I'm not sure.

@DAlperin
Copy link
Author

DAlperin commented Sep 9, 2022

@mbautin, just checking on this

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.

2 participants