diff --git a/flake.lock b/flake.lock index f6eef320..e80091d9 100644 --- a/flake.lock +++ b/flake.lock @@ -486,11 +486,11 @@ "pre-commit-hooks": [] }, "locked": { - "lastModified": 1733254721, - "narHash": "sha256-2HjYrmwQtOTJJGzWmDf6isy8aPuHmhlDCbFN4rLkzpY=", - "rev": "473c1bdcabcb5c513ec7ff9aaa7bcd8b1cee68a5", + "lastModified": 1733356231, + "narHash": "sha256-imRN26yl6V/WLRspYlyadK0Fc2hfkpXFbLxvbYJdcCo=", + "rev": "07a26fc776ff833be7d85edec255e7106103c9c9", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/473c1bdcabcb5c513ec7ff9aaa7bcd8b1cee68a5.tar.gz?rev=473c1bdcabcb5c513ec7ff9aaa7bcd8b1cee68a5" + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/07a26fc776ff833be7d85edec255e7106103c9c9.tar.gz?rev=07a26fc776ff833be7d85edec255e7106103c9c9" }, "original": { "type": "tarball", diff --git a/parts/packages/patches/lix-callpackage-cli.patch b/parts/packages/patches/lix-callpackage-cli.patch index 563dc1c4..57f1bf6f 100644 --- a/parts/packages/patches/lix-callpackage-cli.patch +++ b/parts/packages/patches/lix-callpackage-cli.patch @@ -1,6 +1,6 @@ -From 4ab398fd9629c8ddeec7ca4f43747beac444d2b3 Mon Sep 17 00:00:00 2001 +From 65e47fd58d933b75a2e75777eb36e28873d98be3 Mon Sep 17 00:00:00 2001 From: isabel -Date: Mon, 2 Dec 2024 17:48:34 +0000 +Date: Thu, 5 Dec 2024 17:05:38 +0000 Subject: [PATCH] feat(cli): add callPackage flag adds a --call-package or -C cli option to build a package from the cli @@ -11,7 +11,7 @@ based on the work of https://github.com/privatevoid-net/nix-super 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lix/libcmd/command.hh b/lix/libcmd/command.hh -index 0f9ec66e7..1617afb5c 100644 +index 478032116..40ee997db 100644 --- a/lix/libcmd/command.hh +++ b/lix/libcmd/command.hh @@ -111,6 +111,7 @@ struct SourceExprCommand : virtual Args, MixFlakeOptions @@ -23,7 +23,7 @@ index 0f9ec66e7..1617afb5c 100644 SourceExprCommand(); diff --git a/lix/libcmd/installables.cc b/lix/libcmd/installables.cc -index 1a51a36d3..ec2df929f 100644 +index 700f5115a..8141d6ab4 100644 --- a/lix/libcmd/installables.cc +++ b/lix/libcmd/installables.cc @@ -165,6 +165,19 @@ SourceExprCommand::SourceExprCommand() @@ -46,7 +46,7 @@ index 1a51a36d3..ec2df929f 100644 } MixReadOnlyOption::MixReadOnlyOption() -@@ -426,12 +439,12 @@ Installables SourceExprCommand::parseInstallables( +@@ -428,12 +441,12 @@ Installables SourceExprCommand::parseInstallables( { Installables result; @@ -58,22 +58,22 @@ index 1a51a36d3..ec2df929f 100644 + throw UsageError("'--file', '--expr' and '--call-package' are exclusive"); // FIXME: backward compatibility hack -- if (file) evalSettings.pureEval.override(false); -+ if (file || callPackageFile) evalSettings.pureEval.override(false); - - auto state = getEvalState(); - auto vFile = state->mem.allocValue(); -@@ -442,6 +455,10 @@ Installables SourceExprCommand::parseInstallables( +- if (file) { ++ if (file || callPackageFile) { + evalSettings.pureEval.override(false); + getEvalState()->paths.allowedPaths.reset(); + } +@@ -447,6 +460,10 @@ Installables SourceExprCommand::parseInstallables( } else if (file) - state->evalFile(lookupFileArg(*state, *file), *vFile); + state.evalFile(lookupFileArg(state, *file), *vFile); + else if (callPackageFile) { -+ auto & e = state->parseExprFromString(fmt("(import {}).callPackage %s {}", CanonPath::fromCwd(*callPackageFile)), CanonPath::fromCwd()); -+ state->eval(e, *vFile); ++ auto & e = state.parseExprFromString(fmt("(import {}).callPackage %s {}", CanonPath::fromCwd(*callPackageFile)), CanonPath::fromCwd()); ++ state.eval(e, *vFile); + } else { - auto & e = state->parseExprFromString(*expr, CanonPath::fromCwd()); - state->eval(e, *vFile); + auto & e = state.parseExprFromString(*expr, CanonPath::fromCwd()); + state.eval(e, *vFile); -- 2.44.1 diff --git a/parts/packages/patches/lix-feat-builtins-pow.patch b/parts/packages/patches/lix-feat-builtins-pow.patch index a7ed43a0..cae64b60 100644 --- a/parts/packages/patches/lix-feat-builtins-pow.patch +++ b/parts/packages/patches/lix-feat-builtins-pow.patch @@ -1,12 +1,12 @@ -From 078f184a1cf98bd435370c826eb268081fd47008 Mon Sep 17 00:00:00 2001 +From b89d3ff243691d2b2d108fef9ad5fe931042aed1 Mon Sep 17 00:00:00 2001 From: isabel -Date: Wed, 4 Dec 2024 21:49:25 +0000 +Date: Thu, 5 Dec 2024 17:33:24 +0000 Subject: [PATCH] feat(builtins): pow --- lix/libexpr/builtins/pow.md | 5 +++++ lix/libexpr/meson.build | 1 + - lix/libexpr/primops.cc | 21 +++++++++++++++++++++ - 3 files changed, 27 insertions(+) + lix/libexpr/primops.cc | 10 ++++++++++ + 3 files changed, 16 insertions(+) create mode 100644 lix/libexpr/builtins/pow.md diff --git a/lix/libexpr/builtins/pow.md b/lix/libexpr/builtins/pow.md @@ -33,10 +33,10 @@ index dcbc12e7d..47442c22c 100644 'builtins/readFile.md', 'builtins/readFileType.md', diff --git a/lix/libexpr/primops.cc b/lix/libexpr/primops.cc -index 7b9ea06cc..ca69a2fe0 100644 +index 328ce250b..45b3589d1 100644 --- a/lix/libexpr/primops.cc +++ b/lix/libexpr/primops.cc -@@ -2420,6 +2420,27 @@ static void prim_div(EvalState & state, const PosIdx pos, Value * * args, Value +@@ -2425,6 +2425,16 @@ static void prim_div(EvalState & state, const PosIdx pos, Value * * args, Value } } @@ -45,20 +45,9 @@ index 7b9ea06cc..ca69a2fe0 100644 + state.forceValue(*args[0], pos); + state.forceValue(*args[1], pos); + -+ if (args[0]->type() == nFloat || args[1]->type() == nFloat) { -+ NixFloat f1 = state.forceFloat(*args[0], pos, "while evaluating the first operand of the exponentiation"); -+ NixFloat f2 = state.forceFloat(*args[1], pos, "while evaluating the second operand of the exponentiation"); -+ v.mkFloat(std::pow(f1, f2)); -+ } else { -+ auto i1 = state.forceInt(*args[0], pos, "while evaluating the first operand of the exponentiation"); -+ auto i2 = state.forceInt(*args[1], pos, "while evaluating the second operand of the exponentiation"); -+ -+ if (i2 < 0) -+ state.error("negative exponent in %1% ^ %2%", i1, i2).atPos(pos).debugThrow(); -+ -+ auto result = std::pow(i1.value, i2.value); -+ v.mkInt(result); -+ } ++ NixFloat f1 = state.forceFloat(*args[0], pos, "while evaluating the first operand of the exponentiation"); ++ NixFloat f2 = state.forceFloat(*args[1], pos, "while evaluating the second operand of the exponentiation"); ++ v.mkFloat(std::pow(f1, f2)); +} + static void prim_bitAnd(EvalState & state, const PosIdx pos, Value * * args, Value & v)