xzfc / cached-nix-shell

Instant startup time for nix-shell
https://xzfc.github.io/cached-nix-shell/cached-nix-shell.1
The Unlicense
195 stars 16 forks source link

Stranged HOME_PATH format #17

Closed blaggacao closed 3 years ago

blaggacao commented 3 years ago

https://github.com/direnv/direnv/issues/654#issue-664915055

@xzfc would you agree to have a quick look at what I observed when using with direnv? Maybe you can see at first sight why a few \n are inserted where direnv doesn't expect them and if it's legit and on which part to fix?

xzfc commented 3 years ago

It seems that you have shellHook in shell.nix that echoes extra lines to stdout?

It's a bug in cached-nix-shell: it doesn't expect anything extra in the output of nix-shell --run 'env -0'. I'll fix it. In the meantime, you can wrap shellHook into {} 1>&2 to redirect its output to stderr.

blaggacao commented 3 years ago

Yep:

    export KUBECTL_EXTERNAL_DIFF=delta
    git config git-town.code-hosting-driver gitea
    git config git-town.code-hosting-origin-hostname git.p1.rocks
    git config git-town.main-branch-name master
    just help

I print out the just help recipe for better onboarding. Your analysis is spot-on black magic. Thank you! :+1:

There, they are, the \ns:

$ nix-shell --run 'env -0'
warning: unknown setting 'experimental-features'
nix-pre-commit-hooks: hooks up to date

# -------------------------------------
# Task Runner
# -------------------------------------
# show recipes with: `just --list`

# -------------------------------------
# Conventional Commits
# -------------------------------------
# Only well-formatted commits shall
# land in master branch.
# -------------------------------------
# `cz commit` to commit
# `cz info` to show the info
# `cz schema` to show the schema
# `cz example` to show an example

# -------------------------------------
# GitTown for collaboration
# -------------------------------------
# `git town sync` - synch everything
# `git town hack` - start new feature
# `git town` - list all commands

HOST_PATH[...]
blaggacao commented 3 years ago

just help 1>&2 worked around! Thank you!

xzfc commented 3 years ago

Should be fixed in the current master.

blaggacao commented 3 years ago

It is fixed. Thank you! Looks so much better :smile: !