feat(tvix/eval): implement tvix's user-agent, err, nixVersion
nixpkgs has hardcoded references to Nix versions, we need to provide it with something that looks like a Nix version while actually being a Tvix version. For now, we do this by stealing a trick out of the browser book and constructing a version that looks like a Nix version to Nix, but like a Tvix version to people who know what they are looking for. Nevermind that we don't actually have any kind of versioning for Tvix (yet?), other than depot revisions. Change-Id: I7ce8079dd8164a2079891d38e707f09a45f0bbc1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6858 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
8f2c67d5dd
commit
7fe1331570
3 changed files with 12 additions and 0 deletions
|
@ -374,6 +374,12 @@ fn pure_builtins() -> Vec<Builtin> {
|
|||
fn builtins_set() -> NixAttrs {
|
||||
let mut map: BTreeMap<NixString, Value> = BTreeMap::new();
|
||||
|
||||
// Pure-value builtins
|
||||
map.insert(
|
||||
"nixVersion".into(),
|
||||
Value::String("2.3-compat-tvix-0.1".into()),
|
||||
);
|
||||
|
||||
let mut add_builtins = |builtins: Vec<Builtin>| {
|
||||
for builtin in builtins {
|
||||
map.insert(builtin.name().into(), Value::Builtin(builtin));
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
-1
|
|
@ -0,0 +1,5 @@
|
|||
# nixpkgs checks against the `builtins.nixVersion` and fails if it
|
||||
# doesn't like what it sees. To work around this we have a "user-agent
|
||||
# style" version (see cl/6858) that ensures compatibility.
|
||||
|
||||
builtins.compareVersions "2.3" builtins.nixVersion
|
Loading…
Reference in a new issue