{
  "$type": "site.standard.document",
  "content": {
    "$type": "pub.leaflet.content",
    "pages": [
      {
        "$type": "pub.leaflet.pages.linearDocument",
        "blocks": [
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ],
                  "index": {
                    "byteEnd": 77,
                    "byteStart": 59
                  }
                },
                {
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ],
                  "index": {
                    "byteEnd": 264,
                    "byteStart": 252
                  }
                }
              ],
              "plaintext": "NixOS is great, but it is a bit tedious to always type out vim /etc/nixos/... etc to make changes to your system, nor do I want a complicated setup for my nix configuration files. So I devised a little script to speed up the progress, which I saved to configure.sh allowing me to configure NixOS by just opening my terminal and typing ./configure.sh"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "#!/run/current-system/sw/bin/bash\nsudo $EDITOR /etc/nixos/configuration.nix\nread -p \"Want to apply the config? [y/n]\" choice\nif [[ \"$choice\" == \"y\" ]]; then\n  nixos-rebuild switch --use-remote-sudo\nfi"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ],
                  "index": {
                    "byteEnd": 141,
                    "byteStart": 134
                  }
                }
              ],
              "plaintext": "It will open the nix configuration in the editor of your choice and after finishing your edit session, offer to apply it immediately. $EDITOR will resolve to nano by default, but you can change it easily by changing the environment variable from your nix config:"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "nix",
              "plaintext": "environment.variables = {\n    EDITOR = \"hx\";\n};"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "plaintext": ""
            }
          }
        ],
        "id": "019e6e7b-e211-7bb8-8681-2775b93f9ed0"
      }
    ]
  },
  "description": "",
  "path": "/3mmvzrtbezc2s",
  "publishedAt": "2025-03-23T13:33:00.000Z",
  "site": "at://did:plc:z4yzhhsdetqfkq6hneiwc3cv/site.standard.publication/3m5k5jw2onk2h",
  "tags": [
    "nix",
    "linux",
    "scripts"
  ],
  "title": "The quickest way to change your nix configuration"
}