forked from mirrors/nixpkgs
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
{ lib, stdenv, fetchFromGitLab, pkgconfig, xfce4-dev-tools, hicolor-icon-theme, xfce, wrapGAppsHook }:
|
|
|
|
{ category
|
|
, pname
|
|
, version
|
|
, attrPath ? "xfce.${pname}"
|
|
, rev-prefix ? "${pname}-"
|
|
, rev ? "${rev-prefix}${version}"
|
|
, sha256
|
|
, odd-unstable ? true
|
|
, patchlevel-unstable ? true
|
|
, ...
|
|
} @ args:
|
|
|
|
let
|
|
inherit (builtins) filter getAttr head isList;
|
|
inherit (stdenv.lib) attrNames concatLists recursiveUpdate zipAttrsWithNames;
|
|
|
|
filterAttrNames = f: attrs:
|
|
filter (n: f (getAttr n attrs)) (attrNames attrs);
|
|
|
|
concatAttrLists = attrsets:
|
|
zipAttrsWithNames (filterAttrNames isList (head attrsets)) (_: concatLists) attrsets;
|
|
|
|
template = rec {
|
|
inherit pname version;
|
|
|
|
nativeBuildInputs = [ pkgconfig xfce4-dev-tools wrapGAppsHook ];
|
|
buildInputs = [ hicolor-icon-theme ];
|
|
configureFlags = [ "--enable-maintainer-mode" ];
|
|
|
|
src = fetchFromGitLab {
|
|
domain = "gitlab.xfce.org";
|
|
owner = category;
|
|
repo = pname;
|
|
inherit rev sha256;
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
outputs = [ "out" "dev" ];
|
|
|
|
pos = builtins.unsafeGetAttrPos "pname" args;
|
|
|
|
passthru.updateScript = xfce.updateScript {
|
|
inherit pname version attrPath rev-prefix odd-unstable patchlevel-unstable;
|
|
versionLister = xfce.gitLister src.meta.homepage;
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://gitlab.xfce.org/${category}/${pname}/about";
|
|
license = licenses.gpl2; # some libraries are under LGPLv2+
|
|
platforms = platforms.linux;
|
|
};
|
|
};
|
|
|
|
publicArgs = removeAttrs args [ "category" "pname" "sha256" ];
|
|
in
|
|
|
|
stdenv.mkDerivation (recursiveUpdate template publicArgs // concatAttrLists [ template args ])
|