Comments (6)
It seems that when we use mkIf
, the option must exist even if the condition is false. Something like optionalAttrs
would fix that, but it might introduce new issues which mkIf
exists to solve.
from stylix.
I looked into it, and it seems we're running into a limitation of the nixos module system. We can't conditionally set an option only if it exists. The following in stylix/nixos/default.nix
should work, but it will break for any config in which computing the WHNF of options
depends on the WHNF of config
:
if options ? home-manager
then (lib.mkIf hm.autoImport {
home-manager.sharedModules = [ homeManagerModule ];
})
else {}
from stylix.
Hi everyone!
@dwarfmaster the WHNF of options can't depend on the WHNF of config in first place as it will cause infinite recursion right away, because the WHNF of config depends on the WHNF of options, so it's safe to do as you proposed.
@danth maybe follow this pattern for modules which set options that are not in the latest release? I just tried it on my local fork with avizo and mako, while being on 22.11, and it worked. Example (mako.nix
):
...
config = if options.services ? mako then lib.mkIf config.stylix.targets.mako.enable {
...
from stylix.
that seems like a reasonable option to me
from stylix.
@SenchoPens That makes sense, I can implement it unless you're already working on it (I noticed you forked the repo).
Is it safe to use lib.optionalAttrs
in place of the if statement?
from stylix.
Done. Good call with the lib.optionalAttrs
!
from stylix.
Related Issues (20)
- home manager bemenu option missing HOT 2
- Cannot find colorscheme 'base16-stylix'
- Enforce matching nixpkgs and home-manager versions HOT 8
- gnome: the clock and status icons in GDM are always white
- doc: Link in Stylix book refers page not found
- Add installation instructions for NixOS, without Flakes or Home Manager HOT 1
- zathura: missing transparency HOT 3
- targets.kitty.enable=false doesn't work HOT 4
- stylix: improve `stylix.mkEnableTarget` behaviour HOT 8
- doc: add "accent" colour to spec HOT 2
- treewide: GitHub Action failures HOT 2
- Support for Nix 24.05? HOT 7
- Image needs to be set on rebuild
- hyprland: init `hyprpaper` service
- sddm: add support HOT 2
- Stylix breaking Plasma 6's shortcuts and Spectacle HOT 9
- Release 24.05 HOT 6
- Stylix no longer functional after update HOT 2
- The option `stylix.image' is used but not defined. HOT 14
- kde: home-manager failing to set Plasma wallpaper, not connected to D-Bus server HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylix.