2018-12-20

<clever> also hand, `/run/current-system/bin/switch-to-configuration test` will "repair" /etc/
<clever> behind the scenes, nixos-rebuild just calls nix-env for you, to update the profile, and then run switch-to-configuration on that new build
<clever> that will take the current version of the profile, and either make it the boot default, apply it to the running system, or both
<clever> /nix/var/nix/profiles/system/bin/switch-to-configuration {boot|test|switch}
<clever> that will switch the profile to the given generation, but not apply it to the running os
<clever> jtojnar: nix-env --profile /nix/var/nix/profiles/system --switch-generation 123
<clever> jtojnar: aha, --switch-generation
<clever> jtojnar: hmmm, that one also lacks the right flag
<clever> jtojnar: i think you want nix-env --rollback
<clever> ah
<clever> i didnt need containers in my case
<clever> while less locked down, it was far simpler to make 10 systemd units on each machine
<clever> which turned into 110 evals of nixos
<clever> j_r0m: i ran into similar problems with i had a nixops deployment with 10 machines, each having 10 containers
<clever> j_r0m: each container shares the host store, but adding 10 containers to nixos, will make nixos-rebuild require 11 times as much ram to eval
<clever> and i only used it on a machine i didnt care about bricking
<clever> only 3 systems i have support read, and only 1 of those supports erase&write
<clever> samrose: but it also heavily depends on flashrom supporting your motherboard
<clever> samrose: yep
<clever> samrose: but i only flashed it with a copy i had previously read, and was just confirming erase&write works, no actual version change occured
<clever> samrose: i was able to use flashrom on a random server, to erase and then re-flash the bios

2018-12-19

<clever> ,escape''
<clever> so it doesnt need to be in LD_LIBRARY_PATH
<clever> lucus16: there are also flags to add it to the rpath of the binaries it generates
<clever> lucus16: there is a setup hook to add it to something like NIX_LDFLAGS, check `env | grep LDFL`
<clever> that lets you load a given nix file, and install a given attr inside it
<clever> pie__: nix-env -f foo.nix -iA bar

2018-12-18

