From 16f8bcfe708f6f49b715be4260c28d23425ce243 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 8 Oct 2024 21:56:48 +0300 Subject: [PATCH 1/7] hyprland: format Use `inherit (lib) x` instead of `lib.x` Remove no-longer-needed jq Use importJSON --- pkgs/by-name/hy/hyprland/package.nix | 61 +++++++++++++++++----------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/pkgs/by-name/hy/hyprland/package.nix b/pkgs/by-name/hy/hyprland/package.nix index 99a80aa30187..0beb44f8aebe 100644 --- a/pkgs/by-name/hy/hyprland/package.nix +++ b/pkgs/by-name/hy/hyprland/package.nix @@ -15,7 +15,6 @@ hyprlang, hyprutils, hyprwayland-scanner, - jq, libGL, libdrm, libexecinfo, @@ -45,15 +44,30 @@ enableNvidiaPatches ? false, }: let - info = builtins.fromJSON (builtins.readFile ./info.json); + inherit (lib.asserts) assertMsg; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.lists) + concatLists + optionals + ; + inherit (lib.strings) + makeBinPath + optionalString + cmakeBool + ; + inherit (lib.trivial) + importJSON + ; + + info = importJSON ./info.json; in -assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; -assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; -assert lib.assertMsg (!hidpiXWayland) +assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; +assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; +assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; stdenv.mkDerivation (finalAttrs: { - pname = "hyprland" + lib.optionalString debug "-debug"; + pname = "hyprland" + optionalString debug "-debug"; version = "0.43.0"; src = fetchFromGitHub { @@ -93,7 +107,6 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ hyprwayland-scanner - jq makeWrapper cmake ninja @@ -108,7 +121,7 @@ stdenv.mkDerivation (finalAttrs: { "dev" ]; - buildInputs = + buildInputs = concatLists [ [ aquamarine cairo @@ -129,32 +142,33 @@ stdenv.mkDerivation (finalAttrs: { wayland-protocols xorg.libXcursor ] - ++ lib.optionals stdenv.hostPlatform.isBSD [ epoll-shim ] - ++ lib.optionals stdenv.hostPlatform.isMusl [ libexecinfo ] - ++ lib.optionals enableXWayland [ + (optionals stdenv.hostPlatform.isBSD [ epoll-shim ]) + (optionals stdenv.hostPlatform.isMusl [ libexecinfo ]) + (optionals enableXWayland [ xorg.libxcb xorg.libXdmcp xorg.xcbutilerrors xorg.xcbutilwm xwayland - ] - ++ lib.optionals withSystemd [ systemd ]; + ]) + (optionals withSystemd [ systemd ]) + ]; cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; dontStrip = debug; - cmakeFlags = [ - (lib.cmakeBool "NO_XWAYLAND" (!enableXWayland)) - (lib.cmakeBool "LEGACY_RENDERER" legacyRenderer) - (lib.cmakeBool "NO_SYSTEMD" (!withSystemd)) - ]; + cmakeFlags = mapAttrsToList cmakeBool { + "NO_XWAYLAND" = !enableXWayland; + "LEGACY_RENDERER" = legacyRenderer; + "NO_SYSTEMD" = !withSystemd; + }; postInstall = '' - ${lib.optionalString wrapRuntimeDeps '' + ${optionalString wrapRuntimeDeps '' wrapProgram $out/bin/Hyprland \ --suffix PATH : ${ - lib.makeBinPath [ + makeBinPath [ binutils pciutils pkgconf @@ -163,9 +177,10 @@ stdenv.mkDerivation (finalAttrs: { ''} ''; - passthru.providedSessions = [ "hyprland" ]; - - passthru.updateScript = ./update.sh; + passthru = { + providedSessions = [ "hyprland" ]; + updateScript = ./update.sh; + }; meta = { homepage = "https://github.com/hyprwm/Hyprland"; From 43bf94409f98b6a5cdb34bb1c461c80fbe6425f9 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 8 Oct 2024 22:01:42 +0300 Subject: [PATCH 2/7] hyprland: use moldLinker via stdenvAdapters Leave open the possibility of adding multiple adapters in the future. --- pkgs/by-name/hy/hyprland/package.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/hy/hyprland/package.nix b/pkgs/by-name/hy/hyprland/package.nix index 0beb44f8aebe..e08f6da130cb 100644 --- a/pkgs/by-name/hy/hyprland/package.nix +++ b/pkgs/by-name/hy/hyprland/package.nix @@ -1,6 +1,7 @@ { lib, stdenv, + stdenvAdapters, fetchFromGitHub, pkg-config, makeWrapper, @@ -44,6 +45,9 @@ enableNvidiaPatches ? false, }: let + inherit (builtins) + foldl' + ; inherit (lib.asserts) assertMsg; inherit (lib.attrsets) mapAttrsToList; inherit (lib.lists) @@ -60,13 +64,21 @@ let ; info = importJSON ./info.json; + + # possibility to add more adapters in the future, such as keepDebugInfo, + # which would be controlled by the `debug` flag + adapters = [ + stdenvAdapters.useMoldLinker + ]; + + customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters; in assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; -stdenv.mkDerivation (finalAttrs: { +customStdenv.mkDerivation (finalAttrs: { pname = "hyprland" + optionalString debug "-debug"; version = "0.43.0"; @@ -142,8 +154,8 @@ stdenv.mkDerivation (finalAttrs: { wayland-protocols xorg.libXcursor ] - (optionals stdenv.hostPlatform.isBSD [ epoll-shim ]) - (optionals stdenv.hostPlatform.isMusl [ libexecinfo ]) + (optionals customStdenv.hostPlatform.isBSD [ epoll-shim ]) + (optionals customStdenv.hostPlatform.isMusl [ libexecinfo ]) (optionals enableXWayland [ xorg.libxcb xorg.libXdmcp From 359a25b1fa47cd89826bfae268440be007a7b866 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 8 Oct 2024 22:06:32 +0300 Subject: [PATCH 3/7] hyprland: use meson for building Follow upstream. --- pkgs/by-name/hy/hyprland/package.nix | 34 ++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/hy/hyprland/package.nix b/pkgs/by-name/hy/hyprland/package.nix index e08f6da130cb..e3ae1a176b52 100644 --- a/pkgs/by-name/hy/hyprland/package.nix +++ b/pkgs/by-name/hy/hyprland/package.nix @@ -6,6 +6,7 @@ pkg-config, makeWrapper, cmake, + meson, ninja, aquamarine, binutils, @@ -57,7 +58,8 @@ let inherit (lib.strings) makeBinPath optionalString - cmakeBool + mesonBool + mesonEnable ; inherit (lib.trivial) importJSON @@ -90,11 +92,6 @@ customStdenv.mkDerivation (finalAttrs: { hash = "sha256-+wE97utoDfhQP6AMdZHUmBeL8grbce/Jv2i5M+6AbaE="; }; - patches = [ - # forces GCC to use -std=c++26 on CMake < 3.30 - "${finalAttrs.src}/nix/stdcxx.patch" - ]; - postPatch = '' # Fix hardcoded paths to /usr installation sed -i "s#/usr#$out#" src/render/OpenGL.cpp @@ -120,11 +117,13 @@ customStdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ hyprwayland-scanner makeWrapper - cmake + meson ninja pkg-config - python3 # for udis86 wayland-scanner + # for udis86 + cmake + python3 ]; outputs = [ @@ -166,15 +165,22 @@ customStdenv.mkDerivation (finalAttrs: { (optionals withSystemd [ systemd ]) ]; - cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; + mesonBuildType = if debug then "debugoptimized" else "release"; dontStrip = debug; - cmakeFlags = mapAttrsToList cmakeBool { - "NO_XWAYLAND" = !enableXWayland; - "LEGACY_RENDERER" = legacyRenderer; - "NO_SYSTEMD" = !withSystemd; - }; + mesonFlags = concatLists [ + (mapAttrsToList mesonEnable { + "xwayland" = enableXWayland; + "legacy_renderer" = legacyRenderer; + "systemd" = withSystemd; + }) + (mapAttrsToList mesonBool { + # PCH provides no benefits when building with Nix + "b_pch" = false; + "tracy_enable" = false; + }) + ]; postInstall = '' ${optionalString wrapRuntimeDeps '' From 51b85c5d18065941b05be44852034017279e28ec Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 8 Oct 2024 22:07:31 +0300 Subject: [PATCH 4/7] hyprland: 0.43.0 -> 0.44.0 --- pkgs/by-name/hy/hyprland/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/hy/hyprland/package.nix b/pkgs/by-name/hy/hyprland/package.nix index e3ae1a176b52..a3a7d061dc1f 100644 --- a/pkgs/by-name/hy/hyprland/package.nix +++ b/pkgs/by-name/hy/hyprland/package.nix @@ -82,14 +82,14 @@ assert assertMsg (!hidpiXWayland) customStdenv.mkDerivation (finalAttrs: { pname = "hyprland" + optionalString debug "-debug"; - version = "0.43.0"; + version = "0.44.0"; src = fetchFromGitHub { owner = "hyprwm"; repo = "hyprland"; fetchSubmodules = true; rev = "refs/tags/v${finalAttrs.version}"; - hash = "sha256-+wE97utoDfhQP6AMdZHUmBeL8grbce/Jv2i5M+6AbaE="; + hash = "sha256-XgDhPx+tKs+2lyWM/ZqIHnMArd/c0LGmwAwu0EG1uJM="; }; postPatch = '' From 50c0415679cf230cdd3d65be4a5fec9417e8feff Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Wed, 9 Oct 2024 11:11:14 +0300 Subject: [PATCH 5/7] hyprpicker: format --- .../hyprwm/hyprpicker/default.nix | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix index 0ee4884f5b6f..f7e2e5329ef1 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix @@ -1,26 +1,27 @@ -{ lib -, stdenv -, fetchFromGitHub -, pkg-config -, cmake -, ninja -, cairo -, fribidi -, libGL -, libdatrie -, libjpeg -, libselinux -, libsepol -, libthai -, libxkbcommon -, pango -, pcre -, util-linux -, wayland -, wayland-protocols -, wayland-scanner -, libXdmcp -, debug ? false +{ + lib, + stdenv, + fetchFromGitHub, + pkg-config, + cmake, + ninja, + cairo, + fribidi, + libGL, + libdatrie, + libjpeg, + libselinux, + libsepol, + libthai, + libxkbcommon, + pango, + pcre, + util-linux, + wayland, + wayland-protocols, + wayland-scanner, + libXdmcp, + debug ? false, }: stdenv.mkDerivation (finalAttrs: { pname = "hyprpicker" + lib.optionalString debug "-debug"; @@ -65,11 +66,11 @@ stdenv.mkDerivation (finalAttrs: { install -Dm644 $src/LICENSE -t $out/share/licenses/hyprpicker ''; - meta = with lib; { + meta = { description = "Wlroots-compatible Wayland color picker that does not suck"; homepage = "https://github.com/hyprwm/hyprpicker"; - license = licenses.bsd3; - maintainers = with maintainers; [ fufexan ]; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ fufexan ]; platforms = wayland.meta.platforms; mainProgram = "hyprpicker"; }; From acb4f3cbb35563a90435fc2ba13a50732b3062dd Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Wed, 9 Oct 2024 11:13:49 +0300 Subject: [PATCH 6/7] hyprpicker: drop unused dependencies --- .../hyprwm/hyprpicker/default.nix | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix index f7e2e5329ef1..7487a2131ec5 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix @@ -4,19 +4,11 @@ fetchFromGitHub, pkg-config, cmake, - ninja, cairo, - fribidi, libGL, - libdatrie, libjpeg, - libselinux, - libsepol, - libthai, libxkbcommon, pango, - pcre, - util-linux, wayland, wayland-protocols, wayland-scanner, @@ -38,27 +30,19 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake - ninja pkg-config ]; buildInputs = [ cairo - fribidi libGL - libdatrie libjpeg - libselinux - libsepol - libthai libxkbcommon pango - pcre wayland wayland-protocols wayland-scanner libXdmcp - util-linux ]; postInstall = '' From 95bdf20d2ea7acc18ea98d4f4fb7789b81c81e91 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Wed, 9 Oct 2024 11:16:33 +0300 Subject: [PATCH 7/7] hyprpicker: 0.3.0 -> 0.4.1 --- .../window-managers/hyprwm/hyprpicker/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix index 7487a2131ec5..7d54fa161072 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprpicker/default.nix @@ -2,9 +2,12 @@ lib, stdenv, fetchFromGitHub, + nix-update-script, pkg-config, cmake, cairo, + hyprutils, + hyprwayland-scanner, libGL, libjpeg, libxkbcommon, @@ -17,24 +20,26 @@ }: stdenv.mkDerivation (finalAttrs: { pname = "hyprpicker" + lib.optionalString debug "-debug"; - version = "0.3.0"; + version = "0.4.1"; src = fetchFromGitHub { owner = "hyprwm"; repo = "hyprpicker"; rev = "v${finalAttrs.version}"; - hash = "sha256-BYQF1zM6bJ44ag9FJ0aTSkhOTY9U7uRdp3SmRCs5fJM="; + hash = "sha256-gu26MSYbTlRLMUpZ9PeYXtqqhzPDQXxEDkjiJgwzIIc="; }; cmakeBuildType = if debug then "Debug" else "Release"; nativeBuildInputs = [ cmake + hyprwayland-scanner pkg-config ]; buildInputs = [ cairo + hyprutils libGL libjpeg libxkbcommon @@ -50,6 +55,8 @@ stdenv.mkDerivation (finalAttrs: { install -Dm644 $src/LICENSE -t $out/share/licenses/hyprpicker ''; + passthru.updateScript = nix-update-script { }; + meta = { description = "Wlroots-compatible Wayland color picker that does not suck"; homepage = "https://github.com/hyprwm/hyprpicker";