infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - - Logs:
__monty__ has joined #nix-lang
__monty__ has quit [Quit: leaving]
__monty__ has joined #nix-lang
__monty__ has quit [Quit: leaving]
kisik21 has joined #nix-lang
<infinisil> > 1/1
<{^_^}> /var/lib/nixbot/state/nixpkgs/1/1
<kisik21> > builtins
<{^_^}> { abort = <PRIMOP>; add = <PRIMOP>; addErrorContext = <PRIMOP>; all = <PRIMOP>; any = <PRIMOP>; attrNames = <PRIMOP>; attrValues = <PRIMOP>; baseNameOf = <PRIMOP>; builtins = { abort = <PRIMOP>; add =...
<infinisil> Anything with / in it will prefer to be a path
<kisik21> > /var/lib/nixbot
<{^_^}> /var/lib/nixbot
<kisik21> > builtins.listDirectory /var/lib/nixbort
<{^_^}> attribute 'listDirectory' missing, at (string):169:1
<clever> > builtins.attrNames builtins
<{^_^}> [ "abort" "add" "addErrorContext" "all" "any" "attrNames" "attrValues" "baseNameOf" "builtins" "catAttrs" "compareVersions" "concatLists" "concatStringsSep" "currentSystem" "currentTime" "deepSeq" "de...
<clever> > builtins.readDir ./.
<{^_^}> { ".dir-locals.el" = "regular"; ".editorconfig" = "regular"; ".git" = "directory"; ".gitattributes" = "regular"; ".github" = "directory"; ".gitignore" = "regular"; ".version" = "regular"; COPYING = "r...
gchristensen has joined #nix-lang
<kisik21> > builtins.readDir /var/lib/nixbot
<{^_^}> access to path '/var/lib/nixbot' is forbidden in restricted mode
<kisik21> builtins.readDir /etc/os-release
<kisik21> > builtins.readDir /etc/os-release
<{^_^}> access to path '/etc/os-release' is forbidden in restricted mode
<infinisil> Bless restricted mode :)
<kisik21> owww
<kisik21> I'm not able to crash the whole system
<kisik21> boo
<kisik21> bad bot
<infinisil> Nope!
<mpickering> You should all be more worried about the behaviour of == hehe
<kisik21> > builtins = null
<{^_^}> builtins defined
<kisik21> oops
<kisik21> I didn't expected THAT to work
<infinisil> That may break it lol
<kisik21> > builtins
<{^_^}> null
<kisik21> oops
<infinisil> > true
<{^_^}> infinite recursion encountered, at (string):146:10
<infinisil> > true = builtins.true
<{^_^}> true defined
<infinisil> > true
<{^_^}> value is null while a set was expected, at (string):146:9
<infinisil> Yup lol
<kisik21> sorry!
<mpickering> the bot is stateful haha?
<kisik21> how to reset it?
<kisik21> mpickering: seemingly
<kisik21> ,
<{^_^}> All commands: -A IFD NUR arm ask bootfull callPackage channels cloudfront context dnw error escape" escape'' escape-special fancy-uninstall github hardware haskell help home-manager howoldis library logs nix-env-r nix-info nix-repl nixGL nixcon nixeval nixpkgsVersion not-os notfound outPath overlay paste pills pinning pr profiling pure-eval python qt replaceModule runtimeDeps stateVersion stuck thesis timer todeclarative tofu unfree unstable which-cha
<kisik21> ,reset
<kisik21> ,restart
<kisik21> ,reboot
<infinisil> I'll reset it manually lol
<kisik21> And then I'll unset builtins again ^^
<infinisil> Yeah, I'll have to make it better eventually
<infinisil> Or just disallow assigning builtins and stuff
<kisik21> Make a reset button that would reset these changes
<kisik21> that would be both funny and safe
<infinisil> "these changes"??
<kisik21> unsetting builtins and stuff
<kisik21> like, restart the nix-repl or what does it use under the hood
<kisik21> so environment would be reset to initial state with one command
<infinisil> Doesn't use nix-repl, it's my own repl thing
<kisik21> Still
<kisik21> Reset button would be nice to have
<kisik21> I really didn't mean to break it...
<infinisil> Nah, I wouldn't want to delete all definitions
<infinisil> I had such a reset button once
<kisik21> at least make builtins builtins again
<infinisil> > true
<{^_^}> true
<infinisil> > false = builtins.false
<kisik21> > builtins
<{^_^}> false defined
<{^_^}> { abort = <PRIMOP>; add = <PRIMOP>; addErrorContext = <PRIMOP>; all = <PRIMOP>; any = <PRIMOP>; attrNames = <PRIMOP>; attrValues = <PRIMOP>; baseNameOf = <PRIMOP>; builtins = { abort = <PRIMOP>; add =...
<kisik21> whew
<kisik21> it's working again
<infinisil> I don't have time to fix this right now though, will have to wait a bit
<kisik21> > builtins_backup = builtins
<{^_^}> error: syntax error, unexpected '=', expecting ')', at (string):169:17
<kisik21> > builtinsbackup = builtins
<{^_^}> builtinsbackup defined
<infinisil> Nah that won't work, it allows recursive defs
<kisik21> builtinsbackup
<kisik21> > builtinsbackup
<{^_^}> { abort = <PRIMOP>; add = <PRIMOP>; addErrorContext = <PRIMOP>; all = <PRIMOP>; any = <PRIMOP>; attrNames = <PRIMOP>; attrValues = <PRIMOP>; baseNameOf = <PRIMOP>; builtins = { abort = <PRIMOP>; add =...
<infinisil> So whatever you define as builtins after that, builtinsbackup will use
<kisik21> ouch...
<infinisil> No that's really useful
<infinisil> And it's what makes me love this repl much more than nix-repl
<kisik21> I haven't expected it to work with pointer-like things...
<kisik21> or at least making a variable point to a variable
<infinisil> It really just assembles a nix file in the back
<gchristensen> :o
<kisik21> where's the code?
<infinisil> A big giant let in statement
<infinisil> (it's not really runnable by anyone other than me though, and no docs)
<kisik21> why not rubnnable by others?
<kisik21> too arcane config?
benley has joined #nix-lang
<infinisil> Can only be run with some rabbitmq frontend, {^_^} in this case (made by gchristensen), and it needs some stateful setup (like nix-index, nixpkgs version)
<infinisil> I'll fix all of those things eventually
<ldlework> what do you mean by stateful setup?
<clever> make a nixos module that manages both!!
<infinisil> ldlework: I ran nix-index manually at some point so it has database to nix-locate with
<infinisil> clever: You mean to run nix-index before it starts?
<clever> infinisil: and configure all the other state, and run the service via systemd
<infinisil> Hmm that might be a pretty good idea
<infinisil> Dealing with this on the haskell side is annoying
<infinisil> clever: Although, is it reasonable to expect people to only be able to run the bot if they use NixOS?
<infinisil> I guess that's not too bad
<clever> infinisil: the module also acts as a document listing what variables have to be set and what commands you must run
<clever> also, screw all other OS's :P
<clever> nixos must rule the world!
<infinisil> Haha yes!
<clever> oh, also
<clever> > (import <nixpkgs/nixos> { configuration = { services.mysql.enable = true; }; })
<{^_^}> The option `services.mysql.package' is used but not defined.
<infinisil> Oh right
<clever> > (import <nixpkgs/nixos> { configuration = { pkgs, ... }: { services.mysql = { enable = true; package = pkgs.mysql; }; }; })
<infinisil> People don't need NixOS to run it after all
<{^_^}> "<derivation /nix/store/ffs8bmj5a06jrvgkp9y0dmb7xsrvwgd0-mysql-runner.drv>"
<clever> that wont deal with inter-service deps, but that can run a nixos service
<gchristensen> but also it is pretty reasonable to expect them to run nixos
<infinisil> Yeah, considering the bot's target audience
<gchristensen> and the current actual number of operators
<infinisil> Yes :P
<clever> good point :P
<gchristensen> I catch myself sometimes thinking poeple don't actually want to run nixos, despite them hiring me for my expertise, and me believing nixos is generally the best choice... I have to remind myself no, stand tall for nixos
<clever> gchristensen: a friend i know works for a company that is very anti-nix
<clever> because the previous guy to introduce them to nix, was still learning it at the time
<gchristensen> oops
<clever> yeah
<ldlework> I started this presentation to introduce Nix at my last job,
<ldlework> I should finish it some day
<infinisil> Nix solved problems I didn't even know I had before I used it!
<infinisil> Or rather in my case: Nix made me a person that would've had problems Nix solves if I didn't use Nix
<clever> infinisil: the original reason i installed nixos, was to fix a bug only nixos had, lol
<infinisil> What was it?
<clever> clicking links in teamspeak did not open chromium
<clever> teamspeak uses libredirect (a nix only wrapper), to force it to read files from the store
<clever> and chromium deadlocks if that is in LD_PRELOAD
<clever> i was initialy a firefox user, and was unable to reproduce it, but liked the idea of nixos and kept using it
<infinisil> Neat
<clever> ~2 months later, i switched to chrome, and then reproduced it, and had to fix it :P
<clever> and maybe a year or 2 after that, i was helping somebody else fix a different chrome issue with selinux, and squeezed in the redirect fix
<ldlework> things like libredirect freak me out
<clever> why?
<ldlework> I imagine being at a Dockercon trying to sell nix and trying to explain that libredirect is even a thing and not having the audience stand up and leave
<ldlework> Having to radically fork software just to get it to work is harrowing at best.
<ldlework> It kind of reminds me of Emacs. Some people are willing to go all in, but it is clear that the vast majority is not.
<kisik21> Idlework: libredirect?
<clever> ldlework: multimc was downloading a lot of stuff at runtime, and shoving them into $prefix, aka, /nix/store
<clever> i also still have the last commit on its source
<ldlework> clever: if you see the form of my balking, you can see that, even a line or two is enough to trigger
<ldlework> just to get a game working I have to edit its source code? that is just not going to fly for the vast majority.
<clever> steam-run
<ldlework> In a way similar to having to become a lisp programmer to make much use out of Emacs.
<kisik21> Actually games should not download to $PREFIX
<clever> ldlework: people have laughed at me because of how small my vim config is :P
<kisik21> What if $PREFIX is readonly, like /nix/store?
<clever> kisik21: multimc expects you to download a pre-built .tar and just unpack it to $HOME
<ldlework> clever: well sure, emacs and vim are not the same kind of software
<kisik21> This is still undesirable behaviour and should be reported upstream.
<clever> so that allowed them to get sloppy
<clever> kisik21: the .patch i linked above is missing in the latest version on nixpkgs
<clever> i think they have fixed it upstream
<kisik21> Nice!
<infinisil> > v1 = lib.makeExtensible {}
<{^_^}> v1 defined
<kisik21> > v1
<{^_^}> attempt to call something which is not a function but a set, at /var/lib/nixbot/state/nixpkgs/lib/fixed-points.nix:25:21
<clever> infinisil: ah, i was playing with that earlier
<clever> it needs a function
<kisik21> What's v1 is anyway now?
<clever> > v1 = lib.makeExtensible self: {}
<{^_^}> error: syntax error, unexpected ':', expecting ';', at (string):150:30
<kisik21> ()
<clever> > v1 = lib.makeExtensible (self: {})
<{^_^}> v1 defined
<infinisil> I'll use this to implement the next version of nixbot
<kisik21> in nixbot
<kisik21> written in nix
<infinisil> > v2 = v1.extend (self: super: with super; { foo = 10; })
<{^_^}> v2 defined
* kisik21 is trying to joke, but fails
<kisik21> > v2
<{^_^}> { __unfix__ = <LAMBDA>; extend = <CODE>; foo = 10; }
<infinisil> > v3 = v2.extend (self: super: with super; { foo = foo + 2; })
<{^_^}> v3 defined
<clever> cardanoPkgs = builtins.foldl' (pkgs: overlay: pkgs.extend overlay) cardanoPkgsBase activeOverlays;
<kisik21> > v2.__unfix__
<{^_^}> <LAMBDA>
<infinisil> >
<{^_^}> evaluation aborted with the following error message: 'xxx'
<kisik21> > v2.__unfix__ {};
<{^_^}> error: syntax error, unexpected ';', expecting ')', at (string):171:16
<kisik21> > v2.__unfix__ {}
<{^_^}> { foo = 10; }
<clever> infinisil: this takes an array of overlays, and applies them to something that supports .extend
<kisik21> what's __unfix__ thing here?
<clever> kisik21: not sure
<kisik21> > v2.__unfix__ { awoo = 40; }
<{^_^}> { foo = 10; }
<kisik21> nope
<ldlework> i have no idea what you all are doing
<kisik21> me too
<clever> this documents it
<infinisil> > v2 = v1.extend (self: super: with super; { blabla = 10; })
<{^_^}> v2 defined
<infinisil> > v3 = v2.extend (self: super: with super; { blabla = blabla + 2; })
<{^_^}> v3 defined
<infinisil> > v3.blabla
<{^_^}> 12
<infinisil> There we go
<kisik21> it looks not unlike overlays
<kisik21> self, super...
<kisik21> y'know
<infinisil> The next version of nixbot will use something like this
<clever> kisik21: but it lets you do overlay style overrides, on arbitrary attribute sets
<infinisil> Indeed, that is an overlay
<kisik21> Cool~
<clever> kisik21: so rather then having to overwrite all of pkgs, i can just jam together 4 overlays, and make my own set
<infinisil> Every new definition will then add a new v3, v4, etc. (but a bit more smartly)
<infinisil> And the with super; allows you to use previous definitions
<ldlework> clever: nice
<clever> kisik21: and in here, i conditionally enable some overlays, and mix in haskellPackages
<infinisil> This has a very nice advantage:
<infinisil> > v2 = v1.extend (self: super: with super; { true = false; })
<{^_^}> v2 defined
<kisik21> v2.true
<kisik21> > v2.true
<{^_^}> false
<infinisil> > v3 = v2.extend (self: super: with super; { blabla = true; })
<{^_^}> v3 defined
<kisik21> > v2.blabla
<infinisil> > v3.blabla
<{^_^}> attribute 'blabla' missing, at (string):171:1
<{^_^}> true
<ldlework> this needs a wiki entry for sure
<infinisil> What does?
<ldlework> makeExtensible
<infinisil> It's in the lib docs
<infinisil> ,find lib/customizable.nix
<{^_^}> Couldn't find any such files
<infinisil> ,locate fixed-points.nix
<{^_^}> Couldn't find any packages
<infinisil> ,find fixed-points.nix
<ldlework> Are you trying to explain that people should discover this functionality by browsing the source?
<infinisil> ldlework: Hmm yes? :P
<ldlework> :|
<infinisil> As long as we don't have some kind of docstrings, that's the best option
<infinisil> A wiki entry would just duplicate these docs
<infinisil> And possibly become outdated
<ldlework> source code comments are not a good way to document things
<ldlework> they are a good way to explain implementation decisions
<infinisil> It works fairly well though
<infinisil> Assuming you're comfortable browsing the source
<ldlework> documentation is one of the biggest things I have to contend with with people putting nixos down
<ldlework> and there's nothing to defend
<infinisil> I guess what would work is to extract the docs for every function with some automated script from nixpkgs/lib and put that into the nixpkgs docs
<ldlework> if you do that, then lib has to be well organized since the documentation becomes homoioconic with the implementation
<ldlework> or whatever
<ldlework> lol
<infinisil> Not sure what you mean by that
<kisik21> Idlework: documentation? you need no documentation if you have nixpkgs checkout
<infinisil> Just get the docs right above the functions definitions
<ldlework> the structure of the documentation will be the same as the structure of li
<ldlework> lib
<kisik21> never used it separately
<kisik21> actually never used it anywhere
<clever> and now for some history, all-packages.nix used to have the wrong indentation!
<ldlework> it is disheartening to hear comfortable and satisfied resolve for the worst possible form of documentation
<infinisil> However, better docs don't come from complaining, but rather from doing work to make them better :)
<infinisil> Haha somebody had to implement bit operations in Nix:
<clever> lol
<infinisil> The bitwise not concerns me a bit though
<infinisil> It just subtracts one..
<clever> -1 is true
<infinisil> Oh wait
<infinisil> > builtins.sub (-1) 10
<{^_^}> -11
<infinisil> > builtins.sub (-1) 0
<{^_^}> -1
<clever> > lib.not true
<{^_^}> attribute 'not' missing, at (string):171:1
<clever> > lib.not 1
<{^_^}> attribute 'not' missing, at (string):171:1
<clever> > lib.bitNot 1
<{^_^}> -2
<clever> wut?
<infinisil> Ah never mind, it's correct
<infinisil> bitwise not in 2s-complement is -x-1
<infinisil> =-1 -x
<infinisil> = builtins.sub (-1)
<demize> infinisil: Next, implement an assembly interpreter.
<infinisil> On it!
<ldlework> > better docs don't come from complaining - I'm reporting the fact that the current documentation is indefensible to the typical linux user which doesn't bode well for Nix and you tell me to bugg off and write the documentation myself. This attitude doesn't bode well either. I am just making observations.
<{^_^}> error: syntax error, unexpected ')', expecting ID or OR_KW or DOLLAR_CURLY or '"', at (string):172:1
<ldlework> Second time in two days I've heard this sort of "I'm fine with the state of things, but you go fix what you don't like", despite the fact I've contributed to the wiki and nix mode and I am not talking about myself since I am ready to do those things.
<infinisil> Sorry, didn't mean to sound rude
<ldlework> Me either, I just wanted to stand ground a little there.
<infinisil> The wiki is a very good development, comes along much quicker than nixpkgs docs lol
<ldlework> "patch the source" and "read the source" are just hard pills to swallow for most
<ldlework> most people are just going to want an OS who's config they can put in git and reproduce on a new workstation / server
<ldlework> the culture of package management is extraneous
<ldlework> well, ought to be
<ldlework> it is absolutely central to the experience right now
<samueldr> ldlework: one of the bigger issues w/r/t docs is how huge the endeavor (nixpkgs) is, the current set of maintainers is barely managing enough to not accrue too much debt with regards to updates (implmenting stuff, PRs, etc)
<ldlework> but lib?
<samueldr> which in other words do mean: we need people to stop doing things and *actually* document things
<ldlework> yeah, I acknowledge timeline and priority too
<ldlework> i am not balking against the state of things
<ldlework> but the attitude i'm hearing regarding it
<samueldr> and yeah, there's probaby a bit of a case of the people actually knoweldgeable enough to write the docs don't feel the need to (since they know)
<samueldr> it could be second nature to them to use *anything*...
<samueldr> not knowing what you don't know is hard :/
<samueldr> or uh, with the right amount of negation in there :)
<ldlework> samueldr: which is pretty typical I'd say
<ldlework> so no special blame to lay or anything
<samueldr> though I have to say that docstrings in lib/* files are not always present, but are generally good currently
<samueldr> but one of the issues right now is bikeshedding this :/
<ldlework> it is almost an intrinsic game theory thing what you just observed, that experts don't feel a pressing need for documentation of what they already understand but are the best ones suited to write it
<infinisil> How about creating a priority list for stuff that needs to be improved in regards to docs