Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@v16
with:
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@v16
with:
name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-nixpkgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nixPlugin/flake-module.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ ... }: {
perSystem = { pkgs, system, ... }:
let
nix = pkgs.nixVersions.nix_2_25;
nix = pkgs.nixVersions.nix_2_31;
in
{
packages = {
Expand Down
40 changes: 20 additions & 20 deletions nixPlugin/plugin.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <common-eval-args.hh>
#include <config-global.hh>
#include <eval-inline.hh>
#include <eval-settings.hh>
#include <eval.hh>
#include <globals.hh>
#include <primops.hh>
#include <nix/cmd/common-eval-args.hh>
#include <nix/expr/eval-inline.hh>
#include <nix/expr/eval-settings.hh>
#include <nix/expr/eval.hh>
#include <nix/expr/primops.hh>
#include <nix/expr/value.hh>
#include <nix/store/globals.hh>
#include <nix/util/config-global.hh>
#include <string>
#include <value.hh>

using namespace nix;

Expand All @@ -21,18 +21,18 @@ void prim_lambdaMeta(EvalState &state, const PosIdx pos, Value **args,
auto attrs = state.buildBindings(10);
bool isPrimOp = false;
if (value.isLambda()) {
auto lambda = value.payload.lambda;
auto lambda = value.lambda();
PosIdx posIdx = lambda.fun->getPos();
Pos funPos = state.positions[posIdx];
state.mkPos(attrs.alloc("position"), posIdx);
}
// Special case for __functors
if (value.type() == nAttrs) {
auto i =
value.payload.attrs->find(state.symbols.create("__functor"));
value.attrs()->find(state.symbols.create("__functor"));

if (i != value.payload.attrs->end()) {
PosIdx posIdx = value.payload.attrs->pos;
if (i != value.attrs()->end()) {
PosIdx posIdx = value.attrs()->pos;
Pos funPos = state.positions[posIdx];
state.mkPos(attrs.alloc("position"), posIdx);
attrs.alloc("isFunctor").mkBool(true);
Expand All @@ -47,16 +47,16 @@ void prim_lambdaMeta(EvalState &state, const PosIdx pos, Value **args,

if (value.isPrimOp()) {
// Primops should have documentation"
auto primDoc = value.payload.primOp->doc;
auto primDoc = value.primOp()->doc;
if (primDoc != nullptr) {
std::string s(primDoc);
attrs.alloc("content").mkString(s);
}

auto args = value.payload.primOp->args;
auto arity = value.payload.primOp->arity;
auto experimentalFeature = value.payload.primOp->experimentalFeature;
auto name = value.payload.primOp->name;
auto args = value.primOp()->args;
auto arity = value.primOp()->arity;
auto experimentalFeature = value.primOp()->experimentalFeature;
auto name = value.primOp()->name;
attrs.alloc("name").mkString(name);

auto & argsList = attrs.alloc("args");
Expand All @@ -78,17 +78,17 @@ void prim_lambdaMeta(EvalState &state, const PosIdx pos, Value **args,
}

if (value.isPrimOpApp()) {
Value *maybePrimop = value.payload.primOpApp.left;
Value *maybePrimop = value.primOpApp().left;
unsigned int countApplied = 1;
// Find the primop by traversing left
while (maybePrimop != nullptr && !maybePrimop->isPrimOp() &&
maybePrimop->isPrimOpApp()) {
maybePrimop = maybePrimop->payload.primOpApp.left;
maybePrimop = maybePrimop->primOpApp().left;
countApplied++;
}
attrs.alloc("countApplied").mkInt(countApplied);
if (maybePrimop->isPrimOp()) {
std::string doc = maybePrimop->payload.primOp->doc;
std::string doc = maybePrimop->primOp()->doc;
attrs.alloc("content").mkString(doc);
}
}
Expand Down
12 changes: 10 additions & 2 deletions pesto/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
commonArgs = {
inherit src;
strictDeps = true;
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
buildInputs = [ pkgs.oniguruma ];
nativeBuildInputs = [ pkgs.pkg-config ];
RUSTONIG_SYSTEM_LIBONIG = "1";
};

pesto = craneLib.buildPackage commonArgs;
cargoArtifacts = craneLib.buildDepsOnly commonArgs;

pesto = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
});

data-json = pkgs.stdenv.mkDerivation {
name = "pesto-data";
Expand All @@ -23,10 +29,12 @@
checks = {
inherit pesto;
pesto-clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
pesto-fmt = craneLib.cargoFmt { inherit src; };
pesto-nextest = craneLib.cargoNextest (commonArgs // {
inherit cargoArtifacts;
partitions = 1;
partitionType = "count";
});
Expand Down