!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1927 Members
Nix programming language360 Servers

Load older messages


SenderMessageTime
8 Jun 2021
@andrew:mtx.rew.laandrew unsafeGetAttrPos seems very useful 00:20:19
@aaronjanse:matrix.orgaaronjanse
In reply to @andrew:mtx.rew.la
hmm, didn't rnix-lsp already have goodies built in to determine where, for example, pkgs in with pkgs; came from?
Are you sure you need to know where it came from?
00:20:23
@aaronjanse:matrix.orgaaronjanseIt might make sense to start off trying to do as much as possible with unsafeGetAttrPos00:20:53
@aaronjanse:matrix.orgaaronjanseHuh or maybe start off by just visualizing the output of pkgs.lib.nixosSystem (which should list the values of all nixos options)00:21:55
@aaronjanse:matrix.orgaaronjanse* Huh or maybe start off by just visualizing the output of pkgs.lib.nixosSystem { ... } (which should list the values of all nixos options for your system)00:22:17
@andrew:mtx.rew.laandrew I'm probably getting ahead of myself, but it would be useful for users to be able to modify things like let-in statements. E.g. observe that python3Packages comes from a let-in statement, then examine the expression defining python3Packages, examine which options depend on it, then understand properly whether python3Packages should be upgraded from 37 to 39 00:22:36
@aaronjanse:matrix.orgaaronjanseHmm, would they do this in an IDE like vscode, or would they use something like the UI you send a screenshot of above?00:25:29
@andrew:mtx.rew.laandrewIdeally this works for noobs, but has the capability for more advanced changes00:25:57
@aaronjanse:matrix.orgaaronjanseIf the latter, maybe you could combine {nix-instantiate with unsafeGetAttrPos} with rnix-lsp00:26:21
@aaronjanse:matrix.orgaaronjanseThat way you know the fully evaluated system then can do insights (using rnix-lsp) on the code that nix-instantiate points you to00:26:58
@andrew:mtx.rew.laandrew what does unsafeGetAttrPos provide which I can't get from rnix-lsp? 00:27:20
@aaronjanse:matrix.orgaaronjanseOh it just lets you do operations on evaluated expressions. And I assume you'll want to evaluate the configuration.nix to figure out what the current nixos option values are and where they're defined?00:28:30
@andrew:mtx.rew.laandrewwell I'm not sure I ever want the evaluated option values. Just a form representation of the "raw" option00:29:09
@aaronjanse:matrix.orgaaronjanseOh got it00:29:32
@andrew:mtx.rew.laandrewalthough seeing the incrementally evaluated form of an option could be useful while editing00:30:01
@aaronjanse:matrix.orgaaronjanseI guess you'd want the value to know whether the "enabled" checkbox should be checked for a given option00:31:29
@aaronjanse:matrix.orgaaronjanseBut you've thought through this more than I have00:31:39
@aaronjanse:matrix.orgaaronjanse* But you've thought this through more than I have00:34:03
@andrew:mtx.rew.laandrew Right now I just record the current system state in json via nix-build /etc/nixos/nixpkgs/nixos/release.nix -A options -o release_out and nixos-option, however because this requires evaluating the expression it works for things like checkboxes which generally are defined with basic expressions (true / false rather than a function). 00:35:17
@andrew:mtx.rew.laandrewmore complicated solutions come in when it's defined by a variable or an attribute within a variable (excuse my likely wrong terminology)00:36:07
@aaronjanse:matrix.orgaaronjanseYeah no problem00:36:49
@buckley310:matrix.orgBuckley does nix language have an equivelant to haskell's $ operator for reducing parenthases? 05:45:51
@buckley310:matrix.orgBuckleyi haven't seen one yet, but just checking 😇05:47:02
@aaronjanse:matrix.orgaaronjanse Buckley I don't think it does 06:15:05
@jez:petrichor.meJez (he/him) changed their profile picture.08:53:59
@jez:petrichor.meJez (he/him) changed their profile picture.09:42:56
@NYXT:matrix.orgdavidtwco joined the room.10:01:35
@artturin:matrix.orgartturin joined the room.17:24:10
@emilazy:matrix.orgemily Buckley: no, but you can do e.g. pipe x [ f g h ] for f (g (h x)) 21:17:48
@emilazy:matrix.orgemily still need parens if f, g or h are themselves function applications (e.g. for passing multiple arguments) 21:17:59

Show newer messages


Back to Room ListRoom Version: 6