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:
28
flake.nix
28
flake.nix
@@ -50,10 +50,7 @@
|
|||||||
nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ] (
|
nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ] (
|
||||||
system: fn system nixpkgs.legacyPackages.${system}
|
system: fn system nixpkgs.legacyPackages.${system}
|
||||||
);
|
);
|
||||||
buildDmsPkgs = pkgs: {
|
|
||||||
dms-shell = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
||||||
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
||||||
};
|
|
||||||
mkModuleWithDmsPkgs =
|
mkModuleWithDmsPkgs =
|
||||||
modulePath:
|
modulePath:
|
||||||
args@{ pkgs, ... }:
|
args@{ pkgs, ... }:
|
||||||
@@ -62,6 +59,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);
|
||||||
@@ -78,10 +76,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:
|
||||||
@@ -99,8 +98,7 @@
|
|||||||
in
|
in
|
||||||
"${cleanVersion}${dateSuffix}${revSuffix}";
|
"${cleanVersion}${dateSuffix}${revSuffix}";
|
||||||
in
|
in
|
||||||
{
|
pkgs.lib.makeOverridable (
|
||||||
dms-shell = pkgs.lib.makeOverridable (
|
|
||||||
{
|
{
|
||||||
extraQtPackages ? [ ],
|
extraQtPackages ? [ ],
|
||||||
}:
|
}:
|
||||||
@@ -180,8 +178,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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user