frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Json2dir: a JSON-to-directory converter, a fast alternative to home-manager

https://github.com/alurm/json2dir
34•alurm•3h ago

Comments

jauntywundrkind•2h ago
I have a js proxy project that auto-persists changes out live, as you change the object, rathre like this. I really need to get back to it.

The advantage of being able to see state easily is incredible. It's so scriptable. I only demo'ed it for myself, but I've also run a git-auto-commit program on the data as it changes over time, which is much more useful commits to look at over time than seeing data in a huge JSON file change.

I really really hope we can start using the hierarchical file system to hold data. For transport, its convenient to have data glommed together, but I think we're really missing out on end user programming and malleable systems by having these rich data formats everywhere and keeping the filesystem dumb.

QuantumNomad_•2h ago
If I understand correctly:

- OP project manages contents of multiple files as a single JSON with the intention of tracking that one single file in git, and splits it into the original files when you apply it

- Your tool sounds like it can do the same thing, split one JSON file into multiple files, but it’s geared for use the other way around, to track in git as separate files the pieces that make up the total JSON as a.

Both tools can probably be used for the same, it’s up to the user to decide if the combined file is the result and the split files are for git or the other way around.

And fwiw, I agree with you that keeping the split up thing in git is more helpful for reading diffs than a single massive JSON file. I have some scripts in one of my projects too, that takes fragments split across multiple files which are separately tracked, and combine those into single JSON files when I use them.

alurm•2h ago
Well, if you're generating JSON with Nix, you don't have to put everything inside of one file. It would be a better idea to split it up into multiple. You can also use builtins.readFile for reading config files which don't have to be generated in a complex manner. It's up to you to choose, I just kept everything inside of one file since it makes for a simpler example.

Edit: I have updated the documentation to mention this explicitly, thanks!

porridgeraisin•2h ago
> file system to hold data

My bespoke clipboard manager also uses the filesystem as the primary data structure.

h/$serial_number/$mime_type/{data, index}

H for history. data has the actual paste data. index has metadata useful for search - window name, day name, I also include wifi network so I can find clipboard history in terms of place, if I remember it that way. It also includes a copy of the data file if it's a text paste. You can include anything really it's fairly flexible. You can write whatever executable you want to the *-posthook file and they are all executed with argv having the path to the history entry directory. You can then modify the index as you please.

I have a few frontends to actually use this clipboard history as well. One is a gtk3 frontend searchbar + list below. Another is a cli fzf based thing.

Since the data structure is just the filesystem it's really composable and amazing.

Various things like blacklisting windows, "pausing" clipboard history, etc are all just files as well.

If you create a pause file it will pause (there's an if test -f pause check). You can add a grep -E pattern to the blacklist file and it won't paste from those window names.

Unlimited history since I don't care about space. But it does support wrapping around after N items.

Sync with phones is one thing i have to figure out...syncing across my different computers is dead easy of course.

alurm•2h ago
Yeah, in general (a bit of a tangent), ideas from Plan 9 are really powerful. For example, the Acme text editor exposes it's API as a file system (it's represented via Unix sockets in plan9port, but FUSE is available as well there). It's easy to write scripts to manipulate the editor, and quite fun.
Rucadi•1h ago
Cool project!

I'm kinda of the opinion that the real option to handle dotfiles is to override/overlay the package itself with the dotfiles, patching if necessary in order to make it look to the dotfile inside the store, so you can copy the closure of *your* whole app to any machine even if they don't use/can't use nix tho.

tadfisher•1h ago
It's amusing that nixpkgs contributors have spent thousands of human-hours to craft a module system suitable for patching and wrapping any piece of software to accept static configuration, but NixOS, home-manager, and now json2dir end up producing an activation script which litters the filesystem with said configuration.

Everything runs just so much better if the binaries in your profile are wrapper scripts that essentially run "program --config /nix/store/<hash>-program.config". Each file that needs to be copied or symlinked to a "blessed" location in the global mount namespace via an activation script is a failure opportunity, which breaks the atomicity of profile activation and leaves you (or some complicated logic in NixOS/home-manager) to clean up the mess.

Even in the case that a program cannot be patched to run this way, it is easy these days to bind-mount into a clean namespace via bwrap or similar. Alas, shared libraries are kind of the Achilles' heel of this approach.

benreesman•1h ago
This is a legitimately hard problem (as an `emacs` user on NixOS I see both sides of it and their merits).

NixOS is directionally the future but the implementation is self-crippled by ideology in a few important places. There is absolutely no reason why `buildFHSEnv` couldn't come by default rather than `/sw/` or `/run`: links into the store are links into the store, putting them in a place that breaks everything? That's incompatible by design and you know it's intentional because symlinks are cheap you could just do both!

Ditto `nix-ld` being necessary, it's a great piece of work but the dynamic linker should be in the normal place and know about all the libraries on the system by default. It's possible to do this in my NixOS modules? `uv add flash-attention-blah`? Works without any trouble on my machine. But it was a super pain to set up that most people won't put up with.

`home-manager` is awesome, it pioneered a bunch of great stuff, but it's not maintained with the vigor it once was, and some dated ideas got wired in really deep. I still run it, and I probably will forever because it slays at some stuff, but that's the nice thing about symlinking into a a store! I can use it where it works well, and use other stuff where it's trouble. This is the magic of NixOS. The next thing I'm trying is https://github.com/outfoxxed/impurity.nix, which comes highly recommended by heavy Nix people I know.

I think it's time to just update NixOS to run things properly by default. It can be done with zero sacrifice on real pure builds and caching/substitors working properly and all of that. I sometimes call Nix "advanced alien technology that was badly damaged on crash re-entry". @jade is a boss and says kind of the same thing a different way.

