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

feat: added a nixStatic docker image #29

Merged
merged 3 commits into from
Jun 27, 2022
Merged

Conversation

teto
Copy link

@teto teto commented Oct 26, 2021

an annoying thing about static nix:

bash-5.1# nix-env -iA glibc -f https://github.com/NixOS/nixpkgs/archive/23f71e9427c7cd2a6f87a167b4f6dc170b4431df.tar.gz  
unpacking 'https://github.com/NixOS/nixpkgs/archive/23f71e9427c7cd2a6f87a167b4f6dc170b4431df.tar.gz'...
error: attribute 'unsafeDiscardStringContext' missing, at /nix/store/r3n7lyc3sb64qx18ai1qay1gx18c07dy-23f71e9427c7cd2a6f87a167b4f6dc170b4431df.tar.gz/lib/strings.nix:442:13

@teto
Copy link
Author

teto commented Nov 2, 2021

@zimbatm passes CI now

@zimbatm
Copy link
Member

zimbatm commented Nov 2, 2021

@teto is the image including references to the /nix/store? You might have to rewrite the original nix image to clean that up.

@zimbatm
Copy link
Member

zimbatm commented Nov 15, 2021

Is the PR ready?

@teto
Copy link
Author

teto commented Nov 25, 2021

sadly no sry. I dont have much time to complete it right now. Is it ok to leave it pending ? I can close it anyway.
IIRC the nix binary works but there are still references to the nix store.

@zimbatm
Copy link
Member

zimbatm commented Nov 28, 2021

no worries, let's just leave it like that in case somebody else wants to take over

Use the same version of nixpkgs as the shell itself
@zimbatm zimbatm force-pushed the static branch 2 times, most recently from 0d3067a to d0af823 Compare June 27, 2022 15:01
This is a special docker images that contains no /nix/store. And only
static binaries in /bin.

The main use-case is to be able to bind-mount /nix from the host
into the container.
@zimbatm
Copy link
Member

zimbatm commented Jun 27, 2022

finally got around and finished this!

@zimbatm zimbatm merged commit 910b593 into nix-community:master Jun 27, 2022
@teto teto deleted the static branch June 27, 2022 19:48
@teto
Copy link
Author

teto commented Jun 27, 2022

good that you could work around this, we are moving our runners towards nixos (which solve most of the problem) si I probably would never have gotten around to finishing this :s

@zimbatm
Copy link
Member

zimbatm commented Jun 29, 2022

actually the static nix binary is currently segfaulting when run inside of the container, so it looks like it's not entirely static

@zimbatm
Copy link
Member

zimbatm commented Jun 29, 2022

Turns out the user home needs to exist. I added a complementary entrypoint and wrapper script: https://github.com/nix-community/docker-nixpkgs/tree/master/images/nix-unstable-static#using-the-container-with-the-host-store

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