nixpkgs/pkgs/desktops/xfce/mkXfceDerivation.nix

61 lines
1.7 KiB
Nix
Raw Normal View History

2021-01-17 02:21:50 +00:00
{ lib, stdenv, fetchFromGitLab, pkg-config, 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:
2017-12-17 15:02:52 +00:00
let
inherit (builtins) filter getAttr head isList;
2021-01-15 13:21:58 +00:00
inherit (lib) attrNames concatLists recursiveUpdate zipAttrsWithNames;
2017-12-17 15:02:52 +00:00
filterAttrNames = f: attrs:
filter (n: f (getAttr n attrs)) (attrNames attrs);
concatAttrLists = attrsets:
zipAttrsWithNames (filterAttrNames isList (head attrsets)) (_: concatLists) attrsets;
template = rec {
2020-12-27 20:28:16 +00:00
inherit pname version;
2017-12-17 15:02:52 +00:00
2021-01-17 02:21:50 +00:00
nativeBuildInputs = [ pkg-config xfce4-dev-tools wrapGAppsHook ];
buildInputs = [ hicolor-icon-theme ];
2017-12-17 15:02:52 +00:00
configureFlags = [ "--enable-maintainer-mode" ];
src = fetchFromGitLab {
domain = "gitlab.xfce.org";
owner = category;
repo = pname;
inherit rev sha256;
2017-12-17 15:02:52 +00:00
};
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}";
2021-03-02 12:07:57 +00:00
license = licenses.gpl2Plus; # some libraries are under LGPLv2+
2017-12-17 15:02:52 +00:00
platforms = platforms.linux;
};
};
publicArgs = removeAttrs args [ "category" "pname" "sha256" ];
in
stdenv.mkDerivation (recursiveUpdate template publicArgs // concatAttrLists [ template args ])
# TODO [ AndersonTorres ]: verify if it allows using hash attribute as an option to sha256