Stream: cull-os

Topic: Fixing what Nix did wrong


view this post on Zulip RGBCube (Jun 21 2024 at 18:38):

(copied from the matrix; this is about fixing flakes being a new concept and destroying the "everything is a derivation" concept of Nix; also see this post https://jade.fyi/blog/flakes-arent-real)

The way I want to fix this in Cab is overridable expressions.

{ a = 1; } ==> a * a

assuming this is assigned to b, just evaluating b will get you 1. But overriding it like b <== { a = 2; } and then evaluating that expression will get you 4. The trick here is that ==> is not a function symbol (unlike :, which has the same behavior in Cab as in Nix)

So you will be able to do things like

inputs @ {
  packages = import <github:cull-os/packages> <== inputs;
} ==> {
  packages.bar = packages.buildCrate ./.;
}

import will import /${<github:cull-os/cab>}/default.cab, which is another expression like our default.cab. Then it will override it, with our inputs. The trick here is that our inputs were already overriden by the Cab CLI, which did <== { buildSystem = ...; targetSystem = ...; } so the build and target systems get passed into CullOS packages. Then we get a neat attribute set packed with packages configured for our target.

view this post on Zulip RGBCube (Jun 21 2024 at 18:42):

I also want to implement the "standard library" in Pure Rust, eagerly checking for types of things. This will also make it a part of the language instead of some unrelated repository like nixpkgs. And it will be faster, as a result.

view this post on Zulip RGBCube (Jul 13 2024 at 21:10):

cc @Jonathan Ringer

view this post on Zulip RGBCube (Jul 13 2024 at 21:11):

this would work without "overrideable expressions" in Nix too. But it would require you to call everything, which is fine I guess


Last updated: Oct 18 2024 at 08:48 UTC