refactor(pkgs): use haumea for automatic callPackage

This commit is contained in:
2025-07-06 14:29:10 +08:00
parent 32232d08db
commit b460cb58ef
14 changed files with 59 additions and 19 deletions

22
flake.lock generated
View File

@@ -534,6 +534,27 @@
"type": "github" "type": "github"
} }
}, },
"haumea": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1685133229,
"narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=",
"owner": "nix-community",
"repo": "haumea",
"rev": "34dd58385092a23018748b50f9b23de6266dffc2",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "v0.2.2",
"repo": "haumea",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -1092,6 +1113,7 @@
"darkly": "darkly", "darkly": "darkly",
"fenix": "fenix", "fenix": "fenix",
"go-musicfox": "go-musicfox", "go-musicfox": "go-musicfox",
"haumea": "haumea",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"impermanence": "impermanence", "impermanence": "impermanence",
"infuse": "infuse", "infuse": "infuse",

View File

@@ -57,6 +57,9 @@
infuse.url = "git+https://codeberg.org/amjoseph/infuse.nix"; infuse.url = "git+https://codeberg.org/amjoseph/infuse.nix";
infuse.flake = false; infuse.flake = false;
haumea.url = "github:nix-community/haumea/v0.2.2";
haumea.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs =
@@ -81,12 +84,25 @@
final: prev: { final: prev: {
inherit (inputs.home-manager.lib) hm; inherit (inputs.home-manager.lib) hm;
inherit infuse; inherit infuse;
haumea = inputs.haumea.lib;
} }
); );
infuse = (import inputs.infuse { inherit (nixpkgs) lib; }).v1.infuse; infuse = (import inputs.infuse { inherit (nixpkgs) lib; }).v1.infuse;
in in
{ {
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); packages = forAllSystems (
system:
lib.haumea.load {
src = ./pkgs;
loader = [
{
matches = str: builtins.match ".*\\.nix" str != null;
loader = _: path: nixpkgs.legacyPackages.${system}.callPackage path { };
}
];
transformer = lib.haumea.transformers.liftDefault;
}
);
# workaround for "treefmt warning" # workaround for "treefmt warning"
formatter = forAllSystems ( formatter = forAllSystems (
@@ -108,7 +124,9 @@
} }
); );
overlays = import ./overlays { inherit inputs infuse; }; overlays = import ./overlays {
inherit inputs lib;
};
nixosConfigurations = forAllHosts ( nixosConfigurations = forAllHosts (
hostname: hostname:

View File

@@ -1,10 +1,24 @@
{ inputs, infuse, ... }:
{ {
additions = final: prev: import ../pkgs prev; inputs,
lib,
}:
{
additions =
final: prev:
lib.haumea.load {
src = ../pkgs;
loader = [
{
matches = str: builtins.match ".*\\.nix" str != null;
loader = _: path: final.callPackage path { };
}
];
transformer = lib.haumea.transformers.liftDefault;
};
modifications = modifications =
final: prev: final: prev:
infuse prev { lib.infuse prev {
cage.__output.patches.__append = [ ./cage-specify-output-name.patch ]; cage.__output.patches.__append = [ ./cage-specify-output-name.patch ];
matrix-synapse.__assign = final.stable.matrix-synapse; matrix-synapse.__assign = final.stable.matrix-synapse;
bottles.__input.removeWarningPopup.__assign = true; bottles.__input.removeWarningPopup.__assign = true;

View File

@@ -1,14 +0,0 @@
pkgs:
let
packages = [
"win11-icon-theme"
"mono-gtk-theme"
"fcitx5-themes"
"fcitx5-lightly"
"fluent-fcitx5"
"wps-office-fonts"
"ttf-wps-fonts"
"translate-shell"
];
in
pkgs.lib.genAttrs packages (package: pkgs.callPackage ./${package}.nix { })

View File

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View File

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View File

Before

Width:  |  Height:  |  Size: 93 B

After

Width:  |  Height:  |  Size: 93 B

View File

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

View File

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B