Unverified Commit de0ded25 authored by Adam C. Stephens's avatar Adam C. Stephens
Browse files
parent 2003ac15
Loading
Loading
Loading
Loading
+105 −16
Original line number Diff line number Diff line
# 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",
}:

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; };

linkFarm "zig-packages" [
  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=";
    };
  }
]
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "river";
  version = "0.3.6";
  version = "0.3.7";

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

@@ -34,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 { };