!wfudwzqQUiJYJnqfSY:nixos.org

NixOS Module System

146 Members
30 Servers

Load older messages


SenderMessageTime
2 Mar 2025
@infinisil:matrix.orginfinisil * loudgolem: Done :) 04:27:13
6 Mar 2025
@mr-qubo:matrix.orgmr-qubo Is there a mkAfter but for strings? I want to append flags to nixos option programs.captive-browser.browser, and I have no idea how. 14:40:14
@nbp:mozilla.orgnbp mkAfter is for any option, so yes, unless you are using dependent strings which are ordered based on dependencies. 14:42:52
@mattsturg:matrix.orgMatt Sturgeon mkOrder (+ mkBefore & mkAfter) affects the order definitions get merged in, so it is applicable to any mergable type. 14:42:57
@nbp:mozilla.orgnbp * mkAfter is for any option, so yes, unless you are using dependent strings which are merged based on dependencies. 14:43:28
@mr-qubo:matrix.orgmr-qubo I've tried using mkAfter and it just replaced the strings enitrely. 14:43:55
@mr-qubo:matrix.orgmr-qubo * I've tried using mkAfter and it just replaced the strings entirely. 14:44:00
@mr-qubo:matrix.orgmr-qubo * I've tried using mkAfter and it just replaced the string entirely. 14:44:04
@nbp:mozilla.orgnbpThat's because you do not have the same priority level.14:44:19
@nbp:mozilla.orgnbpOr there is a problem with the merge function of the option.14:45:37
@mattsturg:matrix.orgMatt Sturgeon Sounds like your definition has a higher override priority. For example a "normal" definition will not be merged with a "default" definition, because merging is only done for definitions of whatever happens to be the highest priority 14:45:41
@mr-qubo:matrix.orgmr-quboYes, I want to merge with the default value of that option.14:46:34
@mr-qubo:matrix.orgmr-quboThis module needs the flags, which are passed in default value.14:46:56
@nbp:mozilla.orgnbp then you need mkDefault (mkAfter suffix) 14:47:00
@mattsturg:matrix.orgMatt Sturgeon Assuming the option's type actually supports merging, you need to make your definition have the same override priority. This is probably either mkDefault or more likely mkOptionDefault 14:47:30
@nbp:mozilla.orgnbp * then you need mkOptionDefault (mkAfter suffix) — editted: wrong function name 14:48:21
@mattsturg:matrix.orgMatt Sturgeon

If the option doesn't support merging, a less idiomatic solution would be to read the option's default value and use that in your overriding definition:

foo = options.foo.default + "suffix";

This is ugly and fragile, but could work as a hacky solution if necessary.

14:50:45
@mr-qubo:matrix.orgmr-qubo mkOptionDefault raises an error. The type is types.str. I'll guess I'll go with options..default then. 15:24:07
@mattsturg:matrix.orgMatt Sturgeon types.str has merge = mergeEqualOption, which essentially means it doesn't support merging multiple definitions 15:58:40
7 Mar 2025
@qyriad:katesiria.orgQyriad changed their display name from Qyriad to qyriad.16:43:26
8 Mar 2025
@qyriad:katesiria.orgQyriad changed their display name from qyriad to Qyriad.21:41:03
9 Mar 2025
@jappie:jappie.devjappie joined the room.09:23:03
12 Mar 2025
@lehmanator:tchncs.deSam LehmanIs there a "best-practices" way of iterating over many option names/values in a config? Particularly such that I can test the existence of many options without losing the benefits of lazy eval.12:09:50
@lehmanator:tchncs.deSam Lehman e.g. I'm trying to persist directories using impermanence by enumerating all services*.dataDir options, then appending its value to environment.persistence."/persist".directories with lib.optional config.services.<name>.enable config.services.<name>.dataDir 12:10:09
@nbp:mozilla.orgnbp Unfortunately no. So far people have been using map within modules to iterate over the individual definitions, and some have used mkMerge / mkIf to make their definitions conditional.
I have no found any way to generalize the processing of multiple option definitions into 1 or multiple at the moment.
If you have any idea of what might be a good API, feel free to suggest, and people in this channel might be able to provide an implementation (if possible)
14:18:09
@vidariondr:matrix.orgvidariondr joined the room.21:07:51
22 Mar 2025
@isabel:isabelroses.comisabel joined the room.00:42:48
@vaw:nlih.devaw joined the room.21:26:12
27 Mar 2025
@nam3l33ss:matrix.org·☽•Nameless☆•777 · ± changed their profile picture.04:46:05
@nam3l33ss:matrix.org·☽•Nameless☆•777 · ± changed their profile picture.07:58:24

There are no newer messages yet.


Back to Room ListRoom Version: 10