<clever> pie____: thats generally where i start
<clever> strace -ff -o logfiles foobar
<clever> pie____: i happened to use this, but nix repl is good to tab-complete things
<clever> $ nix-build '<nixpkgs>' -A libxml2.out --no-out-link
<clever> /nix/store/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8
<clever> split outputs, the default is .bin, which lacks libraries
<clever> yep
<clever> jomik: try adding libxml2.out to the array where zlib is
<clever> pie____: nix-locate
<clever> jomik: its a dep of python
<clever> ,locate libxml2.so
<clever> thats also why i avoid installing any dev tools at all
<clever> jomik: youll want ${patchelf}/bin/patchelf then
<clever> jomik: i think patchelf was installed by default on nixos for ages
<clever> jomik: oops!
<clever> steam uses an fhsenv, because there are just too many things to patch, that update on their own, and may get upset if you try to patch them
<clever> jomik: thats about the only good reason to use steam-run and/or the build fhsenv stuff
<clever> jomik: and nix isnt aware that the ELF file needs those libs, so it will fail too
<clever> jomik: yeah
<clever> and that stops the gc from eating the bash
<clever> the nix-build command always creates an indirect root in the current dir, called result, by default
<clever> and it will then embed that zlib and glibc path into the ELF you ran it on
<clever> jomik: that bash script depends on zlib and glibc
<clever> jomik: when you nix-build the nix file, it creates a gc root pointing to the built bash script
<clever> :D
<clever> the result symlink produced by nix-build, will also root all libraries, so a GC wont delete them on you
<clever> if you then run that bash script on a random ELF, it will patch it for you
<clever> jomik, pie: if you nix-build the file in that gist, it will generate a bash script
<clever> one sec
<clever> the above command will create a result symlink that behaves exactly the same as the result nix-build makes
<clever> iqubic: nix-store -r /nix/store/foo --add-root result --indirect
<clever> iqubic: it will
<clever> iqubic: run the chromium binary on the path to the file
<clever> ah, thats odd then
<clever> 2018-12-18 19:07:31 < iqubic> pie____: Nope. No controller support on the demo on firefox.
<clever> iqubic: did you try the html5 gamepad test in firefox and chrome?
<clever> iqubic: what happens when you run /nix/store/cjnkqww1pd5ak02369wqaqdr1s5i0jay-chromium-70.0.3538.77/libexec/chromium/chromium ?
<clever> it will not be added to any profiles
<clever> iqubic: nix-store -r /nix/store/foo will just download /nix/store/foo, and its deps
<clever> iqubic: /nix/store/cjnkqww1pd5ak02369wqaqdr1s5i0jay-chromium-70.0.3538.77/libexec/chromium/chromium
<clever> iqubic: try browsing this page
<clever> 2018-12-18 18:37:02 < pie____> https://www.cross-code.com/en/start
<clever> iqubic: run this command to download the same chrome i have, then run the chrome binary in its /bin dir, to start it
<clever> 2018-12-18 18:37:29 < clever> nix-store -r /nix/store/cjnkqww1pd5ak02369wqaqdr1s5i0jay-chromium-70.0.3538.77
<clever> pick a random one from a month or 2 ago
<clever> ldlework: if you boot an older generation of nixos, does it come back?
<clever> lspci wouldnt show a mic
<clever> ldlework: pavucontrol?
<clever> to get the exact version of chrome i use
<clever> nix-store -r /nix/store/cjnkqww1pd5ak02369wqaqdr1s5i0jay-chromium-70.0.3538.77
<clever> works perfectly
<clever> pie____: found it, http://cross-code.com/en/start
<clever> there was some demo url that let you just play it in a browser
<clever> pie____: for the game
<clever> pie____: what was the URL?
<clever> pie____: i'm using the open source chromium, not the google blob
<clever> and .xsession
<clever> Judson: that script is responsible for starting your session of choice, and dealing with .xinit and .xprofile
<clever> Judson: one sec
<clever> pie____: probably, but i just have it installed noramlly
<clever> pie____: gamepad just worked with zero config in chrome
<clever> pie____: ive only gotten it to work in chrome so far, havent tried under steam
<clever> Judson: xterm can sometimes wind up being the default
<clever> Judson: did you select a desktop manager at the login screen?
<clever> the error tells you where
<clever> then you need to make one
<clever> 2018-12-18 18:15:14 < clever> you must use config.nix for nix-shell
<clever> 2018-12-18 18:15:10 < clever> pie____: nix-shell never uses configuration.nix
<clever> iqubic: config.nix still needs an allowUnfree = true;
<clever> nix-shell -p "steamPackages.steam-chrootenv.override { extraPkgs = [ gtk3 ]; }" for ex should work
<clever> pie____: shouldnt need the import at all
<clever> yes
<clever> which allows testing it without any secrets present
<clever> kandinski: `optionalAttrs (builtins.pathExists ./clever_router.ovpn)` is optional, it just makes the rest of that code silently do nothing if the config is missing
<clever> kandinski: i wasnt using network manager, but this is how i had previously done it: https://github.com/cleverca22/nixos-configs/blob/master/router.nat.nix#L153-L157
<clever> you must use config.nix for nix-shell
<clever> pie____: nix-shell never uses configuration.nix
<clever> so the nixos options dont understand it
<clever> pie____: nixpkgs.config is just a free-form attrset, containing the same thing as the normal config.nix for nixpkgs
<clever> pie____: oops wait, its nixpkgs.config.allowUnfree
<clever> pie____: steam-run is to run steam like games, in the same sandbox, without the steam ui
<clever> pie____: nixpkgs.allowUnfree
<clever> yeah, thats the tricky part, the steam stuff is a bit of a maze
<clever> nix-shell -p 'hello.override {}'
<clever> not sure
<clever> pie____: oh, then you could likely do it via .override
<clever> and then build and use the steam from that nixpkgs clone
<clever> iqubic: try editing the nix file like in the above commit, to add gtk to steam
<clever> i would just patch the steam expression to include gtk
<clever> pie____: http://html5gamepad.com/
<clever> so even if i plug in the receiver, the usb gamepad doesnt exist, until i turn on the controller itself
<clever> and the adapter dynamically creates/destroys usb devices, as they connect wirelessly
<clever> and for extra fun, i'm using an xbox controller, with a usb<->rf adapter
<clever> but the html5 gamepad api doesnt care
<clever> so i must plug it in, before loading the game
<clever> mostly, the game only checks for a gamepad at startup
<clever> i had more gamepad problems in proper native games, lol
<clever> pie____: i cant remember the link, but ive just opened it directly in chrome before, and the gamepad just worked
<clever> how did you try to paste?
<clever> just select text with the mouse, thats it
<clever> iqubic: you dont have to ctrl+c, ever
<clever> iqubic: middle click to paste it
<clever> iqubic: the selection buffer, any text you select, in any app, is in the selection buffer
<clever> iqubic: that would explain how well it works in the browser
<clever> shapr: probably the default for nixos
<clever> ben: :D
<clever> iqubic: i dont know how they did it, but crosscode works in the browser, and even supports gamepads, in javascript
<clever> ,profile djahandarie
<clever> should have just worked
<clever> nornagon: how did you image the livecd?

