2018-08-10

<clever> it looks like a bug in the package
<clever> the nix expression is patching the udev rules file, but that never actually gets installed
<clever> there is nothing in the brightnessctl package that could possibly do what line 18 claims it does
<clever> lo_mlatu: it looks like it will only work via sudo with the current config
<clever> lo_mlatu: the video group gives you no special access to that file
<clever> lo_mlatu: or similar path, whatever is under backlight
<clever> lo_mlatu: ls -lh /sys/class/backlight/intel_backlight/brightness
<clever> ah
<clever> lo_mlatu: what is the exact error nix-env gave?
<clever> lo_mlatu: and what user owns the mlatus directory?
<clever> lo_mlatu: and `ls -lh /nix/var/nix/profiles/per-user/mlatus` ?
<clever> lo_mlatu: what does `echo ~ ; ls -lh ~/.nix-profile` say ?
<clever> lo_mlatu: does brightnessctl give any errors?
<clever> lo_mlatu: if you run `id`, does it list you as being in the video group?
<clever> but if you set the value to anything, it wont use the default
<clever> its automatically included as the default
<clever> mightybyte: did you set the nix.binaryCaches in your own configuration.nix?
<clever> --option lets you override any nix.conf entry
<clever> mightybyte: nixos-rebuild switch --fast --option substituters https://cache.nixos.org
<clever> mightybyte: one sec
<clever> sigtrm: can you paste the exact error ssh gave?
<clever> mightybyte: and how did you update to 18.03?
<clever> mightybyte: is cache.nixos.org listed in /etc/nix/nix.conf ?
<clever> mightybyte: what is taking that long to build?
<clever> sigtrm: try `systemctl stop firewall`
<clever> sigtrm: is the machine acting as a router?
<clever> sigtrm: you can also run reset to reset the terminal
<clever> sigtrm: ps aux | grep sshd
<clever> sigtrm: is sshd running?
<clever> sigtrm: check the ip's shown by `ip addr`
<clever> infinisil: already tried it, but it just makes the problem worse :P
<clever> Dedalo: the vimium extension lets you search for tabs by title with T
<clever> Dedalo: 22 windows with a total of 436 tabs for the second profile
<clever> Dedalo: 35 windows, with a total of 1399 tabs, for the first chrome profile
<clever> Dedalo: i have over 1000 tabs in chrome, and it uses 32gig of ram and sometimes another 32gig of swap
<clever> Dedalo: if you want hibernation, then the swap has to be bigger then the ram, beyond that, it depends purely on what you run and how bad your tab addition is
<clever> rescue_boot.nix mainly saves you from having to dig out the USB you installed from
<clever> Dedalo: its more for if you mess up the root partition, or want to make drastic changes to root
<clever> Dedalo: the rescue script only works if /boot is intact
<clever> jgt: it will obey /etc/nix/machines when building the inputs to the expression, but the shell itself will be ran locally
<clever> windows probably already had gpt tables there
<clever> Dedalo: p will tell you if its dos or gpt
<clever> jgt: ah, so your probably hitting the original problem that made it linux-only
<clever> jgt: did you set allowBroken?
<clever> jgt: ^^^
<clever> jdnavarro: error: Package ‘postgis-2.4.4’ in /home/clever/apps/nixpkgs/pkgs/development/libraries/postgis/default.nix:101 is not supported on ‘x86_64-apple-darwin’, refusing to evaluate.
<clever> and it adds an option for it to grub
<clever> Dedalo: that drops a ~300mb initrd into /boot, that contains the entire nixos installer
<clever> Dedalo: and here is an optional tool that you can use to recover things easily if you want: https://github.com/cleverca22/nixos-configs/blob/master/rescue_boot.nix
<clever> only indirect roots are broken
<clever> elvishjerricco: normal roots within /nix/var/nix/profiles/ and friends will survive, if you GC with the right command
<clever> elvishjerricco: if you try to GC a store without chroot'ing into it, then all indirect roots will be shreded
<clever> i generally go for 1gig
<clever> and q quits without saving, oops, lol
<clever> Dedalo: n to make a new partition, t to change its type, L to list them, 1 is efi system
<clever> and checking help (with m), i can see that g creates a new gpt table
<clever> Created a new DOS disklabel with disk identifier 0xba2c2175.
<clever> Device does not contain a recognized partition table.
<clever> [root@amd-nixos:~]# truncate -s 10g /root/dummy.img ; fdisk /root/dummy.img
<clever> :D
<clever> Dedalo: i also dont drink coffee, lol
<clever> Dedalo: also of note, nvme only boots with uefi, so your /boot partition has to be an efi system partition, with GPT tables, and formated as fat32
<clever> fresheyeball: i dont drink beer, lol
<clever> Dedalo: then you want to aim fdisk at the nvme drive
<clever> Dedalo: so you have 2 drives plugged in, sdb, and nvme0n1, by the sizes, can you tell what physical device each is?
<clever> fresheyeball: you can also just copy the whole module to the current dir and imports = [ ./copy.nix ];
<clever> Dedalo: what does lsblk say?
<clever> elvishjerricco: ExecStart is not a nixos option, you have to mkForce the entire serviceConfig
<clever> fresheyeball: one min
<clever> fresheyeball: not easily, but it can be done
<clever> jgt: postgis compiles for me on linux
<clever> jgt: what revision of nixpkgs do you have checked out?
<clever> jgt: it will likely also fail with `nix-build /Users/jgt/nixpkgs -A postgis` ?
<clever> sigtrm: and you really want to have physical access when messing with IP config, so you can undo things
<clever> sigtrm: try specifying the protocol, like in https://github.com/cleverca22/nixos-configs/blob/master/router.nat.nix#L48-L56
<clever> infinisil: that could also find duplicates between multiple files in your imports
<clever> infinisil: one option is to just use nix-diff, and brute-force delete tokens and see if the diff changes or not
<clever> sigtrm: the default is true
<clever> fresheyeball: yeah
<clever> fresheyeball: nixpkgs.overlays = [ ... ];
<clever> it was moved in nix2
<clever> it will recreate the db if its missing, and then query all caches
<clever> thats how nix caches what is (and isnt) on the binary caches
<clever> ocharles: sudo rm /root/.cache/nix/binary-cache-v5.sqlite*
<clever> ocharles: single or multiuser nix?
<clever> hyper_ch2: i think it took me something like 6 hours?
<clever> Dedalo: id also give each machine a unique pool name
<clever> Dedalo: then you want something like `zpool create -o ashift=12 -o altroot=/mnt rpool /dev/sda2`
<clever> ashift=12 says to use 2^12 bytes per sector, which is 4096 bytes
<clever> the ashift is seperate from the raid level
<clever> do you plan to have any raid?
<clever> and then it should just work with zfs
<clever> yep
<clever> so rebooting wont help any
<clever> Dedalo: if your using the ISO image on the USB stick, then all changes are reverted upon reboot
<clever> Dedalo: i also recomend having seperate datasets for / and /nix/
<clever> and GPT partition tables
<clever> Dedalo: make sure to mount boot after the rootfs
<clever> Dedalo: so you need an efi system partition, which will be formated as fat32, and mounted to /mnt/boot/, and then a partition for zfs, with the root mounted to /mnt/
<clever> Dedalo: then your booting the USB in EFI mode, and will probably also want efi for the nixos install
<clever> due to pesky licenses, we cant ship an image with zfs enabled
<clever> symphorien: though you also have to edit the USB's configuration.nix if you want to enable ZFS support
<clever> Dedalo: does `mount | grep efi` show efivarfs being mounted?
<clever> Dedalo: inside the main { and } that surround the bulk of the file
<clever> Dedalo: you will need a /boot that is not zfs, and then depending on uefi and/or gpt, some other things
<clever> Dedalo: and after reading the above wiki, you can also look at this script i made that automates a zfs nixos install: https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix#L93-L108
<clever> but nix-env doesnt support that
<clever> after buildEnv has merged all systemPackages, it will run update-mine-database and a few others, to generate the proper caches
<clever> yeah
<clever> try moving it to systemPackages
<clever> did you install it with nix-env or systemPackages?
<clever> maerwald: you sometimes have to logout and back in to get that kind of thing detected
<clever> but by accident, i used nix master, which was too new, and then the nix within nixpkgs couldnt read db.sqlite
<clever> i used lynx from text mode to open hydra and find the path to nix
<clever> so i had a very broken gentoo install, and a very very old nix
<clever> house*
<clever> i was in the middle of moving the gentoo data off to wipe the system and had to leave the huse
<clever> ive done the above before, when upgrading a nix 1.9 on gentoo, without /usr/bin, lol
<clever> and then just jam it into PATH temporarily
<clever> srhb: you can still run `nix-store -r /nix/store/hash-nix-2.0/ to download a new nix, without having to parse nixpkgs
<clever> Taneb: it may not allow numbers as a job name?
<clever> nothing obvious from the ps tree
<clever> yep
<clever> Taneb: try doing `systemctl restart hydra-evaluator` and see if it recovers
<clever> Taneb: is localhost in /etc/nix/machines ?
<clever> Taneb: can you pastebin the output of `ps -eH x` ran on the hydra machine?
<clever> Taneb: there should be a jobset called .jobsets, which will show the normal status page, including when it last did an eval and how often it evals
<clever> ,libraries thekolb
<clever> thekolb: it only works under nix-shell and nix-build
<clever> thekolb: gcc wont work right if you install it with nix-env
<clever> but $CC is set to the right thing on darwin and clangStdenv.mkDerivation
<clever> Dezgeg: when using gcc, cc exists, but when using clang, cc doesnt exist
<clever> thekolb: yeah, change the makefile to use $CC
<clever> ixxie: if the install worked fine, yep
<clever> dhess: look for asset in https://ipxe.org/cfg
<clever> tobiasBora: yeah, you need --allow-unsafe-native-code-during-evaluation, or builtins.exec wont even exist
<clever> tobiasBora: it outputs { val1 = 5*5; ... }
<clever> and it will behave as if you had originally written foo = /tmp/whatever.json;
<clever> tobiasBora: the script on lines 5&6, could then download the json to a temp file, then just echo the path to stdout
<clever> in this case, i use nix to create a script, then builtins.exec to run that script impurely, and whatever the script printed, is then parsed as nix, and returned by builtins.exec
<clever> it could just be a string or a path
<clever> tobiasBora: i'm not sure where its documented, but it can return any expression you want
<clever> tobiasBora: ah, found the example i made: https://gist.github.com/cleverca22/590cbb3e6b0ad1959e720d73c36e1e95
<clever> tobiasBora: yeah, but nix wants the command to print a nix expression to stdout
<clever> tobiasBora: its mostly to force things to be pure, but builtins.exec or a custom plugin can inject less pure data
<clever> thats a field the bios declares within the acpi tables
<clever> and you can then use whatever server-side scripting you want to dynamically select the ipxe config
<clever> the ${net0/mac} is in the ipxe docs
<clever> dhess: and ${net0/mac} is part of the ipxe language, to insert the addr for the 0th NIC
<clever> dhess: in my actual lan, that file contains a switch-case statement, that changes the reply based on the mac addr
<clever> dhess: also, this was copied from my LAN setup, which had an actual boot.php, not just a dummy file (like lines 45-46)
<clever> undionly is a build of ipxe, that works with the old pxe booting in NIC's and legacy bios
<clever> the #!ipxe script then does kernel and initrd loading, and ipxe treats the relative paths sanely, even over http
<clever> the arch fields are to detect UEFI doing net-boot, but i havent gotten that to work
<clever> ipxe will then fetch that #!ipxe script and run it
<clever> then the if on 89 detects ipxe re-doing its own dhcp, and it sends an http url
<clever> initially, the filename will be "undionly.kpxe", which causes the bios to grab ixpe over tftp
<clever> dhess: the dhcp server will run these if statements on every dhcp request, and send the right filename for the situation
<clever> dhess: yeah
<clever> dhess: ah, i hadnt
<clever> dhess: ive only had it work with legacy pxe
<clever> dhess: a build of ipxe that can be loaded by UEFI, but i never got it working right
<clever> or use builtins.exec
<clever> tobiasBora: hmmm, may need to be tweaked a bit, the only impure thing nix allows is tars, so you need to return a tar containing a json
<clever> tobiasBora: oh, you could try `builtins.fromJSON (builtins.fetchTarball https://example.com/foo.tar)`
<clever> ixxie: yeah
<clever> ixxie: yeah, fdisk will force the start to be aligned to ~2mb automatically
<clever> tobiasBora: you would want to export things as json, and then use builtins.readFile + builtins.fromJSON
<clever> tobiasBora: what are you thinking of doing?
<clever> ixxie: yeah
<clever> uefi and luks are optional
<clever> it will always create a GPT install with ZFS
<clever> ixxie: this generates a bash script that automates the entire nixos install process, but it has to be tweaked a bit to fit the machine
<clever> if its under 2tb, you dont really need to bother with GPT
<clever> so GPT needs a dedicated bios boot partition do handle the same task
<clever> the GPT tables take up more then 1 sector, and dont allow using "unused" space
<clever> ixxie: it has to be MBR/dos, or the requirements get a bit more complex
<clever> when using MBR, grub puts stage1 in the "unused" space between sector 1 and partition 1, which is usually about 2048 sectors long due to alignment requirements
<clever> ixxie: umount, partition it with 1 partition, then format sda1 and start over
<clever> ixxie: yeah
<clever> ixxie: did you mount sda or sda1?
<clever> LnL: also of note, prior to discovering nixos, i was writing my own initrd's for gentoo, and even had wifi drivers and firmware loading in one initrd, to netboot over wifi
<clever> the FS choice as well
<clever> LnL: but kexec lets you repartition and reformat it however you want
<clever> LnL: the main limitation of NIXOS_LUSTRATE is that you must reuse the existing partition layout of the install
<clever> LnL: and that automation was based on when i manually converted gentoo to nixos, and debugged the problems it had
<clever> LnL: but the debian junk in /bin and /lib and /etc will break nixos, so a `touch /etc/NIXOS_LUSTRATE` will tell the nixos initrd to rename eveyrthing in / on bootup
<clever> LnL: then `touch /etc/NIXOS` to bypass some safeties, and `./result/bin/switch-to-configuration boot` to install the nixos bootloader
<clever> LnL: basically, you can install nix on any linux distro, then just `nix-build '<nixpkgs/nixos>' -A system -I nixos-config=/etc/nixos/configuration.nix` to build a copy of nixos within /nix (on debian!)
<clever> tobiasBora: but its usually enough to get ssh fixed, and then you can just switch to ssh
<clever> tobiasBora: main issue ive seen with both curses and serial console, is that its not properly aware of the screen width/height, and things get a little wonky
<clever> LnL: /etc/NIXOS_LUSTRATE is based on how i had mutated one of my gentoo installs into nixos a year or 2 ago
<clever> and how stories of a few have wound up merged into nixpkgs, lol
<clever> LnL: i was just thinking, how many different ways ive devised to install nixos, lol
<clever> LnL: i'm thinking of it
<clever> dhess: yeah, if you can control the real dhcp-server for your LAN, you can just steam and merge things
<clever> dhess: so the target machine can borrow the internet via the ethernet cable
<clever> dhess: it also configures the machine to act as a router, with the wifi as wan, and ethernet as lan
<clever> dhess: i used that on my old laptop to install to the new laptop
<clever> ixxie: but that wont support gpt or uefi, so it will need to be MBR and legacy booting
<clever> ixxie: if your using ext4 for /, then you could just have a single partition for the ext4 and thats it
<clever> tobiasBora: ah, yeah, you will need that then
<clever> ixxie: its the same as if you had booted the ISO on a machine that already had ubuntu
<clever> ixxie: you may also want to repartition the drive
<clever> tobiasBora: i believe the default args in the iso already do that part
<clever> ixxie: and then nixos-generate-config --root /mnt/
<clever> ixxie: you need to format the hdd before mounting it to /mnt/
<clever> all i can think of then is to fix the hash in the expression
<clever> manveru: does the expression use fetchpatch or fetchurl?
<clever> manveru: we would need to also have the original version of the patch to know what has changed and where the problem is
<clever> tobiasBora: and maybe `-graphics none` also, not sure
<clever> tobiasBora: `-serial stdio`
<clever> tobiasBora: you could try switching to a serial console instead, that wont notice the gfx
<clever> manveru: then the upstream is being naughty and has modified the patch
<clever> manveru: is it really a diff?, read it
<clever> manveru: run file on that storepath
<clever> dhess: oh, line 5 of the above file, it is an option, lol
<clever> you can also `systemctl stop autoreboot.timer` once you get in, and then it just never triggers
<clever> yeah, it needs better warning
<clever> so you had to file a ticket just to reboot the machine
<clever> and i originally used this on a datacenter that lacked remote reboot
<clever> dhess: i added that because its sometimes easy to get the network config wrong, and then you cant control the machine
<clever> but if you began to repartition, then it wont be able to boot
<clever> if the original OS hasnt been modified, then that will boot back up, and you can kexec again
<clever> ixxie: you have ~5 minutes to cancel it with `shutdown -c`
<clever> ixxie: yeah, thats a safety for if you cant get in
<clever> ixxie: lsblk
<clever> ixxie: once your booted into it, you can just mount the hdd to /mnt and install as normal, just like you had used the ISO
<clever> jasongrossman: nixos-generate-config defaults to /, and its designed so you can re-run it from a normal install, to update /etc/nixos/hardware-configuration.nix
<clever> its just a wrapper that runs `nixos-rebuild` under a chroot for you
<clever> and i would expect `nixos-install --root /` to break
<clever> jasongrossman: nixos-install defaults to /mnt/
<clever> mightybyte: execsnoop, ran as root
<clever> strace it!
<clever> its called nix-index
<clever> ,locate firefox

2018-08-09

<clever> a thunk is how a lazily evaluated language works
<clever> without that, it will be super-lazy, and wont even run the thunks
<clever> symphorien: in this case, it will allow --json to force thunks
<clever> what about --strict --json ?
<clever> symphorien: also, try adding --strict
<clever> symphorien: try builtins.toJSON instead of --json
<clever> symphorien: what command caused the failure?
<clever> it will say function, not thunk
<clever> > builtins.toJSON { a = x: x*5; }
<clever> symphorien: what did you pass to builtins.toJSON?
<clever> fresheyeball: is the process running?
<clever> ldconfig does not work in nix
<clever> selfsymmetric-pa: sudo will mess with env vars
<clever> yeah
<clever> selfsymmetric-pa: what about `sudo -i` then `nixos-rebuild switch` ?
<clever> selfsymmetric-pa: and what command is giving the error?
<clever> selfsymmetric-pa: what does `echo $NIX_PATH` say?
<clever> which allows you to then forcibly bypass things
<clever> at least in mysql, you can start the daemon with a special parameter, that disables all auth and just gives localhost full admin
<clever> that is also the simplest way to change the stateVersion, at the cost of data loss
<clever> and it should recreate everything and obey the current config
<clever> elvishjerricco: if its a fresh install, just blow away `/var/lib/postgresql` after you stop the service, then start it again
<clever> elvishjerricco: from within psql, you can query them
<clever> fresheyeball: ah
<clever> elvishjerricco: yeah
<clever> elvishjerricco: changing the stateVersion back restored the old datadir, and the whole db
<clever> and as a result, all data just vanished
<clever> elvishjerricco: i also recently got surprised by a recent accidental change of stateVersion, the datadir for postgres now contains the version#
<clever> ,locate libstdc++.so
<clever> symphorien: is wireguard still in extraModulePackages?
<clever> nix will parse it once, and generate a nix-build command, that then makes the squashfs
<clever> > "nix-build -E 'with import <nixpkgs> {}; callPackage <nixpkgs/nixos/lib/make-squashfs.nix> { storeContents = [ ${ghc} ]; }"
<clever> that refers to a closure in the store
<clever> it could just be a 1 line script like what i pasted above
<clever> not so
<clever> just run nix-build inside the prestart script
<clever> so you have a closure in the host store, and it can use the nixos cache, then at service startup, it generates the squashfs
<clever> another thought is to generate the squashfs on the remote machine
<clever> ah
<clever> tilpner: and why is this running under qemu?
<clever> ah
<clever> tilpner: if you didnt have the squashfs, then the remote machine can grab ghc from cache.nixos.org and ignore your upload
<clever> tilpner: why does this need to be inside a squashfs?
<clever> tilpner: why not?
<clever> testing this...: [clever@system76:~]$ nix-build -E 'with import <nixpkgs> {}; callPackage <nixpkgs/nixos/lib/make-squashfs.nix> { storeContents = [ ghc ]; }'
<clever> and then ghc wont be in the squashfs at all
<clever> tilpner: if you build your haskell program with haskell.lib.justStaticExecutables then it wont depend on ghc
<clever> tilpner: dont depend on ghc at all
<clever> ah, and my compression patches where to make-system-tarball, not squashfs: https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/make-system-tarball.nix
<clever> what did you need to modify?
<clever> tilpner: you may want to look into the make-squashfs.nix i linked
<clever> symphorien: have you seen the nixpkgs function to generate a squashfs?
<clever> mikeplus64: buildEnv just merges things, so you would want to have the right paths in the original inputs