2018-03-09

<clever> so when anything tries to import <nixpkgs> it loads your dummy
<clever> boomshroom: you may need a dummy default,nix in NIX_PATH, that does import <realnixpkgs> { crossSysstem = foo; };
<clever> boomshroom: i dont think there is any way to set the right flags in config.nix
<clever> nice
<clever> genesis: nice
<clever> which uploads from the console
<clever> you can also run `gist -p default.nix` after `nix-env -iA nixos.gist`
<clever> so it uses the mkDerivation from qt
<clever> genesis: try removing the stdenv. from that
<clever> can you gist your current nix expressions?
<clever> what about qt510.mkDerivation ?
<clever> genesis: and which callPackage are you using?
<clever> script is part of the qtscript attr
<clever> qt5.qtscript.dev 894 r /nix/store/mwhscavyy74qan5yanjspagpnxixdxjv-qtscript-5.8.0-dev/mkspecs/modules/qt_lib_scripttools.pri
<clever> qt510.qtbase i think
<clever> thats a library, not part of creator
<clever> nix-env -iA nixos.qtcreator
<clever> genesis: i see it in nixpkgs still
<clever> hakujin: _module.args.pkgs is how the pkgs argument got there in the first place
<clever> boomshroom: did you check the nix-store man page?
<clever> boomshroom: usually hostname-1, and when you remake the key, it becomes hostname-2
<clever> Lisanna: but libcurl may obey ~/.netrc
<clever> boomshroom: is the daemon 1.11 or 2.0?
<clever> Lisanna: its using libcurl in this file, so it depends on what libcurl reads by default
<clever> and now that nix-channel has been redone in c++, you cant use curl flags directly
<clever> it normally fetches ~2 files from a dir, and to make it atomic, it first follows the redir, then appends the names to that
<clever> Lisanna: when it follows the redirect, it looses the auth info, because you didnt give it --user and --pass
<clever> Lisanna: oh, its the http redir
<clever> or native-build random parts, including the entire gcc and glibc toolchain
<clever> so you must either cross-compile everything, always
<clever> nix believes the cross-built glibc is different from the native build glibc
<clever> this is a problem that cross-compiling will always have
<clever> you may be better off building manually with nix-build on an external machine, running `nix copy`, and then `nix-store -i /nix/store/path`
<clever> but it will still want to download the x86 compiler to the phone, then upload it to the build slave
<clever> boomshroom: always pass crossSystem to <nixpkgs> and it should always cross-compile on an x86 machine
<clever> boomshroom: so you can safely use any machine as the build slave, as long as the cpu can run the compiler
<clever> boomshroom: there is no way for nix to get versions crossed like that
<clever> mutantmell: i'm thinking its not cleaning up self.reply_buffer[request_metadata.response_id] when requests fail
<clever> boomshroom: oops, meant to send that to mutantmell
<clever> why?!
<clever> boomshroom: i think its polling the json endpoint that returns 27mb
<clever> mutantmell: maybe that sharing isnt it, still fails, i'll try to debug more...
<clever> mutantmell: the slack admin has to approve the wee-slack app first
<clever> it may not like that
<clever> resulting in 3 sessions
<clever> mutantmell: aha, that might be it, i "stole" the auth token out of my browser session, and then launched 2 weechats from that token
<clever> i suspect its repeatedly hitting a certain endpoint
<clever> and this slack is free, so it has a max of 10k messages total
<clever> mutantmell: it seems to wait until you focus the channel
<clever> 1.3gig
<clever> 1gig of ram
<clever> ERROR: Failed connecting to Slack with token xxx ratelimited
<clever> mutantmell: upgraded the server to 2.0, its using 500mb of ram and 100% cpu, and is still forking
<clever> the un-configured one is sitting at 3mb
<clever> 2, but 1 is un-configured
<clever> depending on your nix channel, you may not need this
<clever> adjusting my expression to force that version
<clever> thats the machine where it works fine
<clever> "18.03pre129076.831ef4756e3"
<clever> [clever@amd-nixos:~/apps/slack-irc-gateway]$ nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion
<clever> 2.0 is behaving better
<clever> 1.9 on the server
<clever> 1.9 vs 2.0
<clever> on the server, its up to 1.6gig
<clever> on my desktop, its idling at 500mb, and isnt forking
<clever> note, this slack has 16,000 users, and i had to adjust a timeout to even connect, because the very first API call returns a 27mb blob of JSON
<clever> yes
<clever> 1.2gig
<clever> mutantmell: ehgads!, weechat is using up a gig of ram already, and is forking like crazy
<clever> Lisanna: some people try to mount a tmpfs to /tmp!!
<clever> and i just realized some absurdity, i was connecting to tmux to set it up, while inside screen, lol
<clever> all of the state lands in the home directory, which is over here
<clever> [root@router:~]# ls -ltrh /var/lib/weechat-example/.weechat/
<clever> same
<clever> and you also gain the ability to control it
<clever> yeah, weechat requires a tty to even start
<clever> mutantmell: /slack register gives help on how to find it
<clever> mutantmell: it also includes the slack plugin, with the patches i previously mentioned, so it needs a different token
<clever> `sudo -u example -i` and `tmux a -t example` to connect to tmux and control it, ^bd to disconnect
<clever> mutantmell: that will generate several (based on line 43) systemd services&users, each running a weechat inside tmux
<clever> Lisanna: i think thats systemd, what is it set to outside nix-shell?
<clever> mutantmell: dang, tmux also wants a tty!
<clever> the -i asks before overwriting, the -v tells me exactly what it just did, and the trailing / causes it to fail, it cant rename a file to directory/
<clever> thats why i always do `mv -vi file1 file2 directory/`
<clever> if directory doesnt exist, it renames file1->directory, then renames file2->directory
<clever> `mv file1 file2 directory`
<clever> it can also fail in other fun ways
<clever> `mv file1 file2 file3` renames 1->3, then 2->3
<clever> except, its dumb, when you give it 3 files
<clever> jtojnar: it will assume your trying to rename file1 to file2, like `mv file1 file2`
<clever> ah,
<clever> (which overwrites the last file with the 2nd last, and deletes all overs)
<clever> jtojnar: did you try to `mv *`?
<clever> yeah, i think it demands a tty
<clever> Mar 09 04:16:01 router weechat[22621]: Error opening terminal: unknown.
<clever> oh wait no
<clever> i think systemd tried to run the service before the user/home where created
<clever> Mar 09 04:14:00 router systemd[21983]: weechat-example2.service: Failed at step CHDIR spawning /nix/store/0jpaib26q5qgshva3v3pzxnlm5n6r57b-unit-script/bin/weechat-example2-pre-start: No such file or directory
<clever> ah, createHome didnt give it permission to the parent of home
<clever> yet it does exist
<clever> Mar 09 04:12:16 router weechat-example-pre-start[21394]: mkdir: cannot create directory ‘/var/lib/weechat’: Permission denied
<clever> oh, i forgot to set User=
<clever> jeaye: do you happen to have any experience running weechat under systemd?
<clever> Mar 09 04:11:11 router weechat[20956]: Error: unable to get HOME directory
<clever> *doh*
<clever> chown -R $[name} /var/lib/weechat/example
<clever> Mar 09 04:09:51 router weechat-example-pre-start[20432]: /nix/store/s1wkdni2rn51jz7chh0r5fr0f1viki50-unit-script/bin/weechat-example-pre-start: line 4: unexpected EOF while looking for matching `]'
<clever> mutantmell: and now to test it!
<clever> !tofu
<clever> i could have also used map over configs, but its simpler to just merge the 2 operations
<clever> i'll post the full file in a few minutes, but thats an example of what the fn has to return
<clever> 17 "${name}" = {
<clever> 16 mkUser = name: {
<clever> and each gets his own user!
<clever> users.extraUsers = lib.foldl' (state: name: state // (mkUser name)) {} configs;
<clever> so you give it a list of configs, and it generates a list of systemd services, allowing you to run several weechats at once
<clever> systemd.services = lib.foldl' (state: name: state // (mkService name)) {} configs;
<clever> i can never remember the order of the params, had to experiment in nix-repl
<clever> { a = 1; b = 1; }
<clever> mutantmell: a handy function that i'm using...
<clever> nix-repl> lib.foldl' (state: n: state // { "${n}" = 1; }) {} [ "a" "b" ]
<clever> yeah, i'll need to experiment and see what it does
<clever> though the type=oneshot will cause problems...
<clever> mutantmell: this random page i found says to run weechat inside tmux, rather then directly from systemd: http://www.mythmon.com/posts/2015-02-15-systemd-weechat.html
<clever> boomshroom: for the moment, just rsync over a copy of nixpkgs and ignore channels
<clever> boomshroom: ah, i havent gotten to bed yet
<clever> and if possible, i want to connect to it from a normal irc client
<clever> currently, i'm running it in a terminal, but i want to switch it over to being a service
<clever> so you can use it without approval from the workspace admin
<clever> wee_slack.patch changes it from needing an official api token, to re-using the websocket token from your browser session
<clever> if you run nix-build on this file, it will patch wee_slack.py to work on nixos, and also adjust the type of api token you need
<clever> ah, then youll want what i just wrote
<clever> also, any way to control it when its in that mode?
<clever> on to phase 2, setting it up as a service so it can log without me having to pay any attention
<clever> aha
<clever> but ~/logs didnt exist until i just ran mkdir on it
<clever> the config says its logging and that it writes to "%h/logs/"
<clever> i have a plugin connecting to slack, and i want it to simply log things
<clever> do you know much about how the logging works in weechat?
<clever> and you dont even have to create the user or homedir, this section auto-generates a user
<clever> mutantmell: in the pre-start for your service, you create a symlink to the config in the users home directory
<clever> ah, then youll want something more like hydra
<clever> though it may also try to write files there, which could cause issues
<clever> mutantmell: this lets you point it to a directory where the config probably lives
<clever> -d, --dir <path> set WeeChat home directory (default: ~/.weechat)
<clever> [clever@amd-nixos:~/Downloads]$ weechat --help
<clever> mutantmell: ive also just recently started using weechat for a plugin, and am wondering how to get its logging to work right
<clever> nix works better when you do it that way
<clever> mutantmell: its better to pass it on the cmd line
<clever> boomshroom: search for the config.nix file inside nix, and check if the paths in it are arm executables
<clever> boomshroom: i'm going to be heading to bed soon
<clever> boomshroom: i'm guessing that the config.nix inside the nix package has some wrong paths in it
<clever> boomshroom: can you paste the error?
<clever> though, if you want to be able to run it in a terminal, you will need to install it, either seperately, or by adding environment.systemPackages = [ pkgs.weechat ]; between lines 25&26 of my example
<clever> line 21 automatically downloads it
<clever> no need to install the application
<clever> just put that file into /etc/nixos/ and add imports = [ ./snmpd.nix ]; to your configuration.nix
<clever> lines 11-14 is some SNMP config, and line 21 runs snmpd against that file
<clever> mutantmell: ah, then my snmp module would be a perfect example
<clever> mutantmell: what arguments is weechat ran with when acting as a server?
<clever> boomshroom: you man need to manualy run unxz on it, some tar's are not smart enough to figure it out
<clever> this region, modifies the arx package nix-bundle generates, so that the installer script can access your $HOME
<clever> and i'm calling it directly, from a helper script, after everything has been unpacked to ~/nix-install
<clever> thoughtpolice: this uses the ./nix directory for /nix, exposes /home directly, and maps the host /etc to /host-etc, along with passing 3 env vars thru and wiping the rest
<clever> exec .${nix-bundle.nix-user-chroot}/bin/nix-user-chroot -n ./nix -c -m /home:/home -m /etc:/host-etc -m etc:/etc -p DISPLAY -p HOME -p XAUTHORITY -- /nix/var/nix/profiles/profile/bin/enter-phase2
<clever> thoughtpolice: about 2 weeks ago, i redid a large chunk of nix-user-chroot, to allow customizing the chroot env more
<clever> boomshroom: yeah
<clever> boomshroom: and this gets around the problem of the unshare command either being wonky, or just not present: https://github.com/matthewbauer/nix-bundle/tree/master/nix-user-chroot
<clever> boomshroom: the other major feature of this, is that you can run an update-runner inside the namespace, to upgrade itself
<clever> no downloads like the https://nixos.org/nix/install
<clever> you run that, and it sets up the entire ~/nix-install/
<clever> also, this uses nix-bundle and arx, so the whole thing compiles down to a single 146mb "bash" script
<clever> this will give you an installation that includes the daedalus wallet
<clever> and installedPackages is the primary use right now, other derivations that are pre-installed into it
<clever> line 1 accepts an installationSlug argument, which lets you change the directory
<clever> that manages setting up a mount namespace in ~/nix-install/
<clever> boomshroom: yep
<clever> i just finished a far more complex nix expression
<clever> these paths will be fetched (109.31 MiB download, 751.06 MiB unpacked):
<clever> rewrote it to be a bit more pretty
<clever> i would expect it to have failed by now if it didnt
<clever> i assumed it only did the first step, auto-calling the <nixpkgs> function
<clever> and i'm a pretty advanced user
<clever> i didnt even know it recursed like that until i read the source
<clever> repeat until you run out of -A parts
<clever> if that attr contains a function, it is called with all --arg and --argstr
<clever> it will then index into the .b attribute
<clever> if that attr contains a function, it is called with all --arg and --argstr
<clever> if you supplied -A a.b.c, it will index into the .a attribute
<clever> if that file contains a function, it is called with all --arg and --argstr
<clever> nix-build '<nixpkgs>' searches the search path, nix-build alone tries default.nix in the current dir, and nix-build whatever.nix opens that directly
<clever> when you give a filename to nix-build, it will import that filename
<clever> i didnt notice the 3rd until i got thar far, and didnt feel like optimizing it in a single-line edit box
<clever> and then you need a pkgs.callPackage for make-tar, where you can reuse the 2nd nixpkgs
<clever> then you need a 2nd nixpkgs for the value of crossSystem (which you already had)
<clever> its a bit more complex then that, one min
<clever> you need one nixpkgs with crossSystem set, for the cross compile
<clever> 2 of those can be merged
<clever> (import <nixpkgs> { config = { allowUnfree = true; }).google-chrome
<clever> nix-build '<nixpkgs>' --arg config '{ allowUnfree = true; }' -A google-chrome
<clever> it translates very simply, let me type an example
<clever> storeContents = [ { object = nix; symlink = "/nix"; }]; }
<clever> let nix = (import <nixpkgs> { crossSystem = (import <nixpkgs> {}).lib.systems.examples.armv7l-hf-multiplatform; }).nixUnstable in (import <nixpkgs> {}).callPackage <nixpkgs/nixos/lib/make-system-tarball.nix> {
<clever> boomshroom: create a nix file that does
<clever> mduggie: id make it a single PR
<clever> but it will be empty
<clever> it will auto-generate a db.sqlite any time its missing
<clever> which makes every path in that tar valid
<clever> run `nix-store --load-db < nix-path-registration` to restore the db backup
<clever> it will also generate a nix-path-registration file in the root of the tar
<clever> it will generate a tar file with symlink (in my case, /kexec_nixos) pointing to object, and everything object depends on
<clever> object points to the nix 2.0 derivation, and symlink is just a path of your choosing
<clever> boomshroom: the correct way to generate a tar is like this: https://github.com/cleverca22/nix-tests/blob/master/kexec/kexec.nix#L39-L44
<clever> boomshroom: so nothing you copied over with tar is "valid"
<clever> boomshroom: you didnt load the db.sqlite backup
<clever> boomshroom: run realpath on it to resolve every level
<clever> just copy whatever you got and see what happens
<clever> boomshroom: these 2 files need to exist, just steal them from a nixos machine for the moment
<clever> ca-bundle.crt ca-certificates.crt
<clever> [clever@amd-nixos:~/Downloads]$ ls /etc/ssl/certs/
<clever> because it wants to use the x86 bash for echo
<clever> and the device will NEVER be able to compile its own files, even a simple "echo foo > $out"
<clever> boomshroom: then nix will know that the compiler needs x86, and will force you to setup build slaves
<clever> boomshroom: if its a proper cross-compiler, then you need to pass the cross-compile flags to nixpkgs when you import <nixpkgs> { ... };
<clever> otherwise it will fail to create things in /nix/store/
<clever> whole thing
<clever> the oposite of useradd is userdel
<clever> adduser or useradd?
<clever> how did you create them?
<clever> thats how single-user nix works on most linux distros
<clever> then you can just omit build users and give the primary user full ownership
<clever> if it never gets root, and it has +w to the store, it works without build users
<clever> you only need build users if nix is being ran as root
<clever> then you have dbus that crashes the entire program if /etc/machine-id is missing, lol
<clever> -qR just automagically knows what it depends on (if its written right), and just works
<clever> yeah, thats the magic of nix
<clever> nix will try to delete itself pretty quickly if you do anything like a GC
<clever> make-system-tarball includes a "backup" of the db.sqlite you can restore, because your nix doesnt believe itself to be a valid store path
<clever> boomshroom: ah, you wanted `nix-store -qR` or the `make-system-tarball` previously mentioned
<clever> boomshroom: nice, which route worked?

2018-03-08

<clever> gemishhood: what error did npm give?
<clever> tinco: the doc i just linked, is auto-generated via javascript, so it cant really be indexed
<clever> gemishhood: "works", but the css is missing, and the title bar is gone, the window can only be moved with alt+left drag
<clever> gemishhood: also, use a pastebin service, or risk the wrath of gchristensen :P
<clever> gemishhood: ah, you have to run `npm install .` i think, to download those deps
<clever> gemishhood: and does electron work there?
<clever> gemishhood: is there a package.json file in the git directory?
<clever> gemishhood: what happens if you just run "electron ." in the soundnode directory?
<clever> rawtaz: xfce4-settings-editor
<clever> rawtaz: i had to boot the backup xterm "desktop env" and manually run the xfce version of regedit to delete the resolution config
<clever> rawtaz: somewhere in $HOME
<clever> even if that resolution config causes Xorg to segfault, lol
<clever> rawtaz: i use xfce, and it restores all of my resolutions at login
<clever> rawtaz: .xprofile could be used for that, since nixos will source it and then continue booting X up
<clever> johnhamelink: and nixos uses ~/.xprofile (sourced) and ~/.xsession (executed) for its x init stuff
<clever> johnhamelink: there are enable options for several tiling window managers: https://nixos.org/nixos/options.html#bspwm
<clever> johnhamelink: one min
<clever> manveru: i genrally ignore systemd warnings like that
<clever> rawtaz: and keep in mind, nixos uses the nixos channel, which currently points to 17.09
<clever> rawtaz: and did you run nix-channel --update as root?
<clever> rawtaz: does `sudo nix-channel list` show channel called nixos?
<clever> you run it on the directory
<clever> gemishhood: you dont run it on the ELF file
<clever> gemishhood: you have to run electron, not Soundnode
<clever> joepie91: dynamic
<clever> joepie91: static builds are actually more likely to work on nixos
<clever> gemishhood: try running the electron from nixpkgs on the directory with package.json, you can get it via `nix-build '<nixpkgs>' -A electron`
<clever> or was it 4000 PR's?
<clever> a few days ago i think?, when ryan was making about 400 PR's
<clever> Judson: and you can play with the value of NIX_PATH and -I on that command, to see how it works
<clever> Judson: basically, run nix-instantiate --find-file nixpkgs, and echo $NIX_PATH
<clever> Judson: then youll want import /home/clever/.nix-defexpr/channels/nixpkgs {} or similar
<clever> Judson: so nix-channel --list shows nixpkgs?
<clever> boomshroom: the issue with current master, is that it needs nix2 to even parse release.nix
<clever> boomshroom: ah, maybe it was one of the 12pre versions i had tested it on
<clever> Judson: which depends on which user that channel is on, did you add it with or without sudo?
<clever> Judson: replace <nixpkgs> on line 3 of your default.nix with the full path to nixpkgs
<clever> so there is no way to access the channel called nixpkgs using <brackets>
<clever> Judson: but <nixpkgs> maps to the nixos channel on nixos
<clever> Judson: nix-env directly uses the channels, so you can access both seperately
<clever> boomshroom: try an older nix branch, maybe 1.11.15
<clever> Judson: so one of your channels is newer then the other
<clever> Judson: kubectl is only on nixpkgs, and is not on nixos
<clever> Judson: ah, i checked the gist
<clever> Judson: what is the exact nix-env command that works, and nix-shell that fails?
<clever> !-A