9 Aug 2024 |
Elliot Cameron | But doing that should probably be considered a novelty, not a solution. | 19:06:19 |
10 Aug 2024 |
| lychee joined the room. | 02:07:16 |
| Austin Horstman changed their display name from Khaneliman to Austin Horstman. | 03:50:05 |
| up-st0rm joined the room. | 11:12:45 |
11 Aug 2024 |
| lgmrszd joined the room. | 12:26:04 |
| @interru:chat.interru.io left the room. | 15:48:17 |
12 Aug 2024 |
| @amiablechief:matrix.org left the room. | 11:34:29 |
| Crower changed their display name from 江一苇 to Crower. | 13:14:44 |
| Crower set a profile picture. | 13:15:41 |
| kyub left the room. | 16:59:10 |
| kyub joined the room. | 17:00:44 |
13 Aug 2024 |
atagen | how would I enumerate attrs? for example, if I have:
foo = {
bar = { baz = false; };
rab = { zab = true; };
};
how can I process this to get
foo = {
bar = { n = 0; baz = false; };
rab = { n = 1; zab = true; };
};
```?
| 02:18:12 |
atagen | * how would I enumerate attrs? for example, if I have:
foo = {
bar = { baz = false; };
rab = { zab = true; };
};
how can I process this to get
foo = {
bar = { n = 0; baz = false; };
rab = { n = 1; zab = true; };
};
```
?
| 02:18:26 |
atagen | * how would I enumerate attrs? for example, if I have:
foo = {
bar = { baz = false; };
rab = { zab = true; };
};
how can I process this to get
foo = {
bar = { n = 0; baz = false; };
rab = { n = 1; zab = true; };
};
?
| 02:18:42 |
atagen | I don't care about the order of evaluation, only that n is unique for each member | 02:19:01 |
infinisil | atagen: There's a PR proposing imapAttrs : https://github.com/NixOS/nixpkgs/pull/270049 | 02:20:59 |
emily | nix-repl> :p lib.listToAttrs (lib.imap0 (n: {name, value}: {inherit name; value = value // { inherit n; }; }) (lib.attrsToList {a = {}; b = {};}))
{
a = { n = 0; };
b = { n = 1; };
}
| 02:21:56 |
emily | (why do you want this?) | 02:21:58 |
atagen | In reply to @emilazy:matrix.org (why do you want this?) I have a home-manager option that generates firefox profiles w userchrome removed, unique .desktop files etc to make pseudo-PWAs - the IDs need to be unique and sequential for firefox to respect all entries in the profile ini | 02:24:54 |
emily | I see | 02:25:20 |
emily | you might want to skip the listToAttrs part depending on your usecase | 02:25:28 |
emily | also, since there's no ordering guarantees, if renumbering would matter at all you might just want it to be a list to begin with | 02:25:54 |
atagen | I appreciate the help, I'll have a poke around at it | 02:25:55 |
atagen | anything beats setting them manually at each site | 02:26:32 |
atagen | In reply to @emilazy:matrix.org also, since there's no ordering guarantees, if renumbering would matter at all you might just want it to be a list to begin with though hmm yeah | 02:26:36 |
@adis:blad.is | Attrsets are sorted | 02:27:03 |
atagen | now I think about it, if I remove one and the number decrements, firefox will probably start using the data of the old profile from the wrong app | 02:27:08 |
@adis:blad.is | So you'll get numbering in lexicographical order | 02:27:20 |
atagen | * now I think about it, if I remove one and the number decrements, firefox will probably start using the data of the old profile from the wrong app.. perhaps I can do some symlink crimes based on app names and some stateful stuff in home dir | 02:29:21 |
emily | In reply to @adis:blad.is Attrsets are sorted uh, TIL | 02:30:38 |