!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1938 Members
Nix programming language357 Servers

Load older messages


SenderMessageTime
13 Jul 2021
@kreyren:tchncs.dekreyrennone ever does u.u17:20:18
@kreyren:tchncs.dekreyren
In reply to @infinisil:matrix.org
Though I'm not entirely sure what exactly causes it
^
17:20:22
@kreyren:tchncs.dekreyreni have a terrible headache from working on this $@#^17:21:06
@infinisil:matrix.orginfinisilHeh, 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:tchncs.dekreyren >.< 17:21:40
@kreyren:tchncs.dekreyren 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:tchncs.dekreyrenppl keep yelling flakes on me but that just seems to increase the complexity without any real value 17:23:01
@kreyren:tchncs.dekreyren and some better way to just define modules in git repositories e.g. the dns.nix and import them 17:24:36
@matrsz:matrix.orgMatrsz changed their display name from Matías to Inox.18:22:05
@matrsz:matrix.orgMatrsz changed their display name from Inox to Matrsz.18:24:40
@b:chreekat.netchreekatI wish everyone who tries to convince people to use flakes would do themselves a favor by documenting flakes. :p19:39:35
14 Jul 2021
@polykernel:kde.orgpolykernelis there a way in nix to show the full expansion of an attribute set?04:38:37
@thibaut:thibautmarty.frthibaut polykernel: in the repl :p, not in the repl: various traceSeq* functions 07:07:51
@niksnut:matrix.orgniksnut
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:matrix.orgMagic_RB joined the room.10:23:13
@lunik1:lunik.onelunik1

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:thibautmarty.frthibaut
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:thibautmarty.frthibaut
17:02:42
@thibaut:thibautmarty.frthibaut *

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:lunik.onelunik1hmm I might have just spelled the option wrong, and the import error was raised before the undefined variable...17:04:17
@thibaut:thibautmarty.frthibautOh, I was wrong myself17:06:23
@thibaut:thibautmarty.frthibaut
  system = lib.mkIf config.security.sudo.enable (
    import ./wrong.nix;
  );

does not work indeed.

17:06:47
@thibaut:thibautmarty.frthibaut lunik1: so to answer your question, do programs = lib.mkIf … { ssh = import … } and it should work 17:07:19
@lunik1:lunik.onelunik1ah thanks I will try that17:08:11
@lunik1:lunik.onelunik1nope, that didn't work :/17:24:18
@infinisil:matrix.orginfinisil lunik1: The reason it doesn't work is because the module system propagates lib.mkIf down to single options 18:39:20
@infinisil:matrix.orginfinisil 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:matrix.orginfinisilAnd to get these attributes, it needs to read the file18:39:52
@infinisil:matrix.orginfinisil So I guess the module system is fairly lazy in option values, but not option keys 18:42:22
@infinisil:matrix.orginfinisil 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

Show newer messages


Back to Room ListRoom Version: 6