2018-02-26

<clever> i believe the --dry-run stops it from actualy deleting anything, so you can preview the action first
<clever> sophiag: which will just set a cut-off point in time
<clever> sophiag: not directly, but there is `nix-collect-garbage --delete-older-than 30d --dry-run`
<clever> and i use them enough that its all automatic
<clever> mfiano: nope, i just type really fast
<clever> comes to 3gig on my router
<clever> 3.0G total
<clever> 578M /nix/store/c1lqq2yd6xgk2m940m6ldhlnbwgj0vah-clang-4.0.1
<clever> 254M /nix/store/haa62nc1zz7327d2l6iyghi8lsbwjr08-go-1.9.2
<clever> shared*
<clever> but a very large chunk of that, is ahred with 392, 391, and a couple of others
<clever> mfiano: this is the total size of everything that generation 393 used
<clever> [root@router:~]# du -hc --max=0 $(nix-store -qR /nix/var/nix/profiles/system-393-link) | sort -h
<clever> mfiano: and you can also `nix-store --delete` just one of those, so you dont ruin the cache
<clever> 279M total
<clever> 192M /nix/store/8fchpdqskkzlwjamvb5lvyqw8zwzm9x8-systemd-237
<clever> 23M /nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131
<clever> du will now sum up how big every piece of garbage is
<clever> [root@router:~]# du --max=0 -hc $(nix-store --gc --print-dead) | sort -h
<clever> you have to know the full path to use it
<clever> but nothing refers to it, so it wont be used automatically
<clever> mfiano: yeah, it doesnt call it cache, but it is caching a copy of chrome, incase you want it again
<clever> sophiag: [root@system76:~]# ls -l /nix/var/nix/profiles/
<clever> mfiano: simpler to just use that directly
<clever> mfiano: thats basically what nix-collect-garbage does
<clever> i think this just lists all garbage
<clever> sophiag: also, nix-store --gc --print-dead
<clever> so its a balance between how much space you want, and how much bandwidth you want to waste re-downloading lesser used things
<clever> sophiag: it will just delete all un-rooted things, freeing up a ton of space, and ruining your cache, so you have to redownload a lot for nix-shell or nix-build
<clever> mfiano: nix-env --delete-generations
<clever> i get obsessed with knowing how things work, and consume source code like its food :P
<clever> it builds <nixpkgs/nixos> -A system, and then stores that in the newest generation
<clever> behind the scenes, nixos-rebuild is just a wrapper for nix-env -p /nix/var/nix/profiles/system
<clever> and from the man page, nix-env --delete-generations generations...
<clever> sophiag: `nix-env --list-generations` as each user that has used nix-env, and also `nix-env --list-generations -p /nix/var/nix/profiles/system` for the nixos generations
<clever> it will still obey roots, and refuse to delete anything you might need
<clever> also, if you know a particular store path that is rather fat, you can just `nix-store --delete /nix/store/that-path`
<clever> and the rollbacks are all gc roots
<clever> nix refuses to delete anything that is rooted
<clever> ah
<clever> sophiag: then just stops when it hits the requested number
<clever> sophiag: it only deletes things that are un-rooted, and it counts the bytes as it deletes things
<clever> it will still preserve all GC roots, so rollbacks are un-affected
<clever> that will delete 2gig worth of garbage, and stop
<clever> sophiag: one handy trick, nix-collect-garbage --max-freed 2g
<clever> mfiano: xserver.desktopManager.xfce.enable = true; and dont touch anything related to window managers
<clever> mfiano: xfce is the one i prefer
<clever> mfiano: try another WM and see if it still happens?
<clever> Havvy: postgress is dead: https://hydra.nixos.org/
<clever> disasm: overrides/overlays
<clever> disasm: in my case, i pinned the deployment to a rev on github, so it doesnt care about local nixpkgs at all
<clever> because nix tries to singlequote the entire thing
<clever> oh, and the singles will need \'s
<clever> mfiano: try ''quotes'' instead
<clever> fragamus: clone that, and then just run `nix-build -A swift` in the root directory
<clever> mfiano: and just confirming the syntax is valid without doing a full build
<clever> mfiano: its a lot more handy when it comes to smaller strings
<clever> copy, echo -e <paste>, lol
<clever> i think the only way around that is to throw it at `echo -e`, lol
<clever> nix-repl escapes linebreaks
<clever> or add nix-repl to systemPackages
<clever> nix-env -iA nixos.nix-repl
<clever> mfiano: with just that, you can see how nix parses your configuration.nix to generate its shellInit
<clever> mfiano: and :r to reload everything
<clever> then eval config.environment.shellInit
<clever> for example, try nix-repl '<nixpkgs/nixos>'
<clever> its massively useful
<clever> mfiano: i also did nix-repl '<nixpkgs>' and tab-completed gitAnd then .h and .git-e
<clever> mfiano: git-extras was the hint i needed to also find hub
<clever> [clever@system76:~/nixops]$ grep -r --color git-extras ~/nixpkgs/
<clever> nix-repl> gitAndTools.hub
<clever> nix-repl> gitAndTools.git-extras
<clever> /home/clever/nixpkgs/pkgs/applications/version-management/git-and-tools/default.nix: git-extras = callPackage ./git-extras { };
<clever> mfiano: at a quick glance, i dont see it
<clever> fearlessKim[m]: id add a checkPhase to the derivation that manages the vim config, that runs vim against the config file
<clever> using the giant nix-diff incantation above, to diff 2 nix files
<clever> my router is getting a similar overhaul
<clever> at the bash layer
<clever> maybe it never needed escaping in the first place
<clever> ah
<clever> mfiano: so you may need to "\\?" it
<clever> mfiano: oh, but the bash that this generates might be invalid then
<clever> mfiano: i think you can just environment.shellAliases."?" = "man";
<clever> mfiano: double most of the time
<clever> an example from a config i'm editing now
<clever> fileSystems."/media/videos/4tb/" = {
<clever> keys in a set can be quoted
<clever> mfiano: ah, just quote it
<clever> mfiano: ${ inside a ''string'' is escaped as ''${
<clever> disasm: now i can diff the original router config, against a refactored version
<clever> [clever@system76:~/nixops]$ nix-diff $(readlink original) $(nix-instantiate -I nixpkgs=https://github.com/nixos/nixpkgs/archive/8bce347f02f6bd606ec1822f0ba9b94d7f139071.tar.gz '<nixpkgs/nixos>' -I nixos-config=./router.nix -A system)
<clever> disasm: i believe the -I flag from create/modify, is stored into the state file, and then persists from there
<clever> disasm: aha
<clever> disasm: [clever@system76:~/nixops]$ nixops modify router_deployment.nix -I nixpkgs=https://github.com/nixos/nixpkgs/archive/8bce347f02f6bd606ec1822f0ba9b94d7f139071.tar.gz
<clever> i'm trying to track down how to set the nix_path in the same region
<clever> i think i was mixing different python files up
<clever> there is another mode that looks only at the { and } chars
<clever> mfiano: yeah, it probably depends on what you set the indentation to
<clever> mfiano: i believe each string would be its own fold, because they are indented one lever deeper then their quotes
<clever> mfiano: i havent looked into folding that heavily yet, but if the file is well indented, then the indent mode also works nicely
<clever> disasm: the nixops i cloned, doesnt match the nixops i have in github
<clever> rollback_enabled = nixops.util.attr_property("rollbackEnabled", False)
<clever> nixops/deployment.py: self.rollback_enabled = config["network"].get("enableRollback", False)
<clever> but the option is called enableRollback in nix...
<clever> disasm: ok, weird, nixops python code is checking for rollbackEnabled
<clever> disasm: i see an extra_nix_path in that source, that feels related to what i saw before...
<clever> disasm: whatever we do, it has to impact this area of the code
<clever> i need to look into a better option, i saw one but cant remember where it was
<clever> disasm: currently, i'm just changing $NIX_PATH before i run nixops
<clever> nixos-unstable currently fails to build hydra, so i cant go further
<clever> then i upgraded it to the latest nixos 17.09 channel
<clever> which got nixops into control, with minimal changes
<clever> disasm: i initially copy-closured that nixpkgs to the laptop, and aimed nixops at it, and used nix-diff to get the resulting derivation to be as identical as possible
<clever> disasm: originally, the router ran a copy of nixos-unstable that claimed to be nixos 16.03, lol
<clever> awygle: yeah
<clever> disasm: i switched my nixos router over to nixops lastnight, with minimal issues
<clever> mfiano: this is a fully self-contained netboot server, that also does dhcp, dns, and nat: https://github.com/cleverca22/nixos-configs/blob/master/netboot_server.nix
<clever> mfiano: ive made netboot images with nixos, that boot into a ramdisk, and can run without any hdd
<clever> mfiano: oh, another crazy thing ive done, that may interest you
<clever> awygle: you can also just refer to files on the local machine as paths
<clever> awygle: then you have your own default.nix file, that has a url pointing anywhere you want
<clever> awygle: with nix, you typically give both a URL and a sha256, and then it automatically downloads it, and verifies it still matches that hash
<clever> so core.nix contains common stuff for both machines
<clever> and both laptop and desktop contain imports = [ ./core.nix ];
<clever> also, i have a desktop.nix in the same nixcfg repo
<clever> and if somebody wants to spawn a copy of your machine, laptop.nix is all they care about, all the btrfs sub-volume junk is useless
<clever> everything else goes into laptop.nix
<clever> and then configuration.nix is basically just the bare-minimum to boot the hardware, and imports = [ ./nixcfg/laptop.nix ];
<clever> the way i manage my systems, is that i have a git repo at /etc/nixos/nixcfg/
<clever> id leave it owned by root
<clever> if you wanted to use a specific bash to run this script
<clever> and it could be changed to #!${bashInteractive}/bin/bash
<clever> but the /bin/sh at the #! is what matters
<clever> because nothing actually runs bash
<clever> mfiano: the bashInteractive also does nothing in rofi-pass.nix
<clever> yep
<clever> samueldr: nice
<clever> editing...
<clever> thats also an option
<clever> and those keys are in scope while parsing <value>
<clever> mfiano: any place you can put a value, you can also put: let key=value; key2=value; in <value>
<clever> mfiano: the in is part of the let syntax
<clever> mfiano: yeah, my original example had a typo or 2, https://gist.github.com/cleverca22/295d8efc424d216b74ac9f56ca34ec29#file-configuration-nix-L11 is a fixed version
<clever> updated my gist
<clever> mfiano: oops, i forgot to prepend to path, env cant be found, lol
<clever> tertle||eltret: then add environment.systemPackages = [ (renoise.override { releasePath = /home/foo/path/to/renoise.tar.gz; }) ]; between the main { and }
<clever> tertle||eltret: farther down, where it says systemPackages
<clever> tertle||eltret: inside the systemPackages array
<clever> disasm: you just have to run things like ifconfig or ip, and parse away
<clever> disasm: not really, its only known at runtime, so nix has no clue what it will be
<clever> mfiano: this is confirmed to build: https://gist.github.com/cleverca22/295d8efc424d216b74ac9f56ca34ec29
<clever> mfiano: adding it to the vm to iron-out the bugs
<clever> you will need to merge it with your own line 1
<clever> mfiano: line 1 defines a function, and what arguments it is asking for
<clever> mfiano: the same as your nix-shell -p
<clever> typing up an example...
<clever> that just skips nix-shell entirely
<clever> mfiano: and you can generate a rofi-pass in your configuration.nix
<clever> mfiano: use that, to prepend to PATH, and use the writeScriptBin example i made for doit
<clever> mfiano: using this, you can generate a PATH variable
<clever> coreutils utillinux procps ]}
<clever> export PATH=${lib.makeBinPath [
<clever> that would probably also fix everything?
<clever> id rewrite it to be installed as part of configuration.nix, dont use nix-shell
<clever> the VM is meant for testing nixos, and lacks a <nixpkgs>
<clever> $NIX_PATH is broken
<clever> nope
<clever> nothing happened
<clever> no /tmp/vars
<clever> manually made it before running
<clever> ps confirms
<clever> now i have a new terminal
<clever> mfiano: alt+enter no longer opens a shell
<clever> mfiano: this generates a bash script, and line 59 puts it into the default $PATH
<clever> lets see...
<clever> there is still the issue of getting that giant string into the VM
<clever> cant even get the URL into the vm
<clever> mfiano: and i dont have any cut/paste in the VM
<clever> mfiano: how do i launch the problem nix-shell then?
<clever> ah, one min
<clever> so the only question remaining, is if those land after the set
<clever> set-environment obeys methods A and C
<clever> you can also modify what goes into set-environment
<clever> testing it that way...
<clever> it was already setup correctly by /etc/profile
<clever> then when you source set-environment again (which isnt needed due to profile already having been sourced), it sets PATH again, undoing things
<clever> so when you source /etc/profile (which xsession does), it sets PATH directly, then prepends your things
<clever> then read that file
<clever> read the /etc/profile file to find the set-environment path
<clever> not append, not prepend, just set
<clever> mfiano: set-environment, SETS PATH!, lol
<clever> mfiano: aha, found some of the problem
<clever> samueldr: :D
<clever> so it just said, mesos somehow depends on this tar
<clever> it may be an overriden version
<clever> and nix-index had trouble finding the attrpath of gnutar
<clever> and mesos depends on tar
<clever> gnutar is the package with a man page
<clever> ah, over more
<clever> samueldr: can you paste the full line nix-index gave?
<clever> which is different from "${mesos}"
<clever> samueldr: that means its the .out output of mesos
<clever> for the i3 child, its wrong
<clever> for the xsession bash, its right
<clever> mfiano: let me check deeper...
<clever> mfiano: i believe i3 is doing something wonky
<clever> mfiano: its right for root (via sudo -i), but wrong for your user, interesting
<clever> mfiano: that launched uxterm
<clever> mfiano: yep
<clever> samueldr: are you quering the exact storepath the nix-index listed?
<clever> samueldr: maybe they had one when the index was made, but lack it now?
<clever> mfiano: yep, no more xterm auto-opening, now i need to know the magic i3 spell to get a shell, lol
<clever> mfiano: testing with the line 136 i pasted above...
<clever> samueldr: so the wrapper package has to symlink the man pages into itself
<clever> samueldr: you generate a package that is just shell-scripts setting up env vars, and then that breaks all man pages
<clever> samueldr: browsers are a good use of that
<clever> https://packages.debian.org/sid/disorderfs is a package designed to make that problem worse, within a single setup, so it can be detected
<clever> so it varies from user to user
<clever> the order of the default DM's, is dependant on how your FS sorts files in a dir
<clever> i think there is also a filesystem dependant bug here
<clever> added this
<clever> 136 desktopManager.xterm.enable = false;
<clever> the vm boots directly into an xterm window, fullscreen, with i3 at the bottom
<clever> the instant you quit the xterm, it kills the entire gui session
<clever> you appear to be using xterm as a desktop manager as well, which can be rather anoying
<clever> mfiano: something is probably setting it again
<clever> mfiano: the line i linked samueldr covers all of /etc/profile
<clever> so its something to do with how i3 got launched
<clever> mfiano: the weird part, is that the parent of i3 is good, but i3 itself is bad
<clever> but the i3 under it, doesnt!
<clever> mfiano: the bash running xsession, has the right $PATH
<clever> mfiano: whoa
<clever> and its xterm that is adding things, for the reason samueldr mentioned
<clever> mfiano: using /proc, i confirmed that the i3 in my vm, has that 2nd PATH

2018-02-25

<clever> mfiano: that is the path i get in this VM, in xterm
<clever> mfiano: cargo and .bin are in $PATH
<clever> environment.shellInit
<clever> mfiano: i added `export FINDME=yes` to that block, and it persists to the xterm that opened
<clever> mfiano: so which variable is (not) set in what situation?
<clever> then the whole gui crashed
<clever> I3 is giving me a tutorial, heh
<clever> mfiano: build-vm forces the driver to something
<clever> mfiano: it be booting!
<clever> i'm on a different version of nixpkgs
<clever> mfiano: minor bug in the neovim build, but i doubt vim is involved, so i can just delete it
<clever> ln: failed to create symbolic link '/nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env/bin/bundle': File exists
<clever> and you never have to think about them on future installs
<clever> mfiano: thats why i prefer doing everything with nixos, then they are just included automatically
<clever> mfiano: when done, i'll have a qemu based VM that contains a complete copy of your machine, minus your $HOME files
<clever> the nix eval passes, these paths will be fetched (183.18 MiB download, 863.57 MiB unpacked):
<clever> mfiano: ive cloned the gist, and removed the hardware-configuration.nix line, it is now processing...
<clever> [clever@amd-nixos:~/mfiano/a97e94b42f59aea37cef5ca615d7a5ef]$ nixos-rebuild -I nixos-config=./configuration.nix build-vm -Q
<clever> mfiano: ehh, gist then
<clever> mfiano: can you just put the entire configuration.nix into a github repo?
<clever> nvm, there it is
<clever> source /nix/store/1ximi7apy1wdc4hgywldyr5sln39r5hk-set-environment
<clever> mfiano: something fishy is going on
<clever> mfiano: but the changes i said to apply are abnormally missing
<clever> mfiano: aha, and /etc/profile already sources the file i said to add, so A&C should also work
<clever> mfiano: hmmm, line 35 sources /etc/profile, so options D, B, and E should already work
<clever> dtz: `man configuration.nix` is already available by default, thats a large chunk of it
<clever> mfiano: can you gist the file?
<clever> mfiano: and you can read it to confirm what went into it
<clever> id just duplicate them then
<clever> mfiano: oops, didnt spell xsession correctly
<clever> mfiano: nix-store -qR /run/current-system | grep xession
<clever> mfiano: one sec
<clever> mfiano: even after restarting display-mamager?
<clever> then everything done with methods A and C will be included
<clever> yeah, like this
<clever> services.xserver.displayManager.sessionCommands = "source ${config.system.build.setEnvironment}";
<clever> mfiano: so if we just source that inside the display manager one
<clever> mfiano: methods a and c from my original gist
<clever> mfiano: several of them land in this file
<clever> . /nix/store/x13swbpz573bgk0b5lfiddhk3w6ipns7-set-environment
<clever> mfiano: yeah, those would still need their, oh, hmmm
<clever> mfiano: that will also persist to any shell the WM launches, so you likely wont need the other config
<clever> mfiano: those should fix it
<clever> mfiano: with this, you can set env vars before the WM runs
<clever> mfiano: https://nixos.org/nixos/options.html#xserver.displaymanager.sessionc
<clever> mfiano: but the nvidia driver knows how to actually control the card, and do things right
<clever> mfiano: i think the vesa driver is trying to use legacy bios API's to change the resolution, and its using dos-era tech to do it all, lol
<clever> bhipple[m]: i think proot has more overhead then nix-user-chroot
<clever> mfiano: then the window manager isnt obeying any of those env settings, you may want https://nixos.org/nixos/options.html#xserver.displaymanager.sessionc