Hacker Newsnew | past | comments | ask | show | jobs | submit | ablob's commentslogin

So if I want to use grep in a small script, do I have to write:

/nix/store/grep-hash -flags files | /nix/store/head-hash

instead of: "grep -flags files | head"?


If it's a one off, you just use something like "nix shell" to add it to your path for running the script.

For non one-off sorts of things, you would substitute in the nix expression "${gnugrep}/bin/grep" the "${gnugrep}" will expand to "/nix/store/grep-hash" and also make a dependency on the gnugrep package, so that the grep install won't get garbage-collected as long as your package is still around.

Here's an example[1] from a package expression for e-mail client I use, which will shell out to base64 and file. Upstream relies on these two programs being in $PATH, but this replaces the string used for shelling out with the absolute path in the nix store.

For shell scripts, I'll just do something like this near the top:

   GREP="${GNU_GREP:-$(command -v grep)}"
Then I use "$GREP" in the script itself, and develop with grep in my path, but it's trivial to prepend all of my dependencies when I bundle it up for nix.

1: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/no...


    [user@nixos:~]$ which grep
    /run/current-system/sw/bin/grep

    [user@nixos:~]$ ls -l /run/current-system/sw/bin/grep
    lrwxrwxrwx 1 root root 65 Jan  1  1970 /run/current-system/sw/bin/grep -> /nix/store/737jwbhw8ji13x9s88z3wpp8pxaqla92-gnugrep-3.12/bin/grep
Basically, it is still in your environment, so I don't see how he can claim that this problem doesn't exist in Nix, unless you use flakes like a proper Nix afficionado.

Yes, the original comment that this problem doesn't exist in Nix is wrong for a typical user environment.

It does contain the issue a bit though:

I'm running isync in a systemd service, yet the program "mbsync" is not in my path. I have several services installed, yet their programs aren't in my path. My e-mail client shells out to "file" for mime-type verification, yet "file" is not in my path.

Run "compgen -c |wc -l" to get a list of commands; its over 7000 on my Ubuntu system and right around 2000 on my NixOS system.

As an aside, the packages that put the most executables in my path are probably going to be in the path for most NixOS installs (231 just for coreutils+util-linux):

     27 /nix/store/csxa6mi2mpjl9vqxbv2j0bha6sz6nbjw-cups-2.4.14
     31 /nix/store/334afxah19b3hr6ll93pfxlcyhhh2vws-pipewire-1.4.9
     31 /nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0
     33 /nix/store/914x32c982bs3i1998yxvkg9svm3ycr5-shadow-4.18.0
     33 /nix/store/a6s3hzj3b2z6rsyfkjyxwn265iyfl2gn-mtools-4.0.49
     33 /nix/store/jky7jszaci5n7g426wf6nsg5dmik9nfw-kbd-2.9.0
     37 /nix/store/2v1l6mqz0d7mfpp4ksw2048v3g0a1a19-hplip-3.25.2
     45 /nix/store/90wlc37ljr6rpy2lan46bp0gq19vbgl5-iptables-1.8.11
     48 /nix/store/1byhxs7b28grh8s15jc2dvs2zg36swjb-lvm2-2.03.35-bin
     61 /nix/store/9xwxjkrwxjsvc5gs1l0syr4wbfvvvvcn-bluez-5.84
     64 /nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2
     72 /nix/store/1igrj9w84w7s3r80l3nkxcqwd84sw9mz-qemu-10.1.2
    106 /nix/store/v4q3154vdc83fxsal9syg9yppshdljyk-coreutils-full-9.8
    125 /nix/store/3c6r8gh8zrqw8xmncmlj9vivz9rz6r30-util-linux-2.41.2-bin

True enough, but in my experience it's not really much of a problem because if I'm not doing Nix, then I'm doing containers which are widely available.

What can be a problem is muscle memory, when you expect it to autocomplete one way and it doesn't because something you want now shares first two or three letters with something else in your path. That's where FIGNORE comes in.


>> No it isn't, it has a fixed number of yields, which has a very different duration on various CPUs

> You say this with zero data.

