fix `cargo run` on nixos
Browse files at this commitdd919fe01b7d235c8e23660732bf24aa4629c8b5Parent: f86a9be2 changed files +16 -24
- flake.lock +6 -6
- flake.nix +10 -18
flake.lockmodified+6 -6
| @@ -7,11 +7,11 @@ | ||
| 7 | 7 | ] |
| 8 | 8 | }, |
| 9 | 9 | "locked": { |
| 10 | - "lastModified": 1722960479, | |
| 11 | - "narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=", | |
| 10 | + "lastModified": 1724533099, | |
| 11 | + "narHash": "sha256-ZIDtvVQHoCkNoBlLUB3wmqbqCb0Es3DfdUGeDI/58aY=", | |
| 12 | 12 | "owner": "ipetkov", |
| 13 | 13 | "repo": "crane", |
| 14 | - "rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4", | |
| 14 | + "rev": "7543c8d76f91b8844e0f3b3cc347a72d8fb4b49e", | |
| 15 | 15 | "type": "github" |
| 16 | 16 | }, |
| 17 | 17 | "original": { |
| @@ -77,11 +77,11 @@ | ||
| 77 | 77 | }, |
| 78 | 78 | "nixpkgs": { |
| 79 | 79 | "locked": { |
| 80 | - "lastModified": 1723572004, | |
| 81 | - "narHash": "sha256-U5gKtbKuPahB02iGeGHFPlKr/HqrvSsHlEDEXoVyaPc=", | |
| 80 | + "lastModified": 1724395761, | |
| 81 | + "narHash": "sha256-zRkDV/nbrnp3Y8oCADf5ETl1sDrdmAW6/bBVJ8EbIdQ=", | |
| 82 | 82 | "owner": "NixOS", |
| 83 | 83 | "repo": "nixpkgs", |
| 84 | - "rev": "19674872444bb3e0768249e724d99c8649c3bd78", | |
| 84 | + "rev": "ae815cee91b417be55d43781eb4b73ae1ecc396c", | |
| 85 | 85 | "type": "github" |
| 86 | 86 | }, |
| 87 | 87 | "original": { |
flake.nixmodified+10 -18
| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | src = nixpkgs.lib.cleanSourceWith { |
| 43 | 43 | src = craneLib.path ./.; |
| 44 | 44 | filter = path: type: |
| 45 | - (builtins.match "resources" path == null) || | |
| 46 | - ((craneLib.filterCargoSources path type) && | |
| 47 | - (builtins.match "niri-visual-tests" path == null)); | |
| 45 | + (builtins.match "resources" path == null) | |
| 46 | + || ((craneLib.filterCargoSources path type) | |
| 47 | + && (builtins.match "niri-visual-tests" path == null)); | |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | nativeBuildInputs = with pkgs; [ |
| @@ -68,6 +68,9 @@ | ||
| 68 | 68 | stdenv.cc.cc.lib |
| 69 | 69 | pipewire |
| 70 | 70 | pango |
| 71 | + cairo | |
| 72 | + glib | |
| 73 | + pixman | |
| 71 | 74 | ]; |
| 72 | 75 | |
| 73 | 76 | runtimeDependencies = with pkgs; [ |
| @@ -91,22 +94,11 @@ | ||
| 91 | 94 | checks.niri = niri; |
| 92 | 95 | packages.default = niri; |
| 93 | 96 | |
| 94 | - devShells.default = pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} rec { | |
| 95 | - inherit (niri) LIBCLANG_PATH; | |
| 96 | - packages = niri.runtimeDependencies ++ niri.nativeBuildInputs ++ niri.buildInputs; | |
| 97 | - | |
| 98 | - # Force linking to libEGL, which is always dlopen()ed, and to | |
| 99 | - # libwayland-client, which is always dlopen()ed except by the | |
| 100 | - # obscure winit backend. | |
| 101 | - RUSTFLAGS = map (a: "-C link-arg=${a}") [ | |
| 102 | - "-Wl,--push-state,--no-as-needed" | |
| 103 | - "-lEGL" | |
| 104 | - "-lwayland-client" | |
| 105 | - "-Wl,--pop-state" | |
| 106 | - ]; | |
| 97 | + devShells.default = craneLib.devShell { | |
| 98 | + inputsFrom = [niri]; | |
| 107 | 99 | |
| 108 | - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; | |
| 109 | - PKG_CONFIG_PATH = pkgs.lib.makeLibraryPath packages; | |
| 100 | + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs); | |
| 101 | + inherit (niri) LIBCLANG_PATH; | |
| 110 | 102 | }; |
| 111 | 103 | } |
| 112 | 104 | ); |