<theduke>
is there some helper function for escaping single quotes inside the command?
<KarlJoad`>
There's lib.escape
<KarlJoad`>
It takes a list of strings of what to search for in a given string and will properly escape them for you.
<KarlJoad`>
If you want to escape something YOU are putting in, \ is the escape character.
<theduke>
tanks
<theduke>
* ah, thanks
<theduke>
is there some decent way to search `lib` and `builtins` for available functions?
<KarlJoad`>
You can google for the builtins. But for the lib ones, I haven't found a good way other than go through the nixpkgs/lib directory and search for what I want.
<theduke>
the problem with Googling/grepping in the repo is that it spits out mainly function usage rather than definitions
<KarlJoad`>
I don't disagree. You have to know kind of what you want done and then check.
<KarlJoad`>
But, almost all of the lib functions can be reconstructed using builtins, so, that's a thing.
<theduke>
alright
<theduke>
and one more question: is there a way to specify a custom check function that validates the whole config for a service?
<theduke>
I need to look at multiple keys in `options` for some cross-validation
<KarlJoad`>
Some of that should be handled by the type system.
<KarlJoad`>
What does validity mean for those options?
<theduke>
in this case it means at least one of them must be specified
<KarlJoad`>
I mean, a logical OR would be my first answer to that. I'm not quite sure what the options are for though, nor do I know the type of the options.
<theduke>
I guess I'll have to nest them under a parent and use `mkOptionType`
<KarlJoad`>
If you're talking about the `timeouts`, then I would make those a submodule, yes.
<theduke>
the rule is: either `beforeSleep`, `afterResume`, `lock`, `unlock` or at least one `timeouts` entry must be specified
<theduke>
timeouts already is a submodule, the problem is that timeouts can be empty if one of the above keys is specified
<KarlJoad`>
You could check each of the 4 against their defaults, if those are the same, then check the length of the timeouts.
<KarlJoad`>
Then have an abort if any of those predicates do not hold.
<KarlJoad`>
If the timeouts list has the correct length, then check each of the elements for correctness.
<theduke>
which leads to my original question, where would I add that check?
<theduke>
* which leads to my original question: where would I add that check?
<KarlJoad`>
I would add that check underneath your `config = mkIf cfg.enable {}` as a set of assertions.
<KarlJoad`>
At least, that's how its done in the module I'm tinkering with right now, who's original code is not my own.
<KarlJoad`>
Let me be clearer, under `cfg.enable` there is an expression that contains a LIST of assertions.
<KarlJoad`>
Check the mbsync program file for an exampel.
<theduke>
yeah that will work
<theduke>
I guess it's not ideal from a error reporting perspective though since the error won't point to the location of the service config (I assume?)
<KarlJoad`>
As far as I can tell, the assertions will not, no.
<KarlJoad`>
There is likely a better way to define the dependencies of these options on each other that I am not aware of.
khassanov has joined #home-manager
khassanov[m] has joined #home-manager
khassanov has left #home-manager [#home-manager]
cjpbirkbeck has quit [Quit: cjpbirkbeck]
greizgh has quit [Quit: greizgh]
greizgh has joined #home-manager
dermetfan has joined #home-manager
quinn has joined #home-manager
ardumont has quit [Quit: WeeChat 2.7.1]
ardumont has joined #home-manager
ardumont has quit [Client Quit]
ardumont has joined #home-manager
cole-h has joined #home-manager
asymptotically has quit [Remote host closed the connection]
ardumont has quit [Quit: WeeChat 2.7.1]
ardumont has joined #home-manager
cole-h has quit [Quit: Goodbye]
kenran has joined #home-manager
<KarlJoad`>
rycee: How hard of a rule is maintaining backward compatibility?
<energizer>
KarlJoad`: what do you want to break?
<KarlJoad`>
isync/mbsync.
<KarlJoad`>
I have rewritten the module to allow for multiple accounts to be specified for each account.
<KarlJoad`>
However, I have written a lot of code to get the backwards compatability in place too.
<KarlJoad`>
So although the old way is still possible to use, the config generation will default to the newer versions if possible. This does also mean that the old generated config code is a little ugly.
<{^_^}>
nixpkgs#71300 (by NilsIrl, 36 weeks ago, closed): No colour in alacritty when installed via `configuration.nix`
<KarlJoad`>
Ok. That seems like a hard issue to fix. A real rabbit hole problem.
<asdjlsojfiejslfd>
The design of nix means that anyone else with my same nix configs would have this issue right? Seems strange that this issue is not as popular since alacritty and neovim are very popular.
<KarlJoad`>
In theory, yes. Anyone running NeoVIM in Alacritty should end up with the same problem. But, Nix doesn't attempt to manage what is outside the nix store. So, environment variables will change from person to person.
<KarlJoad`>
That's why the `--pure` option is present in nix-shell.
<KarlJoad`>
It does seem like the problem is tied to JUST NeoVIM in JUST Alacritty, which means there's likely a problem in how the 2 interact with each other.
<asdjlsojfiejslfd>
Oh wow, the env vars hint might help me solve this issue
<asdjlsojfiejslfd>
I have a long laundry list of env vars set to force XDG Base dir compliance everywhere
<KarlJoad`>
Again, I have no idea, as I don't use either tool. But that would be my first guess.
KarlJoad has joined #home-manager
KarlJoad` has left #home-manager ["ERC (IRC client for Emacs 26.3)"]
<asdjlsojfiejslfd>
Thanks KarlJoad, you just helped me fix it lol
<KarlJoad>
Oh wow... really?!
<KarlJoad>
I'm on a roll today!
<asdjlsojfiejslfd>
it was my TERMINFO_DIRS that I had set
<KarlJoad>
Wow. Knocking out mbsync and that today! I've really been productive!!
dermetfan has quit [Ping timeout: 272 seconds]
asdjlsojfiejslfd has quit [Remote host closed the connection]
KarlJoad` has joined #home-manager
KarlJoad has left #home-manager ["too many mes"]
<ornxka_>
home-manager wants to clobber my .xresources
<ornxka_>
but i dont set any xresources-related options?
<KarlJoad`>
What files does it want to overwrite?
<ornxka_>
just ~/.Xresources
<KarlJoad`>
Could be another program that uses Xresources for its configuration.
<KarlJoad`>
You could always copy your current version to a backup, delete the original, and run the switch
<KarlJoad`>
Or you could do a `home-manager build` and see what it outputs.
<ornxka_>
the xresources it builds is empty
<ornxka_>
actually, wait, it contains exactly one newline
<KarlJoad`>
That's likely the problem.
<KarlJoad`>
Was ~/.Xresources managed by home-manager before?
<ornxka_>
no
<ornxka_>
i did try to enable dunst and xscreensaver
<ornxka_>
but ive disabled those
<KarlJoad`>
Well... If the only difference is a newline, then you should be safe.
<ornxka_>
i enver switched to a generation that included those
<ornxka_>
well, my .Xresources has stuff in it
<ornxka_>
and the one home-manager wants to put there does not
<ornxka_>
i guess i could just jam all my .Xresources stuff into a extraConfig variable
<KarlJoad`>
Gotcha. There's always the escape hatch of writing ~/.Xresources from within home-manager itself.
<KarlJoad`>
But otherwise, you'll probably have to track down which options are generating the file.
<ornxka_>
hmmm
<ornxka_>
i recently discovered nixos-option
<ornxka_>
it would be nice if something like that worked in home-manager too