Last active
October 29, 2025 22:40
-
-
Save mochienya/bbdb13458cb457d2213686d910490096 to your computer and use it in GitHub Desktop.
nix attrset stringifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| __toString = | |
| self: | |
| let | |
| keys = builtins.filter (n: n != "__toString") (builtins.attrNames self); | |
| pairs = builtins.map (key: " ${key} = ${self.${key}};") keys; | |
| in | |
| builtins.concatStringsSep "\n" ( | |
| builtins.concatLists [ | |
| [ "{" ] | |
| pairs | |
| [ "}" ] | |
| ] | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment