News for hackers. Stuff that matters.
Re:Oasis – a small, statically-linked Linux system by dijit on Friday January 26, 2024 @09:45AM (#39143165)
I cant speak much about the system, it just works, but the community was really nice when I interacted with them over IRC

I had the plan to build oasis with bazel for some immutable OS images that could run as kubernetes nodes. I succeeded with a little pointing.

Re:Oasis – a small, statically-linked Linux system by malux85 on Friday January 26, 2024 @10:50AM (#39144017)
Thats a cool idea! Will you open source it or make it available somehow? I would like to play with it for running Atomic T
Re:Oasis – a small, statically-linked Linux system by gravypod on Friday January 26, 2024 @10:06AM (#39143428)
Have you shared your BUILD files upstream?
Re:Oasis – a small, statically-linked Linux system by dijit on Friday January 26, 2024 @10:18AM (#39143584)
No, they were quite happy with Samurai
Re:Oasis – a small, statically-linked Linux system by public_void on Friday January 26, 2024 @03:24PM (#39147739)
Why did you need to use bazel?
Re:Oasis – a small, statically-linked Linux system by dijit on Friday January 26, 2024 @03:28PM (#39147802)
I didnt need to use bazel, I like bazel and want to learn more about it.

I also have a small, but burning, passion for reproducible builds, distributed compilation and distributed caching.

Being able to build an entire OS and essentially anything I want on top in a reproducible and relatively organic way (with incremental compilation) is pretty dope.

Re:Oasis – a small, statically-linked Linux system by i-use-nixos-btw on Friday January 26, 2024 @05:40PM (#39149777)
You sound like the perfect Nix cult memb… erm, user. It’s everything you describe and more (plus the language is incredibly powerful compared with starlark).

But you speak from sufficient experience that I presume Nix is a “been there, done that” thing for you. What gives?

Re:Oasis – a small, statically-linked Linux system by chaxor on Friday January 26, 2024 @05:49PM (#39149890)
Nix has decentralized caching and memorizing?
Re:Oasis – a small, statically-linked Linux system by i-use-nixos-btw on Friday January 26, 2024 @06:29PM (#39150344)
Decentralised caching, absolutely - unless I’m misunderstanding what you mean there. You can build across many machines, merge stores, host caches online with cachix (or your own approach), etc. I make fairly heavy use of that, otherwise my CI builds would be brutal.

Memorizing isn’t a term I’m familiar with in this context.

Re:Oasis – a small, statically-linked Linux system by chaxor on Friday January 26, 2024 @07:18PM (#39150796)
Sorry - memoizing.

I am interested in making a system that can memoize large databases from ETL systems and then serve that on iroh or ipfs/torrent, such that a process that may take a supercomputer a week to process can have the same code run on a laptop and it will notice it's been done my a university supercomputer before already and grab that result automatically from the decentralized network of all people using the software (who downloaded the ETL database).

That way you save compute and time.

Re:Oasis – a small, statically-linked Linux system by i-use-nixos-btw on Friday January 26, 2024 @09:59PM (#39151993)
Oh I see!

Yes, absolutely doable in Nix.

Derivations are just a set of instructions combined with a set of inputs, and a unique hash is made from that.

If you make a derivation whose result is the invocation of another, and you try and grab the outcome from that derivation, here’s what will happen: - it will generate the hash - it will look that hash up in your local /nix/store - if not found it will look that hash up in any remote caches you have configured - if not found it will create it using the inputs and instructions

This is transitive so any missing inputs will also be searched for and built if missing, etc.

So if the outcome from your process is something you want to keep and make accessible to other machines, you can do that.

If the machines differ in architecture, the “inputs” might differ between machines (e.g. clang on Mac silicon is not the same as clang on x86-64) and that would result in a different final hash, thus one computation per unique architecture.

This is ultimately the correct behaviour as guaranteeing identical output on different architectures is somewhat unrealistic.

Re:Oasis – a small, statically-linked Linux system by chaxor on Saturday January 27, 2024 @03:47PM (#39159682)
I see. Perhaps the added benefit I am trying to create with this other system is that specifying remote locations isn't necessary, and is just inherited as the distributed network. Anytime anyone runs it, they're added to the network, so it scales with the number of users.
Re:Oasis – a small, statically-linked Linux system by IshKebab on Friday January 26, 2024 @05:52PM (#39149926)
Nix isn't as fine-grained as Bazel as I understand it? I don't think it's incremental within a package, which is presumably what dijit achieved.
Re:Oasis – a small, statically-linked Linux system by i-use-nixos-btw on Friday January 26, 2024 @06:23PM (#39150276)
Weirdly enough I came across a blog post last week that talked about exactly this. https://j.phd/nix-needs-a-native-build-system/

Nix can be used as a build system in the same way that bazel can. It already has all of the tooling - a fundamental representation of a hermetic DAG, caching, access to any tool you need, and a vast selection of libraries.

The only catch is that no one has used it to write a build system for it in public yet. I’ve seen it done in a couple of companies, though, as using Nix to only partially manage builds can be awkward due to caching loss (if your unit of source is the entire source tree, a tiny change is an entirely new source).

Re:Oasis – a small, statically-linked Linux system by gallexme on Saturday January 27, 2024 @08:48AM (#39155511)
Nix can do it incremental U could split it into multiple derivations which get built into one package For rust there ist the excellent https://crane.dev/index.html project

Or you can also go to the extreme and do 1:1 source to derivation mapping So for example if ur project has 100 source files it could be built from 100 derivations, the language/CLI tools are flexible enough for that

https://discourse.nixos.org/t/distributed-nix-build-split-la... https://discourse.nixos.org/t/per-file-derivations-with-c/19...

Don't know tho if there any well working smart nix tools which can make it well working /efficient, in theory it's very possible, just unsure about practicality/overheads

Re:Oasis – a small, statically-linked Linux system by yencabulator on Tuesday January 30, 2024 @01:50PM (#39194030)
Nix is basically merely a quirky functional programming language that generates shell scripts to be run in a sandbox for the actual build. It is not a great tool for within-a-project building; its minimal unit of work has a pretty high overhead.
Re:Oasis – a small, statically-linked Linux system by yx827ha on Friday January 26, 2024 @09:42PM (#39151890)
You should check out the ChromeOS Bazelification project[1]. It has those exact same goals. Not all packages are reproducible though because they embed timestamps.

[1]: https://chromium.googlesource.com/chromiumos/bazel/+/HEAD/do...

Re:Oasis – a small, statically-linked Linux system by MuffinFlavored on Friday January 26, 2024 @03:59PM (#39148244)
> I cant speak much about the system, it just works,

What systems don't just work by this criteria?

Just because something is statically linked vs dynamically linked, as long as you are within "normal expected operating conditions", does it really make a "just works vs doesn't work" quality difference?

Re:Oasis – a small, statically-linked Linux system by Koshkin on Friday January 26, 2024 @04:22PM (#39148612)
Read after the comma:

> it just works, but...

Re:Oasis – a small, statically-linked Linux system by Qwertious on Saturday January 27, 2024 @11:47AM (#39157102)
...but the community was really nice.

That still doesn't tell us how low the parent commenter's standards for "just works" are. It's irrelevant.

Re:Oasis – a small, statically-linked Linux system by colatkinson on Friday January 26, 2024 @08:16PM (#39151291)
If you don't mind I'm super curious as to what approach you ended up taking. Did you use rules_foreign_cc to build the ninja files they generate? Or generating BUILD files directly? Or something completely different? Sounds like a really cool project!
Re:Oasis – a small, statically-linked Linux system by dieortin on Saturday January 27, 2024 @06:00PM (#39160756)
Same, I’m curious too!
Re:Oasis – a small, statically-linked Linux system by eek2121 on Friday January 26, 2024 @10:33PM (#39152240)
"it just works" so you are doing the tech support when it doesn't, right?

EDIT: that was meant to be a joke, I forgo HN doesn't support emojies.

Re:Oasis – a small, statically-linked Linux system by xenophonf on Saturday January 27, 2024 @11:30AM (#39156891)
As an aside, emoticons work just fine. ;)