DeterminateSystems/nuenv

`nix run` returns empty record

siph opened this issue · 2 comments

siph commented

Using the template at the bottom of the readme:

# This example is only for x86_64-linux; adjust for your own platform
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    nuenv.url = "github:DeterminateSystems/nuenv";
  };

  outputs = { self, nixpkgs, nuenv }: let
    pkgs = import nixpkgs {
      system = "x86_64-linux";
      overlays = [ nuenv.overlays.nuenv ];
    };
  in {
    packages.x86_64-linux.run-me = pkgs.nuenv.mkScript {
      name = "run-me";
      script = ''
        def blue [msg: string] { $"(ansi blue)($msg)(ansi reset)" }
        blue "Hello world"
      '';
    };
  };
}

Running both of these commands result in an empty record:

> nix run .#run-me
╭──────────────╮
│ empty record │
╰──────────────╯
> nix build .#run-me
> ./result/bin/run-me
╭──────────────╮
│ empty record │
╰──────────────╯

Passing the result into nushell works as expected:

> nu ./result/bin/run-me
Hello world

Nushell version: 0.77.1

This is a Nushell version issue. I just tried running nix flake update && nix run .#run-me and got the same error as you. I've pinned Nixpkgs to a specific revision in a change I just pushed to flake.nix. Using that same revision should resolve this. I'll see if there's a fix for this for more recent versions.

siph commented

Cool. As a workaround I'm just using nixpkgs from neunv:

pkgs = import nuenv.inputs.nixpkgs {
  overlays = [ nuenv.overlays.nuenv ];
  inherit system;
};