diff --git a/flake.nix b/flake.nix index 9259520..a21531a 100644 --- a/flake.nix +++ b/flake.nix @@ -15,10 +15,28 @@ pkgs = import nixpkgs { inherit system; }; in { + # nixos/rfcs#140 + # Only produces the package set of the proposed functionality. + # Unstable names are variables. packages = - lib.filterAttrs - (_: drv: builtins.elem system (drv.meta.platforms or [ ])) - (import ./pkgs/top-level/all-packages.nix { inherit pkgs; }); + let + unitDir = "unit"; + 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 = { nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8ac4065..13bc757 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1,15 +1,6 @@ { pkgs }: 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 { qt = pkgs.libsForQt512.callPackage ../development/go-modules/qt { }; }; @@ -34,14 +25,10 @@ rec { ideaUltimateWithPlugins = ideaUltimatePlugins.jetbrainsWithPlugins; }; - libhl = pkgs.callPackage ../development/libraries/libhl { }; - mopidy-subidy = pkgs.callPackage ../applications/audio/mopidy/subidy.nix { python3Packages = pkgs.python3Packages // python3Packages; }; - pam_gnupg = pkgs.callPackage ../os-specific/linux/pam_gnupg { }; - picom-animations = pkgs.picom.overrideAttrs (_oldAttrs: { pname = "picom-animations"; src = pkgs.fetchFromGitHub { @@ -58,8 +45,6 @@ rec { patches = (oldAttrs.patches or [ ]) ++ [ ../applications/misc/polybar/9button.patch ]; }); - psst = pkgs.callPackage ../applications/audio/psst { }; - python3Packages = pkgs.recurseIntoAttrs { py-sonic = pkgs.python3.pkgs.callPackage ../development/python-modules/py-sonic { }; }; @@ -73,12 +58,4 @@ rec { protonmail-bridge-headless = protonmailBridgePackages.protonmail-bridge-headless; 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 { }; } diff --git a/pkgs/applications/terminal-emulators/alacritty-ligatures/default.nix b/pkgs/unit/al/alacritty-ligatures/package.nix similarity index 100% rename from pkgs/applications/terminal-emulators/alacritty-ligatures/default.nix rename to pkgs/unit/al/alacritty-ligatures/package.nix diff --git a/pkgs/tools/misc/amdgpu-fan/default.nix b/pkgs/unit/am/amdgpu-fan/package.nix similarity index 100% rename from pkgs/tools/misc/amdgpu-fan/default.nix rename to pkgs/unit/am/amdgpu-fan/package.nix diff --git a/pkgs/games/atlauncher/default.nix b/pkgs/unit/at/atlauncher/package.nix similarity index 100% rename from pkgs/games/atlauncher/default.nix rename to pkgs/unit/at/atlauncher/package.nix diff --git a/pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch b/pkgs/unit/ca/cardboard/0001-use-system-dependencies.patch similarity index 100% rename from pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch rename to pkgs/unit/ca/cardboard/0001-use-system-dependencies.patch diff --git a/pkgs/applications/window-managers/cardboard/default.nix b/pkgs/unit/ca/cardboard/package.nix similarity index 100% rename from pkgs/applications/window-managers/cardboard/default.nix rename to pkgs/unit/ca/cardboard/package.nix diff --git a/pkgs/development/libraries/libhl/fix-link.patch b/pkgs/unit/li/libhl/fix-link.patch similarity index 100% rename from pkgs/development/libraries/libhl/fix-link.patch rename to pkgs/unit/li/libhl/fix-link.patch diff --git a/pkgs/development/libraries/libhl/default.nix b/pkgs/unit/li/libhl/package.nix similarity index 100% rename from pkgs/development/libraries/libhl/default.nix rename to pkgs/unit/li/libhl/package.nix diff --git a/pkgs/os-specific/linux/pam_gnupg/default.nix b/pkgs/unit/pa/pam_gnupg/package.nix similarity index 100% rename from pkgs/os-specific/linux/pam_gnupg/default.nix rename to pkgs/unit/pa/pam_gnupg/package.nix diff --git a/pkgs/applications/audio/psst/default.nix b/pkgs/unit/ps/psst/package.nix similarity index 100% rename from pkgs/applications/audio/psst/default.nix rename to pkgs/unit/ps/psst/package.nix diff --git a/pkgs/tools/misc/samrewritten/default.nix b/pkgs/unit/sa/samrewritten/package.nix similarity index 100% rename from pkgs/tools/misc/samrewritten/default.nix rename to pkgs/unit/sa/samrewritten/package.nix diff --git a/pkgs/tools/misc/spotify-ripper/fix-setup.patch b/pkgs/unit/sp/spotify-ripper/fix-setup.patch similarity index 100% rename from pkgs/tools/misc/spotify-ripper/fix-setup.patch rename to pkgs/unit/sp/spotify-ripper/fix-setup.patch diff --git a/pkgs/tools/misc/spotify-ripper/default.nix b/pkgs/unit/sp/spotify-ripper/package.nix similarity index 100% rename from pkgs/tools/misc/spotify-ripper/default.nix rename to pkgs/unit/sp/spotify-ripper/package.nix diff --git a/pkgs/tools/misc/ytarchive/default.nix b/pkgs/unit/yt/ytarchive/package.nix similarity index 100% rename from pkgs/tools/misc/ytarchive/default.nix rename to pkgs/unit/yt/ytarchive/package.nix diff --git a/pkgs/shells/zsh/zsh-z/default.nix b/pkgs/unit/zs/zsh-z/package.nix similarity index 100% rename from pkgs/shells/zsh/zsh-z/default.nix rename to pkgs/unit/zs/zsh-z/package.nix