1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-02 02:22:06 -04:00

flake: let module callers supply pkgs so overlays reach the build (#2244)

The nixosModule/homeModule path previously called `buildDmsPkgs pkgs` but
internally referenced `self.packages.${system}.default`, which was
instantiated via `nixpkgs.legacyPackages`, an unoverlayed pkgs. That
meant downstream flakes couldn't reach through their own overlays to
the dms-shell build (e.g. to swap `kdePackages.sonnet` or trim perl
out of the aspell closure).

Extract the derivation as `mkDmsShell = pkgs: ...` at the top-level
`let`, and call it from both `packages.${system}.dms-shell` (for
direct consumers of the flake) and `buildDmsPkgs pkgs` (for module
consumers, which now pass in the system's overlayed pkgs).

Also re-checks overrideAttrs / .override still work: `mkDmsShell pkgs`
is the same `pkgs.lib.makeOverridable` wrapper as before, just
parameterized on the caller's pkgs instance.

Co-authored-by: Lucas <43530291+LuckShiba@users.noreply.github.com>
This commit is contained in:
Amaan Qureshi
2026-04-27 15:14:25 -04:00
committed by purian23
parent dd2a3f3efc
commit eb5afcdc40

View File

@@ -41,10 +41,11 @@
nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] ( nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (
system: fn system nixpkgs.legacyPackages.${system} system: fn system nixpkgs.legacyPackages.${system}
); );
buildDmsPkgs = pkgs: { forEachLinuxSystem =
dms-shell = self.packages.${pkgs.stdenv.hostPlatform.system}.default; fn:
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default; nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ] (
}; system: fn system nixpkgs.legacyPackages.${system}
);
mkModuleWithDmsPkgs = mkModuleWithDmsPkgs =
modulePath: modulePath:
args@{ pkgs, ... }: args@{ pkgs, ... }:
@@ -53,6 +54,7 @@
(import modulePath (args // { dmsPkgs = buildDmsPkgs pkgs; })) (import modulePath (args // { dmsPkgs = buildDmsPkgs pkgs; }))
]; ];
}; };
mkQmlImportPath = mkQmlImportPath =
pkgs: qmlPkgs: pkgs: qmlPkgs:
pkgs.lib.concatStringsSep ":" (map (o: "${o}/${pkgs.qt6.qtbase.qtQmlPrefix}") qmlPkgs); pkgs.lib.concatStringsSep ":" (map (o: "${o}/${pkgs.qt6.qtbase.qtQmlPrefix}") qmlPkgs);
@@ -69,10 +71,11 @@
qtimageformats qtimageformats
kimageformats kimageformats
]; ];
in
{ # Allows downstream modules to provide their own 'pkgs' (with overlays)
packages = forEachSystem ( # instead of being forced to use the flake's locked nixpkgs.
system: pkgs: mkDmsShell =
pkgs:
let let
mkDate = mkDate =
longDate: longDate:
@@ -90,8 +93,7 @@
in in
"${cleanVersion}${dateSuffix}${revSuffix}"; "${cleanVersion}${dateSuffix}${revSuffix}";
in in
{ pkgs.lib.makeOverridable (
dms-shell = pkgs.lib.makeOverridable (
{ {
extraQtPackages ? [ ], extraQtPackages ? [ ],
}: }:
@@ -150,6 +152,9 @@
substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \ substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \
--replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so --replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so
substituteInPlace $out/share/quickshell/dms/assets/pam/u2f \
--replace-fail pam_u2f.so ${pkgs.pam_u2f}/lib/security/pam_u2f.so
installShellCompletion --cmd dms \ installShellCompletion --cmd dms \
--bash <($out/bin/dms completion bash) \ --bash <($out/bin/dms completion bash) \
--fish <($out/bin/dms completion fish) \ --fish <($out/bin/dms completion fish) \
@@ -168,8 +173,16 @@
) )
) { }; ) { };
buildDmsPkgs = pkgs: {
dms-shell = mkDmsShell pkgs;
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
in
{
packages = forEachSystem (
system: pkgs: {
dms-shell = mkDmsShell pkgs;
quickshell = quickshell.packages.${system}.default; quickshell = quickshell.packages.${system}.default;
default = self.packages.${system}.dms-shell; default = self.packages.${system}.dms-shell;
} }
); );