2019-10-06

<clever> you want:
<clever> mishac: objects/symlinks, is a set of derivations to copy into the /nix/store of the tar (including deps) and add to the registration-path file, and create symlinks (within the tar) so you can figure out the hash
<clever> mishac: so, sources/targets is just a list of things to blindly copy, from source to target, and target is a path that will exist within the tar
<clever> mishac: and the closure info, is based purely on the list of objects you give it
<clever> mishac: and then seperate from both of those, everything in the closure info (explained later) gets copied into /nix/store/
<clever> object/symlinks, is then a set of symlinks to make, pointing to those objects
<clever> which explains why it was at a /nix/store/hash-Test
<clever> mishac: so, you told it to copy from the nix package, to whatever path /home/misha/Test hashes to
<clever> mishac: all sources/targets get copied here, from source to target
<clever> mishac: you want object to contain that expr, and symlink to be a quoted path, and it has to go into storeContents, not contents
<clever> mishac: that
<clever> 2019-10-05 23:54:58 < clever> mishac: you would want to use (import <nixpkgs> {}).pkgsCross.armv7l-hf-multiplatform.nix in the expr that is building the tar
<clever> mishac: its just blindly copying a single directory, not a nix build and the things it depends on
<clever> mishac: yeah, theres the problem, you must put a nix expr in line 8
<clever> mishac: something is not right with that, can you pastebin the nix file you used to build it?
<clever> mishac: can you pastebin the output of `tar -tvf /path/to/tar` ?
<clever> mishac: what files are in the tar?
<clever> jersey[m]: nope, i just happened to find the failure in docker
<clever> jersey[m]: thats a recent bug i discovered in docker, that i still need to report
<clever> jersey[m]: oh, try `nix-shell -p .... --option sandbox false`
<clever> jersey[m]: can you paste the entire output of nix-shell, including the failure?
<clever> jersey[m]: that command works perfectly here
<clever> jersey[m]: can you paste the full command you used?
<clever> jersey[m]: correct
<clever> so, you must declare the hash of the output, that ensures you always produce the same source
<clever> also, network access is impure, so you could do naughty things that make a different build, defying the hash
<clever> evils: so a fixed-output drv puts a halt to that, and says "this tar always has this hash", and it wont care what the hash of curl is
<clever> evils: and you dont want to re-fetch (and re-build) EVERYTHING, when curl changes
<clever> evils: nix hashes all inputs, but a drv to fetch something, has curl as an input
<clever> 80gig mechanical sata in my router, it runs an entire hydra instance
<clever> but my router is a dual-socket rack-mount machine, with several gig of ECC ram....
<clever> and there is #nixos-on-your-router
<clever> evils: i run full nixos on my router...
<clever> you can always do nix-build on arch or ubuntu :P
<clever> i basically just dont support other distros :P
<clever> evils: put it into its own derivation, with the 3 attrs i mentioned before
<clever> correct
<clever> the src = fetchFromGitHub is also a derivation, that is downloading source
<clever> evils: the script doing the download needs to be in a seperate derivation from the compile
<clever> so thats not really possible
<clever> evils: each derivation is hashed seperately
<clever> philr: already on unstable here
<clever> and looks like i'm outa luck too
<clever> Sep 30 15:34:05 amd-nixos kernel: amdgpu 0000:01:00.0: kfd not supported on this ASIC
<clever> and it wont use the "wrong" build from another machine, on your current one
<clever> philr: but if you specify which gpu in the nix config, it can build for that gpu, even on the "wrong" machine
<clever> philr: that kind of thing makes it imposible to reproduce the builds, or use build slaves
<clever> philr: yuck!
<clever> philr: what was the solution?
<clever> but that did
<clever> mishac: also, @clever doesnt light up on this end
<clever> mishac: you would want to use (import <nixpkgs> {}).pkgsCross.armv7l-hf-multiplatform.nix in the expr that is building the tar
<clever> mishac: then use nix-env -i /nix/store/hash-nix, to install nix on the arm device
<clever> mishac: make a tar, that contains the arm build of nix, then unpack that tar on the arm device, and run `nix-store --load-db < /nix/store/nix-path-registration`
<clever> so it turns things into failures you can clearly see
<clever> philr: nix-build already enforces not touching things you shouldnt touch
<clever> philr: can be hard to know exactly what its doing (when it shouldnt), without running the whole thing under strace, and going over 1000's of lines of logs
<clever> philr: nix-shell --pure doesnt stop you from peeking into /sys
<clever> you should investigate why its trying to run lsmod, and tell it to stop
<clever> philr: ah, nix-daemon is already correctly blocking you from using lsmod
<clever> philr: what error did it have with kmod?
<clever> philr: sounds like it has multiple problems
<clever> but you probably shouldnt be adding kmod to the inputs
<clever> ,locate bin/lsmod
<clever> philr: it may also just be failing because of lsmod not being in PATH
<clever> philr: and the error is complaining that gfx000 is not valid
<clever> philr: i think line 170 is saying what the valid targets are
<clever> philr: and cmake lists
<clever> philr: can you pastebin or link the nix file?
<clever> philr: you must specify a flag like -amdgpu-target to tell it what gpu you want
<clever> philr: its trying to dynamically query what kernel modules you have, which is horid-impure!
<clever> and this site shows the tests each channel waits for
<clever> ,howoldis notgne2
<clever> notgne2: when all of the tests on master pass, nixos-unstable updates
<clever> notgne2: that will only load whatever the unstable channel is poining to
<clever> in my example, a local clone, where i would have to first `git checkout master && git pull`
<clever> you can then use whatever you want to fetch "master"
<clever> notgne2: if you want something more dynamic, nix-env -iA foo.nim will use whatever nixpkgs this file loads
<clever> [clever@amd-nixos:~]$ cat .nix-defexpr/test/foo/default.nix
<clever> import /home/clever/apps/nixpkgs
<clever> notgne2: if you just want it once, nix-env -f https://github.com/nixos/nixpkgs/archive/master.tar.gz -iA nim
<clever> philr: way back about an hour ago, lol
<clever> pittma: oops, that question was for philr
<clever> notgne2: does it need to be found by nix-env, nix-build, or nix-shell?
<clever> 2019-09-17 18:04:03< clever> there should be a nix-path-registeration within that tar somewhere
<clever> 2019-09-17 18:03:51< clever> nix-store --load-db < /nix/store/nix-path-registration
<clever> 2019-09-17 18:03:03< clever> make-system-tarball.nix, will generate a tarball you can unpack to /, that contains a given set of packages
<clever> mishac: yeah, thats what the tar stuff was for
<clever> mishac: you need to fix .bashrc such that `ssh user@host nix-store --version` can find nix-store
<clever> (as the same user you did --add)
<clever> contrun[m]: you must nix-channel --update after you --add
<clever> nearly all of my machines look like that
<clever> [root@system76:~]# nix-channel --list
<clever> you must have deleted the nixos channel
<clever> contrun[m]: and also `sudo nix-channel --list`
<clever> pittma: how does it fail? what os are you building on?
<clever> pittma: what happens if you build it with nix-build?
<clever> red[m]: i think the only time ive seen such a thing, was to keep tiny items like baby socks from clogging up the drain, lol
<clever> in this case, i start a very simple WM, then just exec something, so the user has no choice over what desktop manager runs
<clever> pittma: ah yeah, and i have an example here: https://github.com/cleverca22/nixos-configs/blob/master/media-center.nix#L20
<clever> nixos then just blindly inserts those lines into the script, near where i linked
<clever> '';
<clever> several lines of shell code
<clever> services.xserver.displayManager.sessionCommands = ''
<clever> and if it exists, it will execute ~/.xsession (causing the chosen session manager to not activate)
<clever> it will then source ~/.xprofile
<clever> pittma: nixos will first run the code in services.xserver.displayManager.sessionCommands (which lets you do that stuff from configuration.nix)
<clever> pittma: one minute

