25 Jul 2024 |
Tranquil Ity | Namely, smth like this should work | 05:31:15 |
mr-qubo | In reply to @ity:itycodes.org Does this answer your Q? No. I don't know the users a prori. The users of the module can use anything, e.g. someone could configure it like.
{
users.alice = { foo = true; }
users.bob = { bar = true; }
}
And with this example I wold want it to evaluate to
{
users.alice.foo = true;
users.alice.bar = false;
users.bob.foo = true;
users.bob.bar = true;
| 09:26:05 |
mr-qubo | In reply to @ity:itycodes.org Does this answer your Q? * No. I don't know the users a prori. The users of the module can use anything, e.g. someone could configure it like.
{
users.alice = { foo = true; }
users.bob = { bar = true; }
}
And with this example I wold want it to evaluate to
{
users.alice.foo = true;
users.alice.bar = false;
users.bob.foo = true;
users.bob.bar = true;
| 09:26:12 |
mr-qubo | * No. I don't know the users a prori. The users of the module can use anything, e.g. someone could configure it like.
{
users.alice = { foo = true; }
users.bob = { bar = true; }
}
And with this example I wold want it to evaluate to
{
users.alice.foo = true;
users.alice.bar = false;
users.bob.foo = true;
users.bob.bar = true;
}
| 09:26:34 |
Tranquil Ity | Why is foo for bob true while bar for alice is false | 09:32:20 |
Tranquil Ity | Which part exactly are you stuck on? | 09:32:34 |
mr-qubo | In reply to @ity:itycodes.org Why is foo for bob true while bar for alice is false That's a small example of what I want it to do. I want to write a module, but it's for home-manager, so it must work for everyone and I don't know what will be the attribute for users in this example. I want to set users.${user}.foo = mkIf config.users.${user}.bar true for every attribute of users . That's also just example, what I'm trying to write involves more complicated expression. | 09:38:31 |
mr-qubo | But I've managed to figure it out:
{ config, lib, ... }:
with lib;
{
options = {
users = mkOption {
type = types.attrsOf (types.submodule (args: let user = args.config; in {
options = {
foo = mkEnableOption "foo";
bar = mkEnableOption "bar";
};
config = {
foo = mkIf user.bar true;
};
}));
default = {};
};
};
}
| 09:39:30 |
| Kotomine joined the room. | 10:48:32 |
| bumperboat changed their display name from bumperboat (UTC+2) to bumperboat. | 12:47:19 |
| @sebby_webby:matrix.org left the room. | 16:39:14 |
| heywoodlh joined the room. | 16:55:01 |
| Emma [it/its] ⚡️ left the room. | 17:32:05 |
| heywoodlh set a profile picture. | 18:47:40 |
| @setunset:matrix.org left the room. | 20:00:29 |
26 Jul 2024 |
| upidapi joined the room. | 00:57:40 |
Gaétan Lepage | I have no idea why I don't know this, but how to achieve
a = [x y] ++ (mkIf condition [z]);
?
This snippet is wrong | 06:07:31 |
Gaétan Lepage | Of course, I could use optional but, this is not evaluated at the same stage as mkIf is | 06:08:02 |
Gaétan Lepage | Or maybe, there is no nicer solution than mkMerge | 06:10:47 |
Tranquil Ity | I feel like, since that is not about the Nix language but rather about nixpkgs libraries, wouldn't that Q be better answerable elsewhere? | 06:19:06 |
Gaétan Lepage | Oh sure ! | 06:28:51 |
| lnlsn joined the room. | 13:48:32 |
infinisil | Tranquil Ity: Gaétan Lepage: There's #modules:nixos.org where it would fit, but I'll just answer here :P | 14:14:14 |
infinisil | Gaétan Lepage: a = mkMerge [ [ x y ] (mkIf condition [ z ]) ] | 14:14:42 |
| Picnoir joined the room. | 15:21:36 |
Gaétan Lepage | Ok thank you infinisil ! | 15:30:51 |
| Dennis joined the room. | 16:50:46 |
mr-qubo | I want to fix issue in nixpkgs. I have a local git repo with changes. How can I build my nixos configuration with this local nixpkgs to test the changes? I'm using channels. | 17:04:38 |
mr-qubo | I've got it NIX_PATH=nixpkgs=/home/nix/nixpkgs:$NIX_PATH nixos-rebuild boot . | 17:42:38 |
mr-qubo | Oh, sorry, wrong room. | 17:43:48 |