2018-09-06

<clever> swapDevices = [ { device = "/var/lib/swap1"; size = 1024 * 16; } ];
<clever> ixxie: nixos also supports swap files fairly nicely https://nixos.org/nixos/options.html#swapdevices.*.size
<clever> ixxie: if your rootfs is ext4, you can use swap files, and then you are free to just delete the swap when you dont need it
<clever> so the swap must be on a lvm LV or a bare partition
<clever> ixxie: zfs doesnt support swap files, and is unstable with a zvol
<clever> ixxie: https://imgur.com/a/a7BzyOa is what swap is for :P
<clever> ixxie: one min
<clever> adamantium: and since hibernation doesnt work, you dont really loose anything from using https://nixos.org/nixos/options.html#randomencryption
<clever> ive also had issues with swap on zvol deadlocking, so i would use a dedicated swap
<clever> joko: zfs also does not support suspend to disk at all
<clever> the bootable flag doesnt exist on gpt i believe
<clever> swap is optional, but yeah that sounds good
<clever> joko: min-free+max-free will trigger automatically when you hit min-free bytes, and will raise it to max-free, so it doesnt suffer from those 2 problems, though it currently has bugs that can break the eval
<clever> joko: and its going to delete garbage, no matter how little there is, so it may wind up deleting the same 5kb every time, if the machine is very idle
<clever> joko: but the problem with this method, is that it will only run once (or twice in this case) per day, and if you consume more then 128gig in that 12 hour period, it can still fail poorly
<clever> which then stops at ~128gig free
<clever> joko: so if 100gig is free, it will tell nix to GC 28gig worth of garbage
<clever> joko: that is computing the difference between 128gig and how much is currently free
<clever> adamantium: not sure
<clever> adamantium: my intimate knowldge of nix in here is what got me a job at iohk.io :P
<clever> if you supply a wrong hash, that matches an old version, nix wont notice, and will keep using the old version
<clever> adamantium: id also recomend zero'ing out a few digits of the hash
<clever> adamantium: yeah
<clever> so the sha256 only changes if the gitrev changes
<clever> adamantium: the hash is over the source tree, and the tree is fixed for a given git rev
<clever> wdanilo: that script is using used to ship a .app bundle, which contains haskell binaries that nix had compiled
<clever> adamantium: whatever revision you want, previously you used the latest master, so that would work
<clever> wdanilo: thats some haskell code that will automatically copy libs from the nix store and run otool to make things run without nix
<clever> wdanilo: one min
<clever> wdanilo: you would need to run otool on the binaries to mutate the search path, and then just ship a lib dir and a binary that looks in the right path
<clever> adamantium: you must also supply a valid revision from the git repo
<clever> wdanilo: i dont know of any way to do it on darwin
<clever> wdanilo: for linux, you can use user namespaces to automatically chroot things, nix-user-chroot and nix-bundle do that
<clever> orivej: that example is for linux
<clever> You can use the dd utility to write the image: dd if=path-to-image of=/dev/sdb.
<clever> ixxie: yeah, that looks like a mac only thing
<clever> adamantium: yeah, that would be the correct hash
<clever> wdanilo: yeah
<clever> wdanilo: yeah
<clever> thats why it failed
<clever> ixxie: rsda is a regular file in /dev, not a device
<clever> -rw-r--r-- 1 root root 0 Sep 6 10:52 rsda
<clever> ixxie: and your /dev/ fs is full, it didnt write to any block devices
<clever> ixxie: `ls -ltrh /dev/` is missing
<clever> ixxie: i see no mention of that in the dd man page
<clever> adamantium: no, it probably hasnt tried to download homemanager yet
<clever> ixxie: `ls -ltrh /dev/ ; df -h ` into a pastebin
<clever> ixxie: what offset was it at when it failed?
<clever> ixxie: how big is the device in `lsblk`?
<clever> adamantium: you must first put a hash of a valid length into the nix, like 0000000000000000000000000000000000000000000000000000
<clever> adamantium: can you gist the error?
<clever> adamantium: you have to manualy look at the error when you first build it, then copy that hash into the nix code, and build it again
<clever> look at what {^_^} said above
<clever> nix will also give the url and hash when the dl fails
<clever> nix-prefetch-url --unpack
<clever> adamantium: fetchTarball doesnt need a hash
<clever> adamantium: the length of the hash must be correct
<clever> ,tofu
<clever> wdanilo: if you build nix without using nix (just ./configure && make), you can ship that nix binary around, and then use --store with it, that may help
<clever> v0latil3_: try the above
<clever> [clever@amd-nixos:~]$ nix-shell -p 'python.withPackages (ps: [ ps.pygtk ])'
<clever> v0latil3_: id also recomend using withPackages, one min
<clever> v0latil3_: you must use attribute paths, not names
<clever> -p loads <nixpkgs> automatically
<clever> v0latil3_: nix-shell -p python python2.7-pygtk
<clever> adamantium: let me edit it in a gist
<clever> wdanilo: if you have ownership of an empty /nix directory, it can install without root
<clever> adamantium: let blocks are always in the form of key=value;, your missing the key
<clever> wdanilo: i dont think proot supports macos, and that /proc path is linux-only
<clever> a let block would make it a bit cleaner and easier to read
<clever> adamantium: oh, and that has to go inside the {} of "${....}/nixos"
<clever> adamantium: and since its in a list, wrap it with another ()
<clever> adamantium: (import <nixpkgs> { config={}; overlays=[]; }).fetchFromGitHub { owner = "rycee"; repo = "home-manager"; rev = "gitrev"; sha256 = "hash"; }
<clever> srk: i just use an ext4 /boot
<clever> real 2m28.518s
<clever> 53093
<clever> [root@nas:~]# time ls -l /nix/store/ | wc -l
<clever> ive got a 3 drive raidz1, let me check its numbers...
<clever> minutes, every boot, because the kernels involve navigating /nix/store/
<clever> yeah
<clever> so it has to iterate over every single folder in /nix/store/
<clever> ive heard of grub slowing down by minutes, because it cant understand the b-tree indexes in zfs
<clever> now that i see how to get gpt to work both ways, i always do a gpt install on every machine, no excuse not to
<clever> yeah
<clever> EFI doesnt have a 1.5, since the UEFI firmware provides fs access drivers
<clever> for a GPT disk with legacy, it will use the dedicated bios boot partition to hold 1.5
<clever> oops, MBR table
<clever> for an MBR fs, 1.5 goes between sector 1 and partition 1, in the "unused" space
<clever> adamantium: when grub is doing a normal install, it will concat the grub kernel, and the drivers for the /boot FS, to create a stage 1.5
<clever> lol
<clever> adamantium: i never put /boot on ZFS
<clever> so you need to pre-load the "ubuntu" version of those modules, before you source it
<clever> though, nixos's config will try to load modules built for the nixos grub, which fails
<clever> so you can then source it from another grub
<clever> if you set boot.loader.grub.device = "nodev";, then nixos will create a grub config file, but not install into any MBR
<clever> adamantium: one thing ive done before, was just putting a source statement into the other grub config, to source the nixos grub config
<clever> if you already have an easy way to boot the target into an installer
<clever> and if your going to upload the entire closure anyways, you might as well have the option of shippimg that base image that wont be of much use
<clever> adamantium: main thing i'm thinking of, is that if you create a machine from a base image, 90% of the time, the nixpkgs will differ, and it will have to re-upload the entire closure on the first nixops deploy
<clever> so you can populate an entirely blank /mnt dir with a nixos build
<clever> adamantium: after mounting everything under /mnt as normal, you can build the nixos on another box (possibly even with nixops), and then copy it over ssh, directly into /mnt
<clever> adamantium: i also recently found another trick with nix copy
<clever> adamantium: ah, a lot like my justdoit
<clever> adamantium: what does themelios do?
<clever> adamantium: you may be able to solve it by switching to `(import <nixpkgs> { config={}; overlays=[]; }).fetchFromGitHub`
<clever> already filing one
<clever> adamantium: yep, this fails
<clever> [clever@amd-nixos:~]$ nix-instantiate -E '(import (builtins.fetchTarball https://github.com/nixos/nixpkgs/archive/master.tar.gz) {}).hello' --store local?root=/home/clever/fakeroot/
<clever> let me test a fetchtarball first
<clever> adamantium: i dont think the problem is to do with home-manger, but just fetchTarball
<clever> adamantium: it might be another side-effect of the chroot stuff like https://github.com/NixOS/nix/issues/2381
<clever> and others, see the above link
<clever> and postStart vs ExecStartPost
<clever> script vs ExecStart is the same thing
<clever> behind the scenes, preStart will set ExecStartPre for you, pointing it to the auto-generated bash script
<clever> rauno: ExecStartPre must be an absolute path to a single command
<clever> rauno: preStart is a multi-line string, that gets added into a shell script for you
<clever> rauno: yep
<clever> rauno: thats a job for the prestart on the module, not the package
<clever> rauno: yeah, that build will never have root and cant write to /var
<clever> rauno: can you gist the nix file that is trying to create that dir?

