Skip to content

shell.nix doesn't set proper library path #10604

Open
@zeratax

Description

@zeratax

It seems to me like the provided shell.nix doesn't set the library path correctly?

when I run

$ nix-shell
$ echo 'puts "Hello World!"' > hello_world.cr
$ crystal run hello_world.cr

I get

Showing last frame. Use --error-trace for full trace.

In hello_world.cr:1:1

 1 | puts "Hello World!"
     ^
Error: can't find file 'prelude'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?

Which afaict is due to the library path not being set correctly, which seems to be confirmed when I run:

$ crystal env
CRYSTAL_CACHE_DIR=/home/kaine/.cache/crystal
CRYSTAL_PATH=lib
CRYSTAL_VERSION=1.0.0
CRYSTAL_LIBRARY_PATH=''
CRYSTAL_OPTS=''

my system:

  • system: "x86_64-linux"
  • host os: Linux 5.4.108, NixOS, 20.09.3732.91b77fe6942 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): "nixos-20.09.3732.91b77fe6942, nixos-unstable-21.05pre279456.04a2b269d89"
  • channels(kaine): "home-manager-20.09"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.topic:infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions