<FRidh>
srhb: I have no idea if it can be done actually
<FRidh>
most important one is Nix
<srhb>
FRidh: Got it. :)
<MichaelRaskin>
Well, if you can evaluate release.nix for correct revision, you just intersect its derivation reference-closure with the failed build derivation referrers-closure
<MichaelRaskin>
No idea if Hydra can do that.
<srhb>
MichaelRaskin: Not to my knowledge.
page has quit [Quit: leaving]
jtojnar has quit [Ping timeout: 252 seconds]
jtojnar has joined #nixos-dev
init_6 has joined #nixos-dev
hedning has joined #nixos-dev
__Sander__ has joined #nixos-dev
fadenb has quit [Remote host closed the connection]
fadenb has joined #nixos-dev
jtojnar has quit [Quit: jtojnar]
init_6 has quit []
Synthetica has joined #nixos-dev
<shlevy>
Does anyone have a satisfactory setup for editing Nix expressions in emacs? Sometimes feel like I'm more fighting nix-mode than benefitting from it
<gchristensen>
M-x text-mode
<shlevy>
:) OK
<Profpatsch>
shlevy: What do you need to be satisfied?
<gchristensen>
personally, it seems to chowder my indentation and I fight it a lot
<Profpatsch>
I use the `nixos` layer in spacemacs.
<shlevy>
chowder is such a good verb there
<Profpatsch>
It just keeps the last indentation for me.
<gchristensen>
yeah, but it is a real fight to get that first one indented sometimes
<Profpatsch>
SPC-SPC
<Profpatsch>
No fight, just two keys. :P
<gchristensen>
I wish tabbing inside a word indented the line instead of adding a tab inside the word
<Profpatsch>
^-i-SPC-SPC
<Profpatsch>
(in evil mode)
<Profpatsch>
Oh, and it does indent for me.
<Profpatsch>
(in insert mode)
<Profpatsch>
Just the default nixos layer in Spacemacs, nothing fance.
<gchristensen>
shlevy: so, I wonder if the changes since nix-mode was pulled out have added problems?
<shlevy>
I'm not sure which version I was using... YOu expect it to be worse?
<gchristensen>
well if spacemacs has an old version, the one from the nix repo (as linked in the docs) and Profpatsch has a good experience and we have a bad experience -- it could be :)
<shlevy>
Aah :)
page has joined #nixos-dev
infinisil has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
drakonis has joined #nixos-dev
infinisil has joined #nixos-dev
hedning has quit [Ping timeout: 268 seconds]
florianjacob has quit [Ping timeout: 264 seconds]
florianjacob has joined #nixos-dev
hedning has joined #nixos-dev
__Sander__ has quit [Quit: Konversation terminated!]
<domenkozar>
niksnut: I'm trying to get hnix parser to be faster
<domenkozar>
right now 40% of time is spend parsing uri
<domenkozar>
if we forbid a:a to be an uri
<domenkozar>
I can actually parse identifier first and just fallback to uri
<shlevy>
Presumably that would also benefit nix itself?
<shlevy>
Do we have any a:a style URIs in real world Nix expressions?
<domenkozar>
it's a real shame that such an edge case type has to be parsed before the identifier
<domenkozar>
yeah I'd never imagine why a:a would be an uri
<domenkozar>
probably not even by RFC
<MichaelRaskin>
about:blank
<shlevy>
domenkozar: I wonder how hard it would be to profile it in Nix
<samueldr>
mailto:example@example.com
<shlevy>
Sure, but do those show up in nix expressions unquoted?
<MichaelRaskin>
Here we have an @ and this might be another can of worms
<shlevy>
If they do obviously we have a blocker, but if not...
<domenkozar>
yeah : and @ are the issues
<domenkozar>
I mean I can do two lookaheads..
<domenkozar>
_a:a is a string
<domenkozar>
a:a is an uri
<shlevy>
_a:a is a function you mean?
<domenkozar>
er, yeah
<samueldr>
and for funsies, shouldn't be an issue, tel:+1-888-555-1234
<shlevy>
:D
<domenkozar>
lol
<shlevy>
I don't know enough about flex but presumably it has the same issue...
<globin>
\
drakonis has quit [Quit: WeeChat 2.2]
<shlevy>
Yeah so it looks like flex *has* to first see if something matches URI, and if not backtrack and lex it into an ID, a ':', and the rest
<shlevy>
I don't see any other way the existing behavior could come out of lexer.l
<shlevy>
domenkozar: Can we somehow make it so that by default we just treat the identifier and colon as separte tokens, but if there's no whitespace after the colon we see if the identifier is a valid scheme and if so go into parsing mode?
<shlevy>
URI parsing mode I mean?
<shlevy>
So we don't have to lookahead, it's :[^\w] that triggers the fallback case
<shlevy>
I mean it's bad style to not have a space there :P
drakonis has joined #nixos-dev
<domenkozar>
what if it's not an uri then?
<domenkozar>
return the identifier?
<shlevy>
Then it's a function
<shlevy>
But it's OK for that function case to be slow
<shlevy>
Because it's not like _a:a is common either
<domenkozar>
right
drakonis_ has quit [Ping timeout: 240 seconds]
<shlevy>
I mean ideally we'd have separate toekns for ID vs SCHEME, and :// would signal a new kind of tken, and we wouldn't have to think about this at all
<domenkozar>
yeah let's not talk ideally right now :P
<shlevy>
:D
<shlevy>
Ideally we'd just quote URIs :P
<domenkozar>
yeah, 2 char write time optimizations sux
<Synthetica>
... But I kinda like unquoted URI's
<Synthetica>
:(
<shlevy>
Don't worry, that ship has long sailed
<domenkozar>
I'm going to try with two lookaeads
<domenkozar>
sounds much better than parsing uri first :P
<shlevy>
Yeah I mean 90% of identifiers are going to backtrack...
drakonis_ has joined #nixos-dev
<gchristensen>
oh cool
<globin>
nix 3 /o\
drakonis has quit [Ping timeout: 260 seconds]
<globin>
also
<globin>
> let a = { b = "bar"; }; b = "baz"; in with a; b
<{^_^}>
"baz"
<shlevy>
#PRAGMA FastParsing
<shlevy>
globin: That'd be horrible to change
drakonis has joined #nixos-dev
<shlevy>
Any lookups that have a with in scope would be super slow
<globin>
yes, I guess that will never change
<shlevy>
Plus you'd lose laziness
<shlevy>
Now if you want ot get rid of with... ;)
<globin>
but it is rather unintuitive
<shlevy>
I'd much rather some nice version of (map (attr: x.${attr}) [ "a" "b" "c" ])
<shlevy>
Like perl's QW thing
drakonis_ has quit [Ping timeout: 260 seconds]
<shlevy>
from x [ a b c ]
drakonis1 has joined #nixos-dev
<gchristensen>
maybe we could borrow a trick from Nix and use inherit (x) a b c;
<gchristensen>
I wouldn't mind `with` just ... going away
<clever>
builtins.attrValues { inherit (x) a b c; } if you insist on getting a list still
<clever>
gchristensen: ive noticed with having a noticable impact on lazyness
<clever>
nix-repl> x: { inherit y; }
<clever>
error: undefined variable 'y' at (string):1:5
<clever>
the scope is known at parse time, and it immediately faile
<clever>
nix-repl> x: with x; { inherit y; }
<clever>
«lambda @ (string):1:1»
<clever>
nix-repl> x: with x; { inherit y; }
<clever>
«lambda @ (string):1:1»
<clever>
oops, double paste
<clever>
now its unknown, and it will fail at force time
drakonis has quit [Ping timeout: 252 seconds]
drakonis has joined #nixos-dev
drakonis1 has quit [Read error: Connection reset by peer]
ixxie has joined #nixos-dev
<clever>
gchristensen: it also feels like with adds a performance cost, because it has to scan the entire scope every time the function is ran
<gchristensen>
yeah
<clever>
nix-repl> f = let x = { y = 1; }; in with x; arg: arg + z
<clever>
«lambda @ (string):1:33»
<clever>
even if the thing in the with block is staticly known, it cant detect the failure until force time
<shlevy>
clever: No, static scope is handled at parse time. An unscoped var just has to jump up the withs, not every variable or anything
<clever>
shlevy: and attrsets are technically Map Int Value, so its not having to deal with constant strcmp's
<clever>
but `with pkgs;` could still be an expensive lookup...
<shlevy>
definitely
<clever>
i wonder, which is faster; let x = pkgs.x; y = pkgs.y; (2 lookups in the map), or inherit (pkgs) x y; (is it capable of finding many things during the lookup?)
<clever>
i know it keeps the key/value pairs sorted by key, so it knows when it has passed the key and will never find it
<gchristensen>
it is a shame you can't override `with` with scopedImport ;)
<shlevy>
clever: Those are equivalent after parse time
<shlevy>
clever: The lookup happens lazily, so only if x is forced will there be a pkgs.x lookup
flokli has quit [Ping timeout: 252 seconds]
<shlevy>
In principle it could also look up y at the same time and shove a thunked eval error into y if it's not there, but that doesn't happen currently and I'd be surprised if it were a big win
genesis has quit [Ping timeout: 252 seconds]
genesis has joined #nixos-dev
flokli has joined #nixos-dev
<clever>
shlevy: ah, so inherit is just syntactic sugar for x = pkgs.x;
<clever>
which runs ExprSelect at force time
<shlevy>
Yep
<clever>
and inherit (pkgs) x y; creates 2 thunks, for x&y
<shlevy>
Well, not pure syntactic sugar, since in a rec (or a let) inherit x and x = x are differnet
<shlevy>
But yes, it's an ExprSelect
<shlevy>
And two thunks
<clever>
yeah, i avoid rec like the plague :P
<globin>
shlevy: what is the difference in that case?
<shlevy>
nix-repl> let x = 1; in { inherit x; }
<shlevy>
> let x = 1; in { inherit x; }
<{^_^}>
{ x = 1; }
<shlevy>
> let x = 1; in { x = x; }
<{^_^}>
{ x = 1; }
<shlevy>
> let x = 1; in rec { x = x; }
<{^_^}>
{ x = <CODE>; }
<shlevy>
> let x = 1; in rec { inherit x; }
<{^_^}>
{ x = 1; }
<shlevy>
> let x = 1; in (rec { x = x; }).x
<{^_^}>
infinite recursion encountered, at (string):206:26
<clever>
shlevy: i think we would need a debug util, that doesnt force the expr's and instead just prints them as-is
<shlevy>
No this shows the issue :)
<clever>
yeah, i see, since the bot wont eval a thunk it seems
<clever>
> { inherit (pkgs) hello; }
<{^_^}>
{ hello = <CODE>; }
<clever>
> { hello = pkgs.hello; }
<{^_^}>
{ hello = <CODE>; }
<clever>
so both match up
<infinisil>
shlevy: That's exactly what my freeVars PR fixed :)
<infinisil>
Well fixed, the semantics for freeVars at least
orivej has quit [Ping timeout: 252 seconds]
page has quit [Quit: leaving]
page has joined #nixos-dev
orivej has joined #nixos-dev
drakonis_ has joined #nixos-dev
drakonis has quit [Ping timeout: 268 seconds]
hedning has left #nixos-dev [#nixos-dev]
hedning has joined #nixos-dev
orivej has quit [Ping timeout: 252 seconds]
drakonis has joined #nixos-dev
drakonis_ has quit [Read error: Connection reset by peer]
drakonis1 has joined #nixos-dev
drakonis_ has joined #nixos-dev
drakonis has quit [Read error: Connection reset by peer]
drakonis_ has quit [Read error: Connection reset by peer]
drakonis_ has joined #nixos-dev
drakonis1 has quit [Ping timeout: 250 seconds]
<andi->
is c0bw3b on IRC?
drakonis has joined #nixos-dev
<gchristensen>
hmm sometimes, but not sure how often. whats up?
<andi->
nothing special just a minor thing... Will just comment on the PR then :)
<gchristensen>
once a day or so
<andi->
(he added a label which by my judgement would be wrong but maybe he has a different reading)
drakonis1 has joined #nixos-dev
<gchristensen>
gotcha
drakonis_ has quit [Ping timeout: 240 seconds]
FRidh has quit [Quit: Konversation terminated!]
drakonis has quit [Ping timeout: 252 seconds]
<gchristensen>
Profpatsch: available to test something?
<shlevy>
gchristensen: OMG (setq nix-indent-function 'nix-indent-line) seems to have fixed it
<shlevy>
Though the docs mark it as experimental? *shrug*
drakonis1 has quit [Ping timeout: 268 seconds]
<gchristensen>
wat?
<gchristensen>
I identified the exact thing that drives me batty
<shlevy>
by default nix-indent-function is set to indent-relative
<shlevy>
I just tried nix-indent-line and I opened a new let and it did the right thing?
<shlevy>
Yeah that doesn't happen with nix-indent-line
<shlevy>
In fact if you don't manually de-dent it does it for you on newline :o
<gchristensen>
:O
<gchristensen>
whyyy is that not default
<gchristensen>
I'll try it immediately
<shlevy>
It's listed as buggy :D
<gchristensen>
:|
drakonis1 has joined #nixos-dev
<shlevy>
"To set it to the experimental indentation, set this value to the function, nix-indent-line. Note that there are major bugs that prevents this from becoming the default. Certain kinds of code involving lots of hanging indents will be incorrect. But, we welcome attempts to improve this experience! Please submit pull requests at https://github.com/NixOS/nix-mode/pulls."
<shlevy>
I mean maybe but the default is incorrect with even one hanging indent :D