lemmy.mlaga97.space
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
ruffsl@programming.dev to Nix / NixOS@programming.devEnglish · 26 days ago

Announcing Nix-manipulator (Nima): structured edits for Nix that keep formatting - NixOS Discourse

discourse.nixos.org

external-link
message-square
4
link
fedilink
17
external-link

Announcing Nix-manipulator (Nima): structured edits for Nix that keep formatting - NixOS Discourse

discourse.nixos.org

ruffsl@programming.dev to Nix / NixOS@programming.devEnglish · 26 days ago
message-square
4
link
fedilink
Announcing Nix-manipulator (Nima): structured edits for Nix that keep formatting
discourse.nixos.org
external-link
(I do not have permissions to post in Announcements, so I am sharing this here. Moderators are welcome to move it.) nix-manipulator is a Python library and CLI for parsing, transforming, and reconstructing Nix while preserving comments and layout, in line with RFC 166. It is built on Tree-sitter using the nix-community grammar. Motivations Nix is often described as “JSON on steroids”. I like this definition but did not find an easy way to update the values in a Nix file without doing string re...
alert-triangle
You must log in or # to comment.
  • ruffsl@programming.devOP
    link
    fedilink
    English
    arrow-up
    6
    ·
    26 days ago

    @onlinepersona@programming.dev , this could be really useful for advancing programmatic mutation of pre-existing nix config files using graphical installers and user administ ration tools, like with SnowflakeOS:

    • https://programming.dev/comment/18873914
    • onlinepersona@programming.dev
      link
      fedilink
      English
      arrow-up
      4
      ·
      26 days ago

      Wow, that’s awesome. Hopefully that can breathe some new life into SnowflakeOS! My attempts at manipulating nix code went through a nix parser that I can’t remember the name of. That’s when I found (or came up with? dunno) the importJson function. But this could be cleaner and more reviewable + definitely allows for things like function calls to take advantage of the “JSON on steroids” aspect the author mentioned.

      Thanks for sharing 🙏

      Anti Commercial-AI license

    • balsoft@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      26 days ago

      What I’m really excited about is automatically editing Nixpkgs meta attrs, e.g. to implement https://github.com/NixOS/rfcs/blob/master/rfcs/0180-broken-package-removal.md

  • Laser@feddit.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    25 days ago

    Very cool

Nix / NixOS@programming.dev

nix@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !nix@programming.dev

Main links

  • website
  • wiki
  • matrix

Videos

  • Linux Experiment about NixOS
  • Chris Titus Tech
  • Mental Outlaw
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 9 users / week
  • 203 users / month
  • 511 users / 6 months
  • 1 local subscriber
  • 2.45K subscribers
  • 263 Posts
  • 1.08K Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • ballmerpeaking@programming.dev
  • WhiteBlackGoose@programming.dev
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org