I’m trying to build this literate XMonad:
https://github.com/disconsis/literate-xmonad-config
First problem is that it’s not finding ntangle
b0ef $ ~/.pkg/disconsis.literate-xmonad-config.git >
make build
bin/build --quiet
[!] 'ntangle' is needed for the build process.
[!] Please install it from https://github.com/OrgTangle/ntangle
make: *** [Makefile:5: build] Error 1
, even though it’s in the path
b0ef $ ~/.pkg/disconsis.literate-xmonad-config.git >
which ntangle
/home/b0ef/.nimble/bin/ntangle
If I modify the file with a full path to the binary, then it works, but I don’t understand why it’s not seeing this?
1 Like
It looks like you’re using which
to check if ntangle
exists, while the build
script is using bash’s -x
on the output of command -v
:
Hopefully that will help you debug the issue a little more.
1 Like
That’s superweird
b0ef $ ~/.pkg/disconsis.literate-xmonad-config.git >
if [ -x "$(command -v ntangle)" ]; then echo ehlo; fi
ehlo
2 Likes
I’m not getting to the bottom of this.
I run this:
#!/usr/bin/env sh
echo which: `which ntangle`
ntangle
if [ -x "$(command -v ntangle)" ]; then
echo ntangle found
else
echo ntangle not found
fi
and get this:
b0ef $ /mnt/7440b882-aecb-4e4a-8ecb-24d7a31dc9f9/home/b0ef/.pkg/disconsis.literate-xmonad-config.git >
make buildtest
bin/buildtest
which: /home/b0ef/.nimble/bin/ntangle
bin/buildtest: line 4: ntangle: command not found
ntangle not found
If I peek at this file, I get:
b0ef $ /mnt/7440b882-aecb-4e4a-8ecb-24d7a31dc9f9/home/b0ef/.pkg/disconsis.literate-xmonad-config.git >
ls -lh ~/.nimble/bin/ntangle
lrwxrwxrwx 1 b0ef users 29 Oct 8 14:43 /home/b0ef/.nimble/bin/ntangle -> ../pkgs/ntangle-0.7.0/ntangle
, so, it’s a symlink to this:
b0ef $ /mnt/7440b882-aecb-4e4a-8ecb-24d7a31dc9f9/home/b0ef/.pkg/disconsis.literate-xmonad-config.git >
ls -lh ~/.nimble/pkgs/ntangle-0.7.0/ntangle
-rwxr-xr-x 1 b0ef users 465K Oct 8 14:43 /home/b0ef/.nimble/pkgs/ntangle-0.7.0/ntangle
Here’s the PATH from env
b0ef $ /mnt/7440b882-aecb-4e4a-8ecb-24d7a31dc9f9/home/b0ef/.pkg/disconsis.literate-xmonad-config.git >
env|grep -i nim
PATH=/run/wrappers/bin:/home/b0ef/.nix-profile/bin:/etc/profiles/per-user/b0ef/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:~/.nimble/bin:~/.dotnet/tools
What about file ~/.nimble/pkgs/ntangle-0.7.0/ntangle
? Are you sure it is using a valid interpreter, and you are able to directly run ~/.nimble/pkgs/ntangle-0.7.0/ntangle
?
Yeah, superweird;)
file ~/.nimble/pkgs/ntangle-0.7.0/ntangle
/home/b0ef/.nimble/pkgs/ntangle-0.7.0/ntangle: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/v6szn6fczjbn54h7y40aj7qjijq7j6dc-glibc-2.34-210/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
b0ef $ ~/.emacs-conf >
file ~/.nimble/pkgs/ntangle-0.7.0/ntangle
/home/b0ef/.nimble/pkgs/ntangle-0.7.0/ntangle: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/v6szn6fczjbn54h7y40aj7qjijq7j6dc-glibc-2.34-210/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
b0ef $ ~/.emacs-conf >
~/.nimble/pkgs/ntangle-0.7.0/ntangle
Usage:
NAME
ntangle - Command-line utility for Tangling of Org mode documents
USAGE
ntangle [optional-params] [orgFilesOrDirs: string...]
OPTIONS
-h, --help print this cligen-erated help
--help-syntax advanced: prepend,plurals,..
--version bool false print version
URI
https://github.com/OrgTangle/ntangle
AUTHOR
Kaushal Modi
VERSION
v0.7.0
Man, I have no idea what could be going on.
The only other debugging option I could come up with is to change
famadorian:
#!/usr/bin/env sh
to
#!/usr/bin/env bash
or even just
#!/nix/store/1234...bash/bin/bash
and see if anything different happens.
Also, put a call to env
to dump all the environment variables in the top of your script that is failing. Manually look if PATH
looks weird or something, or there ends up being two ntangle
binaries in your PATH
, where one doesn’t work or something.
Yup, if I change to bash, then it works;)
b0ef $ /mnt/7440b882-aecb-4e4a-8ecb-24d7a31dc9f9/home/b0ef/.pkg/disconsis.literate-xmonad-config.git >
make buildtest
bin/buildtest
which: /home/b0ef/.nimble/bin/ntangle
Usage:
NAME
ntangle - Command-line utility for Tangling of Org mode documents
USAGE
ntangle [optional-params] [orgFilesOrDirs: string...]
OPTIONS
-h, --help print this cligen-erated help
--help-syntax advanced: prepend,plurals,..
--version bool false print version
URI
https://github.com/OrgTangle/ntangle
AUTHOR
Kaushal Modi
VERSION
v0.7.0
ntangle found
Here’s env:
SHELL=/run/current-system/sw/bin/bash
WINDOWID=20971522
__ETC_PROFILE_DONE=1
__HM_SESS_VARS_SOURCED=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg:/home/b0ef/.nix-profile/etc/xdg:/etc/profiles/per-user/b0ef/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
NAUTILUS_EXTENSION_DIR=/nix/store/lgr4i9rshhlzzixg74kwg7sildsz2chv-system-path/lib/nautilus/extensions-3.0
XCURSOR_PATH=/home/b0ef/.icons:/home/b0ef/.local/share/icons:/home/b0ef/.nix-profile/share/icons:/home/b0ef/.nix-profile/share/pixmaps:/etc/profiles/per-user/b0ef/share/icons:/etc/profiles/per-user/b0ef/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps
LOCALE_ARCHIVE_2_27=/nix/store/9qcjqaz5l9f6cfad298d1wsl1jw84dmm-glibc-locales-2.34-210/lib/locale/locale-archive
DESKTOP_SESSION=/nix/store/66glas1p28v1v0dsyhsvdsy3zqws7vdx-desktops/share/xsessions/none+xmonad
GDK_PIXBUF_MODULE_FILE=/nix/store/6y6gkvymacxvx838gq3mjbnpvajkpiya-gdk-pixbuf-loaders.cache
EDITOR=emacs
XDG_SEAT=seat0
PWD=/home/b0ef/ds/station
NIX_PROFILES=/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/b0ef /home/b0ef/.nix-profile
TRACKER_CLI_SUBCOMMANDS_DIR=/nix/store/1fbfj709q0zdfnn35d0xdlrrw3ji4667-tracker-with-subcommands-3.3.0/libexec/tracker3
NIX_GSETTINGS_OVERRIDES_DIR=/nix/store/pxy0xrsqna41qq4f9svspshawqpyx3nm-nixos-gsettings-desktop-schemas/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
XDG_SESSION_DESKTOP=none+xmonad
LOGNAME=b0ef
QT_QPA_PLATFORMTHEME=gnome
XDG_SESSION_TYPE=x11
CUPS_DATADIR=/nix/store/rkjhav9fp2iymkvckjs5nd8pglsx9r4a-cups-progs/share/cups
NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
NIXPKGS_CONFIG=/etc/nix/nixpkgs-config.nix
XAUTHORITY=/home/b0ef/.Xauthority
QT_STYLE_OVERRIDE=adwaita
HOME=/home/b0ef
SSH_ASKPASS=/nix/store/lyp35cwc4a9sjy0sg090bf5q68yi1iad-ksshaskpass-5.24.5/bin/ksshaskpass
LANG=en_US.utf8
TMUX_TMPDIR=/run/user/1000
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=none+xmonad
ASPELL_CONF=dict-dir /run/current-system/sw/lib/aspell
GIO_EXTRA_MODULES=/nix/store/kxbs417d57qxp67h61q9j98z7zhbh3dr-glib-networking-2.72.2/lib/gio/modules:/nix/store/0c5sryihipvkn9gd8nzmvmnm5yhx11p5-gvfs-1.50.2/lib/gio/modules:/nix/store/jp2xk578wrggvx9lvlzdcaiz1r5a01hg-dconf-0.40.0-lib/lib/gio/modules
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
NIX_USER_PROFILE_DIR=/nix/var/nix/profiles/per-user/b0ef
ALACRITTY_SOCKET=/run/user/1000/Alacritty-:0-1840726.sock
INFOPATH=/home/b0ef/.nix-profile/info:/home/b0ef/.nix-profile/share/info:/etc/profiles/per-user/b0ef/info:/etc/profiles/per-user/b0ef/share/info:/nix/var/nix/profiles/default/info:/nix/var/nix/profiles/default/share/info:/run/current-system/sw/info:/run/current-system/sw/share/info
XDG_SESSION_CLASS=user
TERM=xterm-256color
XDG_DESKTOP_PORTAL_DIR=/nix/store/94qbjxic85jdn8jppmavwvznb17ihmcf-xdg-portals/share/xdg-desktop-portal/portals
GTK_PATH=/home/b0ef/.nix-profile/lib/gtk-2.0:/home/b0ef/.nix-profile/lib/gtk-3.0:/home/b0ef/.nix-profile/lib/gtk-4.0:/etc/profiles/per-user/b0ef/lib/gtk-2.0:/etc/profiles/per-user/b0ef/lib/gtk-3.0:/etc/profiles/per-user/b0ef/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0
LESSOPEN=|/nix/store/35f1v8iygrq8pwr3r61jckjkqvcifm0v-lesspipe-1.85/bin/lesspipe.sh %s
USER=b0ef
TZDIR=/etc/zoneinfo
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
DISPLAY=:0
SHLVL=1
XMONAD_XMESSAGE=/nix/store/5w0dhdji3j7vja687i0pnm2nnd1s0ywb-xmessage-1.0.5/bin/xmessage
PAGER=less
QTWEBKIT_PLUGIN_PATH=/home/b0ef/.nix-profile/lib/mozilla/plugins/:/etc/profiles/per-user/b0ef/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/
__NIXOS_SET_ENVIRONMENT_DONE=1
XDG_VTNR=7
XDG_SESSION_ID=2
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
LESSKEYIN_SYSTEM=/nix/store/d2hd7a88xkf91wgdy2w7yi2bgsmps6fl-lessconfig
TERMINFO_DIRS=/home/b0ef/.nix-profile/share/terminfo:/etc/profiles/per-user/b0ef/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo
LD_LIBRARY_PATH=
MOZ_PLUGIN_PATH=/home/b0ef/.nix-profile/lib/mozilla/plugins:/etc/profiles/per-user/b0ef/lib/mozilla/plugins:/nix/var/nix/profiles/default/lib/mozilla/plugins:/run/current-system/sw/lib/mozilla/plugins
XDG_RUNTIME_DIR=/run/user/1000
NIX_GHC=/nix/store/n7hlfan77z3anf2k0sn9ykraxaxjzd5q-ghc-9.0.2-with-packages/bin/ghc
KDEDIRS=/home/b0ef/.nix-profile:/etc/profiles/per-user/b0ef:/nix/var/nix/profiles/default:/run/current-system/sw
XDG_DATA_DIRS=/nix/store/k49axrgk64y41xnjpf71sfm5sdkrnfks-gnome-mimeapps/share:/nix/store/66glas1p28v1v0dsyhsvdsy3zqws7vdx-desktops/share:/home/b0ef/.nix-profile/share:/etc/profiles/per-user/b0ef/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share:/nix/store/ywrhgnck4ragla6df217p6z4fppv6i86-gnome-shell-42.4/share/gsettings-schemas/gnome-shell-42.4:/nix/store/d40yhrbx1rd3g6p1dpl8ls98d50rl5vs-gnome-shell-extensions-42.3/share/gsettings-schemas/gnome-shell-extensions-42.3
LIBEXEC_PATH=/home/b0ef/.nix-profile/lib/libexec:/etc/profiles/per-user/b0ef/lib/libexec:/nix/var/nix/profiles/default/lib/libexec:/run/current-system/sw/lib/libexec
PATH=/run/wrappers/bin:/home/b0ef/.nix-profile/bin:/etc/profiles/per-user/b0ef/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:~/.nimble/bin:~/.dotnet/tools
ALACRITTY_LOG=/tmp/Alacritty-1840726.log
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
QT_PLUGIN_PATH=/home/b0ef/.nix-profile/lib/qt4/plugins:/home/b0ef/.nix-profile/lib/kde4/plugins:/etc/profiles/per-user/b0ef/lib/qt4/plugins:/etc/profiles/per-user/b0ef/lib/kde4/plugins:/nix/var/nix/profiles/default/lib/qt4/plugins:/nix/var/nix/profiles/default/lib/kde4/plugins:/run/current-system/sw/lib/qt4/plugins:/run/current-system/sw/lib/kde4/plugins
OLDPWD=/home/b0ef/ds
_=/run/current-system/sw/bin/env
Huh, I wonder why. If you do any more debugging into this, I’d be interested if you found the reason.
I have similar problems with other apps, so I need to pursue this a little more right now, I think;)
Here’s how I add those paths to my PATH with home manager:
home = {
sessionPath = [
"~/.nimble/bin"
"~/.dotnet/tools"
];
sessionVariables = {
EDITOR = "emacs";
};
};
programs.bash = {
enable = true;
initExtra = ''
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
'';
shellAliases = {
ne = "nix-env";
ni = "nix-env -iA";
no = "nixops";
ns = "nix-shell --pure";
lss ="exa -xl --icons -T";
};
};
This is getting weirder.
b0ef $ ~/ds/station >
sh
sh-5.1$ env|grep -i nimble
PATH=/run/wrappers/bin:/home/b0ef/.nix-profile/bin:/etc/profiles/per-user/b0ef/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:~/.nimble/bin:~/.dotnet/tools
sh-5.1$ which ntangle
/home/b0ef/.nimble/bin/ntangle
sh-5.1$ ntangle
sh: ntangle: command not found
sh-5.1$ pwd
/home/b0ef/ds/station
sh-5.1$ cd
sh-5.1$ ls -lh .nimble/
bin/ nimbledata.json packages_official.json packages_temp.json pkgs/
sh-5.1$ ls -lh .nimble/bin/ntangle
lrwxrwxrwx 1 b0ef users 29 Oct 8 14:43 .nimble/bin/ntangle -> ../pkgs/ntangle-0.7.0/ntangle
sh-5.1$ .nimble/bin/ntangle
Usage:
NAME
ntangle - Command-line utility for Tangling of Org mode documents
tejing
October 17, 2022, 11:52am
12
From the document describing the differences between posix-mode bash (which is what you get when you run it as sh
) and regular bash:
19. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
I’m guessing that’s your issue.
2 Likes
wow, yeah, you’re absolutely right;) Hehe, great; thanks. On to the next hurdle with this package;)
Wow, I’m pretty impressed you figured this out! I had no idea about sh
not expanding ~
, although it makes complete sense.