diff options
| author | seth <getchoo@tuta.io> | 2024-09-30 19:16:13 -0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-10-05 12:09:24 -0700 |
| commit | 1b44e0cd20b532a440bb571e4b823c95ac3e31fd (patch) | |
| tree | abcea73b98a3326d339819e24e306baa4ef64f40 | |
| parent | b3d4d4eacc88282a5a0f5b5670904e9434ba1a2e (diff) | |
| download | niri-1b44e0cd20b532a440bb571e4b823c95ac3e31fd.tar.gz niri-1b44e0cd20b532a440bb571e4b823c95ac3e31fd.tar.bz2 niri-1b44e0cd20b532a440bb571e4b823c95ac3e31fd.zip | |
flake: add `overlay` output
| -rw-r--r-- | flake.nix | 252 |
1 files changed, 128 insertions, 124 deletions
@@ -81,132 +81,10 @@ packages = forAllSystems ( system: let - inherit (self.packages.${system}) niri; + inherit (self.overlays.default nixpkgsFor.${system} null) niri; in { - niri = nixpkgsFor.${system}.callPackage ( - { - cairo, - clang, - dbus, - libGL, - libclang, - libdisplay-info, - libinput, - libseat, - libxkbcommon, - mesa, - pango, - pipewire, - pkg-config, - rustPlatform, - systemd, - wayland, - withDbus ? true, - withSystemd ? true, - withScreencastSupport ? true, - withDinit ? false, - }: - - rustPlatform.buildRustPackage { - pname = "niri"; - version = self.shortRev or self.dirtyShortRev or "unknown"; - - src = nix-filter.lib.filter { - root = self; - include = [ - "niri-config" - "niri-ipc" - "niri-visual-tests" - "resources" - "src" - ./Cargo.lock - ./Cargo.toml - ]; - }; - - postPatch = '' - patchShebangs resources/niri-session - substituteInPlace resources/niri.service \ - --replace-fail '/usr/bin' "$out/bin" - ''; - - cargoLock = { - # NOTE: This is only used for Git dependencies - allowBuiltinFetchGit = true; - lockFile = ./Cargo.lock; - }; - - strictDeps = true; - - nativeBuildInputs = [ - clang - pkg-config - ]; - - buildInputs = - [ - cairo - dbus - libGL - libdisplay-info - libinput - libseat - libxkbcommon - mesa # libgbm - pango - wayland - ] - ++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus - ++ lib.optional withScreencastSupport pipewire - # Also includes libudev - ++ lib.optional withSystemd systemd; - - buildFeatures = - lib.optional withDbus "dbus" - ++ lib.optional withDinit "dinit" - ++ lib.optional withScreencastSupport "xdp-gnome-screencast" - ++ lib.optional withSystemd "systemd"; - buildNoDefaultFeatures = true; - - postInstall = - '' - install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions - install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal - '' - + lib.optionalString withSystemd '' - install -Dm755 resources/niri-session $out/bin/niri-session - install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user - ''; - - env = { - LIBCLANG_PATH = lib.getLib libclang + "/lib"; - - # Force linking with libEGL and libwayland-client - # so they can be discovered by `dlopen()` - CARGO_BUILD_RUSTFLAGS = toString ( - map (arg: "-C link-arg=" + arg) [ - "-Wl,--push-state,--no-as-needed" - "-lEGL" - "-lwayland-client" - "-Wl,--pop-state" - ] - ); - }; - - passthru = { - providedSessions = [ "niri" ]; - }; - - meta = { - description = "Scrollable-tiling Wayland compositor"; - homepage = "https://github.com/YaLTeR/niri"; - license = lib.licenses.gpl3Only; - mainProgram = "niri"; - platforms = lib.platforms.linux; - }; - } - ) { }; + inherit niri; # NOTE: This is for development purposes only # @@ -227,5 +105,131 @@ default = niri; } ); + + overlays.default = final: _: { + niri = final.callPackage ( + { + cairo, + clang, + dbus, + libGL, + libclang, + libdisplay-info, + libinput, + libseat, + libxkbcommon, + mesa, + pango, + pipewire, + pkg-config, + rustPlatform, + systemd, + wayland, + withDbus ? true, + withSystemd ? true, + withScreencastSupport ? true, + withDinit ? false, + }: + + rustPlatform.buildRustPackage { + pname = "niri"; + version = self.shortRev or self.dirtyShortRev or "unknown"; + + src = nix-filter.lib.filter { + root = self; + include = [ + "niri-config" + "niri-ipc" + "niri-visual-tests" + "resources" + "src" + ./Cargo.lock + ./Cargo.toml + ]; + }; + + postPatch = '' + patchShebangs resources/niri-session + substituteInPlace resources/niri.service \ + --replace-fail '/usr/bin' "$out/bin" + ''; + + cargoLock = { + # NOTE: This is only used for Git dependencies + allowBuiltinFetchGit = true; + lockFile = ./Cargo.lock; + }; + + strictDeps = true; + + nativeBuildInputs = [ + clang + pkg-config + ]; + + buildInputs = + [ + cairo + dbus + libGL + libdisplay-info + libinput + libseat + libxkbcommon + mesa # libgbm + pango + wayland + ] + ++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus + ++ lib.optional withScreencastSupport pipewire + # Also includes libudev + ++ lib.optional withSystemd systemd; + + buildFeatures = + lib.optional withDbus "dbus" + ++ lib.optional withDinit "dinit" + ++ lib.optional withScreencastSupport "xdp-gnome-screencast" + ++ lib.optional withSystemd "systemd"; + buildNoDefaultFeatures = true; + + postInstall = + '' + install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions + install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal + '' + + lib.optionalString withSystemd '' + install -Dm755 resources/niri-session $out/bin/niri-session + install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user + ''; + + env = { + LIBCLANG_PATH = lib.getLib libclang + "/lib"; + + # Force linking with libEGL and libwayland-client + # so they can be discovered by `dlopen()` + CARGO_BUILD_RUSTFLAGS = toString ( + map (arg: "-C link-arg=" + arg) [ + "-Wl,--push-state,--no-as-needed" + "-lEGL" + "-lwayland-client" + "-Wl,--pop-state" + ] + ); + }; + + passthru = { + providedSessions = [ "niri" ]; + }; + + meta = { + description = "Scrollable-tiling Wayland compositor"; + homepage = "https://github.com/YaLTeR/niri"; + license = lib.licenses.gpl3Only; + mainProgram = "niri"; + platforms = lib.platforms.linux; + }; + } + ) { }; + }; }; } |
