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 | "locked": { | 9 | "locked": { |
| 10 | - "lastModified": 1722960479, | 10 | + "lastModified": 1724533099, |
| 11 | - "narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=", | 11 | + "narHash": "sha256-ZIDtvVQHoCkNoBlLUB3wmqbqCb0Es3DfdUGeDI/58aY=", |
| 12 | "owner": "ipetkov", | 12 | "owner": "ipetkov", |
| 13 | "repo": "crane", | 13 | "repo": "crane", |
| 14 | - "rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4", | 14 | + "rev": "7543c8d76f91b8844e0f3b3cc347a72d8fb4b49e", |
| 15 | "type": "github" | 15 | "type": "github" |
| 16 | }, | 16 | }, |
| 17 | "original": { | 17 | "original": { |
| @@ -77,11 +77,11 @@ | |||
| 77 | }, | 77 | }, |
| 78 | "nixpkgs": { | 78 | "nixpkgs": { |
| 79 | "locked": { | 79 | "locked": { |
| 80 | - "lastModified": 1723572004, | 80 | + "lastModified": 1724395761, |
| 81 | - "narHash": "sha256-U5gKtbKuPahB02iGeGHFPlKr/HqrvSsHlEDEXoVyaPc=", | 81 | + "narHash": "sha256-zRkDV/nbrnp3Y8oCADf5ETl1sDrdmAW6/bBVJ8EbIdQ=", |
| 82 | "owner": "NixOS", | 82 | "owner": "NixOS", |
| 83 | "repo": "nixpkgs", | 83 | "repo": "nixpkgs", |
| 84 | - "rev": "19674872444bb3e0768249e724d99c8649c3bd78", | 84 | + "rev": "ae815cee91b417be55d43781eb4b73ae1ecc396c", |
| 85 | "type": "github" | 85 | "type": "github" |
| 86 | }, | 86 | }, |
| 87 | "original": { | 87 | "original": { |
flake.nixmodified+10 -18
| @@ -42,9 +42,9 @@ | |||
| 42 | src = nixpkgs.lib.cleanSourceWith { | 42 | src = nixpkgs.lib.cleanSourceWith { |
| 43 | src = craneLib.path ./.; | 43 | src = craneLib.path ./.; |
| 44 | filter = path: type: | 44 | filter = path: type: |
| 45 | - (builtins.match "resources" path == null) || | 45 | + (builtins.match "resources" path == null) |
| 46 | - ((craneLib.filterCargoSources path type) && | 46 | + || ((craneLib.filterCargoSources path type) |
| 47 | - (builtins.match "niri-visual-tests" path == null)); | 47 | + && (builtins.match "niri-visual-tests" path == null)); |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | nativeBuildInputs = with pkgs; [ | 50 | nativeBuildInputs = with pkgs; [ |
| @@ -68,6 +68,9 @@ | |||
| 68 | stdenv.cc.cc.lib | 68 | stdenv.cc.cc.lib |
| 69 | pipewire | 69 | pipewire |
| 70 | pango | 70 | pango |
| 71 | + cairo | ||
| 72 | + glib | ||
| 73 | + pixman | ||
| 71 | ]; | 74 | ]; |
| 72 | 75 | ||
| 73 | runtimeDependencies = with pkgs; [ | 76 | runtimeDependencies = with pkgs; [ |
| @@ -91,22 +94,11 @@ | |||
| 91 | checks.niri = niri; | 94 | checks.niri = niri; |
| 92 | packages.default = niri; | 95 | packages.default = niri; |
| 93 | 96 | ||
| 94 | - devShells.default = pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} rec { | 97 | + devShells.default = craneLib.devShell { |
| 95 | - inherit (niri) LIBCLANG_PATH; | 98 | + inputsFrom = [niri]; |
| 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 | - ]; | ||
| 107 | 99 | ||
| 108 | - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; | 100 | + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs); |
| 109 | - PKG_CONFIG_PATH = pkgs.lib.makeLibraryPath packages; | 101 | + inherit (niri) LIBCLANG_PATH; |
| 110 | }; | 102 | }; |
| 111 | } | 103 | } |
| 112 | ); | 104 | ); |