But again, the beauty of NixOS is that you can do this yourself, an overlay is a pure function from the world as it is to the world as it ought to be.

EDIT: I know talk is cheap and code wins arguments, and I know this is about a year overdue and not released yet, but it's got beta testers now, it's coming: https://gist.github.com/b7r6/721f62d6431c77b64592a55706d87fd...

mdtrooper•1h ago
And dir2json?

How does Tor work? (2023)

https://skerritt.blog/how-does-tor-really-work/
1•bbno4•1m ago•0 comments

Trump administration seeks $1B settlement from UCLA

https://apnews.com/article/trump-administration-ucla-ec848b4bee5c184f29dba9d7181904a1
1•bikenaga•2m ago•0 comments

Roland's Tadeo Kikumoto on 808, part by part: the ukiyo-e drum machine

https://cdm.link/tadeo-kikumoto-808-day/
2•mariuz•4m ago•0 comments

Meta's AI Strategy

https://thelightcone.substack.com/p/metas-ai-strategy
1•bci12333•5m ago•0 comments

The CIA Spy Who Thwarted Taiwan's Nuclear Plans

https://www.bloomberg.com/news/features/2025-08-08/the-cia-spy-who-exposed-taiwan-s-nuclear-program-now-seems-like-a-hero
1•JumpCrisscross•6m ago•0 comments

GPT-4o is gone and I feel like I lost my soulmate

https://old.reddit.com/r/MyBoyfriendIsAI/comments/1mkbgu1/gpt4o_is_gone_and_i_feel_like_i_lost_my_soulmate/
1•frays•9m ago•0 comments

RISC-V single-board computer for less than 40 euros

https://www.heise.de/en/news/RISC-V-single-board-computer-for-less-than-40-euros-10515044.html
2•doener•12m ago•0 comments

Article II Vests Executive Power, Not the Royal Prerogative

https://repository.law.umich.edu/articles/2062/
4•SubiculumCode•13m ago•0 comments

Its outright war on America's universities

https://www.politico.com/news/2025/08/08/trump-harvard-patents-00500814
2•jonnycomputer•15m ago•0 comments

Free and Ultra-Fast Coding Agent

https://marketplace.visualstudio.com/items?itemName=vsp.vsp
2•pagetok•17m ago•0 comments

What should you do if you accidentally cut off your finger? [video]

https://www.youtube.com/watch?v=wpWm87SfASQ
1•mgh2•19m ago•0 comments

Food companies aren't giving up the chemical that turns products white

https://www.theatlantic.com/health/archive/2025/08/white-food-dye-titanium-dioxide-maha/683806/
1•JumpCrisscross•20m ago•0 comments

Ask HN: Should brain implants be available for everyone as a productivity boost?

1•amichail•21m ago•2 comments

GPT-5 Hangover

https://smartmic.bearblog.dev/gpt-5-hangover/
2•smartmic•21m ago•0 comments

Tversky Neural Networks: Psychologically Plausible Deep Learning With

https://arxiviq.substack.com/p/tversky-neural-networks-psychologically
2•che_shr_cat•21m ago•0 comments

Single Image –> Multiview Splat

https://github.com/rerun-io/vistadream
2•pablovelagomez•28m ago•0 comments

KrebsOnSecurity in New 'Most Wanted' HBO Max Series

https://krebsonsecurity.com/2025/08/krebsonsecurity-in-new-most-wanted-hbo-max-series/
4•todsacerdoti•28m ago•0 comments

Llevered beta is all you need

https://ethanding.substack.com/p/levered-beta-is-all-you-need
1•whoami_nr•29m ago•0 comments

Early-stage lending fintech founders –> how did you fund your first loan book?

1•CocoIemon•32m ago•0 comments

Breaking the Sorting Barrier for Directed Single-Source Shortest Paths

https://www.alphaxiv.org/abs/2504.17033v2
1•chaosprint•33m ago•0 comments

Star leaky app of the week: StarDict

https://www.theregister.com/2025/08/08/stardict_leaky_app_of_week/
1•LorenDB•38m ago•0 comments

Undefined Behavior in C and C++

https://russellw.github.io/undefined-behavior
4•imadr•41m ago•1 comments

Incorrect Lift Theory

https://www.grc.nasa.gov/www/k-12/VirtualAero/BottleRocket/airplane/wrong1.html
2•johlo•43m ago•1 comments

Show HN: Private Markdown library for AI agents / development work

https://markdown-vault.vercel.app/
1•lloydjones•45m ago•1 comments

Texas politicians warn Smithsonian it must not lobby to retain its space shuttle

https://arstechnica.com/space/2025/08/texas-politicians-warn-smithsonian-it-must-not-lobby-to-retain-its-space-shuttle/
23•LorenDB•45m ago•4 comments

Show HN: I made FiscalBud to send invoices fast and worldwide in 77 languages

https://apps.iridesk.com/fiscalbud
2•drex91on•45m ago•0 comments

Hackers Sought a Backdoor in High-Tech Safes – Now Can Open Them in Seconds

https://www.wired.com/story/securam-prologic-safe-lock-backdoor-exploits/
4•kPwn•46m ago•1 comments

A Puzzling Python Program

https://jo3-l.dev/posts/python-countdown/
3•Bogdanp•49m ago•1 comments

OpenAI returns old models to ChatGPT

https://venturebeat.com/ai/openai-returns-old-models-to-chatgpt-as-sam-altman-admits-bumpy-gpt-5-rollout/
3•geox•49m ago•0 comments

Rising heat threatens female-male ratio of India's unique gharial crocs

https://news.mongabay.com/short-article/2025/07/rising-heat-threatens-female-male-ratio-of-indias-unique-gharial-crocs/
1•PaulHoule•52m ago•0 comments