2017-04-22

<clever> Svarog: root:root i think
<clever> hyphon81: currently, it just maps to https://cache.nixos.org/jl72gxms9rg3czv3wj1rskw6n0h3k6gm.narinfo
<clever> hyphon81: i have also looked into using ipfs as a binary cache, and the issue is how do you map /nix/store/jl72gxms9rg3czv3wj1rskw6n0h3k6gm-hello-2.10 to an IPFS hash?
<clever> hyphon81: you cant just forward the nixos.org signature and proove it is un-modified
<clever> hyphon81: one issue right now with running binary caches, is that they have to re-sign the data, and then users need to trust your keypair
<clever> Svarog: or use nix-store --delete to get rid of something, then copy --from it again
<clever> Svarog: try finding something you dont have yet
<clever> yeah, now try using nix-copy-closure --from nix-ssh@server -sign /nix/store/something
<clever> Svarog: it sounds like those 2 keys are working
<clever> Svarog: ok, now try ssh nix-ssh@server "nix-store --serve"
<clever> hyphon81: what else do you want to do with it?
<clever> nice
<clever> and then look at the error
<clever> ssh nix-ssh@server
<clever> you can test 2 of the keys by just trying to ssh into the box
<clever> and all parties need to trust the public of the other party
<clever> and for the sshServe case, the server has 2 keys, and the client has 1 key
<clever> you will either have 1 (nix-serve over http), 2 (nix-serve over https), or 3 (sshServe over sshd)
<clever> nope
<clever> one for the https, and one for the pre-signed data on-disk, that it serves
<clever> https://cache.nixos.org is an example of that, the server has 2 keypairs
<clever> but nix-serve behind an nginx reverse-proxy with https:// may add another keypair into the mix
<clever> nix-serve just skips the 1st and 2nd pair, and runs purely on the 3rd pair alone
<clever> the 3rd keypair, is the nix signing keys, the secret must go into nix.extraOptions, secret-key-files on the server, and the public must go into binary-cache-public-keys on the client
<clever> the 2nd keypair to come into play, is the ssh auth keys (from ssh-keygen, and ~/.ssh/id_rsa), the public must go into nix.sshServe.keys to let you login on sshd
<clever> the first key to come into play, is the ssh server pair, the public lands in ~/.ssh/known-hosts and this pair prevents mitm (so you dont connect to a fake server)
<clever> there are 3 different keypairs at play here
<clever> that is what my last gist does
<clever> the client also needs some nix PUBLIC keys, to trust what is signed
<clever> nix.sshServe.keys is the SSH PUBLIC to let them to get in
<clever> nix.extraConfig = '' secret something''; is the private keys
<clever> oh wait no
<clever> you also need to configure the PUBLIC key on the client
<clever> nix.sshServe.keys is for the PRIVATE key on the server
<clever> Svarog: 2 different ways of doing it: https://gist.github.com/cleverca22/3a5cbf36d23070c046091ed40125478d
<clever> you also need to trust the public half of the key in nix.conf
<clever> only root and other trusted users can import unsigned things
<clever> that implies signing isnt working
<clever> that user had mis-spelled the option, check the next message
<clever> i think thats unrelated
<clever> i think you can use NIX_OTHER_STORES to set it up
<clever> "echo /nix/store/*{thunderbird,gcc,ghc}*/"
<clever> Svarog: either configure it to use sshServe as a binary cache, or copy/paste the list from "echo /nix/store/*/" into the nix-copy-closure commandline
<clever> Svarog: yeah, if you copy package a, and it depends on b, both a&b will get copied
<clever> Svarog: i think its NIX_OTHER_STORES
<clever> joko: you may also need to increase the body size in nginx
<clever> Svarog: and if you configure nix correctly, it will copy things on-demand
<clever> Svarog: any built derivation or .drv file, and it will get the entire closure automatically
<clever> joko: is there a reverse proxy in the mix?
<clever> thats all it does
<clever> if you try to download a .nar.bz2, it will literally just pipe "nix-store --dump $foo | bzip2" out the http port
<clever> it can also help to just look at the nix-serve source: https://github.com/edolstra/nix-serve/blob/master/nix-serve.psgi
<clever> correct
<clever> with the user set right
<clever> so you can just try a copy --from
<clever> and nix-copy-closure already uses that exact command
<clever> adding attributes like .env wont have any impact on nix-build
<clever> nix-repl> hello.type
<clever> "derivation"
<clever> a derivation is just an attrset with a special type flag
<clever> steveeJ: does that help?
<clever> let foo = stdenv.mkDerivation { ... }; bar = stdenv.mkDerivation { something = foo.drvPath; } in foo // { env = bar; }
<clever> you may need to // it on afterwards
<clever> steveeJ: it will need to be passthru it not affect the hash of its parent, but it may still trigger recusion, not sure
<clever> steveeJ: it might be possible to set passthru.env = stdenv.mkDerivation { something = parent_deriv.drvPath; };
<clever> what are you thinking of?
<clever> i dont think it is
<clever> Isorkin: you probably dont need the new nix, that was stuff for sphalerite
<clever> but if you use the new nix globally, it will keep working
<clever> sphalerite: its less that it breaks the db, and more that it may be too new to be compatible with the old nix
<clever> sphalerite: you could also just nix.package = pkgs.nixUnstable in configuration.nix
<clever> yeah, a vm is also an option
<clever> sphalerite: if you dont gc after the backup, then restoring will just cause nix to delete anything made after the backup
<clever> sphalerite: one option, you can just make a backup copy of /nix/var/nix/db/db.sqlite
<clever> Isorkin: try just using php = mypkgs.php56-libressl.php56; first
<clever> Isorkin: that may explain why the files you gave me dont make sense with the data you gave me
<clever> Isorkin: i see you also have 2 different php56 files, pkgs/development/php/default_php56.nix and pkgs/development/php56/default.nix
<clever> Isorkin: you probably need this in services.nix: php = mypkgs.php56-libressl.php56;
<clever> Isorkin: yeah, i think i see the problem
<clever> Isorkin: ok, and what if you run "nix-repl mypkgs/default.nix" then type in php56-libressl, what does it return?
<clever> johnramsden: i cant see anything obviously wrong, so lets try just appending :${xorg.libxkbfile.out}/lib/ to the rpath
<clever> johnramsden: what if you run ldd on the file after it has been patched?
<clever> Isorkin: and also, what is the contents of pkgs/development/php/default_php56.nix?
<clever> Isorkin: what if you try to nix-build -A php56-libressl mypkgs/default.nix
<clever> Isorkin: it may help to common out things in the systemPackages list and try "nixos-rebuild dry-run" and try to narrow down which one is the cause
<clever> Isorkin: something you added to systemPackages is a set
<clever> Svarog: i had to dig thru the nix source for that
<clever> Svarog: you will need this entry on the server to allow it to sign things, i believe
<clever> nix.extraOptions = "secret-key-files = /etc/nix/signing.sec";
<clever> Svarog: nix-daemon has its own config for that
<clever> Svarog: sshServe wont use that key, so it wont help
<clever> Svarog: setting sshServe.enable to true is identical to pasting lines 29-48 into configuration.nix
<clever> Svarog: then scroll down to the config = { region
<clever> Svarog: something that can help a lot, click the enable option here, then the file its declared in: https://nixos.org/nixos/options.html#sshserve
<clever> Svarog: yeah, you can just turn nix-serve off in the configuration.nix
<clever> Isorkin: the nixos module only allows a single php-fpm package, so you would need to make your own service to run the 2nd php-fpm on a different port/unix socket
<clever> Svarog: so its just a more locked down user, that allows things like nix-copy-closure and remote nix builds
<clever> Svarog: sshServe just configures an ssh user to only allow somebody to run nix-store --serve
<clever> that makes it harder to find mistakes
<clever> you also dont need ... in the arguments of a package
<clever> johnramsden: you should generaly also remove the pkgs. on lines 20-36, and add them to the arguments
<clever> for every value you use, you must receive that as an argument, or create it somewhere nearby
<clever> johnramsden: if you put ${bash} into an expression, you need to add bash to the arguments on line 1

2017-04-21

<clever> infinisil: it would be interesting to check the journal, was it checking random users, or users from your config?
<clever> infinisil: it could have also just been fully automatic
<clever> heh
<clever> schoppenhauer: if your using stdenv.mkDerivation, it will happen automaticaly
<clever> yeah
<clever> schoppenhauer: and if you let the fixupPhase run, it will trim extras that dont belong automatically
<clever> gchristensen: same reply the bot gave a month ago
<clever> nstead of builtins.lessThan x y. The comparison operators also work on strings.’.
<clever> gchristensen: 2017-01-03 10:33:05< kmicu> gchristensen: ah, that chapter is not updated since 1.6 with ‘Nix now has proper integer arithmetic operators. For instance, you can write x + y instead of builtins.add x y, or x < y i
<clever> MichaelRaskin: yeah, it would need to also run the built-in tests, if they exist
<clever> MichaelRaskin: it at least makes it easy to use any haskell package on hackage, without having to package half a dozen deps every week
<clever> bennofs: nix-env -iA nixpkgs.haskellPackages.acme-cutegirl, lol
<clever> bennofs: does nixpkgs have EVERY single package from a central repo auto-packaged?
<clever> i havent touched that heap in years
<clever> bennofs: that reminds me, mirc had an option to manualy set a color on a user
<clever> MichaelRaskin: http://i.imgur.com/8XqNP4d.png
<clever> MichaelRaskin: mine is a different color, and other people light up in yellow if they say my name
<clever> i dont even have colored nicks!
<clever> bennofs: https://github.com/taktoa/hsdm is the haskell project
<clever> and the lightdm test being marked non-critical is a 2 year old change
<clever> yep, 1488
<clever> bennofs: i believe the logind pam module is making it all work
<clever> and i am session#1, not session#1488, lol
<clever> bennofs: if i boot up a netboot with slim and login, without starting anything funny (ssh sessions), loginctl lists a single session at seat0
<clever> gotta haskell all the things? lol
<clever> bennofs: a few months ago, i was working on a haskell based display manager
<clever> bennofs: i see 2 sessions, one at seat0, the other not listed
<clever> somebody commented out lightdm...
<clever> only these tests can block a channel update
<clever> IITaudio_: also not in the list of critical tests
<clever> bennofs: it appears to not be a critical test: http://hydra.nixos.org/job/nixos/release-17.03/tested#tabs-constituents
<clever> bennofs: how is the channel even updating?
<clever> bennofs: !!! the gdm test has never passed on the 17.03 channel http://hydra.nixos.org/job/nixos/release-17.03/nixos.tests.gnome3-gdm.x86_64-linux/all
<clever> bennofs: there is also a dedicated gdm test
<clever> hmmm, there is a testcase for gdm
<clever> that would help
<clever> a bigger question though, is how this got thru testing
<clever> and gdm wont even start, possibly unrelated
<clever> bennofs: the commit message says its fixing sddm, and sddm does work
<clever> bennofs: your previous tip to use lightdm would not have worked
<clever> bennofs: ok, so both lightdm and slim are broken on this commit!
<clever> ah
<clever> LnL: i turned auto-gc on and set it to keep 5gig free on some servers, and 20gig on my desktop
<clever> IITaudio_: yeah, ive even used build-vm on a gentoo machine before
<clever> so you need to make your own wrapped python, that fixes every dynamic library the python code is using
<clever> obadz: but the library cant control which python wrapper you use
<clever> obadz: so you need to patchelf or LD_LIBRARY_PATH wrap the python binary
<clever> obadz: that tends to happen with a lot of python stuff, you cant patchelf the rpath of wxcairo.py
<clever> IITaudio_: i'm going all of the DM's a spin in build-vm, to see what else was broken
<clever> obadz: would need to nix-store -qR each output of bash i think
<clever> its not just i3
<clever> oh, interesting, slim + xterm is also broken
<clever> LnL: i think part of the issue though, is that allowedRequisites has no way to allow foo.out but ban foo.dev
<clever> bennofs: but that sddm commit breaks i3 + slim: https://github.com/NixOS/nixpkgs/commit/6b7c5ba5353e2a81255879173de758fc5f08be62
<clever> bennofs: ive been using it since the day i started using nixos, and it has never been broken
<clever> IITaudio_: switching to sddm is one way to fix things
<clever> IITaudio_: yeah, that commit DOES fix sddm!, and it breaks slim
<clever> IITaudio_: and bisect confirms that commit, trying something...
<clever> IITaudio_: oh!, i see a display-manager change right in the middle of the area git bisect cant test!
<clever> infinisil: i have memorized an abnormal amount of the source, lol
<clever> IITaudio_: there is a nixos manual breakage right in the middle of this bisect, and its slowing things down a lot
<clever> bennofs: ah, that works as well then
<clever> bennofs: looks like most of the tmp paths are all pointed at $NIX_BUILD_TOP
<clever> bennofs: yeah, and it will then unpack the tar inside $NIX_BUILD_TOP, creating a 2nd dir, named after the root dir of the tar
<clever> bennofs: the current dir will usualy be a sub-dir of $NIX_BUILD_TOP, named similiarly to the package, and private to that instance of the build
<clever> bennofs: id just make it in the current directory
<clever> infinisil: i think they tested it without hydra, so its just impurely fetching things
<clever> PR time then
<clever> dang!
<clever> Zer000: you need to either list the thing your fetching as a hydra input and route it in right, or use pkgs.fetchurl and give it a hash
<clever> Zer000: fetchurl isnt pure, and hydra forces everything to be pure
<clever> and the antenna was picky enough that i could tilt the screen and see the wifi signal change
<clever> the wifi signal updated fast enough that i could use it to find a router
<clever> it did weird things, like a custom PID loop to manage the cpu fan speed, and high update rate wifi signal level graphs
<clever> i need to look into packaging that old util i made for the asus eeepc, and see how it looks under nixos
<clever> :)
<clever> lol
<clever> IITaudio_: down to 16 commits, 4 steps
<clever> then the up/down would just be plain files in the same dir
<clever> infinisil: oh, and for the inner script ran as root, the runCommand can be simpler, just cp ${./bright-up} $out/bin/bright-up
<clever> infinisil: this is a single derivation, that makes 3 different scripts in the same bin dir
<clever> infinisil: an example: https://pastebin.com/uPeh19d6
<clever> infinisil: runCommand could be used to optimize it more
<clever> IITaudio_: got distracted waiting for the nix-build, 7 steps left, covering 133 commits
<clever> infinisil: script2 is in the global path, and all it does is run script1 as root via sudo, so script1 has root and doesnt need anything special
<clever> infinisil: check back in this example: https://gist.github.com/cleverca22/067caef678a22792e24894ca5fd1ae84
<clever> MichaelRaskin: yeah, for tee its stdin, i was thinking about the echo case
<clever> infinisil: but then you try to use sudo again inside brightness-up, and you have nothing to force it to be ran with sudo
<clever> infinisil: you have sudoers configured to allow running brightness-up as root without a password
<clever> infinisil: oh, i see part of your confusion
<clever> ah, that could work though
<clever> MichaelRaskin: ah, but he wants to raise and lower the brightness, so now he needs ~10 entries
<clever> infinisil: so your back to needing 2 scripts like in my original example
<clever> infinisil: at which point, an attacker can write to any file in the system
<clever> infinisil: which is why i mentioned this a while back: sudo "echo foo > /sys/bar"
<clever> IITaudio_: cleverca22@gmail.com
<clever> infinisil: i get a bit OCD about knowing how things work, so i just devoured all of the source in nixpkgs and nix
<clever> lol
<clever> i have paypal and bitcoin if you want
<clever> it wont say why nixo works, but it will probably say why the rest are broken
<clever> which does break on the demo user
<clever> with one of my basic configs
<clever> IITaudio_: and now i'm just re-doing build-vm for each commit it picks
<clever> IITaudio_: https://pastebin.com/pD8Sa5xS i flagged the bad one as bad, then just went back 1000 commits, it worked, so i hit good
<clever> and theres a bit too much to just go over it all, so i'll give the bisect some more attention
<clever> probably should just "grep -r import" the whole thing, i found another instance in notmuch
<clever> and overrides from aother user may take effect in weird places
<clever> so overrides you apply may not work fully
<clever> but everything else will obey nixpkgs.config within configuration.nix
<clever> IITaudio_: another side effect of the way you did it, i3tmp.nix will obey /root/.nixpkgs/config.nix
<clever> that will reuse the existing nixpkgs and make it build much faster
<clever> IITaudio_: what you want to do is put { rxvt_unicode, xfce, xdotool }: into i3tmp.nix, and then do pkgs.callPackage ./nixopts/configs/i3tmp.nix {}
<clever> IITaudio_: i think your loading 8 extra copies of <nixpkgs> here
<clever> IITaudio_: ah, found something that will likely ruin your performance
<clever> after i went nuts and read the entire nixos option list, lol
<clever> it was added in oct of last year
<clever> oh neat, didnt know there was an option to enable adb
<clever> IITaudio_: which username works and which doesnt?
<clever> ah, now i can see files
<clever> IITaudio_: either i dont know how to use gitlab, or there are 0 files in that
<clever> IITaudio_: can you gist your entire configuration.nix?
<clever> IITaudio_: ./result/bin/run-nixos-vm
<clever> IITaudio_: oh yeah, i can just bisect nixpkgs again
<clever> IITaudio_: so the odd thing isnt the broken user, its the working user, why does he still work
<clever> IITaudio_: i was able to reproduce the problem on this end with https://gist.github.com/cleverca22/2343377ab37107f3154a7432418c3d26
<clever> infinisil: and you might as well just allow a shell at that point
<clever> infinisil: but if you use sudo "echo foo > /sys", you need to allow echo without a password
<clever> writeScriptBin will put it in bin/ so you can install the "package", while writeScript will just put the script bare in /nix/store, so its easyer to reference from other scripts
<clever> same
<clever> just need a "$*" in script2, to pass the arguments onward, forgot that
<clever> and script1 does the actual brightness stuff
<clever> script2 will always call script1 via sudo, and script2 is installed globally
<clever> solved!
<clever> oh, but then you need the absolute path, ick, one sec
<clever> infinisil: this will put a copy of the script into /nix/store, and then paste its path into the sudoers file
<clever> its a bit more complex, but meets rules you have previously mentioned
<clever> ah, let me gist an example
<clever> the script has to be ran with sudo
<clever> it will probably need to be the path to a script, not a "file"
<clever> infinisil: https://nixos.org/nixos/options.html#security.sudo.extra
<clever> infinisil: this allows the ds9 user to run 2 things without a password
<clever> ds9 ALL=(root) NOPASSWD: /root/reload_lighty , /root/ubc
<clever> infinisil: i have similiar on one of my servers
<clever> ah
<clever> infinisil: ive done a few things with it, what are you thinking of?
<clever> ah, but http://howoldis.herokuapp.com/ helps fill it in
<clever> 4 is too short to be unique
<clever> need another digit from the end
<clever> nixo_: what does this return?
<clever> nix-instantiate --eval -E "with import <nixpkgs> {}; lib.nixpkgsVersion"
<clever> nixo_: and check both users for .xprofile or .xsession
<clever> nixo_: try grepping for i3
<clever> nixo_: which user has the problem?
<clever> nixo_: what about comparing the output of "nix-env -q" under each user?
<clever> nixo_: what about files like .xsession and .xprofile?
<clever> elasticdog: yeah, the path for that config.nix has been changed to ~/.config/nixpkgs/config.nix
<clever> elasticdog: what about the contents of ~/.nixpkgs/config.nix or ~/.config/nixpkgs/config.nix?
<clever> elasticdog: strange, and you have the identical default.nix to the gist i linked?, no shell.nix in the same dir?
<clever> elasticdog: what does this output? nix-instantiate --eval -E "with import <nixpkgs> {}; lib.nixpkgsVersion"
<clever> it still evals the nix, so it must be the channel your on
<clever> elasticdog: with this change, i can force my system to build a mac version of everything
<clever> with import <nixpkgs> { system = "x86_64-darwin"; }; {
<clever> elasticdog: ah, one sec
<clever> elasticdog: and if i download the default.nix in the gist, and run nix-shell on it, it does begin downloading things
<clever> elasticdog: it should just work with the value in the gist
<clever> nixo_: cant see anything wrong with that, i would expect it to just work
<clever> elasticdog: you would need a different file if you wanted to use it as an overlay, depend on what your doing, and i also just noticed, you have stdenv in the buildInputs, but thats not required
<clever> nixo_: how are you enabling i3?, would you be able to switch to another wm for testing?
<clever> elasticdog: one thing thats probably wrong, your re-importing a 2nd nixpkgs, which just ruins the whole point of overlays
<clever> elasticdog: you also need to wrap the whole thing with ( and ) if your putting it in a list
<clever> this mixes public and private known-hosts entries, and adds in a password hash
<clever> infinisil: you can also put "secrets = import ./secrets.nix;" into the let block near the top, and then just have an attrset of more private things
<clever> infinisil: yeah, i see even less of an issue with domains that are easily found anyways
<clever> elasticdog: ansible.override { windowsSupport = true; }
<clever> so it now affects all users
<clever> infinisil: if you set this option, the pubkeys land in /etc/ssh/ssh_known_hosts
<clever> infinisil: a: i dont see any problem, b: nixos has its own way of handling that, https://nixos.org/nixos/options.html#programs.ssh.kn
<clever> so ./. doesnt find it
<clever> thats why i try to always put the build directory at ../build-foo/