-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
treewide: add overlays option #866
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Haven't really tested it so far FYI. |
tested it with my config and it's passing |
It seems that it's not. |
This PR does not resolve the root problem, and instead works around it by simply disabling affected code. With commit nix-community/home-manager@662fa98 merged, we can take our time to properly resolve this. @danth, any ideas? |
AFAIK this is the proper solution, because overlays cannot be set from within home manager when |
default = true; | ||
example = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this is the proper solution, because overlays cannot be set from within home manager when
useGlobalPkgs = true
. I read that it was never really possible, but there was no warning that recognized it before. So by design there is no way around it.
Any way we can use useGlobalPkgs
as default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's used by the HM integration to override the default value.
stylix/stylix/home-manager-integration.nix
Lines 228 to 230 in e3fe2c6
(lib.mkIf config.home-manager.useGlobalPkgs { | |
home-manager.sharedModules = [ disableOverlaysModule ]; | |
}) |
stylix/stylix/home-manager-integration.nix
Lines 10 to 12 in e3fe2c6
disableOverlaysModule = { | |
config.stylix.overlays.enable = false; | |
}; |
We could think about using lib.mkDefault
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could think about using
lib.mkDefault
though.
We generally avoid lib.mkDefault
: #388.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's used by the HM integration to override the default value.
stylix/stylix/home-manager-integration.nix
Lines 228 to 230 in e3fe2c6
(lib.mkIf config.home-manager.useGlobalPkgs { home-manager.sharedModules = [ disableOverlaysModule ]; }) stylix/stylix/home-manager-integration.nix
Lines 10 to 12 in e3fe2c6
disableOverlaysModule = { config.stylix.overlays.enable = false; };
Should we do that or leave it as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you asking me? I added it because it covers the case where one would be required to set this anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works. No more home-manager warnings with useGlobalPkgs
My thoughts would be to treat nixpkgs overlays as a separate platform from NixOS / Home Manager / Darwin, and import it automatically where possible, similar to how we integrate Home Manager within NixOS. The overall nixpkgs platform would be a function For example, the GNOME module's stylixConfig: self: super:
let theme = theme = self.callPackage ./theme.nix {
inherit (stylixConfig) colors templates;
};
in {
gnome-shell = super.gnome-shell.overrideAttrs (oldAttrs: {
# Themes are usually applied via an extension, but extensions are
# not available on the login screen. The only way to change the
# theme there is by replacing the default.
postFixup =
(oldAttrs.postFixup or "")
+ ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource
'';
patches = (oldAttrs.patches or [ ]) ++ [
./shell_remove_dark_mode.patch
];
});
} To validate that the format of the |
Good idea, I have also seen other flake systems separating overrides into separate modules. I imagine they could also be a separate output like
Why not use the usual module args like |
Adds the `stylix.overlays.enable` option which can be disabled to remove all overlays. This is to handle scenarios where overlays cannot be set, because the configuration doesn't handle its own nixpkgs instance. Fixes danth#865.
e3fe2c6
to
8364532
Compare
I believe
Unlike the existing platforms, nixpkgs doesn't use a module system, so this attribute set doesn't exist naturally. We could construct it, but I suppose we could still format the arguments as |
Adds the
stylix.overlays.enable
option which can be disabled to remove all overlays. This is to handle scenarios where overlays cannot be set, because the configuration doesn't handle its own nixpkgs instance. Fixes #865.