Files
Martin Kronberger 86e6517abc fix(nix): take libx11 instead of the deprecated xorg set (#19181)
## Description

nixpkgs turned the `xorg` set into a warning alias, thus
`scripts/nix/default.nix` printed `'xorg.libX11' has been renamed to
'libx11'` on every evaluation.
This takes the top-level `libx11` instead.
`libX11` exists at the top level too, but only as an alias, so `libx11`
is the name that stays.

## User-facing changes (Release notes)

n/a

## Additional notes

Checked against current nixos-unstable, evaluates without the warning.
2026-10-07 06:16:03 -05:00
..

Nix Flake for Nushell

Placed in the scripts/nix directory to keep it nicely out of the root of the repo, but also allow including and building with the latest sources. Due to it not being in the root most nix commands will need to be told the location of the flake:

$ nix run ./scripts/nix
$ nix build ./scripts/nix
$ nix flake update --flake ./scripts/nix

Including in another flake

# flake.nix
{
  inputs = {
    nixpkgs.url = "...";
    nushell = {
      url = "github:nushell/nushell?dir=scripts/nix";
      inputs.nixpkgs.follows = "nixpkgs"; # optional
    };
  };

  outputs = inputs: {
    # ...
    # I would recommend using a `for-each-system` function of some kind here.
    packages.x86_64-linux = {
      nushell = inputs.nushell.packages.x86_64-linux.nushell;
    };
  }
}

Adding the hash to version

The inputs.nushell.rev variable can be used to get the commit hash in the output of version:

{
# ...
      nushell = inputs.nushell.packages.x86_64-linux.nushell.override {
        NU_COMMIT_HASH = inputs.nushell.rev;
      };
# ...
}

Using the Overlay

This flake also includes an overlay to allow using the new nushell and plugins without modifying every instance of nushell in the configuration. This is a more complex example than the one above, allowing multiple systems and showing an example of a nixosConfiguration that uses the flakes nushell.

{
  outputs = inputs:
  let
      systems = [
        # List of systems to enable, for example:
        "x86_64-linux"
        "aarch64-darwin"
      ];
      # And for packages or other system-specific inputs, use a function that
      # overlays overlays set during the nixpkgs import:
      forEachSystem =
        f:
        inputs.nixpkgs.lib.genAttrs systems (
          system:
          f {
            pkgs = import inputs.nixpkgs {
              inherit system;
              overlays = [ inputs.nixpkgs.overlays.default ];
            }
          }
        );
  in
  {
    packages = forEachSystem ({pkgs, ...}: {inherit nushell;});
    # For a nixos configuration, add it to the `nixpkgs.overlays`. If a nixos
    # configuration is all that is required, this is the only part needed
    nixosConfiguration.yourHost = inputs.nixpkgs.lib.nixosSystem {
      system = "...";
      modules = [
        {
          nixpkgs.overlays = [
            inputs.nushell.overlays.default
          ];
        }
        ./configuration.nix
        # ... other modules
      ];
    };
  };
}

Using Without Flakes

The package can be built using the scripts/nix/default.nix file:

let
  pkgs = import <nixpkgs> { };
in
{
  nushell = pkgs.callPackage ./scripts/nix { };
}