-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the file generation more transparent #203
Changes from all commits
d926d9c
ee25e74
57ed9c5
a2615af
594cc2a
909cff9
33ea3ad
436e249
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,23 +169,19 @@ | |
passAsFile = ["expectedLockfileContents"]; | ||
} ( | ||
if needNewLockfile | ||
then | ||
lib.warn '' | ||
Lockfile contents are outdated. Please run "nix run .#regenerate-lockfile" to update them. | ||
'' | ||
'' | ||
cp -r "${sources}" sources | ||
if [ -f sources/nickel.lock.ncl ]; then | ||
chmod +w sources sources/nickel.lock.ncl | ||
else | ||
chmod +w sources | ||
fi | ||
cp $expectedLockfileContentsPath sources/nickel.lock.ncl | ||
cat > eval.ncl <<EOF | ||
${nickelWithImports "sources"} | ||
EOF | ||
${nickel}/bin/nickel export eval.ncl --field config.flake > $out | ||
'' | ||
then '' | ||
cp -r "${sources}" sources | ||
if [ -f sources/nickel.lock.ncl ]; then | ||
chmod +w sources sources/nickel.lock.ncl | ||
else | ||
chmod +w sources | ||
fi | ||
cp $expectedLockfileContentsPath sources/nickel.lock.ncl | ||
cat > eval.ncl <<EOF | ||
${nickelWithImports "sources"} | ||
EOF | ||
${nickel}/bin/nickel export eval.ncl --field config.flake > $out | ||
'' | ||
else '' | ||
cat > eval.ncl <<EOF | ||
${nickelWithImports sources} | ||
|
@@ -212,9 +208,18 @@ | |
nickelResult = callNickel { | ||
inherit nickelFile baseDir flakeInputs lockFileContents; | ||
}; | ||
enrichedFlakeInputs = | ||
flakeInputs | ||
// { | ||
# Dummy “flake input” used to pass some data through the Nickel | ||
# evaluation. | ||
# We should ideally get rid of that and find another more principled | ||
# way, but that will do for now. | ||
"%%organist_internal".nickelLock = builtins.toFile "nickel.lock.ncl" (buildLockFileContents lockFileContents); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be nice to add a little comment explaining why we need to do that, for future you, me and others There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. Fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has the doc been lost in a force push?I can't see it still |
||
}; | ||
in | ||
{rawNickel = nickelResult;} | ||
// (importFromNickel flakeInputs system baseDir (builtins.fromJSON | ||
// (importFromNickel enrichedFlakeInputs system baseDir (builtins.fromJSON | ||
(builtins.unsafeDiscardStringContext (builtins.readFile nickelResult)))); | ||
in { | ||
inherit | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
let filegen = import "files.ncl" in | ||
let nix = import "nix-interop/nix.ncl" in | ||
{ | ||
Schema = filegen.Schema, | ||
config | Schema | ||
= { | ||
files."nickel.lock.ncl".file = nix.import_nix "%%organist_internal#nickelLock", | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import testlib | ||
import asyncio | ||
import pytest | ||
import pytest_asyncio | ||
from lsprotocol import types as lsp | ||
|
||
@pytest_asyncio.fixture | ||
async def client(): | ||
# Setup | ||
client = testlib.LanguageClient("organist-test-suite", "v1") | ||
await client.start_io("nls") | ||
response = await client.initialize_async( | ||
lsp.InitializeParams( | ||
capabilities=lsp.ClientCapabilities(), | ||
root_uri="." | ||
) | ||
) | ||
assert response is not None | ||
client.initialized(lsp.InitializedParams()) | ||
return client | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ organist = import "../../../lib/organist.ncl" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.