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

add nix flake support #3

Closed
wants to merge 2 commits into from
Closed

add nix flake support #3

wants to merge 2 commits into from

Conversation

wucke13
Copy link

@wucke13 wucke13 commented Dec 2, 2021

Hi, I'd like to enable a seamless development experience for L4RE on nix based systems. As ham is a key component in the L4RE ecosystem, I started here. Basically, once this PR is merged anyone who happens to already have nix with flakes support installed can simply run nix run github:kernkonzept/ham and ham is automatically installed and already executed. So now, before the PR is merged, I can run nix run github:wucke13/ham and I'm already presented with the help message of ham.

@Steav005 please check this one out and look if you see any issues.

In case this wasn't obvious, I'm one of the DLR folks who intend to take L4RE to the next level 😄

@alexwarg
Copy link
Contributor

alexwarg commented Feb 3, 2022

So I did never use flake or something before, so please be patient with me. However, if I look at the dependencies in flake.nix I think: GitRepository, URI, and XMLMini should be all. All other things are not used, or not directly used by ham.

Just a comment, we will not merge the PR directly, but import the changes in our master repo internally and push an update to github when integrated.

@wucke13
Copy link
Author

wucke13 commented Feb 3, 2022

Hi @alexwarg , thank you for taking a look! I think the catch here is

not directly used by ham

I would guess they are, just that on some systems they are already installed, and thus they are hidden dependencies. If I remove all deps but GitRepository, URI and XMLMini, I get this error when running ham:

Can't locate System/Command.pm in @INC (you may need to install the System::Command module) (@INC contains: /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0/x86_64-linux-thread-multi /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0 /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl /nix/store/8334m6k80h0fd5acqkmp8hfrcgagm684-perl5.34.0-URI-5.05/lib/perl5/site_perl/5.34.0/x86_64-linux-thread-multi /nix/store/8334m6k80h0fd5acqkmp8hfrcgagm684-perl5.34.0-URI-5.05/lib/perl5/site_perl/5.34.0 /nix/store/8334m6k80h0fd5acqkmp8hfrcgagm684-perl5.34.0-URI-5.05/lib/perl5/site_perl /nix/store/dcf4qn3rs67kqa3n800jl1j6wb1gw1qf-perl5.34.0-XML-Mini-1.38/lib/perl5/site_perl/5.34.0/x86_64-linux-thread-multi /nix/store/dcf4qn3rs67kqa3n800jl1j6wb1gw1qf-perl5.34.0-XML-Mini-1.38/lib/perl5/site_perl/5.34.0 /nix/store/dcf4qn3rs67kqa3n800jl1j6wb1gw1qf-perl5.34.0-XML-Mini-1.38/lib/perl5/site_perl /nix/store/y84babjpa0ngq62pqvygsajscx7mlnks-perl-5.34.0/lib/perl5/site_perl/5.34.0/x86_64-linux-thread-multi /nix/store/y84babjpa0ngq62pqvygsajscx7mlnks-perl-5.34.0/lib/perl5/site_perl/5.34.0 /nix/store/y84babjpa0ngq62pqvygsajscx7mlnks-perl-5.34.0/lib/perl5/5.34.0/x86_64-linux-thread-multi /nix/store/y84babjpa0ngq62pqvygsajscx7mlnks-perl-5.34.0/lib/perl5/5.34.0 /nix/store/5inqqk78k9czsqpqsbwld1rn5rx9wnda-ham/opt/ham) at /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0/Git/Repository/Command.pm line 12.
BEGIN failed--compilation aborted at /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0/Git/Repository/Command.pm line 12.
Compilation failed in require at /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0/Git/Repository.pm line 11.
BEGIN failed--compilation aborted at /nix/store/5k3wpd3z5s0sl35rjc95v9g4wz74vbzz-perl5.34.0-Git-Repository-1.324/lib/perl5/site_perl/5.34.0/Git/Repository.pm line 11.
Compilation failed in require at /nix/store/5inqqk78k9czsqpqsbwld1rn5rx9wnda-ham/opt/ham/Hammer/Project.pm line 10.
BEGIN failed--compilation aborted at /nix/store/5inqqk78k9czsqpqsbwld1rn5rx9wnda-ham/opt/ham/Hammer/Project.pm line 10.
Compilation failed in require at /nix/store/5inqqk78k9czsqpqsbwld1rn5rx9wnda-ham/opt/ham/.ham-wrapped line 16.
BEGIN failed--compilation aborted at /nix/store/5inqqk78k9czsqpqsbwld1rn5rx9wnda-ham/opt/ham/.ham-wrapped line 16.

In fact, removing any of the dependencies causes a similar issue. Maybe the perl stuff in the nixpkgs is packaged in a way, that only the most essential transitive dependencies are pulled in by default? This is an artifact of how I made the package. It does not adhere to the perl conventions, thus I just abused the normal mkDerivation builder, which then unfortunately does not resolve transitive dependencies. Therefore I specified them manually.

Anyways, I'll update the version and I would be happy to see this merged/integrated :)

@herrwiese
Copy link
Contributor

Hi, @wucke13.

I'm always looking forward to attempts to make the L4Re ecosystem more Nix-friendly. :-) Irrespective to your PR, did you notice that ham is already packaged within nixpkgs?

$ nix shell nixpkgs#ham
$ ham
  ham

        print help

  ham add  [<project>...]

        Add files to the git index of individual projects.


  ham checkout <branch> [<project>...]

        checkout <branch> in all projects

        --abort-on-errors, -e
            Abort on any error, otherwise all projects will be iterated

[…]

@wucke13
Copy link
Author

wucke13 commented Feb 14, 2022

@herrwiese No, this must have escaped me. In fact, that warrants to close this PR 👍 Could you allocate maybe an hour to look into how L4Re could be built using Nix, together with me? I already have some progress in this regard, but I'd like to check with someone who has a deeper understanding of L4Re 😄

@wucke13 wucke13 closed this Feb 14, 2022
@icedieler
Copy link
Contributor

Hi @wucke13 ,
what would be the best way to contact you? We would like to arrange a short session to help you on this matter.
Best,
Matthias.

@wucke13
Copy link
Author

wucke13 commented Feb 18, 2022

Excellent! I'd like to protect my work mail address from spam and thus do not publishing it, but Adam already has it. You can also contact me on telegram and matrix (I'm on matrix.org as homeserver) - the user name is the same as on GH for both. Looking forward to hear from you 😄

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.

4 participants