| 13 Jul 2021 |
kreyren | none ever does u.u | 17:20:18 |
kreyren | In reply to @infinisil:matrix.org Though I'm not entirely sure what exactly causes it ^ | 17:20:22 |
kreyren | i have a terrible headache from working on this $@#^ | 17:21:06 |
infinisil | Heh, well I'm actually really good at figuring out why infinite recursion occurs, but I'd need to look into it more closely (which is hard in this case because it's a lot of code) | 17:21:15 |
kreyren | >.< | 17:21:40 |
kreyren | is there a better way to achieve the same effect? meaning having a logic using a hostname and domain that sets the values while using the same entry point for multiple systems? | 17:22:43 |
kreyren | ppl keep yelling flakes on me but that just seems to increase the complexity without any real value | 17:23:01 |
kreyren | and some better way to just define modules in git repositories e.g. the dns.nix and import them | 17:24:36 |
| Matrsz changed their display name from Matías to Inox. | 18:22:05 |
| Matrsz changed their display name from Inox to Matrsz. | 18:24:40 |
chreekat | I wish everyone who tries to convince people to use flakes would do themselves a favor by documenting flakes. :p | 19:39:35 |
| 14 Jul 2021 |
polykernel | is there a way in nix to show the full expansion of an attribute set? | 04:38:37 |
thibaut | polykernel: in the repl :p, not in the repl: various traceSeq* functions | 07:07:51 |
niksnut | In reply to @b:chreekat.net I wish everyone who tries to convince people to use flakes would do themselves a favor by documenting flakes. :p https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html | 15:01:52 |
| 15 Jul 2021 |
| Magic_RB joined the room. | 10:23:13 |
lunik1 | I thought I could be smart and have something like
programs.ssh = lib.mkIf config.lunik1.home.gpgKeyInstalled
(import ../config/ssh/config.nix);
in my config, where ../config/ssh/config.nix is a git-crypt managed file which only systems with my private gpg key can read. I expected nix's laziness would prevent the file from being evaluated if gpgKeyInstalled is false, but that seems not to be the case. Is there a way I can force it to be lazy?
| 16:33:53 |
thibaut | In reply to @lunik1:lunik.one
I thought I could be smart and have something like
programs.ssh = lib.mkIf config.lunik1.home.gpgKeyInstalled
(import ../config/ssh/config.nix);
in my config, where ../config/ssh/config.nix is a git-crypt managed file which only systems with my private gpg key can read. I expected nix's laziness would prevent the file from being evaluated if gpgKeyInstalled is false, but that seems not to be the case. Is there a way I can force it to be lazy?
Are you sure? It works as expected here. | 17:01:31 |
thibaut |
| 17:02:42 |
thibaut | * Quick test: config.security.sudo.enable is a boolean and ./wrong.nix does not exist.
system = lib.mkIf config.security.sudo.enable {
stateVersion = import ./wrong.nix;
};
Nix 2.3.12
| 17:04:15 |
lunik1 | hmm I might have just spelled the option wrong, and the import error was raised before the undefined variable... | 17:04:17 |
thibaut | Oh, I was wrong myself | 17:06:23 |
thibaut | system = lib.mkIf config.security.sudo.enable (
import ./wrong.nix;
);
does not work indeed.
| 17:06:47 |
thibaut | lunik1: so to answer your question, do programs = lib.mkIf … { ssh = import … } and it should work | 17:07:19 |
lunik1 | ah thanks I will try that | 17:08:11 |
lunik1 | nope, that didn't work :/ | 17:24:18 |
infinisil | lunik1: The reason it doesn't work is because the module system propagates lib.mkIf down to single options | 18:39:20 |
infinisil | programs.ssh isn't a single option yet, so it tries to recursively apply lib.mkIf to each of the attributes you define | 18:39:46 |
infinisil | And to get these attributes, it needs to read the file | 18:39:52 |
infinisil | So I guess the module system is fairly lazy in option values, but not option keys | 18:42:22 |
infinisil | lunik1: Usually this is not something I'd like to suggest, but in this case it might work: Try using programs.ssh = if config.lunix1.home.gpgKeyInstalled then import ../config/ssh/config.nix else {}; | 18:44:35 |