-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Fix nix build
#579
Fix nix build
#579
Conversation
@sodiboo hi |
Sadly this is probably unrelated to the issues @sodiboo is facing, since they use a custom build process instead of the one supplied by this repo's |
Well, I still want someone who knows nix to take a look |
It's worth noting that I was investigating this issue the other day. I got it down to a change made in Rust nightly I'm exhausted right now, though, and I will probably take a look at this PR tomorrow. |
flake.nix
Outdated
niri = craneLib.buildPackage (craneArgs // {inherit cargoArtifacts;}); | ||
niri = craneLib.buildPackage (craneArgs // { | ||
inherit cargoArtifacts; | ||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath craneArgs.runtimeDependencies; # Needed for tests to find libxkbcommon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being added here instead of to craneArgs
, like with LIBCLANG_PATH
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add it in craneArgs
because craneArgs
is also used for creating cargoArtifacts
, and it's technically not necessary there.
I could also just move it to craneArgs
though, it shouldn't make any difference, I simply tried to keep everything as clean as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if I put LD_LIBRARY_PATH
into craneArgs
, I'd have to turn craneArgs
into a recursive attrset in order to access the runtimeDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have to turn
craneArgs
into a recursive attrset in order to access theruntimeDependencies
craneArgs
is in scope though. you can just move the line up without changing a single char on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I didn't know that was possible. I rebased it now to use craneArgs
, and also fixed the deprecation warning:
warning: `crane.lib.${system}` is deprecated. please use `(crane.mkLib nixpkgs.legacyPackages.${system})` instead
d0207cf
to
1daec2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! does what it says on the tin (fixes nix build
) and now the diff is also really pretty :3. i'd ask to fix cargo build
on NixOS in the same go but uhh, that's a whole 'nother can of worms. i tried. it's awful. i'll submit another PR sometime. this one could do with maybe a nix flake update
and then let's merge it!
Should be ready to merge now, but what do you mean by fixing A simple diff --git a/flake.nix b/flake.nix
index f8c4b63..9b7562e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -77,6 +77,15 @@
xorg.libXcursor
xorg.libXi
libxkbcommon
+ pipewire
+ pango
+ glib
+ cairo
+ seatd
+ systemd
+ libinput
+ pixman
+ mesa # For libgbm
];
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; (I simply added these packages to It isn't really obvious why this would make any differences, as most of these packages are already part of However, when inspecting the resulting |
More experimentation: Running nix-repl> builtins.map toString packages.x86_64-linux.default.buildInputs
[
"/nix/store/dhafvd6slhk8hz8g0hvqnqh5i9fmqma4-wayland-1.23.0-dev"
"/nix/store/prf4i4plz0k43jz0ghyzlf7gwmi8rjvg-systemd-256.2-dev"
"/nix/store/x4ai78x8i92qz2bxpvp9wzgl0k31jvw7-seatd-0.8.0-dev"
"/nix/store/8pbh705kblpkhlg25lax7hcfh2zcv2ab-libxkbcommon-1.7.0-dev"
"/nix/store/gj93mj1hks0xrsj20n7f3dfsdcd471s9-libinput-1.26.1-dev"
"/nix/store/xgpdv93w3kkvp45ip1xym55z72crz7v0-mesa-24.1.4-dev"
"/nix/store/zs4v7bsmxvblgv02nak0wcxpjncw80jf-fontconfig-2.15.0-dev"
"/nix/store/kgmfgzb90h658xg0i7mxh9wgyx0nrqac-gcc-13.3.0-lib"
"/nix/store/cw78ndjp827zan6hpdk41c45ynfwqrvk-pipewire-1.2.1-dev"
"/nix/store/khwdaapk8l3kfy764j71cir1lafr5bpm-pango-1.52.2-dev"
] This shows that, for whatever reason, the |
Thanks; let's do the cargo run fix in a separate PR |
yoo turns out I don't need to do that anymore. it's almost certainly because of thanks to @getchoo for pointing me in the right direction for that (unbeknownst to him) this breaks builds with Fenix, such as our package at the time: |
Currently, running
nix build
in this repo to build niri using theflake.nix
file fails because the tests during the check phase can't find certain runtime dependencies (likelibxkbcommon
).This PR fixes this by simply passing the required runtime dependencies to the phases themselves using the
LD_LIBRARY_PATH
environment variable, fixing the tests without changing the resulting output.