NAR Flinger 1.3, with .glitch-assets support

last thread: NAR Flinger users, I'm cleaning up my binary cache

{
  // ...
  "narflinger": {
    "basenames": [
      "shm2664mpsa4da4rrkjrz5rllpvby22p-emacs-nox-28.2",
      "zx8afr6kxipp78hpm3r578zlgq2a60zn-python3-3.10.11"
    ],
    "update_glitch_assets": true // <- new
  }
}

New in NAR Flinger 1.3, there’s an update_glitch_assets flag you can enable in your package.json file in .narflinger.update_glitch_assets. This option causes NAR Flinger to add a list of the packages it installs to your .glitch-assets file. Having your packages listed in a .glitch-assets file is meant to prevent your dependencies from being erased as unused assets.

Notes:

  • This programmatically modifies your .glitch-assets file, so you should probably back up your .glitch-assets file before setting this up. Just in case, right? See the NAR Flinger license for why.
  • Due to NAR Flinger not looking through packages and dependencies when it sees your requested packages are already present, it won’t actually make any changes until reinstalling after the project goes to sleep and wakes up again (i.e. with a clean /tmp/nix/store directory). You should be able to rm -r /tmp/nix/store and rerun NAR Flinger if you don’t want to wait.
  • This counts as a program changing a file outside of the editor, so run refresh after if you want to view or modify your assets.
  • Some packages have big dependency trees, which will result in there being lots of entries in your Assets view after using this. And that can make it tedious to manage your other assets. Sorry folks.

Get NAR Flinger 1.3 here:

Alright, tutorial time. Here’s how I updated narflinger-postgresql:

  1. Go to the narflinger project
  2. Copy the contents of narflinger.py.
  3. Go to the narflinger-postgresql project.
  4. Paste the contents over the existing narflinger.py.
  5. Add a comma , after the ] of the basenames array.
  6. Add "update_glitch_assets": true on the next line.
  7. Open the terminal.
  8. Run rm -r /tmp/nix/store && refresh.
  9. Open the logs and wait for the install to finish. NAR Flinger’s output ends with something like symlink /app/.local/bin/... -> /tmp/nix/store/.../bin/... exists
  10. Run refresh.
  11. Check in the Assets view that a bunch of “narflinger-narinfo-…” and “narflinger-nar-…” entries are present.
1 Like