2020-04-30

<clever> jumper149: i believe it returns a set, you can confirm that in `nix repl`
<clever> hr[m]: builtins.toFile and builtins.toJSON
<clever> energizer: ah, in my case, it was a linux router, so i had the ability to record all the stats i wanted
<clever> energizer: i never figured out how to "fix" it, but reducing the ping to every 1 sec made the problem nearly invisible
<clever> energizer: and it was configured to ping every 20 seconds, so it would always recover within 20 seconds, from an otherwise "permanent" hang
<clever> energizer: and after much debugging, i eventually tracked it down to a bug in the pppoe drivers on linux, and that the pppoe pings bypassed the "permanent hang", and would fix the state
<clever> energizer: and then after a while of that, i noticed, every time i had a problem, upload hit a perfect 0/second and download suffered (due to a lack of ack packets)
<clever> energizer: i had written it to poll them every second, and render a real-time thruput graph, for both directions
<clever> energizer: last time i had such issues, i wrote a custom program to watch the byte counters in /proc/net/dev
<clever> jboy56: `import <nixpkgs>` returns a function, you want `import <nixpkgs> {}` to call that function
<clever> zxcvqwfp: was there another lib in a place we didnt think to look?
<clever> oops
<clever> TargetName Type Endian TapName State
<clever> zxcvqwfp: if you set those env vars, ld.so will print its own debug, as it tries to resolve all the DT_NEEDED's
<clever> zxcvqwfp: lddtree makes it much more obvious which one is to blame
<clever> zxcvqwfp: you must patchelf the rpath, of all of the other .so files
<clever> zxcvqwfp: its in the DT_NEEDED of one of the other .so files, in the same dir
<clever> zxcvqwfp: libXrandr.so.2 is not in the DT_NEEDED of that binary
<clever> zxcvqwfp: and what is the rpath? patchelf can print it
<clever> xelxebar: and what is the rpath? patchelf can print it
<clever> zxcvqwfp: what does `file` say when ran on the binary?
<clever> zxcvqwfp: is it a 32bit or 64bit binary?
<clever> Alexey37: that function takes a haskell package, and does the override for you
<clever> Alexey37: haskell.lib.dontCheck
<clever> srk: everything else worth playing just works under proton+steam
<clever> srk: space engineers and elite dangerous are the only 2 games that fail under proton and i sometimes want to play
<clever> morgrimm: proton is steam's fork of wine, that has been improved to support most games, and is baked into the linux steam launcher
<clever> morgrimm: ive found that gpu passthru tends to be picky, and you tend to have to reboot constantly, on the host side
<clever> ornxka: theres also pgrep
<clever> glittershark: but then it wont work for unwrapped things
<clever> not sure how those interact with killall and pidof
<clever> there are tricks to fudge argv[0] when launching the wrapped binary
<clever> glittershark: depends on how the binary is named, some things are .foo-wrapped
<clever> cinimod: you want to just set no profiling on the packages your building, and not use mkDerivation to force it to everything
<clever> turlando: simplest is to just secure physical access to the machine
<clever> cinimod: if you make any changes from default, then it wont be cached
<clever> cinimod: by default, hydra is building everything twice (in the same derivation) with and without profiling
<clever> turlando: the worst that can happen, is that somebody could read your /boot partition, and then impersonate the machine, then wait for you to enter a pw
<clever> turlando: oh right, nvm, i was thinking zfs key, not ssh host key
<clever> cinimod: because hydra had pre-built everything with profiling off, changing that means you must now build EVERYTHIGN yourself
<clever> turlando: but that also means the key will be in plaintext within /boot, so it wont be secure enless you encrypt /boot via some other means
<clever> turlando: nix is going to copy the file into the initrd for you, so it doesnt matter where you put it
<clever> turlando: /run/keys is managed by nixops, you probably want to use a different directory
<clever> turlando: i just build a custom installer image (like the ISO) that has that script pre-installed in systemPackages, then just run ot
<clever> turlando: the file i linked is exactly that, a shell script to create everything
<clever> turlando: this is how i usually configure things: https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix#L95-L105
<clever> so i may give coredump its own dataset, to turn snapshots off there
<clever> turlando: and then on a case by case basis, add more with diff options, for example, /var/lib/systemd/coredump can have a lot of churn on some machines, and the snapshots of / then eat a lot of space
<clever> turlando: personally, i have seperate datasets for / /nix /home and then turn on snapshots for everything except /nix
<clever> turlando: i find it much simpler to just leave /nix on the main storage pool, so you dont have any problems in the future if it ever baloons up to 300gig, since you would have terrabytes available
<clever> its also running a hydra
<clever> that nas is a raidz1 of 3 x 4tb disks
<clever> dont trust the size column, zfs makes it a lie
<clever> naspool/nix 434G 130G 305G 30% /nix
<clever> Filesystem Size Used Avail Use% Mounted on
<clever> turlando: for my nas, the nix store is on the main pool for all storage
<clever> turlando: its 74gig on my main desktop
<clever> turlando: if you have other nixos builds, and do a lot of development, it can grow
<clever> i'm using zfs and compression
<clever> turlando: the nixos build for my main desktop, totals to ~7.8gig, including wine, chrome, steam, and other large packages
<clever> cinimod: then you dont need the rvar = rvar; mess
<clever> cinimod: lines 9-12, you want hself, not self.haskellPackages
<clever> manveru: not completely sure, but i think it just got renamed, and you get that error if you mix nixpkgs versions
<clever> i should get to bed
<clever> and its getting late here, 1:36 am, dang
<clever> worldofpeace: ah, the note you linked is more about running both at once, so NM ignores a certain IF
<clever> worldofpeace: i checked this, and i dont see it reading the cfg
<clever> ive just avoided NM like the plague
<clever> or booting from the installer, and using nixos-enter and `nixos-rebuild boot` to repair it
<clever> about the only thing you can really try is usb tethering from the phone
<clever> ive got no idea then
<clever> metasyntactical: did you also change nixpkgs at the same time?
<clever> so that shouldnt work
<clever> metasyntactical: network manager appears to entirely ignore networking.wireless.networks
<clever> metasyntactical: did you update nixpkgs at the same time?
<clever> metasyntactical: all it does is generate a wpa_supplicant.conf file, it should make zero difference
<clever> which method "works", because it sounds like all methods fail
<clever> gotta love surprise auto-complete, lol
<clever> so any failures, leave the old stuff intact
<clever> metasyntactical: which is exactly the reason nixos-rebuild switch doesnt delete old kernels until it has copied everything that is "current"
<clever> metasyntactical: the only thing i can really thing of, is that the wifi driver in the kernel is totally fubar
<clever> metasyntactical: why is it showing 3 different networks, do you have multiple routers? any chance the pw got changed on one or more?
<clever> metasyntactical: what does `scan_results` say exactly?
<clever> metasyntactical: and maybe also enable_network <n>
<clever> metasyntactical: try using `select_network <n>` on the net number
<clever> metasyntactical: and if you run `list_networks`, does it show the same ssid?
<clever> metasyntactical: and if you run `list_networks`, does it show the same ssid?
<clever> energizer: isnt that what https://nixos.org/nixos/options.html#initrd.network.enable is for?
<clever> Raito_Bezarius: also, nearly half the machine is empty, so you could make a much smaller case with the exact same motherboard
<clever> Raito_Bezarius: but system76 didnt have any gpu choices for this model
<clever> Raito_Bezarius: but from the photos, you can clearly see the gpu and gpu-ram missing, and a void where the gpu heatsink/fan are supposed to go
<clever> Raito_Bezarius: i dont really watch the freq enough to know
<clever> metasyntactical: and if you run `list_networks`, does it show the same ssid?
<clever> Raito_Bezarius: doesnt seem to get too hot, but it mostly just sits on a desk near me
<clever> metasyntactical: if you run `scan`, wait for results, then `scan_results`, does it show your network?
<clever> Raito_Bezarius: https://imgur.com/a/hMY9A
<clever> metasyntactical: you used nmcli to connect, but wpa_supplicant should already be connecting
<clever> metasyntactical: does wpa_cli connect now? what does the status cmd within it say?
<clever> metasyntactical: stop using network manager commands, wpa_supplicant only
<clever> Raito_Bezarius: there was no gpu options when ordering, but opening the case up, there is a very clear void where a gpu is meant to go
<clever> 00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
<clever> Raito_Bezarius: integrated gpu
<clever> Raito_Bezarius: i believe it was the kudu
<clever> metasyntactical: wpa_supplicant must be ran as root, or nothing will work at all
<clever> metasyntactical: wpa_supplicant must be ran as root, or nothing will work at all
<clever> metasyntactical: can you screenshot the current conf file?
<clever> add that, to the generated file
<clever> 2020-04-30 00:30:58 < clever> adding this line to the config will enable wpa_cli control as well
<clever> 2020-04-30 00:30:48 < clever> 2020-04-30 00:19:50 < clever> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
<clever> metasyntactical: add that, and restart wpa_supplicant
<clever> metasyntactical: did you add the ctrl_interface line to the config file?
<clever> metasyntactical: does `ifconfig` show an ip on the interface?
<clever> metasyntactical: what does `iwconfig` say, does it show a link quality?
<clever> metasyntactical: you can likely ignore the dbus stuff entirely
<clever> adding this line to the config will enable wpa_cli control as well
<clever> 2020-04-30 00:19:50 < clever> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
<clever> metasyntactical: and use wpa_passphrase to generate a sample config
<clever> metasyntactical: the file can be called anything
<clever> metasyntactical: use a text editor to just make a new file, and point the -c flag to it
<clever> what error?
<clever> and then add that fragment to wpa_supplicant.conf
<clever> you can also use wpa_passphrase <name> <pw> to generate a fragment of the config
<clever> try stopping nm, and then just manually run it, something like: wpa_supplicant -s -u -Dnl80211,wext -c /etc/wpa_supplicant.conf -iwlp3s0
<clever> enless you stop network manager, and manually re-launch wpa_supplicant
<clever> then you likely cant control it with wpa_cli
<clever> metasyntactical: ah, those ones dont count
<clever> metasyntactical: what path is that at, and what is the full name?
<clever> metasyntactical: but does it have a unix socket open?
<clever> Raito_Bezarius: no clue whats going on, and a rollback doesnt solve it
<clever> Raito_Bezarius: was working great, after a recent trip though, the wifi has been acting up
<clever> metasyntactical: do you see anything similar on your end?
<clever> 2 of them infact
<clever> wpa_suppl 2211 root 16u unix 0xffff9011df890800 0t0 30178 /var/run/wpa_supplicant/wlp3s0 type=DGRAM
<clever> metasyntactical: if i lsof the pid of wpa_supplicant, i can see that its listening on a unix socket in that dir
<clever> wpa_suppl 2211 root 20u unix 0xffff9011e4fe8400 0t0 25488 /var/run/wpa_supplicant/p2p-dev-wlp3s0 type=DGRAM
<clever> [root@system76:~]# lsof -p 2211
<clever> wpa_cli will obey the $WPA_CTRL_DIR var, which likely has to match the one in the wpa_supplicant.conf file
<clever> check the args to wpa_supplicant itself, what file is it using? is the ctrl_interface diff?
<clever> it also needs this entry in the config
<clever> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
<clever> [root@system76:~]# cat /etc/wpa_supplicant.conf
<clever> you can also do `scan`, and when its done, `scan_results` to see the current networks
<clever> when i do that, and run `status`, i can see the current network name and all the other info
<clever> metasyntactical: did you tell it which interface to connect for?
<clever> [root@system76:~]# wpa_cli -i wlp3s0
<clever> you can also just edit wpa_supplicant.conf (which is why nix doesnt manage it for me), and restart the wpa_supplicant.service in systemd
<clever> or wpa_gui
<clever> metasyntactical: thats trivial with wpa_cli
<clever> metasyntactical: i just always use wpa_supplicant bare, with wpa_supplicant.conf un-managed, and it has worked great
<clever> Raito_Bezarius: pretty sure you will always have wpa_supplicant, because network-manager uses wpa_supplicant behind the scenes
<clever> metasyntactical: what does `man nmcli` say?
<clever> so i had to add a dummy char on the end, lol
<clever> i would set the network to "abc" and then `iwconfig` would say its looking for "ab"
<clever> Raito_Bezarius: at one time, the wifi driver for my card would cut the last byte off the network name, lol
<clever> metasyntactical: are you able to just plug in an ethernet cable?
<clever> Raito_Bezarius: but by default, it shares the same <nixpkgs> as the main nixos, and will rebuild every time, so bugs within nixpkgs itself (or the kernel, or other stuff) can break the rescue env
<clever> it operates entirely from ram, and is isolated from your / partition, so it can act like a rescue env
<clever> Raito_Bezarius: and if you want to make the free space on /boot even worse!, this will build a 2nd nixos, and jam it into /boot and your grub menu, using the same netboot stuff i talked about earlier
<clever> but thats only partially of use, because 10 generations could share a single kernel/initrd, or they might wind up with 10 different ones of each
<clever> Raito_Bezarius: you can also use this flag, to limit how many generations it keeps on /boot/
<clever> Raito_Bezarius: so if it fails copying things, it wont break the config thats already on-disk
<clever> Raito_Bezarius: it wants to copy all current generations first, and update the config, before it begins deleting obsolete ones
<clever> Raito_Bezarius: it will delete the old kernels, after it has copied the new ones into /boot/
<clever> fonts.fontconfig.enable
<clever> thongpv87: if you enable fontcont in nixos, it will generate a /etc/fonts for you
<clever> energizer: i went the reverse, i replaced the dhall config stuff with nix, lol
<clever> bqv: not-os already ripped the systemd out :P
<clever> Raito_Bezarius: and it will then persist for all deploys
<clever> Raito_Bezarius: when you run this, the -I nixpkgs=... gets recorded to the nixops state file
<clever> # nixops modify -d rpi nixops.nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/45e01e508a792077c77067467e07bce757932fb6.tar.gz
<clever> Raito_Bezarius: it also manages the custom bootcode.bin in /boot, so it can boot without any of the official blobs
<clever> Raito_Bezarius: this lets me deploy nixos, cross-compiled, to an rpi3
<clever> i use nixops to manage my NAS and router, ans also my fully open pi
<clever> Raito_Bezarius: except for the first deploy with nixops
<clever> or just reboot
<clever> Raito_Bezarius: at that point, you have to manually build the wg module for the old kernel, copy-closure it, and insmod it
<clever> Raito_Bezarius: when the kernel versions desync, modprobe starts using /run/booted-system/ to find kernel modules, so it can reference the nixos it had booted from (with the older kernel stuff)
<clever> Raito_Bezarius: if A and A' use the same kernel version, it will load just fine
<clever> it still needs a "reboot", but its not going to fail then
<clever> but with my `nix copy` based idea, you boot an installer env, deploy the config to the disk, then boot that config
<clever> and then you immediately have to reboot, because the kernel is old and cant load the wireguard driver
<clever> currently, you would boot an old nixos from an AMI image, and deploy your full config with wireguard
<clever> this is also a problem that would be solved by my `nix copy` idea previously explained
<clever> Raito_Bezarius: nixops can then detect that, and trigger a reboot, if you --allow-reboot
<clever> Raito_Bezarius: this script will exit with code 100 to signal that special failure
<clever> Raito_Bezarius: if the internal api of systemd changes, you cant dynamically reload systemd and switch to the new generation
<clever> Raito_Bezarius: there is partial support for auto reboot, one min
<clever> Raito_Bezarius: --force-reboot
<clever> and you cant assume wg is in $PATH before you deploy, so you have to copy-closure it first
<clever> so the central box never knows the secrets
<clever> and only then, can you build the deployment (and bake pubs into everything), and deploy nixos to each
<clever> to do it "securely", you would want to copy-closure the wireguard binary to the remote machines, and run the keygen commands over ssh, storing the secret remotely, and public in the nixops state
<clever> that reminds me, i was thinking about how wireguard would work in nixops
<clever> and now you need to insert a p between device and partition!
<clever> because sata uses /dev/sda1, but nvme uses /dev/nvme0n1p1
<clever> so you can then test how justdoit behaves on each
<clever> and then configures justdoit for each of those situations
<clever> booting with either legacy or uefi
<clever> qyliss: this has code to spin up a qemu with either a sata, pata, nvme, or virtio disk
<clever> so if you forget to shutdown vbox, qemu will fail to open /dev/kvm
<clever> you can load both drivers at once, but only one can actively have a guest running
<clever> but, virtualbox and /dev/kvm conflict when in use
<clever> virtualbox+windows also supports dynamically resizing the "monitor", so the desktop always fits the window
<clever> if i just want to boot an existing distro (including windows), i use virtualbox
<clever> if i'm testing linux stuff and messing with kernels, i use qemu
<clever> which is what qemu then uses to accelerate its emulation
<clever> Raito_Bezarius: this explains the raw kvm api on linux
<clever> oh, also...
<clever> and i could see that also complicating the bootloader, for any os that expects to boot in real, then transition to virtual
<clever> Raito_Bezarius: which means running a realmode os like dos isnt possible
<clever> Raito_Bezarius: the 2nd-last paragraph says that VT-X (intel?) requires paging (virtual memory) to be enabled in the guest
<clever> Raito_Bezarius: and they alreadu use nix to build it
<clever> Raito_Bezarius: somebody linked me to https://spectrum-os.org/ recently...
<clever> Raito_Bezarius: and haskell-init?
<clever> Raito_Bezarius: have you seen not-os?
<clever> energizer: when a given attrpath isnt found, the or uses the fallback
<clever> > let foo = { a = 1; }; in foo.b or "fallback"
<clever> energizer: not sure why the bot is behaving differently, but the or keyword only works after a set
<clever> > or

