all: embrace unit packages where possible

This commit is contained in:
xeals 2023-02-23 11:46:04 +11:00
parent e053da240d
commit 5410671050
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C
16 changed files with 21 additions and 26 deletions

View File

@ -15,10 +15,28 @@
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
in in
{ {
# nixos/rfcs#140
# Only produces the package set of the proposed functionality.
# Unstable names are variables.
packages = packages =
lib.filterAttrs let
(_: drv: builtins.elem system (drv.meta.platforms or [ ])) unitDir = "unit";
(import ./pkgs/top-level/all-packages.nix { inherit pkgs; }); packageFun = "package.nix";
callUnitRoot = root:
let
shards = lib.attrNames (builtins.readDir root);
namesForShard = shard: lib.mapAttrs'
(name: _: { inherit name; value = "${root}/${shard}/${name}"; })
(builtins.readDir "${root}/${shard}");
namesToPath = lib.foldl' lib.recursiveUpdate { } (map namesForShard shards);
units = lib.mapAttrs (_: path: pkgs.callPackage "${path}/${packageFun}" { }) namesToPath;
in
units;
legacyPackages = import ./pkgs/top-level/all-packages.nix { inherit pkgs; };
onlyAvailable = lib.filterAttrs (_: drv: builtins.elem system (drv.meta.platforms or [ ]));
in
onlyAvailable (legacyPackages // callUnitRoot "${./pkgs}/${unitDir}");
checks = { checks = {
nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" '' nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" ''

View File

@ -1,15 +1,6 @@
{ pkgs }: { pkgs }:
rec { rec {
# Alacritty with the unmerged ligature patches applied.
alacritty-ligatures = pkgs.callPackage ../applications/terminal-emulators/alacritty-ligatures { };
atlauncher = pkgs.callPackage ../games/atlauncher { };
amdgpu-fan = pkgs.callPackage ../tools/misc/amdgpu-fan { };
cardboard = pkgs.callPackage ../applications/window-managers/cardboard { };
goModules = pkgs.recurseIntoAttrs rec { goModules = pkgs.recurseIntoAttrs rec {
qt = pkgs.libsForQt512.callPackage ../development/go-modules/qt { }; qt = pkgs.libsForQt512.callPackage ../development/go-modules/qt { };
}; };
@ -34,14 +25,10 @@ rec {
ideaUltimateWithPlugins = ideaUltimatePlugins.jetbrainsWithPlugins; ideaUltimateWithPlugins = ideaUltimatePlugins.jetbrainsWithPlugins;
}; };
libhl = pkgs.callPackage ../development/libraries/libhl { };
mopidy-subidy = pkgs.callPackage ../applications/audio/mopidy/subidy.nix { mopidy-subidy = pkgs.callPackage ../applications/audio/mopidy/subidy.nix {
python3Packages = pkgs.python3Packages // python3Packages; python3Packages = pkgs.python3Packages // python3Packages;
}; };
pam_gnupg = pkgs.callPackage ../os-specific/linux/pam_gnupg { };
picom-animations = pkgs.picom.overrideAttrs (_oldAttrs: { picom-animations = pkgs.picom.overrideAttrs (_oldAttrs: {
pname = "picom-animations"; pname = "picom-animations";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -58,8 +45,6 @@ rec {
patches = (oldAttrs.patches or [ ]) ++ [ ../applications/misc/polybar/9button.patch ]; patches = (oldAttrs.patches or [ ]) ++ [ ../applications/misc/polybar/9button.patch ];
}); });
psst = pkgs.callPackage ../applications/audio/psst { };
python3Packages = pkgs.recurseIntoAttrs { python3Packages = pkgs.recurseIntoAttrs {
py-sonic = pkgs.python3.pkgs.callPackage ../development/python-modules/py-sonic { }; py-sonic = pkgs.python3.pkgs.callPackage ../development/python-modules/py-sonic { };
}; };
@ -73,12 +58,4 @@ rec {
protonmail-bridge-headless = protonmailBridgePackages.protonmail-bridge-headless; protonmail-bridge-headless = protonmailBridgePackages.protonmail-bridge-headless;
radeon-profile-daemon = pkgs.libsForQt5.callPackage ../tools/misc/radeon-profile-daemon { }; radeon-profile-daemon = pkgs.libsForQt5.callPackage ../tools/misc/radeon-profile-daemon { };
samrewritten = pkgs.callPackage ../tools/misc/samrewritten { };
spotify-ripper = pkgs.callPackage ../tools/misc/spotify-ripper { };
ytarchive = pkgs.callPackage ../tools/misc/ytarchive { };
zsh-z = pkgs.callPackage ../shells/zsh/zsh-z { };
} }