#nix and #NixOS do HaaS: Hard-coding as a Service.
You tell it what you want your system to look like and it hard-codes the sh*t out of it.
This comes with all the benefits of hard-coding: Your environment, your PATH, manually installed software, etc. don't interfere with your base system at all. Every program and service sees exactly the dependencies and configurations they were given. The amount of power this gives for servers/embedded/purpose-built machines cannot be overstated!
But of course hard-coding has its downsides.
Want to use that dynamic plugin system for a service or program? nah, you gotta let nix hard-code it for you.
Your app remembers absolute paths for file associations? They break on every update.
Want to use precompiled binaries that expect dynamic libraries to be present at standard paths? Nope, you gotta jump through hoops here.
But overall - for me and my use cases - the upsides compensate these downsides massively.
@nobodyinperson In theory this even gives a performance boost for loading dynamic libraries. In practice I think it doesn't yet.
@pmidden @nobodyinperson Counterintuitively, it actually negatively affect(s|ed) loading times for dynamic libraries, at least in a naive implementation. There is a good blog post from @civodul about the issue and what they did to fix it; I don't know if and how the issue has been addressed in nix though: https://guix.gnu.org/blog/2021/taming-the-stat-storm-with-a-loader-cache/
@matrss @nobodyinperson ah, yes, I think I remember reading about that. So, any #nix guru care to share if that's implemented as well?
@pmidden
@matrss @nobodyinperson
I'm no nix "guru", but I did find this discourse thread from 2022 which indicates it was not solved then (and given the leadership mess, I suspect not solved now?): https://discourse.nixos.org/t/making-runpath-redundant-for-nix/21631/
@pmidden @nobodyinperson Farid Zakaria worked on this, https://fzakaria.com/2024/05/03/speeding-up-elf-relocations-for-store-based-systems.html
@nobodyinperson this also allows some unique security features to be enabled: https://xeiaso.net/blog/paranoid-nixos-2021-07-18/
Mainly:
- Rip Out sudo
- Rip Out Default Packages
- Mark All Partitions but /nix/store as noexec