2019-02-22

<clever> jasom: you need to enable non-root namespacing
<clever> teto: did you set python3Packages.pandas.doCheck or are you eval'ing and seeing its already false?
<clever> yep
<clever> so the env vars are going to be much more bare
<clever> the system-path isnt in PATH when that runs
<clever> ar1a: sounds likely
<clever> so it can track all children that tmux made
<clever> and i suspect it uses cgroups to discover the new pid
<clever> judson_: this flag makes systemd think its still running, after it exits with 0
<clever> RemainAfterExit = "yes";
<clever> judson_: i think the -d made it run without needing a tty
<clever> ar1a: script automatically gets written to the nix store, and the path added to ExecStart
<clever> i had tmux working like this, but it had its own dedicated user
<clever> ar1a: add -f to make it follow, and then try to restart the service
<clever> ar1a: not sure what to try next, havent really used tmux much
<clever> judson_: ah
<clever> judson_: attrVals will sort them by the keys first
<clever> ar1a: nothing else in the journal, `journalctl -u minecraft.service` ?
<clever> thats only going to work for inputs of 0 or 1
<clever> lol
<clever> bitNot = builtins.sub (-1);
<clever> and i dont see a shift
<clever> all 4 are primops, so they are actually under builtins
<clever> lib.bitAnd lib.bitNot lib.bitOr lib.bitXor
<clever> not sure
<clever> on each operation, shift by 1 (or *2), and then add either 0 or 1
<clever> judson_: hmmmm, i dont think ive seen anything like that, you would want to use foldl' i think
<clever> damn, has it really been that long? :O
<clever> they go back to 2015-06-25 11:13:00 for this channel ....
<clever> i have irc logs enabled
<clever> ah
<clever> judson_: ah, you already saw it earlier
<clever> 2019-02-21 18:17:49 < LnL> ah https://nixos.org/nixpkgs/manual/#chap-functions
<clever> 2019-02-21 18:16:47 < LnL> I think we have something now
<clever> 2019-02-21 18:15:48 < judson_> Is there a unified list somewhere of builtins and nixpkgs lib functions?
<clever> judson_: hnix is one
<clever> i didnt even think boolToString existed, lol
<clever> if you enter a raw function into the repl, it tells you what defined it
<clever> «lambda @ /nix/store/bssxqlhb7liba974sx8yz3d0arjzvp9s-nixos-19.03pre166449.be445a9074f/nixos/lib/trivial.nix:77:18»
<clever> nix-repl> lib.boolToString
<clever> also, beware, toString is weird with bools
<clever> > toString false
<clever> > toString true
<clever> judson_: i mostly browse the selection with tab-completion in the repl, and then test the function to make it do what i need
<clever> judson_: theres some in the nixpkgs docs, but you can also just `nix repl '<nixpkgs>'` and then use tab completion on builtins. and lib.
<clever> ah
<clever> jasom: NIS?
<clever> but all new installs have been nixos from the start
<clever> yeah, i still have 1 gentoo machine thats sticking around, havent bothered to switch it over
<clever> jasom: i havent actively used gentoo, since before systemd took hold on linux, lol
<clever> acowley: what about just pkgs.linux.override { configFile = ./foo; } ?
<clever> you can always upgrade single to multi later
<clever> at least, the automatic setup
<clever> but multi-user is only supported on a few distros
<clever> gentoo is crazy like that, lol
<clever> systemd may even be optional on gentoo??
<clever> and it isnt auto-detecting that properly
<clever> --daemon needs to know what distro your on, and how your service manager works
<clever> it normally tries to do that itself, via sudo
<clever> jasom: ah, once you create /nix/ and give yourself ownership, it can do the entire install without root
<clever> jasom: which distro are you on? have you tried without --daemon?
<clever> pkgs.linux is coming from manual-config.nix, so you may not need to pay attention to generic.nix
<clever> which is what the main kernel derivation came from
<clever> acowley: i dont see defconfig on the manual-config.nix file
<clever> i usually just do a<tab>
<clever> tab-completion can get confused when the prefixes arent unique
<clever> acowley
<clever> ar1a: or use config itself
<clever> 31 # If unspecified, this will be autodetected from the .config
<clever> 32 config ? stdenv.lib.optionalAttrs allowImportFromDerivation (readConfig configfile),
<clever> 30 # Manually specified nixexpr representing the config
<clever> ar1a: i think you want to .override with a configfile?
<clever> ah
<clever> ar1a: pf?
<clever> ar1a: ar1a 2018-10-04 13:13:06< gchristensen> https://discourse.nixos.org/t/the-nixos-cache-is-now-hosted-by-fastly/1061
<clever> yep
<clever> yeah
<clever> add that to your systemPackages
<clever> Zer000: (pkgs.mpv.override { jackaudioSupport = true; })
<clever> i probably should, i have a number of things like that, that i never got around to doing
<clever> that also works
<clever> ar1a: i have a FTB = pkgs.callPackage ./FTB.nix {}; in my packageOverrides
<clever> you need line 22 of FTB.nix to fix it
<clever> and that tries to load native things from /usr/lib/
<clever> there is a .so file packaged inside one of the jars
<clever> this line handles it
<clever> so you never see the real problem
<clever> and then when the 32bit fails, it reports ELFCLASS32, and nothing else
<clever> ar1a: if the 64bit lib fails to import for any reason (rpath), it will blindly try the 32bit instead
<clever> ar1a: also, minecraft is bad at reporting errors
<clever> ar1a: pkgsi686Linux.openjdk
<clever> might have been a bug in the iso
<clever> ar1a: this may also interest you, https://gist.github.com/31265e9614e808280e38b7ceaa555d90
<clever> try doing that and see if it improves
<clever> ar1a: when did you last run `sudo nix-channel --update` ?
<clever> ar1a: you need a channel called nixos on root for command-not-found to work
<clever> ar1a: that spins up multiple weechat instances, each in its own tmux session, each in its own user
<clever> iqubic: there is a nofail near the bottom of the page, that might also work
<clever> iqubic: yeah, just `sudo mount /something` and its done
<clever> iqubic: disabled auto mounting
<clever> iqubic: remote distro likely doesnt matter, but i just use nixos for everything now
<clever> iqubic: add the noauto flag to the nfs mount on the client
<clever> angerman: or this
<clever> nix-repl> lib.traceShowVal "foo"
<clever> angerman: builtins.toJson or toXML maybe?
<clever> and you select which library you want to install something into
<clever> iqubic: yes, steam support multiple libraries, at different paths
<clever> iqubic: step 2, move downloading off the nas, and replace it with a symlink: https://github.com/ValveSoftware/steam-for-linux/issues/5788#issuecomment-449976207
<clever> iqubic: step 1, setup nfs so you can access the files normally
<clever> ar1a: and load-secrets.nix allows things to gracefully fail when building on hydra
<clever> ar1a: yep
<clever> i just never install cabal-install
<clever> not really
<clever> you need to use .overrideAttrs to keep that magic working
<clever> camsbury: nativeBuildInputs and buildInputs are handled specially in stdenv.mkDerivation, and i think that special magic doesnt work if you further edit them with .overrideDerivation
<clever> and if you need several, you have to chain them in the right order
<clever> which one you need, depends on what your trying to change
<clever> and then at the lowest level, .overrideDerivation happens after stdenv.mkDerivation, so it cant change cross-compile level things
<clever> so its harder to change haskell specific stuff (and overrideCabal wont work on the result), but its easier to change non-haskell things
<clever> .overrideAttrs happens after generic-builder.nix, but before stdenv.mkDerivation
<clever> overrideCabal happens before the haskell generic-builder.nix, so you can mutate the args passed to mkDerivation, before generic-builder.nix acts on them
<clever> .env is haskell specific
<clever> at the highest level, you have .override, which is added by callPackage, it can change the args originally passed into the function (like the { stdenv, hello, cmake }:)
<clever> .overrideAttrs works on the haskell derivations too, but happens at a later stage, and breaks the more haskell features of it, sorta
<clever> and .env is less haskell-y of a derivation, so normal .overrideAttrs works
<clever> i try to override the .env instead, since its only needed on the shell side
<clever> camsbury: if you put the string from the above nix-build, into a default.nix, you can just nix-build without any args
<clever> slack1256: i would just setup build slaves, which is in the nixos manual
<clever> and `cabal configure` just uses Setup.hs without you noticing
<clever> ive been meaning to add a cabal (bash function) to the .env, so this whole thing becomes invisible
<clever> and the defaultMain inside the default Setup.hs, is just going to do the exact same thing as the cabal binary from cabal-install
<clever> you can also `ghc Setup.hs -o Setup` and `./Setup configure` if you want to make it slightly faster
<clever> Setup.hs will link against the Cabal library, which nix always provides
<clever> and then wont behave the same as mkDerivation does at nix-build time
<clever> if you just install cabal-install, it can potentially be the "wrong" version
<clever> camsbury: this is a more complex example
<clever> cabal will give a clear error when you need that
<clever> if you have several executables, you just pass the name at the end
<clever> i have ghcid in my nix-env profile
<clever> but since cabal-install is missing, `runhaskell Setup.hs repl` is needed
<clever> and `cabal repl` will load that for you, while obeying the cabal file
<clever> ghcid just needs a command that drops you into ghci
<clever> and cabal-install isnt present by default, i just `runhaskell Setup.hs configure` then `ghcid -c "runhaskell Setup.hs repl"`
<clever> nix-shell -E 'with import <nixpkgs> {}; (haskellPackages.callCabal2nix "foo" ./. {}).env'
<clever> it will also pull in any hackage based deps automatically
<clever> camsbury: this will build foo.cabal, without needing any nix files
<clever> nix-build -E 'with import <nixpkgs> {}; haskellPackages.callCabal2nix "foo" ./. {}'
<clever> camsbury: https://github.com/cleverca22/nixos-configs/blob/master/vim.nix i dont think you can fully configure emacs as easily as this :P
<clever> if using the repl, you want just lib.version
<clever> `nix eval nixpkgs.lib.version` is the full command, that tells nix to eval lib.version, within <nixpkgs>
<clever> fetchTarball is impure, so it doesnt need a sha256, but it will re-download the tar if it has been an hour since the last try
<clever> ,locate bin nix-locate
<clever> camsbury: which ones?
<clever> check the Makefile in my firmware above
<clever> i dont really like such complex ones, and tend to write my own much simpler ones
<clever> warnings arent fatal for me
<clever> thats likely the makefile in your project
<clever> the rest of the url, i just typed from memory
<clever> the gitrev came from the output of nixpkgs.lib.version
<clever> so when i return to this firmware in another 5 years, i dont have to fix anything, i can just nix-build and get the same file i get today
<clever> camsbury: and now default.nix will always use that version, and never upgrade
<clever> 3 pkgs = import nixpkgs {};
<clever> 1 { nixpkgs ? builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/be445a9074f.tar.gz" }:
<clever> camsbury: this can also come in handy
<clever> "19.03pre166449.be445a9074f"
<clever> $ nix eval nixpkgs.lib.version
<clever> -Werror can do that
<clever> camsbury: https://github.com/cleverca22/thermostat_firmware and its now public!
<clever> camsbury: down to just a single type of warning
<clever> main.c:42:58: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
<clever> camsbury: if you run `nix repl '<nixpkgs>'` and then `pkgsCross`, what does it show?
<clever> pkgsCross is a special set, that will map over all the example cross-compile sets
<clever> camsbury: ah, thats avr.stdenv.mkDerivation
<clever> camsbury: i usually just grep nixpkgs itself
<clever> nixos-unstable
<clever> camsbury: and what was i thinking? lol
<clever> main.c:333:3: warning: 'return' with no value, in function returning non-void
<clever> using functions i never defined ahead
<clever> camsbury: this code is such spaghetti, lol
<clever> untested, but it looks like a good sign
<clever> -r-xr-xr-x 1 root root 7.9K Dec 31 1969 avr.bin
<clever> https://gist.github.com/e21c0cecb25954f100a1116d045b6721 has been updated, running nix-build now creates:
<clever> that is left-over on the gentoo box, from a really old build
<clever> -rwxr-xr-x 1 clever clever 8.2K Feb 17 2014 avr.bin
<clever> and hard-coded paths
<clever> impure path `/usr/lib/binutils/avr/2.24/ldscripts/avr5.x' used in link
<clever> nearly all of my compile errors are due to 5 years of gcc getting more strict about things
<clever> camsbury: buildFlags = "ergodox_ez:camerak";
<clever> what happens if you just drop the above default.nix into the root dir, and nix-build?
<clever> ah
<clever> camsbury: https://gist.github.com/e21c0cecb25954f100a1116d045b6721 almost "just works", with a makefile i last used on gentoo, and havent changed for 5 years
<clever> avr/include/avr/pgmspace.h:extern size_t __strlen_P(const char *) __ATTR_CONST__; /* internal helper function */
<clever> packet.c:17:13: warning: implicit declaration of function 'strlen_P'; did you mean 'strlen'? [-Wimplicit-function-declaration]
<clever> camsbury: i think it works better if you use pkgs.pkgsCross.avr.stdenv.mkDerivation
<clever> its using the nix-locate command from nix-index
<clever> any file
<clever> `git log` says the last commit was 2014!
<clever> that hard-drive has since failed, lol, years ago
<clever> dang!, i havent touched this git repo in ages
<clever> origin /media/mainlv/git_repo_1/thermostat.git/ (fetch)
<clever> clever@c2d ~/apps/thermostat $ git remote -v
<clever> yeah
<clever> i ran `nix repl '<nixpkgs>'`
<clever> «derivation /nix/store/6gphgfsyagslmn3x8s50hgq1680xslzk-avr-libc-2.0.0-avr.drv»
<clever> nix-repl> pkgsCross.avr.avrlibc
<clever> nix-repl> avrlibc
<clever> error: Package ‘avr-libc-2.0.0’ in /nix/store/bssxqlhb7liba974sx8yz3d0arjzvp9s-nixos-19.03pre166449.be445a9074f/nixos/pkgs/development/misc/avr/libc/default.nix:25 is not supported on ‘x86_64-unknown-linux-gnu’, refusing to evaluate.
<clever> ive not done avr stuff on nixos yet, havent had to modify the firmware since switching
<clever> there should be an avr-libc package somewhere
<clever> hmmm, none of those look like the right choice
<clever> ,locate avr io.h
<clever> veverak: i think the rpi can boot from usb mass-storage now, so you can just dd the original .img you started with, to that usb stick
<clever> and then another nixos-rebuild switch will just use it
<clever> veverak: you can then use nix copy again, in the reverse direction, to copy the build product back to /
<clever> veverak: this should work even that early on
<clever> veverak: and this then builds it, inside /mnt/nix/store/
<clever> [root@amd-nixos:~]$ nix-store -r /nix/store/sb7jz3p7l1qkj5dkfc20j6hc54la3l90-nixos-system-amd-nixos-19.03pre166449.be445a9074f.drv --store local?root=/mnt/
<clever> veverak: this will then copy that .drv to /mnt/nix/store/
<clever> [root@amd-nixos:~]$ nix copy --to local?root=/mnt/ /nix/store/sb7jz3p7l1qkj5dkfc20j6hc54la3l90-nixos-system-amd-nixos-19.03pre166449.be445a9074f.drv --no-check-sigs
<clever> veverak: let me find the next step...
<clever> veverak: `nix-instantiate '<nixpkgs/nixos>' -A system` will give you a .drv file for the whole nixos build
<clever> veverak: ah, it could just be that you ran out of space then

2019-02-21

<clever> or maybe it was TMPDIR, or one of those
<clever> NemesisD: just export TMP=/tmp/ i think
<clever> NemesisD: that tmpdir is managed by systemd, and is a percentage of your ram, i try to always keep the build temp on /tmp, which is part of the / fs
<clever> ar1a: that works on both outputs, and .drv files
<clever> ar1a: nix-store --query --tree /nix/store/foo
<clever> NemesisD: if you change the nix expression, just adding a space or comment inside a string, it will rebuild it
<clever> NemesisD: why do you want to force a rebuild?
<clever> veverak: does it fail the same way every time?
<clever> download
<clever> veverak: i'm guessing either your DL got corrupt, or upstream changed something
<clever> veverak: ls -lh /nix/store/6c7kyj10154aggq1igs6rcpyccazw4ar-gcc-7.3.0.tar.xz
<clever> selfsymmetric-pa: sounds like you may need a newer gcc? can google find out which one?
<clever> selfsymmetric-pa: this applies an overlay, that changes the opam attribute
<clever> > (emacsPackagesNg.overrideScope' (self: super: { opam = 42; })).opam
<clever> selfsymmetric-pa: it is a set of emacs packages, and you can use overrideScope to apply an overlay to it
<clever> > emacsPackagesNg.overrideScope
<clever> unstablePkgs.pdf-tools.overrideAttrs (attrs: {
<clever> yeah, thats usually simpler
<clever> attempt to call something which is not a function but a set
<clever> selfsymmetric-pa: it expecs the 1st arg to be a function, but you gave it a set
<clever> selfsymmetric-pa: the args go the other way around
<clever> pdf-tools = unstablePkgs.lib.overrideDerivation unstablePkgs.pdf-tools (attrs: {
<clever> yeah, thats better
<clever> selfsymmetric-pa: this step should fail 100% of the time
<clever> cp -p epdfinfo /home/matt/.local/bin/
<clever> but the new key is only usable from the result, and emacsPackagesNg cant internally refer to it
<clever> ikitat: that is added to your nixos config, and line 14 will run as one of the last steps, when creating the storepath that /run/current-system points to
<clever> ikitat: yeah, thats created by line 14
<clever> ikitat: you need to set nix.nixPath on the target machines, to define <nixpkgs> and <nixpkgs-overlays>
<clever> ikitat: add it as a normal build slave in /etc/nix/machines
<clever> the singlequotes stop bash from eating the double, so nix gets "value" as a nix level string
<clever> --argstr arg value, is just --arg arg '"value"'
<clever> --arg, not --argstr
<clever> > /tmp/foo
<clever> immae: just use /tmp/foo as a path at the nix level, unquoted
<clever> lejonet: of note, root is trusted by default, so you can always just `nix copy --to ssh://root@laptop /nix/store/foo` and ignore fixing the cfg
<clever> illegalprime: yeah, nixos-unstable is just the latest rev of master to pass a set of tests
<clever> illegalprime: pkgs.pkgsCross.aarch64-multiplatform.glibc builds perfectly on a recent nixos-unstable
<clever> evanm: yeah, i believe you need to use a new nixpkgs, to fix the new darwin problems
<clever> illegalprime: its fetching 90% of it from the cache, and only building a single glibc
<clever> illegalprime: trying the same build here...
<clever> illegalprime: you can directly run `nix-shell /nix/store/foo.drv` to open a given derivation in the shell, but that still wont help you know which one to edit
<clever> i just write things for nix, since nix works on every distro
<clever> i basically ignore all other distros when packaging things now
<clever> Phillemann: and you cant use normal env vars like ${out} why?
<clever> Phillemann: looking closer, it wont directly pass $out to make
<clever> Phillemann: the $out env var will always be available
<clever> i cant see any reason for it to be doing that
<clever> thats strange....
<clever> ProofTechnique: i cant see anything that would indicate quoting, can you add /etc/offlineimaprc to the gist?
<clever> ProofTechnique: can you pastebin your nix expression?
<clever> Phillemann: i usually just run ls on the result symlink, find what sub-path its at, and then hard-code the nix to use $out/lib/libfoo.so
<clever> Phillemann: at build-time, it will be somewhere under $out (an env var)
<clever> Phillemann: embeding the absolute path of the .so would be better, not sure why more arent doing it
<clever> Phillemann: thats how nearly all python things handle it, but i dont like that, because people keep missing it and random_python_library#42 then fails when imported
<clever> and its 4am here, i should get some sleep
<clever> eyJhb: i have shared folders without it
<clever> eyJhb: i dont have the extension pack enabled, so it mostly comes from the cache
<clever> eyJhb: yeah, that looks like it should work
<clever> eyJhb: what does `sudo nix-channel --list` report?
<clever> you could try switching to nixos-unstable?
<clever> eyJhb: master is only ~14 hours ahead of nixos-unstable
<clever> "19.03pre166449.be445a9074f"
<clever> $ nix eval nixpkgs.lib.version
<clever> yeah, i think it would be worth a bug on nixpkgs
<clever> without messing up vim for any other users on the machine