2019-10-05

<clever> rizary_: dist/test/bla-01-tasty.log is deleted after the build is done, but `--keep-failed` will keep it, if the build fails
<clever> rizary_: `nix-store -l /nix/store/path` shows you the logs
<clever> freecoder: the above site shows the current rev for each channel
<clever> ,howoldis
<clever> need to figure out what that tag is doing, and what makes it special
<clever> KERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess"
<clever> [clever@amd-nixos:~/Downloads]$ nix-build '<nixpkgs>' -A steamPackages.steam
<clever> [clever@amd-nixos:~/Downloads]$ cat result/lib/udev/rules.d/60-steam-input.rules
<clever> hpfr[m]: hardware.steam-hardware.enable should do exactly that
<clever> erba: what if you just do `sdk = androidsdk_9_0;` and ignore all of those flags?
<clever> androidsdk no longer exists
<clever> > androidenv.androidsdk
<clever> erba: androidenv.androidsdk was a function, androidsdk_9_0 is not
<clever> erba: this line you changed is the problem
<clever> sdk = androidsdk_9_0 {
<clever> sdk = androidenv.androidsdk {
<clever> erba: can you pastebin the exact file your using, with the sdk changes, and the error from `nix-shell --show-trace` ?
<clever> erba: can you pastebin the whole file?
<clever> infinisil: hmmm, yeah, pretty sure ive seen `with import <nixpkgs> {}` work...
<clever> erba: with (import <nixpkgs> { config = { android_sdk.accept_license = true; }; });
<clever> erba: more parens!
<clever> erba: when you import <nixpkgs>, you can pass it the contents of a config.nix, import <nixpkgs> { config = { android_sdk.accept_license = true; }; }
<clever> evils: then you can just do "source ${./script.sh}" or similar, maybe write it to create an oui.txt in the current dir, then "source ${./script.sh} ; mv oui.txt $out"
<clever> so you can put the shell script right into the nix file
<clever> evils: the string at the end, "curl http://example.com > $out" is a chunk of bash code
<clever> and you can then just shove that into a let block, and get a path back out
<clever> > let thing = runCommand "name" { outputHash = "0000000000000000000000000000000000000000000000000000"; outputHashAlgo = "sha256"; outputHashMode = "flat"; buildInputs = [ curl ]; } "curl http://example.com > $out"; in "${thing}"
<clever> evils: that is a fixed-output derivation, that will try to fetch whatever is at example.com, and produces a single file
<clever> > runCommand "name" { outputHash = "0000000000000000000000000000000000000000000000000000"; outputHashAlgo = "sha256"; outputHashMode = "flat"; buildInputs = [ curl ]; } "curl http://example.com > $out"
<clever> > runCommand "name" { outputHash = "0000000000000000000000000000000000000000000000000000"; outputHashAlgo = "sha256"; outputHashMode = "flat"; buildInputs = [ curl ]; "curl http://example.com > $out"
<clever> ,tofu
<clever> in either case, nix will tell you the right hash, if it is wrong
<clever> if outputHashMode == "recursive", then $out can be anything (file, directory, symlink), and outputHash is the hash of the output from `nix-store --dump $out`
<clever> if outputHashMode == "flat", then $out must be a single file, and outputHash is the raw hash of that file
<clever> the output must have a hash of outputHash, which is of type outputHashAlgo
<clever> evils: any derivation that has those 3 attributes, gains network access
<clever> > hello.src.outputHashAlgo
<clever> > hello.src.outputHashMode
<clever> > hello.src.outputHash
<clever> evils: > hello.src.outputHash
<clever> evils: and if the script fails to meet that declaration, the build fails
<clever> evils: you can, but you must declare what the hash of the product will be
<clever> astrall33: for the impure way, just `nix-shell -p nodejs` and then continue as usual
<clever> you probably still want nix to build the sqlite+lua thing, and then provide an environment that has a finished copy of it
<clever> but you can then just point HOME to any dir you make
<clever> and by default, $HOME=/homeless-shelter (which doesnt exist)
<clever> it builds in a unique dir under /tmp, that is mapped to /build
<clever> nix-build can run things with a private $HOME easily
<clever> gyroninja: sounds like you should be using nix-build to build this
<clever> gyroninja: and how do you give it a config file?
<clever> and then echo $FOO
<clever> gyroninja: so you can just add FOO = "${sqlite.dev}/include/";
<clever> gyroninja: and every attr you pass to mkShell becomes an env var
<clever> if you put that expression into the shell.nix file, nix will give you the path
<clever> > "${sqlite.dev}/include/"
<clever> youll need to somehow tell luarocks to use ${sqlite.dev}/include/ then
<clever> gyroninja: what happens if you add pkgconfig to the buildInputs?
<clever> it should be under ${sqlite.dev}/include/
<clever> but if its parsing the file itself, you need to tell it where to look
<clever> if luarocks is running gcc, then it will find the header
<clever> why does luarocks need the header file?
<clever> dont look for headers, just try to use them
<clever> if you just blindly #include <sqlite3.h>, gcc should still find it
<clever> ah, nix will never have headers in those locations
<clever> i would expect that to work, how is luarocks searching for sqlite headers?
<clever> gyroninja: are you using nix-shell?
<clever> gyroninja: in what context are you using that?
<clever> gyroninja: can you paste your code?
<clever> gyroninja: you can likely skip that map in most cases, since those will cast to strings for oyu
<clever> > :p map (x: "${x}") zlib.all
<clever> > map (x: "${x}") zlib.all
<clever> > zlib.all
<clever> > zlib.outputs
<clever> no idea
<clever> which may be why most projects ship their own copy, in the src
<clever> so you need to host a copy somewhere, and fetchurl that copy
<clever> but, its not versioned, so nix will break every time they update it
<clever> this url seems pretty official
<clever> 5 OUI_DOWNLOAD_URL="http://standards-oui.ieee.org/oui.txt"
<clever> there is a script in aircrack that fetches a new version
<clever> aircrack-ng.out 1,988 x /nix/store/k30ahdmy37i59krgg0ql1kzkwinw21qa-aircrack-ng-1.2-rc4/bin/airodump-ng-oui-update
<clever> $ nix-locate oui | grep update
<clever> ahh
<clever> fixed paths are evil!
<clever> evils: nix gets rid of the entire notion of fixed paths
<clever> freeman42x: root can use /home/neo/hie.log without having to use sudo
<clever> evils: yes
<clever> 2019-10-05 16:42:54 < clever> evils: pkgs.fetchurl can be used to download it
<clever> evils: let ouiFile = fetchurl { url = "http://www.example.com/oui.txt"; sha256 = "something"; } in ....
<clever> evils: pkgs.fetchurl
<clever> evils: all network is disabled by default, so you must clearly define (in nix) what you want fetched from the network, and defining those details has an impact on the hash
<clever> evils: ensures that everything you can use, will impact the hash of your drv
<clever> evils: nix will disable the network, so you cant download it yourself
<clever> evils: pkgs.fetchurl can be used to download it
<clever> a command
<clever> pulseaudio breaks horribly if you dont set those things right
<clever> `sudo -u $SUDO_USER foo` can do most of that for you, but only in a child proc, not the current process
<clever> you loose those when dropping back to non-root
<clever> freeman42x: also, there are some special groups that you are in, but /etc/group says you shouldnt be in
<clever> have fun!
<clever> this is why i omited that fact before :P
<clever> so it will take effect at different times in different threads
<clever> but glibc emulates it being process wide
<clever> and setuid is per-thread
<clever> then setgroups, setgid, and setuid
<clever> but now you have to lookup that user in /etc/passwd, then lookup his groups in /etc/group
<clever> freeman42x: $SUDO_USER tells you what user ran sudo
<clever> [root@amd-nixos:~]# env | grep clever
<clever> SUDO_USER=clever
<clever> freeman42x: or just chown configuration.nix
<clever> freeman42x: it may be best to just use imports, to point nixos towards a file you can edit
<clever> freeman42x: but that wont try to edit the file as root
<clever> freeman42x: that will run nixos-rebuild as root
<clever> freeman42x: then you didnt prefix the right thing with sudo
<clever> leo_: line 13 and 17 of the file i just linked
<clever> and just do ./dummy.nix, without the import
<clever> leo_: you could also just put that whole string right in the top-level
<clever> leo_: depends on which machine its being ran on, and in what context
<clever> leo_: so it should obey everything defined in the nix files, and you cant run nix-build from inside a derivation
<clever> leo_: when nixops builds the whole thing, its just a single nix-build command
<clever> leo_: when are those tools ran, what are they doing?
<clever> leo_: so in your nixops deployment files, you must set nixpkgs.overlays
<clever> leo_: nixos only obeys the nixpkgs.overlays config, within the nixos modules
<clever> leo_: it will ignore that, because nixos never obeys <nixpkgs-overlays>
<clever> leo_: and it obeys the overlays in the local config only
<clever> leo_: nixops builds the config locally, before deploying
<clever> leo_: "nix tools used during the deploy" ?
<clever> freeman42x: if stdin/stdout go to a terminal
<clever> freeman42x: yes
<clever> hardware*
<clever> leo_: --create-only will create the hardward in the cloud, but not build anything
<clever> freeman42x: your better off not running cabal as root, and just prefixing the right commands with sudo
<clever> evils: yep
<clever> evils: you would need to put "${hwdata}/data/hwdata/oui.txt" somewhere in the derivation
<clever> evils: only other option is to put it into your source, and install your own copy of it
<clever> evils: some packages like lshw will install it to /usr/share/lshw/oui.txt, on non-nix machines
<clever> lshw.out 3,391,905 x /nix/store/msllr0hg5szkpjks12g7v747dyymqk41-lshw-02.18b/share/lshw/oui.txt
<clever> evils: you can probably just use the path ${hwdata}/data/hwdata/oui.txt
<clever> hwdata.out 3,310,148 r /nix/store/2fw6dcbzzmjl4677k8cjjjjd9ghkripi-hwdata-0.291/data/hwdata/oui.txt
<clever> [clever@amd-nixos:~]$ nix-locate oui.txt
<clever> why is ghci running nixos-rebuild??
<clever> freeman42x: such as?
<clever> freeman42x: why do you need ghci as root?
<clever> HKei: you want clangStdenv.mkDerivation, rather then mkShell (which uses plain stdenv)
<clever> LnL: and also look into how darwin nixpkgs is clang by default, so you can make a linux pkgs that is fully clanged up
<clever> LnL: pkgsCross might be a simpler solution though
<clever> LnL: it wouldnt really be able to deal with things like `buildCommand = "${foo}";`
<clever> the whole point of replaceDependency is to not rebuild
<clever> rather then rebuilding things with a different compiler
<clever> and replaceDependency is more about running sed over the binaries, to swap out the path to a single dyn lib
<clever> HKei: clangStdenv already exists
<clever> and then edit junk.nix
<clever> __monty__: or just add `imports = [ /home/clever/junk.nix ];` to configuration.nix
<clever> freeman42x: nix-shell isnt meant to be ran as root very often, so it doesnt take user into account when picking a color
<clever> freeman42x: run `id` to see if it has root or not
<clever> sudo will also remember if you gave a pw recently, and not ask again
<clever> freeman42x: you can also use `cabal repl`, but nix doesnt provide the cabal binary by default, only the Cabal package in ghc-pkg
<clever> freeman42x: sudo -i, nix-shell on the .env atttribute, `runhaskell Setup.hs repl`
<clever> su always asks for a pw
<clever> sudo will remember if it got a password recently, and only ask if it has been too long
<clever> freeman42x: sudo nixos-rebuild switch
<clever> freeman42x: did you fully logout of X, then log back in?
<clever> give sudoedit the right path to the thing you want to edit
<clever> freeman42x: then your editing ./configuration.nix, not /etc/nixos/configuration.nix
<clever> freeman42x: did you cd into /etc/nixos first?
<clever> freeman42x: ls -lhd /etc/nixos/
<clever> freeman42x: you might need to relog as well
<clever> freeman42x: you must not use sudo or su when using sudoedit
<clever> freeman42x: you have to re-open your terminal for the change to take effect
<clever> freeman42x: yes
<clever> freeman42x: do you see line 70 of vim.nix above?
<clever> freeman42x: refer to the line i just linked
<clever> freeman42x: if you set EDITOR in your default config, you can just `sudoedit configuration.nix`
<clever> freeman42x: just `EDITOR=kate sudoedit configuration.nix` and kate will open, edit the file, save, quit
<clever> freeman42x: sudoedit runs kate for you
<clever> so the editor never runs as root
<clever> freeman42x: when you exit kate, sudoedit will copy it back to configuration.nix
<clever> freeman42x: sudoedit will use sudo to copy configuration.nix to /tmp, then run kate on that copy, without running kate as root
<clever> __monty__: most likely, the build winds up in /run/user/1000
<clever> __monty__: df -h $TMP