2020-04-29

<clever> Raito_Bezarius: i still see rpi users editing /etc/rc.local, and its now systemd based
<clever> cole-h: a single shell command to format your disk and install nixos, with zero confirmations, lol
<clever> Raito_Bezarius: this says to install to /dev/vda, with a 40gig swap, and 512mb /boot, an to enable luks, https://github.com/cleverca22/nixos-configs/blob/master/netboot_server.nix#L20-L27
<clever> Raito_Bezarius: the main limit of justdoit, is that you need to describe how you want it installed, before you make the installer image
<clever> adisbladis: it also cant hide snapshot names
<clever> adisbladis: zfs native crypto doesnt hide the dataset name or the size of the dataset
<clever> Raito_Bezarius: justdoit also supports zfs on luks, though i should remove the lvm layer, nixos doesnt need that anymore
<clever> and i hit the bit 400, lol!
<clever> because MBR limited the type to 1 byte, and things got messy :P
<clever> behind the scenes, gpt uses uuid's for the types of all partitions
<clever> Raito_Bezarius: those are gpt typecode uuid's
<clever> Raito_Bezarius: its already using zfs for everything
<clever> Raito_Bezarius: just modify justdoit.nix to add the right cmd during dataset creation
<clever> you literally just type `justdoit` into a root shell, and your done
<clever> Raito_Bezarius: that is a shell script, which will install nixos with a single command
<clever> Raito_Bezarius: this also includes justdoit on the netboot image...
<clever> and the NAT shares whatever wifi the laptop has
<clever> Raito_Bezarius: any machine plugged into the ethernet port, will then netboot nixos
<clever> Raito_Bezarius: this will setup a laptop to run dhcp+bind+tftpd+nginx on the ethernet port, and run NAT from ethernet->wifi
<clever> oh, also...
<clever> because the netboot code puts the entire rootfs into the initrd
<clever> Raito_Bezarius: most of my code to boot nixos in ram (kexec, multi-boot-helper, and others) is just grabbing that netboot kernel/initrd, and then booting it via something else
<clever> Raito_Bezarius: this generates an ipxe script
<clever> Raito_Bezarius: the netboot stuff in nixos also already supports ipxe
<clever> Raito_Bezarius: havent seen that, but packet.net also allows it, you just give it the url to an ipxe script i believe
<clever> or to make a /boot only disk image, that boots directly from ram
<clever> but it can also be used as another option, when kexec isnt supported in your rescue kernel
<clever> it was originally made to help a guy, that wanted to put a dozen distro installers onto 1 USB stick
<clever> it will behave like a livecd, so all changes are lost at shutdown
<clever> energizer: you would then add that fragment of config to your grub file, and copy the other 2 to /boot, and then you can launch the installer from grub, like any other os in a multi-boot setup
<clever> energizer: this will generate a kernel, initrd, and grub fragment, to boot nixos into ram
<clever> energizer: i also have...
<clever> energizer: though, it could just be the /boot alone, with a kernel/initrd, and then procede to the 2nd function i gave above
<clever> energizer: but DO requires that it be ext3 or ext4...
<clever> armin: cant remember if thats an option or not
<clever> so you can just boot the livecd, and let nixops install to disk
<clever> adisbladis: the "none" backend would also have livecd support, you boot the existing ISO on baremetal, point nixops to it, and just run the 2nd function
<clever> for packet.net, you can pxe boot the kernel+initrd, then use the 2nd func
<clever> for something like OVH, use the api to force it into the netboot rescue console, then use the 1st func to kexec, and the 2nd to deploy
<clever> for aws, skip the kexec stage, use an ami that boots the kernel/initrd directly
<clever> adisbladis: then each provider like aws, will call the right ones, depending on what the provider can do
<clever> adisbladis: the 2nd fucntion then takes ssh creds for a nixos running from ram (kexec, livecd, other similiar ones), and will `nix copy` to /mnt/nix/store, and activate
<clever> adisbladis: i was thinking of it being a plugin that offers 2 main functions, the 1st takes ssh credentials for "not nixos" and will kexec into nixos (which aws can skip, as above)
<clever> adisbladis: and finally, run nixos-install with a storepath, to activate the bootloader
<clever> adisbladis: then nixops would use `nix copy` like in the above ticket, to copy to /mnt/nix/store on the aws machine
<clever> adisbladis: for aws, you would have an AMI that contains the same kernel/initrd (plus changes to deal with aws ssh keys), and grub, and boots with root in ram
<clever> adisbladis: and for aws, you could skip the kexec even, just put the same kernel/initrd into an AMI with grub, and boot it to ram always
<clever> adisbladis: but kexec provisioning would make generation #1 be your exact config
<clever> adisbladis: so once nixops has deployed, you basically doubled your disk usage, due to a mass-rebuild
<clever> energizer: it requires a reboot
<clever> adisbladis: one anoyance with image based stuff like the AMI's in aws, is that your rarely deploying the same nixpkgs revision
<clever> adisbladis: so nixops can copy a pre-made closure to the target, and immediately activate the bootloader cfg
<clever> adisbladis: it also includes directions on how to skip configuration.nix, and just use `nix copy` to copy to /mnt/nix/store on the remote machine
<clever> adisbladis: yeah, thats what the ticket i linked is for
<clever> so you could go to basically any cloud provider, provision a generic linux distro, then just give nixops the ip and root pw, and bam, its now nixos
<clever> energizer: that ticket is also about extending nixos, to support kexec'ing any target to nixos
<clever> energizer: there is also now a shell-script to automate the kexec: https://github.com/NixOS/nixops/issues/1189#issuecomment-615934491
<clever> but kexec lets you wipe the disk clean, and do whatever you want
<clever> the limitation with NIXOS_LUSTRATE, is that you are forced to keep the existing partition layout and FS type
<clever> reconnect over ssh, format, mount, nixos-install as usual
<clever> energizer: build a tar file, copy it to the "victim", unpack and run 1 cmd, and boom, its now running nixos entirely from ram
<clever> but the kexec tools are a lot more flexible/simple