2018-12-17

<clever> rycee: ./. is going to have the identical effect, without any runCommand (if bin is the only thing in . )
<clever> yep
<clever> pietranera: put both into buildInputs?
<clever> if you want to refer to a package, you need to get the pkgs set somehow
<clever> --arg myList '[ { a=1;} {b=2;} ]'
<clever> you can only pass it a list that fully defines all values
<clever> and then call the function and pass it all pkgs
<clever> you want `--arg extraPkgs 'pkgs: [ pkgs.git ]'
<clever> pkgs isnt in scope when parsing `--arg`
<clever> pietranera's
<clever> pietranera: just note, that only works if `shell.nix` begins with { myList ? [] }:
<clever> tilpner: that should work perfectly

2018-12-15

<clever> yeah
<clever> root will fail to do anything
<clever> none
<clever> but when non-root, it can also use the root channels
<clever> yeah
<clever> it doesnt know which nixos is nixos
<clever> thats why its giving an error
<clever> yes
<clever> do `nix-channel --list` as root, and not-root, and youll see that
<clever> you have 2 channels called nixos
<clever> fyuuri: can you pastebin the output of this?
<clever> ls -l ~/.nix-defexpr/*/*
<clever> `which --all foo` will show if duplicates do exist
<clever> the first one in PATH
<clever> and its just a matter of having all 3 in $PATH, echo $PATH to see that
<clever> nix-env as root, controls the default profile
<clever> and when you use nix-env -i/-e/-u, it will mutate a copy of that manifest.nix, and then build a new version of the profile based on it
<clever> nix-env will use <nix/buildenv.nix> to merge all packages in ~/.nix-profile/manifest.nix into a single derivation
<clever> which (by default) goes into the channels profile
<clever> and nix-env -iA foo.bar will use ~/.nix-defexpr/ to find foo
<clever> lrwxrwxrwx 1 clever users 46 Aug 24 18:15 .nix-defexpr/channels -> /nix/var/nix/profiles/per-user/clever/channels
<clever> the channels profile is managed by nix-channel
<clever> lrwxrwxrwx 1 clever users 15 Aug 24 18:15 /nix/var/nix/profiles/per-user/clever/channels -> channels-2-link
<clever> if its in $HOME, then problems will happen at GC
<clever> the profile should always be in /nix/var/nix/profiles/per-user/$USER/profile
<clever> fyuuri: profile is from nix-env, channel is from nix-channel
<clever> fyuuri: depends on if root has actually installed anything with nix-env
<clever> --update will sync the channels profile to that
<clever> --add and --remove just adjust ~/.nix-channels , a plain text file
<clever> etu: did you nix-channel --update ?
<clever> think of it like #include <dbus/dbus.h> in c/c++
<clever> oh, but you want <home-manager/nixos>
<clever> possibly
<clever> and default is also in everybody else's PATH
<clever> fyuuri: default is just nix-env from root

2018-12-13

<clever> runCommand "name" { buildInputs = []; } "cat ${./foo.txt} | bar > $out"
<clever> ToxicFrog: then you just want runCommand
<clever> pkgs.substituteAll
<clever> ToxicFrog: one sec
<clever> i dont think so
<clever> cbarrett: nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz -p hello
<clever> dermetfan: ive not used it yet
<clever> dermetfan: i believe so

2018-12-12

<clever> i need to head off to bed now, goodnight
<clever> yeah, far simpler then the other project i had started and linked above
<clever> those 3 options will just run qconf, gconf, or mconf
<clever> programs also have embedded help text. Be sure to check that for
<clever> The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf')
<clever> elvishjerricco: a random Kconfig file: https://github.com/torvalds/linux/blob/master/sound/drivers/Kconfig#L48
<clever> elvishjerricco: there is already a graphical config option in the kernel
<clever> no point in having ESP options when uefi isnt selected
<clever> and options can dynamically hide themselves, based on others
<clever> elvishjerricco: menuconfig just lets you browse things, and choose what you want
<clever> elvishjerricco: thats the difference between menuconfig and i think oldconfig
<clever> and it will spit out a bash script
<clever> what if i just make a Kconfig format menu, to let you configure most of the nixos install
<clever> busybox, and others, have "stolen" that ui, for their own config
<clever> the linux kernel config, and `make menuconfig`
<clever> oh, i just had an idea
<clever> Mic92: that might cause more confusion, when users try to run grub-install manually
<clever> elvishjerricco: i have started such things before
<clever> or have a program that can quiz you, and do it right
<clever> you either need to have an install guide that shows the "right" way to do it, or just info-dump how everything works and hope they can fit the puzzle pieces together
<clever> Mic92: the tricky part, is that there are so many different choices, you basically need to run the user thru a whole quiz, and then generate a list of steps to make it happen
<clever> if you make a bios boot partition, then you can still do legacy booting on gpt disks
<clever> and uefi is not required when using gpt
<clever> growpotkin: it has to be manually enabled, with things like nix-serve or hydra
<clever> jomik: you can use the imports list on any module, to give paths to more modules
<clever> correct
<clever> dgarzon: something like this
<clever> writeScriptBin "foo" (lib.concatMapStringsSep "\n" (x: "nix-store -r ${x}") (builtins.fromJSON (builtins.readFile (fetchurl ...)))
<clever> > lib.concatMapStringsSep "\n" (x: "nix-store -r ${x}") [ "a" "b" "c" ]
<clever> dgarzon: what exactly do you want to do with that json?
<clever> an object cant be unpacked
<clever> dgarzon: thats no longer a file, but an object
<clever> but you would need to fix every "misbehaving" program in the system...
<clever> Jomik: prefix PATH correctly when running something, and then let PATH do its thing
<clever> nope
<clever> and there is hnix
<clever> gchristensen: taktoa was looking into that a year or 2 ago
<clever> hodapp: https://github.com/cleverca22/nixos-configs/blob/master/wireshark-no-root.nix is a setuid example, rather then setcap
<clever> typetetris: nix-build '<nixpkgs>' -A hello.src
<clever> typetetris: nix-store --query --binding src /nix/store/foo.drv
<clever> but to create the file that nix var was going to go into
<clever> yeah, you would have to restructure it, to not need the answer in a nix var
<clever> its just a normal build of a file
<clever> your not importing the result back to nix, so its not expensive like IFD
<clever> mkaito: the ip-magic above doesnt use IFD, but relies on a custom cpp program to generate the file in question

2018-12-11

<clever> and then just wait for a root pw
<clever> the idea behind that one, is to hit it before you login at a console, because anybody could sign in, and then just run a program that prints `login:`
<clever> iqubic: sysrq+k will kill everything on the current tty
<clever> iqubic: alt+printscreen == sysrq
<clever> there is both ctrl+alt+backspace, and the sysrq sak key
<clever> gchristensen: ctrl+alt+backspace, it should be in the xorg man page
<clever> nix-env will merge everything together as it scans .nix-defexpr, and doesnt really care if something "non-standard" like test/foo/default.nix turns up
<clever> and the channels symlink for non-root users, points to the channels profile of that user
<clever> channels_root on non-root users also points there, so you inherit roots channels
<clever> lrwxrwxrwx 1 root root 44 Nov 26 09:52 /root/.nix-defexpr/channels -> /nix/var/nix/profiles/per-user/root/channels
<clever> Jomik: [root@amd-nixos:~]# nix-env --profile /nix/var/nix/profiles/per-user/root/channels --list-generations
<clever> Jomik: into a secondary nix-env profile, that channels and channels_root point to
<clever> since you can just use whatever nix you want to define it, and it could just be a fetchTarball call
<clever> Jomik: i prefer that over adding file:/// urls as a channel
<clever> akavel: i dont think you can browse, you need to eval your own nixpkgs, to know what hashes to expect
<clever> Jomik: channels vs channels_root is already doing that
<clever> Jomik: any parent directories that it recurses thru, are basically ignored, so the `test` dir is just a way to group channels, and use normal linux permissions to restrict who can modify them
<clever> Jomik: nix-env will recursively search for either a foo.nix, or a foo/default.nix, and then create a channel called foo
<clever> akavel: to see if `/nix/store/nkp4ck5scygkjk87nr6w61gb23li829m-hello-2.10` is present on the cache, you must query `https://cache.nixos.org/nkp4ck5scygkjk87nr6w61gb23li829m.narinfo`
<clever> akavel: cache.nixos.org is the URI
<clever> Jomik: that creates a "channel" called foo, so you can just nix-env -iA foo.hello
<clever> import /home/clever/apps/nixpkgs
<clever> [clever@amd-nixos:~]$ cat .nix-defexpr/test/foo/default.nix
<clever> Jomik: there is a much simpler way for custom channels
<clever> jonaswouters: i believe all fonts must be in the fonts.fonts option in configuration.nix
<clever> mkForce ?
<clever> yep
<clever> ottidmes: you can trivially add more args to all modules
<clever> > pkgs.path + "/pkgs/top-level/all-packages.nix"
<clever> ottidmes: pkgs.path + "/pkgs/top-level/all-packages.nix"
<clever> ottidmes: like so?
<clever> > let __nixPath = [ { path = ./.; prefix = "bar"; } ]; in <bar>
<clever> there is an example of that in the nixops source
<clever> but, you can use it to overwrite the import function, to force the files you import, into using a wrapper, that calls scopedImport again
<clever> and it cant leak backwards up the call stack
<clever> it will only impact the exact files loaded with scopedImport, and nothing else
<clever> ottidmes: but note, scopedImport breaks the import cache, so the performance will suffer
<clever> ottidmes: scopedImport also lets you overwrite the import function, to make its effects recursive
<clever> and scopedImport allows you to inject things into the "global scope" of another file, as you import it (non-recursive)
<clever> and then it does normal var lookup on __findFile and __nixPath
<clever> > __findFile __nixPath "nixpkgs"
<clever> ottidmes: behind the scenes, <nixpkgs> gets translated into (__findFile __nixPath "nixpkgs")
<clever> ottidmes: you can use scopedImport to mess with __nixPath

2018-12-10

<clever> techieAgno2tic: i gave an example above
<clever> arianvp: it could be that it failed to build on hydra, and thats why its not in the cache
<clever> > pkgs.runCommand "name" { buildInputs = [ imagemagick ]; } "mkdir $out ; convert ${./input.png} $out/output.jpg"
<clever> then the nix sandbox can fully enforce purity
<clever> techieAgno2tic: try using pkgs.runCommand, and nix-build