2019-02-06

<clever> that only gives you /bin/sh
<clever> it will still use build users, but it wont be putting them into dedicated containers
<clever> that will fix everything
<clever> suzu: sandbox = false
<clever> so basically, the nix sandbox cant work, if nix was not built with nix
<clever> suzu: and the sandbox is keeping those dirty arch binaries out of sight :P
<clever> suzu: because nix itself was not built with nix, its pointing to the arch binaries
<clever> suzu: normally, mkdir and friends, come from /nix/store/, via a config.nix file
<clever> suzu: oh, i think i know whats wrong
<clever> yeah, space seperated
<clever> i think so
<clever> suzu: try adding /usr/bin/bash=/nix/store/vs6d2fjkl4kb3jb7rwibsd76k9v2n4xy-bash-4.4-p23/bin/bash
<clever> that is how it normally works on nixos
<clever> suzu: and then /bin/sh=/nix/store/vs6d2fjkl4kb3jb7rwibsd76k9v2n4xy-bash-4.4-p23/bin/sh in the config file
<clever> suzu: try `nix-store -r /nix/store/vs6d2fjkl4kb3jb7rwibsd76k9v2n4xy-bash-4.4-p23`
<clever> > "${bash}"
<clever> ah
<clever> suzu: does `nix-build '<nixpkgs>' -A bash` work?
<clever> it only fails when building things, but bash is in the binary cache
<clever> nix-build '<nixpkgs>' -A bash
<clever> suzu: you must set /bin/sh to the nix version of sh, not the arch sh
<clever> suzu: what does `nix-channel --list` say?
<clever> the mozilla overlay has it
<clever> attente[m]: rust is also already in nixpkgs
<clever> attente[m]: all binaries must be installed using nix
<clever> attente[m]: anything that downloads pre-built ELF files will fail hard on nixos, because /lib doesnt exist
<clever> bbarker: there is a function called isELF in the stdenv
<clever> bbarker: throw in an `set -x` and it will show every cmd as it runs it
<clever> attente[m]: you need to patchelf the file, so you want to write a nix expression for that, which has "${gcc.cc.lib}/lib" in it somewhere
<clever> bbarker: add an `echo $exfi` and youll see the problem
<clever> bbarker: line 23, your for loop isnt looping over files
<clever> attente[m]: gcc is in the env by default, so just `nix-shell -p` will give it to you
<clever> "/nix/store/sf0wnp30savqz9ljn6fsrn8f63w5v0za-gcc-7.4.0-lib/lib"
<clever> [root@amd-nixos:~]$ nix-instantiate --eval -E 'with import <nixpkgs> {}; "${gcc.cc.lib}/lib"'
<clever> ,libraries attente[m]
<clever> bbarker: can you pastebin the entire nix file?
<clever> attente[m]: ^^^
<clever> > "${gcc.cc.lib}/lib"
<clever> bbarker: what does it output if you just run `cat $NIX_CC/nix-support/dynamic-linker` in the installPhase?
<clever> bbarker: and are you running that before or after the file gets copied to $out, and what is $exfi?
<clever> bbarker: and you are not telling it what file to edit
<clever> bbarker: you are telling it to set the interpreter to "exec $(cat $NIX_CC/nix-support/dynamic-linker) $exfi $@"
<clever> bbarker: and the " is too far at the end
<clever> bbarker: the exec shouldnt be in there
<clever> so you pre-build the entire thing, and deploy it to the box
<clever> kisik21: or just go ham, and control the box with nixops
<clever> kisik21: you can also use nix-copy-closure to just copy something you already have to another machine
<clever> kisik21: 3/1 split, 3gig to userland, 1gig to kernel
<clever> kisik21: but its imposible to get >3gig of ram in a single process on 32bit
<clever> kisik21: years ago, i found myself unable to build firefox on 32bit gentoo, because it needed >3gig of memory to link the main binary
<clever> joko: i think hydra will get very upset, and not rebuild things it thinks are already built
<clever> one of the fields was 2^64, but jq stores everything as floats
<clever> dckc: i recently corrupted a yaml file, by doing yaml2json | jq | json2yaml
<clever> dckc: :D
<clever> dckc: you can also make default.nix do foo = callPackage ./foo.nix {};, and then foo.nix is the real package
<clever> with import <nixpkgs> {}; is a way to cheat around having to load it with callPackage
<clever> ,callPackage dckc
<clever> dckc: if you are making a simple trac module (like the snmpd.nix in the above gist) then youll know what it relies on the host to provide (users, dirs, and such)
<clever> dckc: i dont see any existing modules for trac or rstudio
<clever> then you just need to deal with getting the users and dirs to exist, since users.users wont do it
<clever> this will just spit out systemd .service files, for any nixos service
<clever> srhb: one sec
<clever> dckc: nixos-container needs root, and assumes its being used on nixos
<clever> dckc: su, ssh root@localhost, installing sudo
<clever> joko: https://github.com/input-output-hk/iohk-ops/pull/352 this PR has the required changes, and the PR description explains things
<clever> joko: one sec
<clever> sicklorkin: basement/memory have the versions changed, and then 3 packages are loaded from cabal files
<clever> sicklorkin: this defines an override, so haskell.packages.ghc861 is a modified set of packages
<clever> sicklorkin: let me find an example...
<clever> sicklorkin: youll want to make an overlay using something like callCabal2nix
<clever> sicklorkin: what are you trying to build?
<clever> oh, lol
<clever> sicklorkin: ivolve?
<clever> sicklorkin: the only way to get coverage from the cache, is to change the minimal subset you need, and to stay as close to nixpkgs as you can
<clever> sicklorkin: when using stack2nix or nix-tools, your overriding the version of every single package, so hydra.nixos.org wont have things covered anymore
<clever> sicklorkin: it needs versions built by nix, but stackage isnt building with nix
<clever> sicklorkin: https://github.com/input-output-hk/nix-tools is the newer stuff
<clever> sicklorkin: stack2nix or nix-tools
<clever> sicklorkin: i think stackage2nix is just for converting an entire stackage snapshot, and has nothing to do with stack.yaml
<clever> infinee: first thing i always do is set the background color to black
<clever> infinee_: nix allows things to be downloaded, but not "installed"
<clever> infinee_: nix-shell sets env vars to put make into PATH
<clever> infinee_: `nix-shell -p`
<clever> though that might only be on a branch
<clever> i think `nix search` also does parallel evaluation
<clever> nixpkgs.sudo
<clever> it must be setuid root to function, and /nix/store/ doesnt support the setuid bit
<clever> dckc: the sudo made by nix-env cant be used, ever
<clever> dckc: normally, .bashrc for root will change $NIX_PROFILE to change things
<clever> $ nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.version'
<clever> ]$ nix-instantiate '<nixpkgs>' -A lib.version --eval
<clever> "19.03pre166449.be445a9074f"
<clever> "19.03pre166449.be445a9074f"
<clever> $ nix eval nixpkgs.lib.version
<clever> yayforj: there should be an error above that line
<clever> pbb: sed or a .patch file
<clever> 2017-08-05 19:19:40< sphalerite> clever: http://ix.io/yUT is the expression, it contains the url for the source. It's also on github at https://github.com/oilshell/oil
<clever> gchristensen: oh, it was sphalerite i was helping with oil!
<clever> so the error was defered, and not obvious
<clever> but, it was concat'ing the zip onto the binary, and unpacking at runtime
<clever> and everything is length prefixed, so that made the zip invalid
<clever> and they accidentally patched a .zip
<clever> i remember them using substituteAll to patch some scripts
<clever> gchristensen: i think i helped somebody package oil in here...
<clever> jluttine: set dontUseCmakeConfigure = true;
<clever> nixpkgs/pkgs/development/tools/build-managers/cmake/setup-hook.sh
<clever> if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then
<clever> jluttine: one min...
<clever> i think it still does
<clever> but i almost never boot into windows (maybe once a month or less)
<clever> infinee_: my primary desktop dual-boots nixos and win7
<clever> infinee_: if your booted into the final install, then its nixos-rebuild
<clever> infinee_: oh, if its booted into the real install, then its already imported and mounted
<clever> infinee_: you can just `zpool import tank` and then re-mount everything to the old spot, edit the config, and re-run nixos-install
<clever> infinee_: try adding the grub removable flag, boot.loader.grub.efiInstallAsRemovable = true;
<clever> not sure what could cause that, would need some strace or set -x
<clever> ottidmes: npm will manage a combined node_modules/.bin for you
<clever> ottidmes: if you add the .bin to PATH, then it should patch correctly
<clever> infinee_: boot.loader.grub.efiSupport is the main thing you want to set for efi
<clever> infinee_: efiSysMountPoint does not appear in either of those pages, and should not be used with /boot/ is the ESP partition
<clever> infinee_: `systemctl start sshd` and `passwd`, then you can ssh into it from another machine with a working GUI
<clever> infinee_: you should only set that if /boot/ itself is ext4, and /boot/efi is vfat
<clever> infinee_: boot.loader.grub.efiSysMountPoint = "/boot/efi"; means that you mounted the ESP partition to /boot/efi/
<clever> ottidmes: is gulp itself in PATH, when you ran patchShebangs?
<clever> infinee_: can you pastebin the whole mount output?
<clever> infinee_: there is a /etc/ missing in that string
<clever> infinee_: what does `mount` output?
<clever> infinee_: the installation should never remove /mnt/etc/nixos/
<clever> ottidmes: ah, that should do it
<clever> ottidmes: you might want to look at how yarn2nix is doing the download, i believe its entirely pkgs.fetchurl calls, so no scripts can run at that time
<clever> if its running scripts at that phase, then its both a security problem, and a purity problem that can break the hash at any time
<clever> s/bash//
<clever> its running the bash script inside the fixed-output derivation?
<clever> patchPhase? postUnpack? replace the tar with a patched tar before nix gets it?
<clever> why is it not possible?
<clever> so your only choice is to patchshebangs, before the script gets ran
<clever> and i think /usr/bin/ is read-only from within the sandbox
<clever> ottidmes: oh, yeah, hydra, and all end-users, would fail to build it, without that change
<clever> in your case, you would want something like /usr/bin/env=${pkgs.coreutils}/bin/env
<clever> ottidmes: using this option in nix.conf, you can impurely add things into the sandbox
<clever> extra-sandbox-paths = /run/binfmt /nix/store/7kvi4xfjp8i4ds611pknr9wdhqsmn20d-qemu-user-arm-2.11.1 /nix/store/y2vfnilcy8qxh6nfxcq44bym4m15arfc-qemu-user-aarch64-2.11.1 /etc/nsswitch.conf /etc/protocols
<clever> dang!
<clever> the only real addition it needed was wine
<clever> ottidmes: on this branch, its able to do the entire windows frontend for electron
<clever> ottidmes: ive got a large example here, that i recently added win64 builds to
<clever> ottidmes: ah, yeah, yarn2nix involves IFD, but i have seen signs that it can work without IFD as well
<clever> ottidmes: yarn2nix should be able to patch the things in node_modules before running the scripts
<clever> ottidmes: have you looked into yarn2nix?
<clever> ottidmes: that will replace every /usr/bin/env foo, with $(which foo)
<clever> ottidmes: you have to run patchShebangs over the script (or the scripts dir)
<clever> ivegotasthma: some services may run into problems, such as hard-coded /run/current-system, or assuming users.users actually made a user, but youll just need to find such things and fix them as they occur
<clever> and that will allow running nixos services no non-nixos
<clever> srhb: if you buildEnv several .service files together, you could then "install" them on any machine, and point systemd towards that dir
<clever> srhb: https://gist.github.com/cleverca22/2c187ff4f21c1f0313b1ea690c5e2717 this shows how to access the generated .service file, for any given nixos service
<clever> srhb: one minnnn
<clever> srhb: its configured to never build on hydra
<clever> > haskellPackages.mdcat.meta.hydraPlatforms
<clever> systemd-boot basically has no config
<clever> i prefer grub, since it has far more options
<clever> infinee: yep
<clever> infinee: nixos_boot would be sda3
<clever> infinee: cfg.poolName is just the name for the pool, i try to keep it matching the hostname
<clever> infinee: nixos_boot would be something like /dev/sda1, but it should be the ESP you created with parted
<clever> hyper_ch2: not much
<clever> l
<clever> after that, its mostly a normal nixos instal
<clever> and then 99-104 mounts all of the things
<clever> 94 creates the zfs pool, and 95-97 setup what will be / /home and /nix
<clever> 93 will format the swap
<clever> infinee: line 92 will format /boot as either vfat or ext4, depending on cfg.uefi (you want vfat)
<clever> infinee: yep
<clever> hyper_ch2: hello
<clever> (disk encryption)
<clever> oh, do you want any luks?
<clever> infinee: and then give the rest of the disk to the zfs partition
<clever> infinee: optionally add some swap (swap on zfs has performance/stability issues)
<clever> infinee: then you will need to create a GPT partition table, with an ESP partition formatted fat32, for /boot/
<clever> infinee: to start with, do you want to boot with efi or legacy?
<clever> srhb: heh, i still had that tab open!
<clever> srhb: i had a derivation that would generate tcpdump captures of every node, along with log files, for the whole test run
<clever> so you can download logs from a failing test
<clever> but, its in the binary cache, hydra-build-products still work
<clever> hydra will then still treat it as a failure
<clever> it will write the real exit code to $out/nix-support/failed
<clever> this makes the nix-level build "succed" even on failure
<clever> succeedOnFailure = true;
<clever> srhb: there is also the flag to make the build "pass" upon failure
<clever> srhb: its also usefull for fetching whatever somebody is using when they have an error, and comparing their version against yours
<clever> infinee: that bash script will wipe the disk, and then setup a zfs pool, optionally inside luks
<clever> srhb: i read what the upgrade did, and then manually downgraded
<clever> infinee: one sec
<clever> and suddenly, my nix is too old to open db.sqlite
<clever> srhb: the problems came up, when i was done, and returned back to nixStable from nixpkgs
<clever> srhb: so i used lynx to open hydra, and accidentally wound up with a build of nix master
<clever> srhb: i once had to do the nix-store -r hack from a gentoo machine that had no X
<clever> in the past, i have manually done nix-store -r, and then jammed it into PATH and set a magic var
<clever> srhb: the modern nixos-rebuild will download a pre-built nix from the binary cache, to deal with that

