2018-03-01

<clever> ottidmes: and if it has more jobs then they can handle, it will start one locally
<clever> ottidmes: it will prefer the remote hosts first, so it fills them up first
<clever> BlessJah: nice, but good luck finding a cheap chip like the allwinner that supports it
<clever> ottidmes: ah, then just leave maxJobs at 1
<clever> sphalerite: it already does so for arm stuff on my x86 hydra
<clever> sphalerite: i think nix will just ignore the preferLocal flag when it cant build locally
<clever> goibhniu: exactly, why waste the money on an entire phone, when you only need the cpu&ram
<clever> ottidmes: yeah, ive that will probably do what you want
<clever> sphalerite: yeah, that also seems likely
<clever> BlessJah: i believe they only require usb 2.0
<clever> BlessJah: and you dont have to deal with the fine pitch of a cpu or the high freq
<clever> BlessJah: so you could just take any small-ish lcd panel, a mini (or custom) usb keyboard&joystick/mouse, 3d print a case, slap in a pcmcia socket, and you can jam in an existing EOMA module for the processor
<clever> BlessJah: the interface has the following things: sata, ethernet, usb, 18/24 pin RGB LCD, MMC, SPI, I2C,
<clever> BlessJah: none that i know of right now
<clever> YegorTimoshenko[: yeah
<clever> sphalerite: this isnt as insane :P
<clever> BlessJah: so the entire laptop body/screen/keyboard can be reused when you switch to that fancy new RISC chip thats coming out
<clever> BlessJah: more that you replace the entire creditcard with a new module, but you can reuse everything else
<clever> BlessJah: have you seen https://www.crowdsupply.com/eoma68/micro-desktop ?
<clever> nixer101: yep
<clever> nixer101: yeah
<clever> nixer101: every system generation is a root, and there are some other roots for other things
<clever> nixer101: it has to be given an extra flag like -d or --delete-older-than, and ran as root, to delete those
<clever> nixer101: by default, nix-collect-garbage doesnt remove the roots, so you can undo things still
<clever> nixer101: so generation #1 and #2 of nixos had version 27.4.2, and nixos is keeping them incase you want to undo removing it
<clever> nixer101: what does this command say? nix-store --query --roots /nix/store/pwplsdk340pad0irimfvmm0kxkxd3ail-palemoon-27.4.2
<clever> nixer101: nix is only checking the links under /nix/var/nix/gcroots/
<clever> nixer101: the rollback generations in your profile kept those versions around by chance
<clever> nixer101: just delete those files and it should fix the issue
<clever> nixer101: and thats now persisting, and making that old version, the default version
<clever> nixer101: it looks like palemoon created those files when you ran it, to flag itself as the default browser
<clever> jonge: i think nix can still be used in the same store though, but ive not looked into guix that much
<clever> jonge: i think guix just doesnt have the allowUnfree flag, and doesnt allow unfree software
<clever> nixer101: can you pastebin the contents of the 2 palemoon files?
<clever> nixer101: do any palemoon files exist in /home/userp/.local/share/applications?
<clever> jonge: from what ive heard, it uses a different language in place of nix, but still uses the same .drv files and daemon, and focuses more heavily on only open-source software
<clever> nixer101: do you see it in one of these directories? ~/.local/share/applications ~/.nix-profile/share/applications/ or /run/current-system/sw/share/applications/
<clever> nixer101: how are you starting palemoon?
<clever> nixer101: just run it as your normal user
<clever> nixer101: what does "type palemoon" say?
<clever> nixer101: nix-env -q
<clever> yeah, all untracked files
<clever> -o appears to invert the action
<clever> Dezgeg: not sure what it will do if a file is in both .gitignore, and the git index
<clever> Dezgeg: its based on git ls-files
<clever> yep
<clever> so .o files just get filtered out automatically
<clever> so your changes persist, but your added files just vanish
<clever> teto2: but files that arent even in git, will be ignored
<clever> teto2: i think modified files that git is aware of will be copied into the nix store
<clever> so random junk like build/ and other un-commited files just vanish automatically
<clever> fearlessKim[m]: it also did filterSource magic to exclude every file that git isnt aware of
<clever> fearlessKim[m]: if any files have been modified, it reports all 0's
<clever> fearlessKim[m]: aha, it only reports a rev if the git repo is clean
<clever> { outPath = "/nix/store/dbznif876wsriw8y5zcwnsnir0i064fn-source"; rev = "0000000000000000000000000000000000000000"; revCount = 0; shortRev = "0000000"; }
<clever> nix-repl> builtins.fetchGit ./.
<clever> let me just run it and see what happens...
<clever> it does something with git ls-files and filterSource
<clever> it will then run git commands, as the user doing the eval (no need to mess with permissions), to inspect the state of the git repo
<clever> if its a set, it contains url/ref/rev/name
<clever> the 1st argument is either a attrset or a uri
<clever> line 188 defines the primop
<clever> let me see exactly what it does
<clever> fearlessKim[m]: that might solve the problem on lines 7-27 of the original fetchgitlocal
<clever> fearlessKim[m]: oh, nix 2 has builtins.fetchgit
<clever> which just gets messy
<clever> fearlessKim[m]: upon closer inspection, it tries to modify the directory, so it would need +w as well
<clever> fearlessKim[m]: so the nix build user needs permission to cd into whatever directory it happens to live at, and perform read based operations
<clever> fearlessKim[m]: line 4 calls toString on src, which forces it into a normal absolute path, not in the store
<clever> fearlessKim[m]: there is fetchgitlocal
<clever> fearlessKim[m]: cleanSource should deal with .git already, maybe build?
<clever> fearlessKim[m]: nothing that i know of, but you can still focus on just making the tree smaller, why is the directory so big that it runs out of memory?
<clever> it needs a patchelf like tool, that goes by a different name
<clever> i dont know much about how to package pre-built software on darwin
<clever> if you have a darwin version of the above url, nix could be updated, but brew is probably simpler
<clever> so it can only ever produce linux binaries
<clever> ldlework: its hard-coded to download a pre-built linux binary, and patchelf it
<clever> ldlework: allowBroken wont work
<clever> cannot coerce null to a string, at /home/clever/apps/nixpkgs/lib/strings.nix:85:38
<clever> error: while evaluating the attribute 'buildPhase' of the derivation 'dotnet-sdk-2.0.3' at /home/clever/apps/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
<clever> [clever@amd-nixos:~/apps/nixpkgs]$ nix-build -A dotnet-sdk --argstr system x86_64-darwin --arg config '{ allowBroken = true; }'
<clever> ldlework: what happened when you tried to nix-env -i it?
<clever> error: Package ‘dotnet-sdk-2.0.3’ in /home/clever/apps/nixpkgs/pkgs/development/compilers/dotnet/sdk/default.nix:48 is not supported on ‘x86_64-darwin’, refusing to evaluate.
<clever> [clever@amd-nixos:~/apps/nixpkgs]$ nix-build -A dotnet-sdk --argstr system x86_64-darwin
<clever> it exists on the linux version
<clever> lrwxrwxrwx 1 root root 67 Dec 31 1969 result/bin/dotnet -> /nix/store/63rsl125qchsggnk7dnr825kj0bzikzp-dotnet-sdk-2.0.3/dotnet
<clever> [clever@amd-nixos:~/apps/nixpkgs]$ ls result/bin/dotnet -lh
<clever> copying path '/nix/store/63rsl125qchsggnk7dnr825kj0bzikzp-dotnet-sdk-2.0.3' from 'https://cache.nixos.org'...
<clever> after checking out the latest master, on linux
<clever> [clever@amd-nixos:~/apps/nixpkgs]$ nix-build -A dotnet-sdk
<clever> ldlework: you may have some luck using nix-index and nix-locate on darwin
<clever> ldlework: ah, it may have different contents on osx
<clever> ldlework: on?
<clever> if i have root on any hardware, i can convert it to nixos in under an hour :P
<clever> thebardian: so you can just unpack the tar to /, run /kexec_nixos, and now nixos is running entirely from ram
<clever> thebardian: also, the kexec.nix in the same directory, generates a tarball containing kexectools, a kernel, and initrd (which contains a rootfs, and justdoit)
<clever> thebardian: and it can be pre-installed into the iso image, so you simply boot and run justdoit, lol
<clever> thebardian: that script does the entire install, from formating the disk to nixos-install
<clever> thebardian: and your root dataset has to have mountpoint=legacy set on it
<clever> thebardian: if you set fileSystems."/".fsType = "zfs"; it will automatically include the zfs tools in the initrd
<clever> boot.loader.efi.efiSysMountPoint
<clever> grub also needs a special flag, to tell it that the vfat is at /boot/efi
<clever> thebardian: for efi, you can either do vfat /boot, or ext4 /boot + vfat /boot/efi
<clever> thebardian: i still dont trust grub with zfs, so i go with ext4 /boot for legacy systems
<clever> nix-env -iA nixos.dotnet-sdk
<clever> The program ‘dotnet’ is currently not installed. You can install it by typing:
<clever> [clever@amd-nixos:~/apps/nixos-configs]$ dotnet
<clever> as in, what command would you run on a shell?
<clever> what is the binary called on most distros?
<clever> ldlework: which command do you want to run on the CLI?
<clever> you cant even buy things that small nowadays
<clever> fearlessKim[m]: so, i opted to put /boot onto a 64mb usb stick, lol
<clever> fearlessKim[m]: for my zfs based nas with a 3 drive raid array, i wanted to avoid stealing 512mb for /boot, because then i loose 512mb on all 3 drives
<clever> so you can always switch to stable if you have problems
<clever> and you are free to change an install between channels whenever you want
<clever> the nix-channel man page explains how to add/remove channels
<clever> [root@amd-nixos:~]# nix-channel --list
<clever> so its still pretty stable
<clever> and it still goes thru a wide array of tests before it updates
<clever> mfiano: i run unstable on all of my machines
<clever> it forked of off master then, and has only had bug fixes and the occasional version upgrade
<clever> mfiano: the 17.09 channel is from the 9th month of 2017
<clever> nix.package = pkgs.nixStable2; for example
<clever> there is an open PR to fix that
<clever> its not the default on master/unstable
<clever> then your likely on 1.11, you cna confirm with realpath $(which nix-build)
<clever> mfiano: does the nix command exist?
<clever> mfiano: none currently
<clever> mfiano: and cryptsetup
<clever> mfiano: check the man pages for pvcreate, vgcreate, and lvcreate
<clever> so, instead, i luks the lvm, then lvm contains both swap&zfs
<clever> but if you luks the swap, and luks the zfs, it will ask for 2 passwords on bootup
<clever> so the swap has to be seperate from the zfs
<clever> i use zfs, but it doesnt play nicely with swap
<clever> when using luks, i also include lvm in the system
<clever> lines 45-72 are a nix if statement, which will either insert 46-60 or 62-71, based on what you set kexec.justdoit.luksEncrypt to
<clever> justdoit.nix generates the bash script, based on nixos config
<clever> luks only uses your password to unlock a master key, and i think every sector has a unique IV, so its much simpler
<clever> and if the data is 0, then no bits are flipped
<clever> it just xor's the data with your password
<clever> in plain view of the world!
<clever> ive tried them before, every string of nulls on your hdd turns into your password, repeating endlessly :P
<clever> i think most of those will just use your password as a key
<clever> from the man page
<clever> Device type can be plain, luks (default), loopaes or tcrypt.
<clever> mfiano: i also have a bash script here, that just automates the entire thing
<clever> mfiano: this has to be added to the nixos config, which tells it to run `cryptsetup open --type luks /dev/sda2 root` during bootup
<clever> boot.initrd.luks.devices = [ { name = "root"; device = "/dev/sda2"; preLVM = true; } ];
<clever> but the /boot cant be encrypted
<clever> and if nixos is configured properly, it will do `cryptsetup open` on bootup
<clever> with those 2 commands, you can make a luks protected block device, and then format it with any FS of your choosing
<clever> `cryptsetup open --type luks /dev/sda2 rootfs` will create a /dev/mapper/root that points to the un-encrypted block device, and ask for the passphrase
<clever> `cryptsetup luksFormat /dev/sda2` will create a new luks volume, and ask for a passphrase
<clever> so you have several ways to unlock it
<clever> luks will then use that master key for the actual drive encryption
<clever> and all of those entries contain an encrypted copy of the same thing, a master key
<clever> each entry can be encrypted differently (passphrase, keyfile, maybe smartcard?)
<clever> mfiano: at the lowest level, the luks header contains a list of entries
<clever> mfiano: but if i just want to boot ubuntu or windows without any fuss and fancy config, i use virtualbox
<clever> mfiano: in general, i prefer qemu for most things, its better documented, more flexible, and open source
<clever> though then you loose paravirtual some
<clever> fearlessKim[m]: another option is to pass grub to -kernel, and then let grub read the config files, or just use a legacy MBR
<clever> fearlessKim[m]: and if you lack an initrd, the kernel must support the rootfs
<clever> 318 also does similar things
<clever> i think 562 then appends all kernel params
<clever> it starts with just argv[0] = "init"
<clever> fearlessKim[m]: follow the usage of argv_init in https://github.com/torvalds/linux/blob/master/init/main.c
<clever> fearlessKim[m]: ahh yeah, you need to mount the /boot and extract that image, i see the issue
<clever> fearlessKim[m]: but only when not using an initrd
<clever> fearlessKim[m]: i suspect that also has the entire /proc/cmdline
<clever> fearlessKim[m]: oh, also, try doing echo "$@" in stage2
<clever> fearlessKim[m]: i dont see you gaining that much time by skipping the initrd, its only going to save you one or 2 seconds of bootup time
<clever> ah, and a change from ~11 months ago added code extremely early in stage-2, that expects /proc to already be present
<clever> fearlessKim[m]: if an initrd is in use, it will mount /proc /sys /dev and /run before transfering control to stage2
<clever> that package has both a $out and a $dev
<clever> fearlessKim[m]: ah yeah, split outputs
<clever> fearlessKim[m]: try "env | grep --color lkl-2018-11-10-dev"
<clever> yep
<clever> ottidmes: in theory, your PBA image could do that, without even kexec'ing the right kernel
<clever> then the kernel will restore the ram and resume execution of the original kernel
<clever> the stage-1 in nixos will write the major:minor of a block device to /sys/power/resume
<clever> ottidmes: the problem, is that you have to run a special command against the swap device, to restore the original os image
<clever> ottidmes: i need to investigate hibernation more, i suspect it can still work there
<clever> ottidmes: nice, so that could entirely solve the luks on my laptop
<clever> ottidmes: i know somebody that has a similar setup, where his bios unlocks the drive, and thought it would need proper firmware support
<clever> ottidmes: do NVME drives support it?
<clever> dtz: prior to unlocking, you see a different set of blocks
<clever> dtz: its involved in unlocking a hdd with built-in crypto
<clever> ottidmes: ive not used the #! mechanics much either
<clever> ottidmes: --arg needs 2 params i think
<clever> ottidmes: so you can get away with having a single staticly linked ELF file in the initrd, and you dont even fork out a single child
<clever> ottidmes: the real fun part, is ripping sedutil and partprobe to shreds, and FFI'ing them into the same binary
<clever> :D
<clever> ottidmes: i also have a simpler one, that is more nixos-like, but can still be customized and stripped down more
<clever> ottidmes: this generates an initrd, with a haskell binary for init
<clever> ottidmes: oh, do you know any haskell?
<clever> ottidmes: ah
<clever> i'm trying to move it all into nixos-configs
<clever> yeah, i have stuff spread across nix-misc, nix-tests, nixcfg, and nixos-configs, lol
<clever> ottidmes: then it just has to be in the same directory, and nixos-install wont break it
<clever> ottidmes: i prefer doing ./nixcfg/shared/modules/foo.nix
<clever> nixops is also another solution, create an initial bare-bones install that only has sshd, then nixops takes over and does everything
<clever> id recomend using fetchurl, rather the NIX_PATH
<clever> ah, that issue
<clever> and the root is nvme0n1
<clever> but nvme drives do ${drive}p${part}, nvme0n1p1
<clever> scsi drives do ${drive}${part}, so, sda1
<clever> though the nvme support is poor right now
<clever> my version includes zfs, and optional luks support
<clever> ottidmes: that netboot image also includes justdoit, a bash script that fully automates a nixos install
<clever> ottidmes: this configures a laptop to act as a router, complete with nat, dhcp, bind, tftp, httpd, and full network booting
<clever> and then ive taken it to more extreme levels
<clever> with its own nixos config
<clever> so now i have a 2nd copy of nixos, in the /boot partition
<clever> and 16-19 configurs grub to present that in the menu
<clever> ottidmes: and then line 22/23, grab the kernel and initrd (and the initrd contains the entire rootfs), and sticks them into /boot/
<clever> ottidmes: that pulls in the netboot-minimal.nix module, and the custom module on line 9-13
<clever> ottidmes: line 3-13 basically does the same thing as import <nixpkgs/nixos>, no idea why i made it more complex then, lol
<clever> ottidmes: oh, let me grab a related example
<clever> any-attrset.nix can also be a function
<clever> and all the arguments you set with --arg, are passed to each
<clever> foo, bar, and baz, can be functions
<clever> ottidmes: -A foo.bar.baz
<clever> ottidmes: also, -A is way more fun then you think
<clever> ottidmes: ah
<clever> ottidmes: if you gist your expression, i can make an example of how to add it to the initrd example i made
<clever> ottidmes: is sedutil in nixpkgs?
<clever> ottidmes: but this also gets the kernel params (a string) and the kernel itself, and bundles it all up
<clever> you can even set things like boot.kernelPackages to change out the kernel&modules
<clever> ottidmes: fill in the right fields of configuration on line 2, and it should modify the initrd
<clever> ottidmes: that will generate a directory containing a kernel, initrd, and the kernel params
<clever> ottidmes: nix-build pre-boot-image.nix -A build
<clever> ottidmes: how does this look?
<clever> ottidmes: yeah, writing that now
<clever> ottidmes: one min
<clever> ottidmes: ahh
<clever> ottidmes: hmmm, what exactly are you trying to do?
<clever> 1: nix-build '<nixpkgs/nixos>' --arg configuration '{ imports = [ ./configuration.nix ]; system.build.initialRamdisk = foo; }'
<clever> ottidmes: several options
<clever> which resulted in an unexpected hash in the url from the errors, and all the hashes we gave failing
<clever> abathur: and we where editing the wrong one, because the --show-trace was clipped to omit the key detail
<clever> abathur: when i was helping to fix that reflex-platform fetchnixpkgs issue, there was 2 fetchNixpkgs.nix files
<clever> abathur: it also needs to be programed to detect users giving false answers to questions
<clever> so they dont have to ask the same stuff
<clever> gchristensen: and also to record the answers for a ticket that can be passed up to tier2
<clever> gchristensen: something ive been wanting to find is a good tier1 support bot, you just give it a tree of questions&answers, with some invisible questions based on past state, and then it can be programmed to solve basic problems
<clever> not sure about the state of the current one
<clever> the last wiki was shutdown due to spam
<clever> which is why the 2nd fault never came out
<clever> that fault causes it to use the 1.11 method on 1.12pre
<clever> michalrus: the test is only broken for 1.12pre, it works fine for 2.0
<clever> michalrus: pass it 2 hashes, one from `nix-prefetch-url` and the other from `nix-prefetch-url --unpack`
<clever> michalrus: 1.12pre is "older" then 1.12, so it never actually used the new logic on the new version
<clever> michalrus: and the test on line 21 was also broken
<clever> michalrus: yeah, the wiki is wrong, it wasnt tested enough on 2.0
<clever> michalrus: this expression is broken, and a given hash will only work on 1.11, or 2.0, and not both
<clever> michalrus: line 35 wants the sha256 of the packed&compressed tarball
<clever> michalrus: line 27 wants the sha256 of the unpacked tarball
<clever> michalrus: yeah, i think i see the problem
<clever> michalrus: i have some thoughts, checking...

2018-02-28

<clever> MichaelRaskin: so shells i leave open on nfs dirs just break randomly
<clever> MichaelRaskin: and nfs doesnt remount cleanly enough to restore that
<clever> MichaelRaskin: ive found the systemd auto-mount stuff to not be aware of the working directory for processes
<clever> sphalerite: basically, the nix-daemon will need to setup a listening unix socket in the build sandbox, and proxy multiple bytestreams back to the nix-build process that initiated the build
<clever> sphalerite: and on the subject of the nix protocol, it will need to be modified to support https://github.com/NixOS/nix/issues/1256
<clever> sphalerite: to solve what i just said, i'm thinking there could be a util that accepts queries on stdin, and prints answers to stdout, and keeps its nix-daemon socket open
<clever> each query process has to connect to the daemon, which initiallized an entire tempdir and a bunch of state, then tears ti down
<clever> for example, for x in /nix/store/*; do nix-store --query --size $x ; done is horid slow
<clever> also, ive wanted more of a repl to the daemon for things
<clever> ahh
<clever> sphalerite: nix also saves all logs in /nix/var/log/
<clever> and the only way to parse it is to know what type is next, based on the state and what bytes you have already read
<clever> sphalerite: oh, on the subject of parsing the protocol...
<clever> sphalerite: ssh does have complete socket activation in its nixos module, you can check that as an example
<clever> and systemd will re-launch it as needed
<clever> sphalerite: with the current socket activation, you could just have nix-daemon exit(0) after an hour of inactivity
<clever> ottidmes: nice
<clever> sphalerite: and it was the server for nfs based netboots
<clever> sphalerite: one of my old NAS's was network booting