2017-10-26

<clever> you can even do: nix-instantiate '<nixpkgs>' -A google-chrome --arg config '{ allowUnfree = true; }'
<clever> this will try to load an unfree package, and tell it to not load config.nix
<clever> nix-instantiate '<nixpkgs>' -A google-chrome --arg config '{}'
<clever> the error telling you to set allowunfree also gives that new path
<clever> that one has higher priority, so the old one gets ignored
<clever> yeah
<clever> pie___: what does this output?
<clever> nix-instantiate '<nixpkgs>' -A hello -vvv 2>&1 | grep config.nix
<clever> pie___: it needs to be in .nixpkgs not ,nixpkgs

2017-10-25

<clever> sphalerite: most of the time, the pattern is that simple, but not always
<clever> sphalerite: and is related to this config option
<clever> /usr/src/linux-3.8.13-gentoo/drivers/net/ethernet/intel/e1000e/Makefile:obj-$(CONFIG_E1000E) += e1000e.o
<clever> sphalerite: e1000e is an object, made up of those files
<clever> /usr/src/linux-3.8.13-gentoo/drivers/net/ethernet/intel/e1000e/Makefile:e1000e-objs := 82571.o ich8lan.o 80003es2lan.o \
<clever> c2d ~ # find /usr/src/linux-3.8.13-gentoo/ -name 'Makefile' | xargs grep e1000e
<clever> sphalerite: finding an example
<clever> sphalerite: you need to grep the makefiles
<clever> judson: try switching to a --pure shell, does that make any difference?
<clever> and ive had the fun of reading the source for at least 2 or 3 of my network drivers
<clever> ive also done kernel module dev, so i am familiar with all of the kernel internals
<clever> sphalerite: oh, is there a /proc/config.gz on the stock kernel?
<clever> sphalerite: youll need to review that, and decide what you want to keep
<clever> sphalerite: "ls -l /sys/module/" includes "modules" that have been linked in at compile time
<clever> one sec
<clever> the cpu likely lacks a pci bus
<clever> sphalerite: lsmod?
<clever> sphalerite: does lspci work on the chromebook?
<clever> its mia from the linux nix-shell
<clever> sphalerite: and anoyingly, you need to add curses to a certain env variable for menuconfig to build
<clever> sphalerite: an imperatively made kernel might be better, so you can quickly rebuild after each iteration
<clever> judson: and then point nix-shell at that second file
<clever> judson: you can also make a second nix file, with the contents of the -E string
<clever> sphalerite: the standard way is to just "make menuconfig" and customize it as you feel, but nixos doesnt accept a .config file
<clever> judson: with import <nixpkgs> {};
<clever> judson: replace the function args on line 1 with just
<clever> judson: you can also write your files such that they dont need this
<clever> '
<clever> judson: nix-shell -E 'with import <nixpkgs> {}; callPackage ./default.nix {}
<clever> judson: then you need to load that default.nix with callPackage
<clever> judson: it only accepts a single file
<clever> judson: you cant give it 2 files at once
<clever> judson: you better have 80+ gig of free space, it will take a while to download the universe :P
<clever> judson: that told it to make a shell that has every single package in all of nixpkgs
<clever> judson: what command did you run to cause that error?
<clever> ahstro: you must set the grub device to the root (sda) not the partition (sda1)
<clever> judson: config.nix and env vars also come into play
<clever> and dealing with a list of config sets is a bit tricky
<clever> ghostyyy: but some things like line 623 are hard-coded to expect 0
<clever> ghostyyy: there is a cfg.display to change what display it uses
<clever> at a minimum, one on :0 and one on :1
<clever> you need to modify it to be able to define several, and then allow some differences between the configs
<clever> this is where the display-manager service gets defined
<clever> MichaelRaskin: that has been on my todo list
<clever> MichaelRaskin: i would just patch the xorg modules in nixos to be able to run 2 at once
<clever> gchristensen: and also a declarative hydra project could define /etc as a project input, and get a snapshot of your entire system config
<clever> gchristensen: from what i understand, a "fixed-output" derivation can do whatever network it wants against any machine in the LAN, possibly the private ip of the host
<clever> judson: and what that loads, depends on the contents of that default.nix (and by proxy, the all-packages.nix and nearly every file in nixpkgs)
<clever> judson: nix-env -q will load the default.nix of every channel, and then eval it to get a set
<clever> that could be mbr partitioning or legacy booting
<clever> ahstro: efi vs legacy?, mbr vs gpt?, what rootfs type?, luks?
<clever> ahstro: a few questions that affect the partitioning answer
<clever> other then preferLocalBuild
<clever> normally, nix-daemon helps, but its harder to tell the daemon to not use NIX_BUILD_HOOK
<clever> and the store itself
<clever> that just disables remote builds entirely (but changes the output hash)
<clever> eqyiel[m]: you can also set preferLocalBuild = true; inside the derivation
<clever> and without NIX_REMOTE, it cant cheat by using the local nix-daemon
<clever> eqyiel[m]: without NIX_BUILD_HOOK, it will loose support for remote builders
<clever> eqyiel[m]: if you have root, you can unset both NIX_REMOTE and NIX_BUILD_HOOK when you run nix-build
<clever> joko: so i'm not sure when exactly the corruption is happening
<clever> joko: its mostly blocked by nixos re-mounting /nix/store read-only, so not even root can do it
<clever> joko: python has been pretty bad at corrupting storepaths, you need to run "nix-store --repair-path" on that first
<clever> joko: /run/current-system
<clever> there is also nixUnstable, but its ... unstable right now!
<clever> only master!
<clever> just below the commit msg, is a list of branches that include that commit
<clever> cmcdragonkai: that <nixpkgs> thing may not be in that version, try installing the dummy channel like in my gist
<clever> yeah, that definitely looks like the same bug
<clever> cmcdragonkai: not sure
<clever> cmcdragonkai: this should just directly remove it from the channel
<clever> cmcdragonkai: nix-env -p /nix/var/nix/profiles/per-user/cmcdragonkai/channels -e /nix/store/qf450s7ayjaijqlaqmf6m2wp053ifvas-nixos-17.03-17.03beta320.ade5837
<clever> ah
<clever> let me check the source...
<clever> strange
<clever> what does it do when you give an absolute path?
<clever> ls -ltrh ~/.nix-defexpr/channels/
<clever> cmcdragonkai: the new target lacks nixos-17.09
<clever> cmcdragonkai: the channels symlink was changed, your cd'd into the old target
<clever> cmcdragonkai: your cd's into channels?
<clever> cmcdragonkai: can you screenshot the terminal where you see 17.03?
<clever> cmcdragonkai: and you ran "nix-channel --update" as that user?
<clever> what is ~/.nix-defexpr/channels a symlink to?
<clever> cmcdragonkai: what is the content of ~/.nix-channels for both users?
<clever> cmcdragonkai: which user did you run --update as, and what is inside ~/.nix-channels for that user?
<clever> cmcdragonkai: you must use nix-env to modify it, and you have to give it a storepath (or derivation) to add
<clever> cmcdragonkai: thats a symlink into the nix store, you cant modify it
<clever> cmcdragonkai: removals dont take effect until you nix-channel --update
<clever> cmcdragonkai: i havent played with it that much yet
<clever> cmcdragonkai: so now the channels symlink under root, and the channels_root symlink under all users, will have the dummy channel
<clever> cmcdragonkai: this adds a dummy channel to channels_root, which just imports the nixpkgs in my home folder
<clever> cmcdragonkai: one minute
<clever> cmcdragonkai: i have a solution that will be more seamless, and not involve deleting things
<clever> cmcdragonkai: ah, one sec then
<clever> jluttine: yeah, thats just a bare document-root, you need to point a webserver at it, not install it
<clever> and foo, which is the name of the "channel"
<clever> test, so it doesnt collide with channels or channels_root
<clever> jluttine: look at tha path nix-env downloaded, and run ls on that
<clever> i just made a test and foo subdir, with a default.nix that imports a nixpkgs
<clever> look at the foo/default.nix above
<clever> and the levels past nixos/foo when going up are ignored
<clever> there is no depth limit to the recursive searching
<clever> and this is accessible at nix-env -iA nixos.hello
<clever> [clever@amd-nixos:~]$ ls -lh .nix-defexpr/channels_root/nixos/default.nix
<clever> so the above file, becomes foo, and you can nix-env -iA foo.hello
<clever> cmcdragonkai: it will recursively search until it finds a default.nix, and then use the element above that as a name
<clever> import /home/clever/apps/nixpkgs
<clever> [clever@amd-nixos:~]$ cat .nix-defexpr/test/foo/default.nix
<clever> and yes, nix-env is the only tool that does that
<clever> you have to give it -f '<nixpkgs>' to make it use the NIX_PATH
<clever> cmcdragonkai: it will only search the default expressions in ~/.nix-defexpr/
<clever> cmcdragonkai: always
<clever> cmcdragonkai: nix-env never reads NIX_PATH
<clever> cmcdragonkai: what command did you run?
<clever> cmcdragonkai: ah
<clever> joko: what gave this error?
<clever> 2017-10-25 04:52:02 < joko> cmcdragonkai: I am still getting "error: selector ‘nodePackages.js-beautify’ matches no derivations"
<clever> joko: you must have ran something else with js-beautify in it
<clever> joko: the string from your error does not appear anywhere in that file
<clever> joko: what command did you run, the full args
<clever> might be another service that turned it off, or you missed a 2nd line from the other command
<clever> youll just need to investigate if its a static ip or dhcp, and confirm if you have an automated way to wipe it and start over, and experiment
<clever> then there is a reasonable chance that the kexec stuff might work
<clever> 00000180 47 52 55 42 20 00 47 65 6f 6d 00 48 61 72 64 20 |GRUB .Geom.Hard |
<clever> [root@amd-nixos:~]# hexdump -C /dev/sda | head -n30
<clever> JosW: next thing would be to confirm if grub is in the MBR
<clever> you can just swapoff /swap and rm /swap
<clever> thats a good sign
<clever> JosW: ok, so its not openvz
<clever> it just uses a bit of hdd space as extra swap
<clever> that command is entirely safe
<clever> JosW: then mkswap /swap; swapon /swap, does it work?
<clever> JosW: "dd if=/dev/zero of=/swap bs=1024 count=$((1024*64))" will make a 64mb file
<clever> JosW: there are some tests you can do though to check how real your root is
<clever> JosW: it needs root, and a shared VM wont give you root
<clever> JosW: that directory contains a cpio archive, which contains a squashfs, which contains a full nixos install
<clever> JosW: this one sets up a really simple nginx with 1 file and 1 directory: https://github.com/cleverca22/nixos-configs/blob/master/netboot_server.nix#L23-L56
<clever> man-pages.out 16,137 r /nix/store/29k7dbrrqabkn79isbmi8ibnvs2ysmb6-man-pages-4.09/share/man/man7/tcp.7.gz
<clever> fearlessKim[m]: its in man-pages
<clever> $ nix-locate man7/tcp
<clever> JosW: this one is parts of my router: https://gist.github.com/cleverca22/5fb37427c8d944626a49eff525a91d06
<clever> JosW: that hydra gist does have some nginx in it
<clever> mrkgnao: file
<clever> JosW: some of them
<clever> Li[m]: the .type attribute
<clever> "derivation"
<clever> nix-repl> firefox.type

2017-10-24

<clever> draw the character once with a 2 pixel offset on x&y in black, then draw it again in current-color
<clever> sphalerite: this is how the text with shadows was done: https://github.com/cleverca22/wowmapviewer/blob/master/src/font.cpp#L109-L119
<clever> so just changing the arch broke everything in the build
<clever> and the old wowmapviewer devs had commited things like config.h that where generated by configure
<clever> also, blizzard was constantly breaking wowmapviewer by changing the way map files are formatted
<clever> couldnt figure out the vertex shaders
<clever> i never got the 3d rendering side to work right
<clever> which created the shadow
<clever> each letter is 4 triangles, each pair forming a rect, to render the character twice, once in black, once in white, with an offset
<clever> in this mode, it was rendering 2d triangles with textures
<clever> my opengl stack wasnt tied into xorg at all, so it just ran fullscreen from the console
<clever> sphalerite: bottom image is wowmapviewer running on a raspberry pi, with my custom driver stack (and the background color adjusted so i could confirm the shadow rendering worked)
<clever> sphalerite: top image is wowmapviewer running on my laptop, with normal linux video drivers
<clever> sphalerite: https://imgur.com/a/uwc2b
<clever> sphalerite: and it could also do add and multiply operations, in the same clock cycle, the opcode encodes 4 inputs, 2 outputs, and 2 operations (one each from the add, and mult sets)
<clever> sphalerite: it was basicaly a 192 core processor, heavily geared towards running the same code in parallel on different datasets
<clever> sphalerite: the 3d engine within the rpi
<clever> sphalerite: i have written my own raspberry pi driver, from scratch
<clever> depending on implementation
<clever> but the linux side drivers may couple things more
<clever> and you can just blast the 3d frames to anywhere in physical memory
<clever> in the case of the rpi, the 3d core isnt really coupled to the 2d framebuffer logic
<clever> tanonym: you will want to mount the <pool>/<fs> to /mnt/ before you mount boot
<clever> tanonym: did you mount the pools root to /mnt/ before mounting boot?
<clever> ./../ylwrap: line 159: 32391 Aborted (core dumped) "$prog" "$@" "$input"
<clever> bison: ../sysdeps/unix/sysv/linux/spawni.c:360: __spawnix: Assertion `ec >= 0' failed.
<clever> sphalerite: i also had something fail on my hydra, let me see
<clever> sphalerite: minor problem i can see from using the qemu.src, the version on line 15 can now be wrong
<clever> tanonym: the justdoit.nix example uses lz4 on line 78, gzip-9 will save you more space, at the cost of more CPU
<clever> Drakonis[m]: i dont think zfs is going to be capable of using more ram then the pool size
<clever> mzabani: that sounds like network problems, try the command again
<clever> Drakonis[m]: i think its a 4gig usb stick
<clever> tanonym: lines 76-86-ish handle creating the zfs filesystem and mounting it
<clever> infinisil: grub has trouble traversing /nix/store/ and copyKernels puts them into a simpler directory structure
<clever> infinisil, avn: but if you use copyKernels with /boot on the same FS as /, it will still copy it, and then grub doesnt have to deal with the insanity that is /nix/store/
<clever> infinisil: i think zfs will just auto-generate a GPT partition table if you tell it to use the whole disk
<clever> zfs also works on luks volumes, if you are not yet using the built-in zfs encryption
<clever> tanonym: grub also doesnt play that nicely with zfs, so you may want a small /boot partition with ext4
<clever> the target nixos will figure that out on its own, because there is an entry in hardware-configuration.nix mentioning zfsa
<clever> tanonym: the host configuration.nix needs that to even be able to create a zfs on the "target"
<clever> lol
<clever> turning off glamor made 2d faster, and removed all 3d accel
<clever> and it acted like a v-sync wait, after every printed character
<clever> the bug only showed itself under xterm, other terminals lacked it
<clever> which resulted in the old bug being present on nixos
<clever> Unode: but the nixos scripts for generating xorg packages where not aware of that merging, and used the deprecated external glamor, that still had the problem
<clever> Unode: in my case, glamor was a seperate repo, with that bug, then it got merged into xorg proper, then fixed
<clever> Unode: my glamor problem was also fixed years ago
<clever> Unode: i think i saw something similar happening 3 days ago, when i ran screen under tmux
<clever> Unode: upstream fixed it 4 years ago, so i'm not sure how it came back: https://github.com/facebook/rocksdb/commit/e7b726da0896f344c42f905caea3fde52312ec1d
<clever> Unode: i recently ran into a problem, something hydra built is using SSE4, and my laptop lacks it
<clever> Unode: yeah, my laptop needed legacy nvidia to even start
<clever> Unode: but nixos handles this much better, because the resulting install is pure, and has no traces of the previous failed attempts, so i am free to try things and know it will have no lasting effect
<clever> Unode: the open source drivers crash hard if i unplug the 2nd monitor while its active
<clever> Unode: the closed-source ati drivers crash hard if i enable dual-monitor
<clever> Unode: an older build of the opensource drivers uses the wrong version of glamor, which causes xterm to wait for vsync, after every printed character
<clever> Unode: for example, one of the drivers will sometimes cause xorg to crash hard and stop, if i ssh in and restart xorg, the kernel hangs
<clever> Unode: i have had weird problems with some of the driver choices, but nixos makes it trivial to remove all traces of failed attempts
<clever> Unode: lol
<clever> lol
<clever> hl: yeah, once i get a system booting, i avoid touching things that low level
<clever> tanonym: you can boot GPT drives on non-efi machines, if you create a "bios boot partition", 2mb, no FS, never mounted, and configure grub to continue booting via legacy
<clever> tanonym: GPT with legacy needs a different special partition type
<clever> tanonym: GPT with efi needs a special partition type and some vars setup in the bios by the installer
<clever> tanonym: i was able to use just that copy of nix to install nixos ontop of gentoo, and get the system fully working
<clever> tanonym: ive broken a gentoo install, by mv'ing nearly half the OS off the hdd, it still had an ancient copy of nix in /usr/local/bin/
<clever> tanonym: :D
<clever> tanonym: anything you manualy installed with nix-env -i wont be cloned
<clever> tanonym: every copy of nixos has nixos-install, and can create more copies
<clever> tanonym: you can also use the nixos running on the hdd to do the nixos-install
<clever> yep
<clever> tanonym: you will need to temporarily set the grub device to sdb to install the bootloader to the MBR, then change it to nodev
<clever> tanonym: as long as grub can read the rootfs, yeah, you can just make a rootfs only
<clever> Unode: only things built by nix and stored in /nix/store/ will continue to work in the future, anything you build and keep in $HOME and elsewhere are untracked and the GC will break them
<clever> ma27: i think the problem is when building the haskell zlib wrapper, it fails to find the original c zlib headers
<clever> Unode: so your always better off letting nix build things, using either cabal2nix or stack2nix
<clever> Unode: anything you install with "stack install" is likely to break without warning in a month or 2, when nix garbage collects the libraries it was using
<clever> Unode: there is also stack2nix
<clever> Unode: what about just nix-env -iA nixos.haskellPackages.hoogle
<clever> what if you run it under "nix-shell -p zlib" ?
<clever> Unode: gcc wont look there, the setup hooks wont run right, and the propagated inputs wont be present
<clever> Unode: why would you want to do that?
<clever> tanonym: 341 to 399 generate the iso image
<clever> tanonym: and line 291 mounts the iso to /iso
<clever> tanonym: the same .ro-store and .rw-store stuff on line 301-318, but this time against /iso/nix-store.squashfs
<clever> tanonym: 24 turns on efi, 27 makes the iso image also have an MBR partition table, and those options exist elsewhere (the files on lines 10-15)
<clever> tanonym: and the squashfs on line 69 only has the closure, with no nix database, so line 95 initializes the DB on bootup
<clever> tanonym: line 76 makes a cpio image containing the squashfs, and prepends it with the normal nixos initrd
<clever> tanonym: then line 53 union's them together, so the store is writeable at runtime (and lost at shutdown)
<clever> tanonym: this will grab a squashfs thats held directly in the initrd, and mount it to .ro-store, and a tmpfs on .rw-store
<clever> tanonym: so a writable compressed filesystem, like zfs, will win
<clever> tanonym: and everything will be in the uncompressed writable layer
<clever> tanonym: the issue though, is that when you do a major update and garbage collect, the read-only will become 90% garbage, that can never be deleted
<clever> tanonym: but you could modify it, to union a writable and a read-only
<clever> tanonym: all of the tmpfs based stuff in nixos, involves using a unionfs to merge a tmpfs and a squashfs
<clever> tanonym: android does the same thing, the os lives on a read-only /system and the user stuff on a writable /data
<clever> the non-persistant iso uses squashfs, which is read-only compression
<clever> at the cost of more cpu usage
<clever> gzip-9 can compress things pretty far
<clever> tanonym: oh, using a filesystem like zfs that supports compression may help
<clever> xfce or just raw text console
<clever> i change it to "nodev"; after the install, so i cant mess with the 2nd sata drive by mistake
<clever> just be careful, boot.loader.grub.device = "/dev/sdb"; wont always point to the usb stick
<clever> you can also change configuration.nix and nixos-rebuild, and it will stick
<clever> tanonym: yeah, a normal install to the usb stick will let everything persist
<clever> tanonym: it will go into a tmpfs and be lost at shutdown/reboot
<clever> guillaum2: so it entirely ignores nix-channel, and always uses the same revision for all
<clever> guillaum2: one option, a bit more extreme, you can just set the nixpkgs revision within your project source
<clever> guillaum2: the exact same revision, or do you just want to ensure it finds it?
<clever> tanonym: https://github.com/cleverca22/nixos-configs/blob/master/rescue_boot.nix puts the entire installer (no xorg) onto /boot/, and takes up about 300mb
<clever> tanonym: i have gotten a simple nixos install image down to 300mb
<clever> guillaum2: that name is specially configured
<clever> guillaum2: yeah, because <nixpkgs> goes to the nixpkgs= in NIX_PATH first, and will always use the channel called nixos on root
<clever> .efiInstallAsRemovable may also have an impact on that
<clever> unplugging the windows drive (or disabling efi) was enough to make it work
<clever> yeah
<clever> my desktop refused to boot anything legacy if the EFI hdd was visible
<clever> as long as the EFI firmware isnt being dumb
<clever> yep
<clever> yeah
<clever> just point the boot.loader.grub.device at the usb stick
<clever> then it should be as simple as a normal install
<clever> tanonym: and you would obviously tell it to not touch efivars
<clever> tanonym: EFI needs a special flag, https://nixos.org/nixos/options.html#installasremov
<clever> tanonym: if you use the legacy MBR configuration, it will boot on anything
<clever> nixer: there can be multiple .drv files for building the same output
<clever> nixer: you would need to build the drv first, and then eval the string in nix-repl
<clever> guillaum2: then you must also have a channel called nixpkgs in nix-channel
<clever> guillaum2: that says that <nixpkgs> maps directly to /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
<clever> guillaum2: echo $NIX_PATH
<clever> nix-repl> builtins.getEnv "HOME"
<clever> "/root"
<clever> kiloreux: builtins.getEnv