2019-02-05

<clever> spacekitteh[m]: `strace -f -e execve ...` will show the exact commands being ran
<clever> pie_: i had to wait for chrome to load, so i could link the exact line :P
<clever> pie_: i memorized the source....
<clever> spacekitteh[m]: --arg myparam will only work if shell.nix starts with { myparam }: or { myparam ? def }:
<clever> pie_: so it grabs a hard-coded nix build directly from the binary cache, bypassing all nix expressions
<clever> pie_: if that fails for any reson, it thinks your old nix is too old
<clever> pie_: nixos-rebuild will first try to build -A nix, to get the new nix from your (new) nixpkgs
<clever> pie_: one min
<clever> pie_: nix itself?
<clever> pie_: what path is at the end of the list you truncated?
<clever> pie_: so you can have a totally broken nix.nixPath, and it will work, once
<clever> pie_: changes to nix.nixPath dont take effect until afetr the build has finished
<clever> jonreeve: that will at least narrow down which one is broken, and needs more attention on it
<clever> jonreeve: try commenting one out, and see if `nixos-rebuild build` passes or fails
<clever> jonreeve: do you have anything python based in your systemPackages?
<clever> jonreeve: you need to edit your configuration.nix, to not put 2 msgpack's into the python env
<clever> jonreeve: it looks like you have 2 different variants of msgpack in that python env
<clever> jonreeve: something you put into systemPackages
<clever> jonreeve: you have conflicting files in a python thing your installing
<clever> builder for '/nix/store/4y42l6irgbdszk6npn1a9mz5hr34l7jw-python3-3.7.2-env.drv' failed with exit code 25
<clever> collision between `/nix/store/bfw27ldvy66v6mhwkzillzz1ddfz5lwf-python3.7-msgpack-0.5.6/lib/python3.7/site-packages/msgpack/__pycache__/exceptions.cpython-37.pyc' and `/nix/store/9dkp2r0hsr2jkd44qinw6m7fk8lsx2xy-python3.7-msgpack-python-0.5.6/lib/python3.7/site-packages/msgpack/__pycache__/exceptions.cpython-37.pyc'
<clever> pie_: this is also a thing, but i suspect it needs the right things in buildInputs already
<clever> > pkgs.autoPatchelfHook
<clever> mpickering: yep
<clever> but if you just want to target an existing platform, pkgsCross.mingwW64.stdenv.mkDerivation
<clever> so adding a new setup to that, should add it to pkgsCross automatically
<clever> lucus16: its just running mapAttrs over lib.systems.examples
<clever> and that set is configured on line 129 of stage.nix
<clever> > builtins.unsafeGetAttrPos "pkgsCross" pkgs
<clever> lucus16: cross-compile package sets are auto-generated for nearly all platforms (maybe all?) and you can then use that to cross-compile almost any package
<clever> > pkgsCross.mingwW64.hello
<clever> no mouse needed either
<clever> on bootup, plex just runs automatically, and i can play any media stored on any plex server i have permissions on
<clever> that file contains everything you need to turn a nixos box into a media center
<clever> Avaq: another handy thing, for both nixos and nixops, is to split the config up into logical blocks: https://github.com/cleverca22/nixos-configs/blob/master/media-center.nix
<clever> Avaq: yep
<clever> Avaq: it will also remap <nixpkgs> to whatever nixpkgs was last used to deploy
<clever> Avaq: so, nixos-rebuild will fail with a clear error, rather then undoing everything nixops did
<clever> Avaq: but, the above module, will remap <nixos-config> to a file that just throws an error
<clever> digitalgrease: not currently, and i havent seen any plans to add it
<clever> behind the scenes, nixos-rebuild always obeys <nixos-config>, which defaults to /etc/nixos/configuration.nix
<clever> this nixos module can also come in handy
<clever> Avaq: one critical thing when migrating from nixos to nixops, is to ensure you setup fileSystems. and boot. correctly, since it ignores configuration.nix and hardware-configuration.nix
<clever> Avaq: yep
<clever> Avaq: if you missed anything vital, it will behave the same as if you had simply removed that from configurationnix
<clever> Avaq: and setup a new generation, as-if you had done a nixos-rebuild
<clever> Avaq: when you do a `nixops deploy`, it will completely replace the old system, by just copying the new stuff into /nix/store and updating /run/current-system
<clever> gchristensen: this is a nix-env profile, that roots every version i have deployed to my router/nas
<clever> lrwxrwxrwx 1 clever users 45 Feb 1 19:47 /nix/var/nix/profiles/per-user/clever/nixops/ca55b021-87f5-11e8-b6f5-024225fad90e -> ca55b021-87f5-11e8-b6f5-024225fad90e-132-link
<clever> gchristensen: it does, when you turn on rollback
<clever> mpickering: if you ssh in from another box, and run `ps -eH x`, is xmonad running, anything else near it?
<clever> and nixos-rebuild tries to avoid restarting X, because it interupts everything, so you need to `systemctl restart display-manager.service` manually after these kinds of changes
<clever> mpickering: it may also help to set desktopManager.xterm.enable = false;
<clever> mpickering: ah, yeah
<clever> mpickering: window manager is a seperate option from desktop manager
<clever> mpickering: the default desktop manager is xterm, you need to enable another one, and then either select it at the login screen, or disable xterm
<clever> i'm not sure if that has an off switch
<clever> Henson: if nix has root when doing a build, it assumes the nixbld group exists, and has build users within it
<clever> alex_giusi_tiri: if the script is ran during the build, then patchPhase is a good place, if its at runtime, then any phase can work
<clever> alex_giusi_tiri: you can also run it on a directory, and all files in the directory will be patched
<clever> cransom: the same can be said about what nix has done to basically every package in the world
<clever> yayforj: just import that file, and use its result, instead of haskellPackages
<clever> dhess: thats what it looks like to me
<clever> cransom: none, and aws, handle the nixops generated key in different ways
<clever> cransom: it relies on the file that was created on the first boot
<clever> cransom: and line 27 is to deal with the fact that the aws backend of nixops, DOES NOT bake its own key into the nixos config!
<clever> cransom: we have also disabled the files in ~/.ssh/, so authorized keys cant be edited from the user itself
<clever> cransom: only issue, is that it doesnt obey services.openssh.authorizedKeysFiles
<clever> cransom: oh, that can work
<clever> yayforj: yeah, stack2nix replaces the entire haskellPackages set, based on what the stack file said
<clever> cransom: sudo requires a password, and cant accept a forwarded agent
<clever> cransom: sudo
<clever> dhess: so send-keys cant really change things
<clever> dhess: nixops bakes its own public key into the nixos config it builds
<clever> re-keying things
<clever> tilpner: that is a bug that needs to be fixed in nixops
<clever> tilpner: when you have 100 machines that you basically never ssh into, and dont want to re-deploy every time somebody quits and you have to cut them off
<clever> tilpner: thats more about disabling the i686 support
<clever> tilpner: my qemu.nix is currently the only thing that sets it
<clever> tilpner: so that will need to be added back in manually
<clever> tilpner: i suspect the new implementation of extra-platforms disables the automatic addition of i686-linux
<clever> why does nixpkgs. work, yet nixos. not??
<clever> actually, thats even stranger
<clever> $ nix-instantiate --find-file nixos
<clever> /nix/var/nix/profiles/per-user/root/channels/nixos
<clever> $ nix build nixos.hello
<clever> error: attribute 'nixos' in selection path 'nixos.hello' not found
<clever> which is a different name from what nix-env calls it
<clever> so `nix build nixpkgs.hello` will search for <nixpkgs> and build hello
<clever> matthewbauer[m]: anoyingly, `nix` style commands, heavily use NIX_PATH, but in a different way from nix-env
<clever> so a user can ignore what the admin has configured