Skip to content

Instantly share code, notes, and snippets.

@vsuharnikov
Created February 14, 2026 07:51
Show Gist options
  • Select an option

  • Save vsuharnikov/44fb153bacd67f2c43a56eb351ff9171 to your computer and use it in GitHub Desktop.

Select an option

Save vsuharnikov/44fb153bacd67f2c43a56eb351ff9171 to your computer and use it in GitHub Desktop.
JSON5 to nix
#!/usr/bin/env bash
# Usage: json52nix.sh <config.json5
set -euo pipefail
nix run github:IvanIsCoding/celq -- --from-json5 'this' \
| nix eval --impure --raw --arg-from-stdin jsonText \
--expr '
{ jsonText }:
let
lib = import <nixpkgs/lib>;
value = builtins.fromJSON jsonText;
in
{ out = lib.generators.toPretty {} value; }
' out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment