diff --git a/pkgs/by-name/ri/river/build.zig.zon.nix b/pkgs/by-name/ri/river/build.zig.zon.nix index 94151aa03e5f..38529cfe603b 100644 --- a/pkgs/by-name/ri/river/build.zig.zon.nix +++ b/pkgs/by-name/ri/river/build.zig.zon.nix @@ -1,34 +1,123 @@ -# generated by zon2nix (https://github.com/nix-community/zon2nix) +# generated by zon2nix (https://github.com/Cloudef/zig2nix) -{ linkFarm, fetchzip }: +{ + lib, + linkFarm, + fetchurl, + fetchgit, + runCommandLocal, + zig, + name ? "zig-packages", +}: -linkFarm "zig-packages" [ +with builtins; +with lib; + +let + unpackZigArtifact = + { name, artifact }: + runCommandLocal name + { + nativeBuildInputs = [ zig ]; + } + '' + hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})" + mv "$TMPDIR/p/$hash" "$out" + chmod 755 "$out" + ''; + + fetchZig = + { + name, + url, + hash, + }: + let + artifact = fetchurl { inherit url hash; }; + in + unpackZigArtifact { inherit name artifact; }; + + fetchGitZig = + { + name, + url, + hash, + }: + let + parts = splitString "#" url; + url_base = elemAt parts 0; + url_without_query = elemAt (splitString "?" url_base) 0; + rev_base = elemAt parts 1; + rev = if match "^[a-fA-F0-9]{40}$" rev_base != null then rev_base else "refs/heads/${rev_base}"; + in + fetchgit { + inherit name rev hash; + url = url_without_query; + deepClone = false; + }; + + fetchZigArtifact = + { + name, + url, + hash, + }: + let + parts = splitString "://" url; + proto = elemAt parts 0; + path = elemAt parts 1; + fetcher = { + "git+http" = fetchGitZig { + inherit name hash; + url = "http://${path}"; + }; + "git+https" = fetchGitZig { + inherit name hash; + url = "https://${path}"; + }; + http = fetchZig { + inherit name hash; + url = "http://${path}"; + }; + https = fetchZig { + inherit name hash; + url = "https://${path}"; + }; + }; + in + fetcher.${proto}; +in +linkFarm name [ + { + name = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56"; + path = fetchZigArtifact { + name = "zig-pixman"; + url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz"; + hash = "sha256-CYgFIOR9H5q8UUpFglaixOocCMT6FGpcKQQBUVWpDKQ="; + }; + } { name = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242"; - path = fetchzip { + path = fetchZigArtifact { + name = "zig-wayland"; url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz"; - hash = "sha256-dvit+yvc0MnipqWjxJdfIsA6fJaJZOaIpx4w4woCxbE="; + hash = "sha256-gxzkHLCq2NqX3l4nEly92ARU5dqP1SqnjpGMDgx4TXA="; }; } { name = "122083317b028705b5d27be12976feebf17066a4e51802b3b5e9f970bec580e433e1"; - path = fetchzip { + path = fetchZigArtifact { + name = "zig-wlroots"; url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.18.1.tar.gz"; - hash = "sha256-fru44ZCuDpd8fc5qp80oAcQO3Jwy3ouywWURhltek+U="; - }; - } - { - name = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56"; - path = fetchzip { - url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz"; - hash = "sha256-zcfZEMnipWDPuptl9UN0PoaJDjy2EHc7Wwi4GQq3hkY="; + hash = "sha256-S77/Own9/GjhLCCE/eI56pdpmhlvMVP41WZ27b+Sook="; }; } { name = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f"; - path = fetchzip { + path = fetchZigArtifact { + name = "zig-xkbcommon"; url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz"; - hash = "sha256-T+EZiStBfmxFUjaX05WhYkFJ8tRok/UQtpc9QY9NxZk="; + hash = "sha256-f5oEJU5i2qeVN3GBrnQcqzEJCiOT7l4ak7GQ6gw5cH0="; }; } ] diff --git a/pkgs/by-name/ri/river/package.nix b/pkgs/by-name/ri/river/package.nix index 7cb285fb0cf8..b96f58a2fa7c 100644 --- a/pkgs/by-name/ri/river/package.nix +++ b/pkgs/by-name/ri/river/package.nix @@ -1,29 +1,30 @@ -{ lib -, stdenv -, callPackage -, fetchFromGitea -, libGL -, libX11 -, libevdev -, libinput -, libxkbcommon -, pixman -, pkg-config -, scdoc -, udev -, wayland -, wayland-protocols -, wayland-scanner -, wlroots_0_18 -, xwayland -, zig_0_13 -, withManpages ? true -, xwaylandSupport ? true +{ + lib, + stdenv, + callPackage, + fetchFromGitea, + libGL, + libX11, + libevdev, + libinput, + libxkbcommon, + pixman, + pkg-config, + scdoc, + udev, + wayland, + wayland-protocols, + wayland-scanner, + wlroots_0_18, + xwayland, + zig_0_13, + withManpages ? true, + xwaylandSupport ? true, }: stdenv.mkDerivation (finalAttrs: { pname = "river"; - version = "0.3.6"; + version = "0.3.7"; outputs = [ "out" ] ++ lib.optionals withManpages [ "man" ]; @@ -33,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: { repo = "river"; rev = "refs/tags/v${finalAttrs.version}"; fetchSubmodules = true; - hash = "sha256-bLUotGbKHlMxNn8kC613cFp41qTXoxtwo0O4mZQLl7w="; + hash = "sha256-4ac0LGQtLldHyXJ2GIRMHV+VZfUrRFdBYLiAHX5lWcw="; }; deps = callPackage ./build.zig.zon.nix { }; @@ -43,8 +44,7 @@ stdenv.mkDerivation (finalAttrs: { wayland-scanner xwayland zig_0_13.hook - ] - ++ lib.optional withManpages scdoc; + ] ++ lib.optional withManpages scdoc; buildInputs = [ libGL @@ -60,10 +60,13 @@ stdenv.mkDerivation (finalAttrs: { dontConfigure = true; - zigBuildFlags = [ - "--system" - "${finalAttrs.deps}" - ] ++ lib.optional withManpages "-Dman-pages" ++ lib.optional xwaylandSupport "-Dxwayland"; + zigBuildFlags = + [ + "--system" + "${finalAttrs.deps}" + ] + ++ lib.optional withManpages "-Dman-pages" + ++ lib.optional xwaylandSupport "-Dxwayland"; postInstall = '' install contrib/river.desktop -Dt $out/share/wayland-sessions @@ -71,7 +74,7 @@ stdenv.mkDerivation (finalAttrs: { passthru = { providedSessions = [ "river" ]; - updateScript = ./update.nu; + updateScript = ./update.sh; }; meta = { diff --git a/pkgs/by-name/ri/river/update.nu b/pkgs/by-name/ri/river/update.nu deleted file mode 100755 index a14e241e0bcf..000000000000 --- a/pkgs/by-name/ri/river/update.nu +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i nu -p nushell common-updater-scripts zon2nix - -let latest_tag = list-git-tags --url=https://codeberg.org/river/river | lines | sort --natural | str replace v '' | last -update-source-version river $latest_tag - -http get $"https://codeberg.org/river/river/raw/tag/v($latest_tag)/build.zig.zon" | save build.zig.zon -zon2nix | save -f pkgs/by-name/ri/river/build.zig.zon.nix -rm build.zig.zon diff --git a/pkgs/by-name/ri/river/update.sh b/pkgs/by-name/ri/river/update.sh new file mode 100755 index 000000000000..1cca378b3daf --- /dev/null +++ b/pkgs/by-name/ri/river/update.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style + +latest_tag=$(list-git-tags --url=https://codeberg.org/river/river | sed 's/^v//' | tail -n 1) + +update-source-version river "$latest_tag" + +wget "https://codeberg.org/river/river/raw/tag/v${latest_tag}/build.zig.zon" +nix --extra-experimental-features 'nix-command flakes' run github:Cloudef/zig2nix#zon2nix -- build.zig.zon >pkgs/by-name/ri/river/build.zig.zon.nix +# strip file protocol +sed -i '\|file = unpackZigArtifact { inherit name; artifact = /. + path; };|d' pkgs/by-name/ri/river/build.zig.zon.nix +nixfmt pkgs/by-name/ri/river/build.zig.zon.nix + +rm -f build.zig.zon build.zig.zon2json-lock