(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.
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.
cc @Jonathan Ringer
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 12 2024 at 20:45 UTC