| 23 Jun 2023 |
CRTified | Wow, that might actually work?
builtins.fromJSON (builtins.readFile (self.outPath + "/flake.lock"))
| 11:53:27 |
CRTified | I mean:
nix-repl> :lf .
Added 15 variables.
nix-repl> test
{ nodes = { ... }; root = "root"; version = 7; }
| 11:53:59 |
CRTified | * Wow, that might actually work?
test = builtins.fromJSON (builtins.readFile (self.outPath + "/flake.lock"));
| 11:54:06 |
emily | oh that's utterly horrible :) | 11:55:46 |
emily | and yet so tempting | 11:55:49 |
emily | the lock doesn't have to be checked in I guess, but you could do awful stuff parsing flake.nix | 11:56:33 |
emily | you shouldn't give me ideas like this, this is dangerous | 11:56:55 |
CRTified | In reply to @emilazy:matrix.org you shouldn't give me ideas like this, this is dangerous I'm still thinking about whether I should write an XML parser in nix, sooo I'm not the one to not give stupid ideas... 😄 | 11:57:57 |
emily | we have builtins.toXML but no parser?? | 11:58:40 |
CRTified | toXML is also something different | 11:58:47 |
CRTified | toXML gives you the expression representation | 11:58:57 |
emily | yeah | 11:59:05 |
emily | still | 11:59:07 |
emily | I know people use toXML to do evil stuff to get information about functions etc. | 11:59:19 |
emily | but I didn't know they were doing, like, regex XML parsing to get that back out | 11:59:29 |
CRTified | And I was asked by a friend whether I could write some "arbitrary XML generation" 😄 https://github.com/CRTified/nixml
And since then, I'm thinking about whether I should write a parser, and maybe write an XSD parser to have some xsdToOptions function 🥲
| 12:00:04 |
CRTified | In reply to @emilazy:matrix.org but I didn't know they were doing, like, regex XML parsing to get that back out I mean, maybe there's some parser already out there | 12:01:29 |
CRTified | In reply to @emilazy:matrix.org we have builtins.toXML but no parser?? https://github.com/NixOS/nixpkgs/issues/57239 | 12:02:38 |
CRTified | https://github.com/kanwren/nix-parsec That might be helpful 🤔 | 12:03:19 |
CRTified | Especially https://github.com/kanwren/nix-parsec/pull/6 | 12:03:43 |
emily | i imagine it'll be miserably slow :) | 12:04:07 |
emily | but it might be fun anyway | 12:04:13 |
emily | i need to sleep, hopefully when i wake up i'll have shaken this dread curse that makes me think trying to reimplement nix's flake.nix parsing logic to poke at an unknown inputs.self is a good idea | 12:05:01 |
twitchy0 | In reply to @emilazy:matrix.org you shouldn't give me ideas like this, this is dangerous I think it's acceptable. Self is considered a flake input, and nix will put your working code in the nix store so you do still have purity in inputs. I can maybe see danger with instability, but it seems like fair game to me to use the flake.lock | 12:06:01 |
twitchy0 | I should say "flake is considered a flake input" only from understanding, dunno about officially | 12:07:29 |
emily | yeah, in this case self would be some unknown third party's flake though | 12:07:43 |
twitchy0 | You certainly don't declare it at such, so it's implicit | 12:07:49 |
emily | and there's no guarantee there's a lock, only flake.nix | 12:07:51 |
emily | so it would be "interesting". | 12:07:54 |
twitchy0 | Ah | 12:07:57 |