-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Lazy trees #6530
base: master
Are you sure you want to change the base?
Lazy trees #6530
Changes from 226 commits
f95c425
30be644
7da3a30
301f388
440214f
89f1021
120bec5
8a43eaa
7c1bdff
c0dd35a
2d5cfca
3667cf5
b293b33
48a5879
1b8065f
85c1959
432a3a1
2a1c63c
28b62dd
a291e37
c3c0682
cbade16
241dd54
5c8d67d
0286edb
1483c56
7317196
5115909
12dd8d4
e2353b9
0402dd0
1683872
e424a8b
a653e98
f02da62
b275aa4
8342317
4072024
64a69b4
561440b
b27cd88
515b908
39a783f
116acc1
fcdca3d
730f6bf
57397a3
d162222
6d104bb
f620184
d950e3a
12c554a
a322306
d8620d7
8becbb0
3bcaa7d
210cd8c
81a4516
880a72b
15d2e0e
b48e641
5e3cd3e
29dff7e
20a0a74
fa5af1e
9286b1a
9512afa
3621d07
3522978
f4f0f8a
37b4a9e
31bb875
aaf8b1b
b14830b
5c29abc
4142982
ca26ce9
219510b
7b1cda9
00b746d
bb421ac
12f1413
02d5c54
26ff9c1
f4009fd
ece20d5
5d1e5a0
c8f7ca2
273df09
21f0a98
03618bb
56a845d
98a90cc
430bfcf
13e8d70
23806db
ab2b0fb
8c8f242
579ecd3
1b0b3b1
834d878
1017b11
86ca2c5
e952d36
d6cdb07
334348f
733861d
3a1a33d
b19534a
854a311
b8218b5
f21e1cf
aa823c2
d7d49fd
bb72d1b
6192fd0
4f1b0d7
cdb946e
7052e19
2f1a90b
0671807
b2a205e
ccd2ad2
2a4462e
f432967
f23b969
2ffa909
4b9215c
9a15ec8
870e750
64b9e50
2154084
a0b0cac
a1501cf
8ee59d7
791e222
5b2be3a
0dfc214
91aefbd
d102273
39079dd
2b9ded5
a9d4780
2dc2f58
ac73702
3c4d678
e59caad
2f18e78
f355c34
56272db
3494c29
4e16d5e
6b70509
eaa785e
ea5c2e3
b219d76
0e48afb
0b72b31
6513f69
94c028f
e350f84
fa8618f
144987e
6a95ff9
b4df104
601de7f
c677ea7
aa85359
ddca787
ec272de
b39148e
3099b51
0aa13b6
be1543e
653c100
575902b
d38f4d9
dab2be3
2055e28
c0b1df7
748567b
5558d65
d022bce
7eb3ba0
d9cfae2
43de535
0d02a63
d2292a1
edcd6ce
793a838
1c56bdd
49f9099
ce23764
3369a81
3f70f20
1abf058
147593d
c6b4f01
cf02c6a
4a9b7c8
0efcbbf
c4cd4cd
93cf285
2fec506
5ddd8e4
1302bfa
9c10fcf
71575a2
333d35a
0950094
2101916
fc4d948
db6c219
a65c8a9
c5ae41d
ea54be0
a435a40
7332321
299d0b7
3a96ba0
25635e5
b5be3b0
2409e6b
44d20c3
4133514
2cb003c
8fc36e2
bcb1be4
f0cf5d8
a123f87
26f1431
b7255f8
584fece
4d39908
e255be6
a33aad3
35bbd85
b6be10d
57e1692
57b2cc2
1b20945
53fabdc
34e4a61
0d3a157
800bc9c
9ed105a
2ab5278
879f6b6
355cb56
250813a
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ toplevel }: | ||
|
||
with builtins; | ||
with import ./utils.nix; | ||
with import <nix/utils.nix>; | ||
|
||
let | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ | |
bzip2 xz brotli editline | ||
openssl sqlite | ||
libarchive | ||
libgit2 | ||
boost | ||
lowdown-nix | ||
gtest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
commit 26e8c76ca84999fa5c0e46a9fc3aa7de80be2e9c | ||
Author: Eelco Dolstra <edolstra@gmail.com> | ||
Date: Mon Oct 10 17:12:47 2022 +0200 | ||
|
||
Return time_t in the Unix epoch | ||
|
||
diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c | ||
index 7fd2f7ce..5c050b4c 100644 | ||
--- a/lib/zip_dirent.c | ||
+++ b/lib/zip_dirent.c | ||
@@ -1018,7 +1018,7 @@ _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) { | ||
tm.tm_min = (dtime >> 5) & 63; | ||
tm.tm_sec = (dtime << 1) & 62; | ||
|
||
- return mktime(&tm); | ||
+ return timegm(&tm); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,8 +208,11 @@ void StorePathCommand::run(ref<Store> store, std::vector<StorePath> && storePath | |
run(store, *storePaths.begin()); | ||
} | ||
|
||
Strings editorFor(const Path & file, uint32_t line) | ||
Strings editorFor(const SourcePath & file, uint32_t line) | ||
edolstra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
auto path = file.getPhysicalPath(); | ||
if (!path) | ||
throw Error("cannot open '%s' in an editor because it has no physical path", file); | ||
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. It would be nice to write it to a temporary file to allow at least read-only operations on the file. By no means a blocker, but maybe a FIXME would be appropriate here? |
||
auto editor = getEnv("EDITOR").value_or("cat"); | ||
auto args = tokenizeString<Strings>(editor); | ||
if (line > 0 && ( | ||
|
@@ -218,7 +221,7 @@ Strings editorFor(const Path & file, uint32_t line) | |
editor.find("vim") != std::string::npos || | ||
editor.find("kak") != std::string::npos)) | ||
args.push_back(fmt("+%d", line)); | ||
args.push_back(file); | ||
args.push_back(path->abs()); | ||
return args; | ||
} | ||
|
||
|
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. Found another issue when using
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. Another very general issue: There's 4 different results you can get when printing lazy paths from this PR:
Paths were already hard to understand, but this makes it even more confusing. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -587,14 +587,14 @@ bool NixRepl::processLine(std::string line) | |
Value v; | ||
evalString(arg, v); | ||
|
||
const auto [path, line] = [&] () -> std::pair<Path, uint32_t> { | ||
const auto [path, line] = [&] () -> std::pair<SourcePath, uint32_t> { | ||
if (v.type() == nPath || v.type() == nString) { | ||
PathSet context; | ||
auto path = state->coerceToPath(noPos, v, context, "while evaluating the filename to edit"); | ||
return {path, 0}; | ||
} else if (v.isLambda()) { | ||
auto pos = state->positions[v.lambda.fun->pos]; | ||
if (auto path = std::get_if<Path>(&pos.origin)) | ||
if (auto path = std::get_if<SourcePath>(&pos.origin)) | ||
return {*path, pos.line}; | ||
else | ||
throw Error("'%s' cannot be shown in an editor", pos); | ||
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. This would happen when the position of the lambda can't be determined, right? I think this error message doesn't reflect that very well. |
||
|
@@ -869,7 +869,7 @@ void NixRepl::addVarToScope(const Symbol name, Value & v) | |
|
||
Expr * NixRepl::parseString(std::string s) | ||
{ | ||
Expr * e = state->parseExprFromString(std::move(s), curDir, staticEnv); | ||
Expr * e = state->parseExprFromString(std::move(s), state->rootPath(curDir), staticEnv); | ||
return e; | ||
} | ||
|
||
|
@@ -927,7 +927,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m | |
break; | ||
|
||
case nPath: | ||
str << ANSI_GREEN << v.path << ANSI_NORMAL; // !!! escaping? | ||
str << ANSI_GREEN << v.path().to_string() << ANSI_NORMAL; // !!! escaping? | ||
break; | ||
|
||
case nNull: | ||
|
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.
Found an issue
the
nix edit
man page saysbut that returns a virtual path instead of the path used by
nix edit
nix edit ".#hello"
works properly and is an editable pathhttps://github.com/NixOS/nixpkgs/blob/e80f82aa1edc853339ae889568cfa430808b0dfe/pkgs/stdenv/generic/make-derivation.nix#L137-L142
builtins.unsafeGetAttrPos
is used to createmeta.position
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.
Another issue
In this filter https://github.com/serokell/nixfmt/blob/7e9e06eefed52d6d698b828ee83b83ea5c163f3b/flake.nix#L66-L68
Only the top level files and directories are passed in the path arg
applying
and doing
nix build ".#packages.x86_64-linux.nixfmt.src"
gives the following his branch
and the following on
2.17