Files
niri/flake.nix

111 lines
2.8 KiB
Nix
Raw Normal View History

# This flake file is community maintained
{
description = "Niri: A scrollable-tiling Wayland compositor.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
fenix = {
url = "github:nix-community/fenix/monthly";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-09-27 12:42:44 -04:00
outputs =
{
self,
nixpkgs,
crane,
nix-filter,
flake-utils,
fenix,
...
}:
let
systems = [
"aarch64-linux"
"x86_64-linux"
];
in
flake-utils.lib.eachSystem systems (
2024-09-27 12:42:44 -04:00
system:
let
pkgs = nixpkgs.legacyPackages.${system};
toolchain = fenix.packages.${system}.complete.toolchain;
2024-08-08 19:53:36 +02:00
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
craneArgs = {
pname = "niri";
version = self.rev or "dirty";
src = nixpkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
2024-09-27 12:42:44 -04:00
filter =
path: type:
(builtins.match "resources" path == null)
2024-09-27 12:42:44 -04:00
|| ((craneLib.filterCargoSources path type) && (builtins.match "niri-visual-tests" path == null));
};
nativeBuildInputs = with pkgs; [
pkg-config
autoPatchelfHook
clang
gdk-pixbuf
graphene
gtk4
libadwaita
];
buildInputs = with pkgs; [
wayland
systemd # For libudev
seatd # For libseat
libxkbcommon
libdisplay-info
libinput
mesa # For libgbm
fontconfig
stdenv.cc.cc.lib
pipewire
pango
cairo
glib
pixman
];
runtimeDependencies = with pkgs; [
wayland
mesa
libglvnd # For libEGL
xorg.libXcursor
xorg.libXi
libxkbcommon
];
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
2024-08-08 19:53:36 +02:00
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath craneArgs.runtimeDependencies; # Needed for tests to find libxkbcommon
};
cargoArtifacts = craneLib.buildDepsOnly craneArgs;
2024-09-27 12:42:44 -04:00
niri = craneLib.buildPackage (craneArgs // { inherit cargoArtifacts; });
in
{
2024-09-27 12:42:29 -04:00
formatter = pkgs.nixfmt-rfc-style;
checks.niri = niri;
packages.default = niri;
devShells.default = craneLib.devShell {
2024-09-27 12:42:44 -04:00
inputsFrom = [ niri ];
2024-09-27 12:42:44 -04:00
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs
);
inherit (niri) LIBCLANG_PATH;
};
}
);
}