NinjaTrappeur has quit [Ping timeout: 256 seconds]
NinjaTrappeur has joined #nixos-chat
lassulus_ has joined #nixos-chat
lassulus has quit [Ping timeout: 240 seconds]
lassulus_ is now known as lassulus
Guanin has quit [Ping timeout: 268 seconds]
Guanin has joined #nixos-chat
Jason_Grossman has joined #nixos-chat
Jason_Grossman has quit [Ping timeout: 264 seconds]
__monty__ has joined #nixos-chat
pie__ has quit [Ping timeout: 240 seconds]
jtojnar has quit [Remote host closed the connection]
jtojnar has joined #nixos-chat
pie__ has joined #nixos-chat
jtojnar has quit [Quit: jtojnar]
jtojnar has joined #nixos-chat
anon777 has joined #nixos-chat
<anon777>
quick question: why does nix use hashes in package names instead of e.g. version numbers?
<__monty__>
anon777: How would you do stateless version numbers?
<anon777>
?
<anon777>
what doyou mean?
<anon777>
a version number refers to a specific git tag/commit at a point in time
<__monty__>
Tags can move and commits are hashes though.
<anon777>
so the program at that exact version would be unique
<samueldr>
the hashes encode more information than what the package itself provides
<samueldr>
» where b6gvzjyb2pg0… is a unique identifier for the package that captures all its dependencies (it’s a cryptographic hash of the package’s build dependency graph).
<samueldr>
a simple example is that a package compiled with gcc-7.0.0 will have a different hash than one compiled with gcc-7.0.1
<anon777>
yes, but those have different version numbers
<samueldr>
sure
<samueldr>
so the package hello should be "hello-1.0.0-with-gcc-7.0.0" and the other "hello-1.0.0-with-gcc-7.0.1"?
<anon777>
what's an example of something with the *same* version ...
<anon777>
ok
<samueldr>
this will increase quickly with all the libraries $package depends on
<anon777>
how exactly are e.g. the compiler used for the program incorporated into the hash?
<anon777>
because programs can be semi-compatible with different-versioned libaries
<__monty__>
anon777: What would be the advantage of a simple increasing number to a hash?
<anon777>
i get it now, thx
<samueldr>
the "exactly how" I'm not entirely sure, looking at the documentation
<anon777>
shorter length
<samueldr>
but I believe all dependencies are explicitly gotten from the dependency graph in nix
<anon777>
i assume the graph includes deps of the deps?
<anon777>
e.g. the libc used for a library dep
<samueldr>
oh, hadn't realised you asked on #nixos :) I was going to suggest going to #nixos as here is more off-topic
<anon777>
nobody answered for like 5 minutes :D
<samueldr>
:)
<anon777>
so how are runtime deps included in the $PATH of executables?
<samueldr>
AFAIUI, all dependencies are included through nix, up to the bootstrapping compilers, maybe even goes higher; e.g. doing a simple modification to the build of the compiler will generally mean *everything* now needs to be rebuilt
<samueldr>
(that is, everything depending on that compiler either directly or through dependencies)
<anon777>
why?
<anon777>
wouldnt it make for a different hash?
<samueldr>
that's it, it's because it makes a different hash
<samueldr>
when I said "now needs to be rebuilt" is not a manual action, it's an effect of changing the dependency
<anon777>
so how is e.g. libc included into the path of already built applications that are running?
<anon777>
is it per-application, or are all apps dumped into the same user env?
<samueldr>
generally, every dependency is expected to be specified *exactly*
<anon777>
would you have a global user environment where /nix/store/*-libc/lib and /nix/store/*-bash/bin is in the same path, or would bash have its *own* path set to only its runtime dependencies?
<samueldr>
I updated the gist
<samueldr>
patchelf is a tool made for using with nix
<samueldr>
it also allows getting information you could otherwise get with ldd and other tools like that
<samueldr>
you see, there are libraries that are "needed", they will be checked for in the RPATH of the app, which is the first line of the output
<samueldr>
so that `git` command will always use *those* libraries
<anon777>
so instead of looking for a lib in /lib, it looks in /nix/store/*-whatever-lib/lib
<anon777>
what about alternatives?(suppose the shell wanted to start some default pdf viewer)
<samueldr>
in the specific path of the library it was linked with
yurb is now known as yurb_afk
<samueldr>
that's pretty much a debian concept there
<samueldr>
well, debian-like
<samueldr>
I know archlinux doesn't have a similar concept, and nixos doesn't either
<anon777>
ok
<anon777>
i suppose it wouldnt be that hard to implement, tho
<samueldr>
as for e.g. default apps, there are the usual XDG conventions
<__monty__>
What concept? Default applications are usually managed by DEs, no?
<samueldr>
so xdg-open works as expected
<anon777>
the app calls /etc/alternatives/www-browser, which is a symlink to /nix/store/*-some-browser-here
<samueldr>
for $PATH for your sessions, so for installed apps, there are "profiles", like the system profile, which creates a symlink forest of all `bin/*` for all needed packages
<anon777>
but thats just for the user, right?
<samueldr>
so your PDF viewer would be in there, and your DE would use one of those (or its .desktop file) to fill in the required databases for xdg-open
<samueldr>
yeah
<anon777>
the apps only ever refer to /nix/store/*
<anon777>
ok
<samueldr>
it can still call xdg-open, if it makes sense
<anon777>
yup
<anon777>
well, thank you :D
<anon777>
bye
anon777 has left #nixos-chat [#nixos-chat]
<LnL>
the nixos modules usually solves this by setting environment variables that point to the impure dependencies like binaries or plugin libraries
pie__ has quit [Ping timeout: 260 seconds]
pie_ has joined #nixos-chat
NinjaTrappeur has quit [Quit: WeeChat 2.1]
pie_ has quit [Ping timeout: 265 seconds]
pie_ has joined #nixos-chat
pie__ has joined #nixos-chat
pie_ has quit [Read error: Connection reset by peer]