Wouldn't the null hypothesis be that the same program behaves differently on different CPUs? Is "different people require different amounts of time to run 100m" a statement that requires data?


I really wonder how "It's year X" could establish itself as an argument this popular.

I remember $CURRENT_YEAR taking off around 2016 where it was used in the innocent days of the culture wars alongside terms like "dongle" and "shitlord".

I find it concerning that kilo can mean both 10^3 and 2^10 depending on context. And that the context is not if you're speaking about computery stuff, but which program you use has almost certainly lead to avoidable bugs.

That latter part is only true since marketing people decided they knew better about computer related things than computer people.

It's also stupid because it's rare than anyone outside of programming even needs to care exactly how many bytes something else. At the scales that each of kilobyte, megabyte, gigabyte, terabyte etc are used, the smaller values are pretty much insignificant details.

If you ask for a kilogram of rice, then you probably care more about that 1kg of rice is the same as the last 1kg of rice you got, you probably wouldn't even care how many grams that is. Similarly, if you order 1 ton of rice, you do care exactly how many grams it is, or do you just care that this 1 ton is the same as that 1 ton?

This whole stupidity started because hard disk manufacturers wanted to make their drives sound bigger than they actually were. At the time, everybody buying hard disks knew about this deception and just put up with it. We'd buy their 2GB drive and think to ourselves, "OK so we have 1.86 real GB". And that was the end of it.

Can you just imagine if manufacturers started advertising computers as having 34.3GB of RAM? Everybody would know it was nonsense and call it 32GB anyway.


Not as far as I can tell. There's power of 10 bits and power of 2 bytes. I've never seen the inverse of those in an actual real world scenario outside of storage manufacturers gaming the numbers but even then the context is once again perfectly clear.

The "which program you use" confusion was instigated by the idiots insisting that we should have metric kilobytes, megabytes and gigabytes (cheered on by crooked storage manufacturers).

Before all that nonsense, it was crystal clear: a megabyte in storage was unambiguously 1024 x 1024 bytes --- with the exception of crooked mass storage manufacturers.

There was some confusion, to be sure, but the partial success of attempt to redefine the prefixes to their power-of-ten meanings has caused more confusion.


Now that RAM prices have spiked perhaps manufacturers should try marketing it in power of ten seven bit bytes.

Since DDR5 has on-chip ECC bits they could just include those in the marketing number.

For the giggles:

nice idea, but "small composable programs" includes perl scripts? That's great if you're already using perl, a bit much to install if you're not.

There shouldn't be any burden of portability for the one writing small tools like these. You're free to rewrite it, of course, but expecting someone to go out of their way to stay within the unix/posix/whatever environment seems a bit much given the context of an unpaid endeavor.


The correct quote is: "Remove invalid 'd' suffix for double literals".

For meshed networks there is a secondary ID (with a name I do not know) that is used to distinguish between APs, since your device should only talk to at most one AP at a time. It wouldn't be surprising if they used that for finding the location, but marketing sells it as SSID matching as the people they want to sell it to are most likely not experts in networking.

The ESSID (Extended Service Set Identifier) is the human-readable thing you see. There is an underlying BSSID (Basic Service Set Identifier) that includes the unique identifier for the AP (its MAC address) your mobile unit is associated with.

On Windows you can see this (from an elevated context and, in newer versions, with location services enabled) by running: "netsh wlan show interfaces"


They could use the BSSID, which is unique per physical access point.

There's also HTML, LaTeX and Typst for documents. I don't think that there is a clear winner here.


So why not allow for enabling this behavior as a configuration option? A big fat banner for most users (i.e. by default) and the few edge cases get the status bar entry after they asked for it.


If the IP address was leaked, wouldn't it be the address of the unit doing the NAT translation instead of the standard-gateway?


In the case of IPv4 - you almost certainly would get the external IP address of the unit doing NAT translation. In the case of IPv6 - it's quite common (outside of the enterprise world) for the Native IPv6 address of the device to be routed directly onto the internet - desirable even.

In the case of a 'leaked" address - there are all sorts of ways in which internal details of an address can leak even when it's not in the DST/SRC envelope of the packet on the Internet.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: