-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Nix Flake Co-authored-by: Bryce Berger <[email protected]> * Describe nix flake in readme * Add `niri-config` to build source list * Add maintainer info Add comment at top to indicate the Nix Flake file is community maintained. * Clarify Nix/NixOS README instructions * Shorten Nix/NixOS build instructions Co-authored-by: Ivan Molodetskikh <[email protected]> * Move NixOS installation instruction to "Tip" section --------- Co-authored-by: Bryce Berger <[email protected]> Co-authored-by: Ivan Molodetskikh <[email protected]>
- Loading branch information
1 parent
b2df3e1
commit 236abd9
Showing
4 changed files
with
254 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/target | ||
/result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# This flake file is community maintained | ||
# Maintainers: | ||
# Bill Sun (github/billksun) | ||
{ | ||
description = "Niri: A scrollable-tiling Wayland compositor."; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
crane = { | ||
url = "github:ipetkov/crane"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
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"; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
crane, | ||
nix-filter, | ||
flake-utils, | ||
fenix, | ||
... | ||
}: let | ||
systems = ["aarch64-linux" "x86_64-linux"]; | ||
in | ||
flake-utils.lib.eachSystem systems ( | ||
system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
toolchain = fenix.packages.${system}.complete.toolchain; | ||
craneLib = crane.lib.${system}.overrideToolchain toolchain; | ||
|
||
craneArgs = { | ||
pname = "niri"; | ||
version = self.rev or "dirty"; | ||
|
||
src = nix-filter.lib.filter { | ||
root = ./.; | ||
include = [ | ||
./src | ||
./niri-config | ||
./Cargo.toml | ||
./Cargo.lock | ||
./resources | ||
]; | ||
}; | ||
|
||
nativeBuildInputs = with pkgs; [ | ||
pkg-config | ||
autoPatchelfHook | ||
clang | ||
]; | ||
|
||
buildInputs = with pkgs; [ | ||
wayland | ||
systemd # For libudev | ||
seatd # For libseat | ||
libxkbcommon | ||
libinput | ||
mesa # For libgbm | ||
fontconfig | ||
stdenv.cc.cc.lib | ||
pipewire | ||
]; | ||
|
||
runtimeDependencies = with pkgs; [ | ||
wayland | ||
mesa | ||
libglvnd # For libEGL | ||
]; | ||
|
||
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; | ||
}; | ||
|
||
cargoArtifacts = craneLib.buildDepsOnly craneArgs; | ||
niri = craneLib.buildPackage (craneArgs // {inherit cargoArtifacts;}); | ||
in { | ||
formatter = pkgs.alejandra; | ||
|
||
checks.niri = niri; | ||
packages.default = niri; | ||
|
||
devShells.default = pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} { | ||
inherit (niri) nativeBuildInputs buildInputs LIBCLANG_PATH; | ||
packages = niri.runtimeDependencies; | ||
|
||
# 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" | ||
]; | ||
}; | ||
} | ||
); | ||
} |