!9IQChSjwSHXPPWTa:lix.systems

Lix

1118 Members
Lix user channel. Feel free to discuss on-topic issues here and give each other help. For matrix.to links to the rest of the Lix channels, see: https://wiki.lix.systems/books/lix-organisation/page/matrix-rooms303 Servers

Load older messages


SenderMessageTime
18 Feb 2026
@opeik:matrix.orgopeik

exactly the same as yours:

#!/usr/bin/env -S nix shell nixpkgs#hello nixpkgs#cowsay -c bash
hello | cowsay
02:37:12
@opeik:matrix.orgopeik *

the same as your example above:

#!/usr/bin/env -S nix shell nixpkgs#hello nixpkgs#cowsay -c bash
hello | cowsay
02:37:58
@ian-h-chamberlain:matrix.orgian-h-chamberlain

huh, maybe some quirk of macos Lix then? the nix-on-droid example worked with Lix 2.93.3 for me but my Mac with Lix 2.93.3 is also giving me a similar error

§ /tmp/test.sh
path '/tmp/test.sh' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file 

also reading the manpage it seems like -S shouldn't even be needed on Darwin but is probably more portable with it. but with or without, seems to want a flake.nix file which afaik shouldn't be necessary with a fully qualified flake ref like github:nixos/nixpkgs that I was trying

06:15:26
@ian-h-chamberlain:matrix.orgian-h-chamberlain I'll try this on nixos when I have a chance then probably search for / file an issue since it seems inconsistent and I think ought to work without the fancy nix-shell parsing mentioned further up 06:22:14
@splurged:matrix.orgsplurged changed their profile picture.09:31:42
@kspatlas:tchncs.deKSP Atlas joined the room.09:57:56
@erin:erindesu.czErin [ DEPRECATED ] left the room.12:02:57
@evoea9:matrix.orglucy changed their display name from evoea0 to lucy.17:01:00
@niko:nrab.lol-> @n:rab.lol changed their display name from niko ⚡️ to -> @n:rab.lol.23:28:24
19 Feb 2026
@ian-h-chamberlain:matrix.orgian-h-chamberlain

Aha! I've figured something out, this is not a Lix issue but indeed a cursed macOS shebang quirk. You can see it more obviously with one like this:

#!/usr/bin/env -S echo nixpkgs#foo nixpkgs#bar

The man pages for env claim (seemingly incorrectly) that # characters only matter at the beginning of a split argument, and can be escaped with \#: https://ss64.com/mac/env.html

This StackExchange question has some more details about a similar, related issue: https://unix.stackexchange.com/a/774145
and it seems macOS simply copied man pages from BSD even though the behavior is different :( so the best bet might be something like the "polyglot" script they suggest for JS there, if you can figure out how to adapt it for your use case.

04:45:06
@n:rab.lolniko joined the room.08:44:12
@shmwot:matrix.orgcatsarecute set a profile picture.19:00:59
@niko:nrab.lol-> @n:rab.lol left the room.22:53:14
20 Feb 2026
@toonn:matrix.orgtoonn Isn't a nix-shell shebang always just `#! /usr/bin/env nix-shell`? So no hashes to mess up and the second "shebang" line is parsed by Nix or Lix as the case may be, not by a shell as a shebang. 10:13:30
@hexa:lossy.networkhexayep11:19:53
@ian-h-chamberlain:matrix.orgian-h-chamberlain maybe but in this case they were trying to use nix shell with flake refs (which as I understand has had shebang parsing removed from Lix), not nix-shell 19:31:11
@hexa:lossy.networkhexanix shell has no shebang support from what I know19:32:06
@toonn:matrix.orgtoonn And either way those flake refs would have to be passed on the second, not really a shebang, line no? 19:34:17
@ian-h-chamberlain:matrix.orgian-h-chamberlainyea. maybe more accurate description is "not added to Lix", cppnix has https://nix.dev/manual/nix/2.33/command-ref/new-cli/nix.html?highlight=shebang#shebang-interpreter19:35:22
@ian-h-chamberlain:matrix.orgian-h-chamberlain but on non-darwin it seems you can fake a subset of this by using OS built-in shebangs and env -S parsing, which is the example I gave earlier 19:39:00
@ian-h-chamberlain:matrix.orgian-h-chamberlain * 19:39:27
@toonn:matrix.orgtoonn But shebang parsing has nothing to do with Nix when it's the shell parsing it. 19:42:37
@toonn:matrix.orgtoonn Nvm, that's kinda what you said anyway. 19:45:31
@toonn:matrix.orgtoonn POSIX actually doesn't require more than one or two arguments (not sure whether env`s -S is an explicit exception or not) to be supported in shebangs. So it's probably a bad idea to try and do it all in a shebang anyway. The second shebang line is a pretty decent workaround IMO. 19:50:35
@shoenot:matrix.orgshoe joined the room.21:56:32
@shoenot:matrix.orgshoehi everyone21:57:28
@shoenot:matrix.orgshoei'm brand new to nix/lix (but not to *nix) and decided to jump in headfirst after downgrading my macbook and discovering that brew doesn't provide binaries anymore 21:58:24
@shoenot:matrix.orgshoecan't be spending 25 minutes compiling cmake 21:58:46
@raitobezarius:matrix.orgraitobezariusbrew doesn't provide binaries for aarch64-darwin anymore?21:59:06
@shoenot:matrix.orgshoeintel, on macos monterey21:59:23

Show newer messages


Back to Room ListRoom Version: 10