niri
Clone
https://git.tahinli.com/Tahinli/niri.git
0 watching0 forksRustGPL-3.012.1 MiB64a9351Ivan Molodetskikh2 years ago1319 commits
| 1 | # This flake file is community maintained |
| 2 | { |
| 3 | description = "Niri: A scrollable-tiling Wayland compositor."; |
| 4 | |
| 5 | inputs = { |
| 6 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
| 7 | crane = { |
| 8 | url = "github:ipetkov/crane"; |
| 9 | inputs.nixpkgs.follows = "nixpkgs"; |
| 10 | }; |
| 11 | flake-utils.url = "github:numtide/flake-utils"; |
| 12 | nix-filter.url = "github:numtide/nix-filter"; |
| 13 | fenix = { |
| 14 | url = "github:nix-community/fenix/monthly"; |
| 15 | inputs.nixpkgs.follows = "nixpkgs"; |
| 16 | }; |
| 17 | }; |
| 18 | |
| 19 | outputs = { |
| 20 | self, |
| 21 | nixpkgs, |
| 22 | crane, |
| 23 | nix-filter, |
| 24 | flake-utils, |
| 25 | fenix, |
| 26 | ... |
| 27 | }: let |
| 28 | systems = ["aarch64-linux" "x86_64-linux"]; |
| 29 | in |
| 30 | flake-utils.lib.eachSystem systems ( |
| 31 | system: let |
| 32 | pkgs = nixpkgs.legacyPackages.${system}; |
| 33 | toolchain = fenix.packages.${system}.complete.toolchain; |
| 34 | craneLib = (crane.mkLib pkgs).overrideToolchain toolchain; |
| 35 | |
| 36 | craneArgs = { |
| 37 | pname = "niri"; |
| 38 | version = self.rev or "dirty"; |
| 39 | |
| 40 | src = nixpkgs.lib.cleanSourceWith { |
| 41 | src = craneLib.path ./.; |
| 42 | filter = path: type: |
| 43 | (builtins.match "resources" path == null) |
| 44 | || ((craneLib.filterCargoSources path type) |
| 45 | && (builtins.match "niri-visual-tests" path == null)); |
| 46 | }; |
| 47 | |
| 48 | nativeBuildInputs = with pkgs; [ |
| 49 | pkg-config |
| 50 | autoPatchelfHook |
| 51 | clang |
| 52 | gdk-pixbuf |
| 53 | graphene |
| 54 | gtk4 |
| 55 | libadwaita |
| 56 | ]; |
| 57 | |
| 58 | buildInputs = with pkgs; [ |
| 59 | wayland |
| 60 | systemd # For libudev |
| 61 | seatd # For libseat |
| 62 | libxkbcommon |
| 63 | libinput |
| 64 | mesa # For libgbm |
| 65 | fontconfig |
| 66 | stdenv.cc.cc.lib |
| 67 | pipewire |
| 68 | pango |
| 69 | cairo |
| 70 | glib |
| 71 | pixman |
| 72 | ]; |
| 73 | |
| 74 | runtimeDependencies = with pkgs; [ |
| 75 | wayland |
| 76 | mesa |
| 77 | libglvnd # For libEGL |
| 78 | xorg.libXcursor |
| 79 | xorg.libXi |
| 80 | libxkbcommon |
| 81 | ]; |
| 82 | |
| 83 | LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; |
| 84 | LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath craneArgs.runtimeDependencies; # Needed for tests to find libxkbcommon |
| 85 | }; |
| 86 | |
| 87 | cargoArtifacts = craneLib.buildDepsOnly craneArgs; |
| 88 | niri = craneLib.buildPackage (craneArgs // {inherit cargoArtifacts;}); |
| 89 | in { |
| 90 | formatter = pkgs.alejandra; |
| 91 | |
| 92 | checks.niri = niri; |
| 93 | packages.default = niri; |
| 94 | |
| 95 | devShells.default = craneLib.devShell { |
| 96 | inputsFrom = [niri]; |
| 97 | |
| 98 | LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs); |
| 99 | inherit (niri) LIBCLANG_PATH; |
| 100 | }; |
| 101 | } |
| 102 | ); |
| 103 | } |