gchristensen changed the topic of #nixos-chat to: NixOS but much less topical || https://logs.nix.samueldr.com/nixos-chat
jess has quit [Quit: K-Lined]
jess has joined #nixos-chat
rajivr has joined #nixos-chat
<Church-> Oh summer of nix looks neat
<Church-> Alas day job
spudly- has joined #nixos-chat
spudly has quit [Ping timeout: 260 seconds]
spudly- is now known as spudly
<pie_> oh this is interesting
<pie_> gchristensen: ever heard of autoexpect?
waleee-cl has quit [Quit: Connection closed for inactivity]
c4rc4s has joined #nixos-chat
ldlework has joined #nixos-chat
lunc has quit [Ping timeout: 252 seconds]
dotdotok has quit [Ping timeout: 268 seconds]
endformationage has quit [Ping timeout: 268 seconds]
<ashkitten> woo i can connect to my irc server and send ping commands
<pie_> i should have written down my neat typos now i forgot all of them
<pie_> latest: nix-hell
<pie_> ashkitten: yay \o/
<pie_> heh
<pie_> why isnt that bundled as an easteregg with the system
<pie_> $ nix-shell -p nix-hell
<pie_> error: undefined variable 'nix-hell' at (string):1:94
<pie_> damnit
cole-h has quit [Ping timeout: 265 seconds]
srk has joined #nixos-chat
linear_cannon has joined #nixos-chat
<ashkitten> the library i was using to parse and build irc messages was awful
<ashkitten> so i grabbed a different one and rewrote my code around it
<ashkitten> much better
linear_cannon is now known as ky0ko
<eyJhb> So, htop reports that the program that uses the most CPU is htop at 0.7, the rest is 0. But still all my cores are at 35
<eyJhb> -45% used (four cores)
<Ke> F2 and display and hide kernel threads
<eyJhb> Ke: It went down again. I think it was a unclean shutdown + ZFS doing some stuff behind the scenes to recover
evanjs has quit [Read error: Connection reset by peer]
evanjs has joined #nixos-chat
srk has quit [Quit: ZNC 1.8.2 - https://znc.in]
srk has joined #nixos-chat
__monty__ has joined #nixos-chat
ottidmes has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
ottidmes has joined #nixos-chat
dotdotok has joined #nixos-chat
waleee-cl has joined #nixos-chat
<gchristensen> pretty cool that for $9/mo you can get a 3 node cluster paying full price on AWS
<pie_> ok so to be fair the thing works from the same directory, just probably not in the way youd think
<pie_> you dont need to set the interpreter but only because it tries to call shell.nix by default im pretty sure
<pie_> if you name it anything else or do anything else nothing will work
<pie_> ok so not quite, things will work, but only as long as youre in the same dir. - and I cant figure out from the source even why passing -p doesnt preempt the shell.nix file existence check even though it's the opposite branch, but I guess I have to stare at it more
<pie_> ok i guess i must have been crossing some streams, -p unscrews things a little
<pie_> gchristensen: eyJhb: i bring ye cursed incantations:
<pie_> #! nix-shell -i "bash -c 'set -x; function f(){ fr=$(realpath \"$1\"); dir=$(dirname \"$fr\"); fname=$(basename \"$fr\"); shift; pushd \"$dir\"; nix-shell -v \"$fname\" \"$@\"; }; f \"$@\"' -- " -v -p hello
<gchristensen> wtf
<pie_> which is what breaks the relative paths
<pie_> the heuristic for shebangs is "is the first argument an executable that starts with a shebang" https://github.com/NixOS/nix/blob/8803753666023882515404177b08f3f8bdad52a0/src/nix-build/nix-build.cc#L106
<pie_> so we pass -v as the first argument to the exec-ed nix shell, as a no-op, to make it not infrec
<pie_> this makes the file-to-interpret not the first argument
<pie_> since it uses exec (?), the `bash -c 'function f() {}; f $@' -- ` pattern lets us do some stuff while reusing the arguments passed at the end
<pie_> -- makes the rest of the args be arguments to the script
<pie_> i think thats everything
<pie_> here's the set output: https://bpa.st/MH3Q
<sterni> pie_++
<{^_^}> pie_'s karma got increased to 19
<sterni> pie_: but what if I told you that the following works under a specific condition https://paste.textboard.org/71226c4a
<sterni> pie_: if the “script” nix expression is named something containing nix-shell it works lol
<sterni> I suspect that nix-shell checks if argv[0] doesn't contain nix-shell to check if it is running in interpreter or normal mode
<sterni> I'm not even joking
<sterni> > ./test-nix-shell.nix
<{^_^}> /var/lib/nixbot/state/nixpkgs/test-nix-shell.nix
<sterni> [nix-shell:~]$
<sterni> it also works if you call it shell.nix apparently
<sterni> but not if it is called anything else
<pie_> sterni: check the source i linked
<pie_> sterni: it checked if the first argument is an executable file with a shebang
<pie_> if it is it drops the first and then does some stuff and then execs itself at some point
<pie_> or wait, did i misunderstand what you man?
<pie_> mean
<sterni> std::regex_search(argv[1], std::regex("nix-shell")
<sterni> it checks if the first argument is called nix-shell
<sterni> so the heuristic is skipped if you call your file something which contains nix-shell
<pie_> yeah but thats to differentiate nix-shell and nix-build since theyre the same executable
<pie_> oh
<pie_> reeeealy
<sterni> argv[1] !!
<sterni> I'm not quite sure why that check exists to be honest
<pie_> sterni: probablz because exec or -a (from exec -a) is argv[0] when it calls itself
<pie_> so its stopping an infrec
<pie_> but imnot actually sure
<sterni> pie_: lol no that is a porting mistake actually
<sterni> I think??
<sterni> in the old perl script it checked argv[0]
<pie_> i'unno
<sterni> compare line 48 in nix-build.in
<sterni> and line 101 in nix-build.cc
<sterni> or is the prel ARGV variable cursed
<sterni> okay it's no mistake
<sterni> perl ARGV is cursed
<gchristensen> \
<pie_> sterni: also i didnt follow what you were trying to show me with https://paste.textboard.org/71226c4a
<sterni> I thought that was what you were trying to get to work roughly
<sterni> and that works without the cursed bash line if you call the file something with the substring nix-shell
<pie_> how does that even work
<pie_> sterni: downside is the shebang doesnt get processed
<pie_> sterni: also do you have a discourse @
cole-h has joined #nixos-chat
<pie_> also might be possible to remove the function, that was something i needed for some other thing but maybe not here
endformationage has joined #nixos-chat
supersandro2000 has quit [Remote host closed the connection]
supersandro2000 has joined #nixos-chat
<bqv> eyJhb: hey, you had a way of building the onlinego apk on nixos, mind walking me through how someday?
<bqv> I think I wanna hack on it
<bqv> But trying to build android projects is the most painful thing I've experienced
<pie_> sterni: so apparently its sufficient to disable the heuristic, and like this you can have your shebang and eat it too #! nix-shell -i "nix-shell -v" -p ""
cole-h has quit [Ping timeout: 260 seconds]
AkechiShiro has quit [Quit: WeeChat 2.9]
evanjs has quit [Quit: ZNC 1.8.2 - https://znc.in]
evanjs has joined #nixos-chat
evanjs has quit [Remote host closed the connection]
evanjs has joined #nixos-chat
AkechiShiro has joined #nixos-chat
tomberek has quit [Quit: Connection closed]
<sterni> pie_: @ sternenseemann
<eyJhb> bqv: I have none of the stuff for it anymore, but sure I can try!
<eyJhb> I actually want to make a "new" way of fetching all the dependencies etc.
<eyJhb> Because I am not a fan of the current one, where it works 70% of the time