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

fix cargo run on nixos #628

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 10 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
src = nixpkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = path: type:
(builtins.match "resources" path == null) ||
((craneLib.filterCargoSources path type) &&
(builtins.match "niri-visual-tests" path == null));
(builtins.match "resources" path == null)
|| ((craneLib.filterCargoSources path type)
&& (builtins.match "niri-visual-tests" path == null));
};

nativeBuildInputs = with pkgs; [
Expand All @@ -68,6 +68,9 @@
stdenv.cc.cc.lib
pipewire
pango
cairo
glib
pixman
];

runtimeDependencies = with pkgs; [
Expand All @@ -91,22 +94,11 @@
checks.niri = niri;
packages.default = niri;

devShells.default = pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} rec {
inherit (niri) LIBCLANG_PATH;
packages = niri.runtimeDependencies ++ niri.nativeBuildInputs ++ niri.buildInputs;

# Force linking to libEGL, which is always dlopen()ed, and to
# libwayland-client, which is always dlopen()ed except by the
# obscure winit backend.
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-Wl,--pop-state"
];
devShells.default = craneLib.devShell {
inputsFrom = [niri];

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
PKG_CONFIG_PATH = pkgs.lib.makeLibraryPath packages;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs);
inherit (niri) LIBCLANG_PATH;
};
}
);
Expand Down