2018-09-05

<clever> tokudan[m]: i also remember something about libffmpeg.so being just a different build mode, where it puts all the libs into one .so file
<clever> hmmm, it has many, but not an ffmpeg
<clever> it may help to see how it compares to the library ffmpeg provides
<clever> tokudan[m]: it doesnt appear to be part of any proper package, it just happens to be included with a bunch of random things that shipped their own libffmpeg.so
<clever> ,locate libffmpeg.so
<clever> cransom: i have had plans to just replace the entire board with something like a esp8266, and just make it purely wifi based :P
<clever> and your shoulder is going to be in the way :P
<clever> the LED is pointing down and backwards
<clever> the low battery LED is imposible to see if you are actually using the headset
<clever> so linux just lacks a low battery warning, and the headset just dies
<clever> it measures the battery level via an unknown method, and then just plays a beep over the audio channel
<clever> joko: the only anoying part, is that the low battery beep, is implemented by windows-only software
<clever> joko: the usb keyboard bits allow it to report volume up/down events when i scroll the volume knob, and previous, play/pause, next, when i push the G1/G2/G3 buttons
<clever> so pulseaudio wont crap its pants and disconnect applications in a damaging way
<clever> and unlike a lot of bluetooth users, the capture/playback device is still present when the headset disconnects
<clever> logitech g930 is the model
<clever> other then some problems with the capture buffer building up latency in pulseaudio, it has never had any serious driver or connection problems
<clever> joko: my wireless headset uses a proprietary USB dongle, it claims to be a usb sound card with HID features, so it just appears as a normal device in alsa, and also acts like a usb keyboard at times
<clever> elvishjerricco: try that when its working, and see if it recovers on its own
<clever> elvishjerricco: what if you simply `pactl exit` ?
<clever> though nix-env -qA can also do it
<clever> d1rewolf: thats a job for nix-instantiate
<clever> das_j: https://nixos.org/nixos/options.html#autoupgrade could maybe do it, but i wouldnt recomend using that option
<clever> d
<clever> das_j: not really, its too late to change the channel once configuration.nix is being loade
<clever> d1rewolf: not sure, we will find out more when a PR is filed and the maintainer of node2nix can comment on it
<clever> basically, you would have to do a complete darwin install, just to disable secure boot
<clever> ixxie: read this for the horror stories of what could have happened, if you had a newer mac:P https://michaellynn.github.io/2018/07/27/booting-secure/
<clever> ixxie: one min
<clever> i'm assuming thats enabled, since you had linux on it before
<clever> you must boot from an EFI usb stick to recover it
<clever> yeah
<clever> you cant disable uefi on a mac
<clever> oh, you didnt mention that
<clever> it has to be disabled in the firmware, not the os
<clever> or del, or f2, or try a hand-stand, lol
<clever> f12 while turning it on
<clever> you can only edit that config when an OS is not running
<clever> ixxie: you will need to disable uefi in the config to be able to boot legacy
<clever> ixxie: if nixos-generate-config enabled uefi, then it supported uefi
<clever> d1rewolf: nix edit nixpkgs.nodePackages.node2nix
<clever> d1rewolf: that or nix edit
<clever> ixxie: last point
<clever> 2018-09-05 15:44:42 < clever> ixxie: yeah, you need a bios boot partition, 1mb in side, not formated, not mounted
<clever> ixxie: you mount the rootfs to /mnt, which is the bigger partition
<clever> d1rewolf: its defined in that file, on line 43866
<clever> > nodePackages.node2nix.meta.position
<clever> d1rewolf: how did you originally install node2nix?
<clever> ryantrinkle: you may have the wrong nixpkgs revision
<clever> ryantrinkle: it looks like your passing libraryFrameworkDepends to the haskell mkDerivation, and your nixpkgs doesnt support that flag
<clever> ixxie: its right at the top of the type codes in fdisk
<clever> 4 BIOS boot 21686148-6449-6E6F-744E-656564454649
<clever> ryantrinkle: hydra can only create an eval when it has jobs to put in it
<clever> ixxie: its using the type code that you must set
<clever> ixxie: id hope you only have a single bios boot partition
<clever> ixxie: i believe grub just scans the GPT tables and picks one
<clever> ryantrinkle: the last eval to pass was all green, and a complete eval failure doesnt make a new eval
<clever> ixxie: grub will then install it into the MBR of sda, and put stage1.5 into the bios boot partition it finds
<clever> ixxie: it must still be set to /dev/sda
<clever> ixxie: still doesnt matter that much, since grub embeds the location of the bios boot partition into the MBR
<clever> :D
<clever> and rather then being a symlink into profiles, its directly in home
<clever> gchristensen: related, ive seen many users who somehow break ~/.nix-profile
<clever> gchristensen: thats the most obvious reason for booted and current to be symlinked under gcroots
<clever> along with all mmap'd binaries, the exe being ran, and the working directory
<clever> any path in any env variable is a root
<clever> if gcroots is empty, nix wont care about /run/booted-system
<clever> gchristensen: those only work because of the symlink i just pasted
<clever> lrwxrwxrwx 1 root root 18 Sep 3 22:34 /nix/var/nix/gcroots/booted-system -> /run/booted-system
<clever> das_j: it cant connect binaries that are running
<clever> ixxie: yeah
<clever> swap is optional
<clever> ixxie: thats required to boot legacy on gpt
<clever> ixxie: yeah, you need a bios boot partition, 1mb in side, not formated, not mounted
<clever> d1rewolf: yeah, check the nixpkgs manual, under overriding
<clever> d1rewolf: yeah, things break in nasty ways if you edit anything in /nix/store/
<clever> d1rewolf: nixos mounts it read-only to stop you from doing that
<clever> d1rewolf: what is the name of the function?
<clever> d1rewolf: usually, i just grep all of nixpkgs for the name
<clever> d1rewolf: that name= is an argument to another function, which is probably doing that
<clever> ixxie: does configuration.nix mention efi?
<clever> ixxie: b: did you enable efi by acicdent?
<clever> d1rewolf: i missed an "in"
<clever> d1rewolf: nix-shell -E 'with import <nixpkgs> {}; let foo = import ./default.nix {}; in stdenv.mkDerivation { name = "foo"; buildInputs = [ foo."@google/clasp" foo."@types/google-apps-script" ]; }'
<clever> ixxie: a: why make root when it failed on boot?
<clever> d1rewolf: try the above command
<clever> nix-shell -E 'with import <nixpkgs> {}; let foo = import ./default.nix {}; stdenv.mkDerivation { name = "foo"; buildInputs = [ foo."@google/clasp" foo."@types/google-apps-script" ]; }'
<clever> yeah, node2nix conflicts with how nix-env works
<clever> then node2nix is responsible for creating those names
<clever> then the names are in that default.nix file
<clever> ah
<clever> d1rewolf: i cant find any trace of google-apps-script in nixpkgs, what other args are you giving to nix-env?
<clever> d1rewolf: its common for package names to be name-1.2.3, and nix-env matches on name to detect upgrades
<clever> d1rewolf: id recomend just using nix-shell -p to get both at once, and not installing either
<clever> d1rewolf: id say the packages are poorly named
<clever> d1rewolf: the name stops at the -
<clever> d1rewolf: its parsing the name as "node" and removing the other "node" when installed
<clever> d1rewolf: is it listing both at once?
<clever> d1rewolf: what name does `nix-env -q` show it as?
<clever> and boot.loader.grub.device = "/dev/sda"; should be set
<clever> ixxie: grub doesnt really care about the bootable flag
<clever> it should say so near the end, its more clearly visible without -v
<clever> d1rewolf: nix-env -i will always replace any package with a matching name, treating it as an upgrade
<clever> legacy can also boot on GPT, but it needs an extra partition
<clever> as long as your using MBR tables
<clever> ixxie: efi also requires a dedicated boot partition
<clever> yeah
<clever> all partitions involved in the install should be mounted, in the correct order
<clever> ixxie: was anything mounted when re-partitioning?
<clever> ixxie: what does mount report?
<clever> NickHu_: try prepending in the script, instead of using execstart
<clever> NickHu_: did you put it at the start or end of PATH?
<clever> NickHu_: did you run /run/wrappers/bin/sudo or `sudo` ?
<clever> you need to add that PATH
<clever> sudo is /run/wrappers/bin/sudo
<clever> [root@amd-nixos:~]# type sudo
<clever> ah
<clever> NickHu_: is it trying to gain root or loose it?
<clever> NickHu_: why does a systemd unit need sudo?
<clever> i mainly use kexec remotely, so ssh must be working before i can wipe the disk
<clever> so the problem is more about not having wifi drivers in the kexec image, and you already wiped the disk
<clever> ah
<clever> ixxie: ah, is the network working in kexec?
<clever> ixxie: oh, has it rebooted yet or not?
<clever> ixxie: pastebin the output of lspci and lsmod, along with the nix files in /etc/nixos/
<clever> ixxie: are you able to plug in the ethernet?
<clever> ixxie: what modules did lsmod show as being loaded?
<clever> ixxie: correct
<clever> ixxie: thats ethernet, not wifi
<clever> Mic92_: semi-related, ive seen haskell programs hard-fail when /etc/protocols is missing, because it doesnt know what tcp is
<clever> ixxie: does the interface appear in `ip link` ?
<clever> you can always experiment and remove them later, once its working, since you will have grub to undo
<clever> sure
<clever> ixxie: those 2 are part of the defaults for all install media, which may be involved in why wifi works under kexec
<clever> hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = lib.mkDefault true;
<clever> ixxie: and what does the hardware-configuration.nix look like?
<clever> ixxie: lspci, lsmod
<clever> ixxie: and depending what your wifi drivers are, enable the right options to install them
<clever> ixxie: run wpa_passphrase to generate a /mnt/etc/wpa_supplicant.conf
<clever> ixxie: then fix the config in /mnt/etc/nixos and re-run nixos-install
<clever> ixxie: ah, then first thing id recomend is to `systemctl stop autoreboot.timer`
<clever> ixxie: the main install, or the kexec image itself?
<clever> tobiasBora: in my bios, i can browse the filesystems, and select any .efi binary, and just execute it immediately, with no changes to config
<clever> once nixos is booted, another round of `nixos-rebuild switch --install-bootloader` should correct the config
<clever> i was thinking about doing a one-time override, to just select the grub binary and boot it
<clever> tobiasBora: do you see grub files in the nearby directories?
<clever> tobiasBora: you may be browsing into the wrong ESP
<clever> tobiasBora: i'm able to do that when on my laptop
<clever> tobiasBora: if you can find the right bios option, try browsing for a custom .efi file, and just manually select /boot/EFI/BOOT/BOOTX64.EFI for a one-time boot
<clever> then you just have to handle the bootloader installation via switch-to-configuration+nixos-enter or maybe nixos-install -s
<clever> dhess: this allows you to copy a pre-built nixos closure to the /mnt of a remote machine, which can even be a freshly formatted disk
<clever> dhess: nix copy --to ssh://root@target?remote-store=local?root=/mnt /nix/store/hash-nixos
<clever> dhess: ive also recently been experimenting with `nix copy`, and it may be possible for nixops to deploy into a machine that was booted into any "install media"
<clever> Takes a size in bytes, optionally suffixed with the usual K, G, M, and T suffixes, to the base 1024 (IEC)
<clever> RuntimeDirectorySize=
<clever> NickHu_: the docs for that option also point to `man logind.conf`
<clever> NickHu_: once you find the right flag for the config file, services.logind.extraConfig
<clever> NickHu_: systemd-logind i believe
<clever> dhess: the signing is more about updating things without having to redo the ipxe binaries/config
<clever> and it will only ever be able to boot what you signed (line 57 of the file)
<clever> dhess: so you could pop a ipxe.efi into a EFI sys partition, whitelist its hash in the bios, and set a bios password
<clever> dhess: oh, and i also recently noticed a secureboot, that you can whitelist the hash of a .efi file, without having to deal with keypairs at all
<clever> dhess: nope, none of my machines support flashboot writing
<clever> dhess: and the main script.ipxe is loaded over the network (and signed) so you can still dynamically reconfigure ipxe remotely
<clever> dhess: so, assuming you can verify the ipxe binary (my original idea was to bake it into coreboot), every file loaded afterwards is signed by the keypair
<clever> dhess: and line 88 then runs ipxe (using the linux-kernel format, via -kernel), and sets up a tftp server with qemu
<clever> dhess: line 64 generates a custom build of ipxe, that has a script embeded into it (which permenantly enables requiring signatures), and embeds the certs
<clever> dhess: line 50 creates an ftp dir, with signed kernel, initrd, rootfs, and script.ipxe files
<clever> dhess: line 4 is a ipxe script with a complete menu, and the script itself is signed