# Curious about system.nix

**URL:** https://discourse.nixos.org/t/curious-about-system-nix/77977
**Category:** Uncategorized
**Created:** [June 1, 2026, 10:20am UTC](https://discourse.nixos.org/t/curious-about-system-nix/77977 "2026-06-01T10:20:21Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![rnhmjoj](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rnhmjoj/32/1792_2.png) [@rnhmjoj](https://discourse.nixos.org/u/rnhmjoj)
#### Post date: [June 1, 2026, 8:32pm UTC](https://discourse.nixos.org/t/curious-about-system-nix/77977/9 "2026-06-01T20:32:15Z")

</div>

I deal with NIX\_PATH like this:

```nix
let
  nixpkgs = builtins.fetchTarball { ... };
in
  import "${nixpkgs}/nixos" {
    configuration = {
      imports = [./configuration.nix];
      nix.nixPath = [
        "nixos-config=${toString ./configuration.nix}"
        "nixos-system=${toString ./system.nix}"
        "nixpkgs=/run/current-system/nixpkgs"
      ];
      system.systemBuilderCommands = "ln -s ${nixpkgs} $out/nixpkgs";
    };
  }

```

- `nixos-config` so that `nixos-rebuild edit` works,
- `nixos-system` so I can run `nixos-rebuild` anywhere,
- `nixpkgs` so Nix uses the same Nixpkgs that was used to build the system,
- and the link to /run/current-system so it doesn’t get gc’ed.

---

_[View the full topic](https://discourse.nixos.org/t/curious-about-system-nix/77977)._
