Unverified Commit 63c5a1bc authored by Adam C. Stephens's avatar Adam C. Stephens
Browse files
parent 7246b4b3
Loading
Loading
Loading
Loading
+13 −98
Original line number Diff line number Diff line
# generated by zon2nix (https://github.com/Cloudef/zig2nix)
# generated by zon2nix (https://github.com/nix-community/zon2nix)

{
  lib,
  linkFarm,
  fetchurl,
  fetchzip,
  fetchgit,
  runCommandLocal,
  zig,
  name ? "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,
      rev ? throw "rev is required, remove and regenerate the zon2json-lock file",
    }:
    let
      parts = splitString "#" url;
      url_base = elemAt parts 0;
      url_without_query = elemAt (splitString "?" url_base) 0;
    in
    fetchgit {
      inherit name rev hash;
      url = url_without_query;
      deepClone = false;
    };

  fetchZigArtifact =
    {
      name,
      url,
      hash,
      ...
    }@args:
    let
      parts = splitString "://" url;
      proto = elemAt parts 0;
      path = elemAt parts 1;
      fetcher = {
        "git+http" = fetchGitZig (
          args
          // {
            url = "http://${path}";
          }
        );
        "git+https" = fetchGitZig (
          args
          // {
            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 [
linkFarm "zig-packages" [
  {
    name = "pixman-0.3.0-LClMnz2VAAAs7QSCGwLimV5VUYx0JFnX5xWU6HwtMuDX";
    path = fetchZigArtifact {
      name = "pixman";
    path = fetchzip {
      url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.3.0.tar.gz";
      hash = "sha256-zX/jQV1NWGhalP3t0wjpmUo38BKCiUDPtgNGHefyxq0=";
      hash = "sha256-8tA4auo5FEI4IPnomV6bkpQHUe302tQtorFQZ1l14NU=";
    };
  }
  {
    name = "wayland-0.3.0-lQa1kjPIAQDmhGYpY-zxiRzQJFHQ2VqhJkQLbKKdt5wl";
    path = fetchZigArtifact {
      name = "wayland";
    path = fetchzip {
      url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.3.0.tar.gz";
      hash = "sha256-xU8IrETSFOKKQQMgwVyRKLwGaek4USaKXg49S9oHSTQ=";
      hash = "sha256-ydEavD9z20wRwn9ZVX56ZI2T5i1tnm3LupVxfa30o84=";
    };
  }
  {
    name = "wlroots-0.18.2-jmOlchnIAwBq45_cxU1V3OWErxxJjQZlc9PyJfR-l3uk";
    path = fetchZigArtifact {
      name = "wlroots";
      url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.18.2.tar.gz";
      hash = "sha256-4/MGFCCgMeN6+oCaj0Z5dsbVo3s88oYk1+q0mMXrj8I=";
    name = "wlroots-0.19.1-jmOlcs7dAwCajnVWlQZIc-ySYjRlbLxy0F5FvTQqYA3P";
    path = fetchzip {
      url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.19.1.tar.gz";
      hash = "sha256-37s4hXaYeKAyZySWZOMQP3BHz7EzxVNpj0dhJcPJoTM=";
    };
  }
  {
    name = "xkbcommon-0.3.0-VDqIe3K9AQB2fG5ZeRcMC9i7kfrp5m2rWgLrmdNn9azr";
    path = fetchZigArtifact {
      name = "xkbcommon";
    path = fetchzip {
      url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz";
      hash = "sha256-HhhUI+ayPtlylhTmZ1GrdSLbRIffTg3MeisGN1qs2iM=";
      hash = "sha256-e5bPEfxl4SQf0cqccLt/py1KOW1+Q1+kWZUEXBbh9oQ=";
    };
  }
]
+6 −9
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
  wayland,
  wayland-protocols,
  wayland-scanner,
  wlroots_0_18,
  wlroots_0_19,
  xwayland,
  zig_0_14,
  withManpages ? true,
@@ -24,7 +24,7 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "river";
  version = "0.3.9";
  version = "0.3.10";

  outputs = [ "out" ] ++ lib.optionals withManpages [ "man" ];

@@ -32,14 +32,11 @@ stdenv.mkDerivation (finalAttrs: {
    domain = "codeberg.org";
    owner = "river";
    repo = "river";
    rev = "refs/tags/v${finalAttrs.version}";
    fetchSubmodules = true;
    hash = "sha256-g6qjSkvcA2Ud4W+/NVzYZjiWoWkAuKvuD20KlO/zGhE=";
    hash = "sha256-mTS62HT/v/5af/PTsNcDIrl7GUczP55+VCumQIii6y4=";
    tag = "v${finalAttrs.version}";
  };

  deps = callPackage ./build.zig.zon.nix {
    zig = zig_0_14;
  };
  deps = callPackage ./build.zig.zon.nix { };

  nativeBuildInputs = [
    pkg-config
@@ -57,7 +54,7 @@ stdenv.mkDerivation (finalAttrs: {
    udev
    wayland
    wayland-protocols
    wlroots_0_18
    wlroots_0_19
  ] ++ lib.optional xwaylandSupport libX11;

  dontConfigure = true;
+4 −6
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style
#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style zon2nix

latest_tag=$(list-git-tags --url=https://codeberg.org/river/river | sed 's/^v//' | tail -n 1)
latest_tag=$(list-git-tags --url=https://codeberg.org/river/river | sed 's/^v//' | sort --version-sort | tail --lines=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
zon2nix build.zig.zon >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
rm -f build.zig.zon build.zig.zon.nix