2020-04-04

<clever> system.replaceRuntimeDependencies
<clever> mudri: but it may be simpler to just copy the file out of the store, and patch the thing that was referencing it (after also copying it)
<clever> mudri: something along the lines of replace dependencies
<clever> bqv[m]: nixos also has it
<clever> > pkgs.linuxPackages_latest.kernel.version
<clever> > pkgs.linuxLatestPackages.kernel.version
<clever> > pkgs.linuxPackages.kernel.version
<clever> bqv[m]: linuxPackages is a set containing the kernel and every optional module
<clever> i havent checked to see what ion is at there
<clever> nixos does extra testing for nixos
<clever> unstable follows master, the others follow the release branches
<clever> sullyj3: each updates when a cerain branch passes a certain set of tests
<clever> sullyj3: nope, nixos-19.03, nixos-19.09, nixos-20.03, nixos-unstable, and nixpkgs-unstable are all channels
<clever> sullyj3: then dozens of nixpkgs-unstable users started to come out of the woodwork, because they where on the wrong channel and it ceased to boot :P
<clever> sullyj3: a few years ago, a bug came up in grub config generation, that corrupted grub.conf, nixos-unstable correctly didnt update, protecting most users
<clever> sullyj3: nixos-unstable goes thru extra testing, to make sure it wont brick a nixos machine
<clever> it does go thru fairly heavy automated testing before it gets to users
<clever> sullyj3: but i just run unstable on everything, since i have rollbacks
<clever> sullyj3: you can also grab just a few things from unstable if you choose to
<clever> ,unstable
<clever> a new release is made every 6 months, and nixos-unstable is the rolling channel
<clever> both 03 and 09 are releases
<clever> but not the gitrev of the current nixpkgs
<clever> sullyj3: all it tells you, is what release you began on
<clever> ,stateVersion sullyj3
<clever> sullyj3: the stateVersion means nothing
<clever> which is exactly the kind of mess nix prevents
<clever> smeag0l: that kind of mess is only needed if packages are going out of their way to avoid collisions in /usr/include
<clever> alexgood: you may need to add libsodium to the buildInputs then
<clever> alexgood: yarn2nix also deals with building node_modules in a pure and read-only manner
<clever> alexgood: those tend to work for me, when using nix-shell
<clever> alexgood: oh, but also dont forget the name = "something";, oops
<clever> alexgood: echo 'with import <nixpkgs> {}; stdenv.mkDerivation { buildInputs = [ yarn nodejs ]; }' > shell.nix
<clever> eyJhb: ah, there it is, now i feel less insane, a rev of nixpkgs from 2014, requires 500500 list concats, to do the same nix expr!
<clever> eyJhb: though, i still cant reproduce the poor perf on the older ver...
<clever> eyJhb: thats why unique isnt as shit as i remember it! lol
<clever> eyJhb: oh!!!!
<clever> eyJhb: ok, maybe its less of a problem when it is already unique..., i forget the exact algo
<clever> eyJhb: and this, 121 concats
<clever> NIX_SHOW_STATS=1 nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.unique (lib.genList (x: x) 100)'
<clever> eyJhb: this leads to 26 concats
<clever> NIX_SHOW_STATS=1 nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.unique (lib.genList (x: x) 5)'
<clever> eyJhb: the area where lib.uniq will truely fail, is line 11, list.concats
<clever> eyJhb: you can also add `NIX_SHOW_STATS_PATH=profile.json` to save the stats, and then post-process with tools like jq
<clever> ,profiling eyJhb
<clever> ehmry[m]: not really, you have to modify the derivation to print it to the logs
<clever> some hosting providers encourage that thought
<clever> ignore the partitions entirely
<clever> MichaelRaskin: depending on the VPS, it might be simpler to just add a whole swap disk!
<clever> and since i choose zfs, i cant use swap files
<clever> it has a 40mb swap, not a 40gig swap
<clever> i made the mistake of mixing up units when i setup my laptop
<clever> which nixops can automate
<clever> so would a small swap file
<clever> MichaelRaskin: given the `created 9682 symlinks in user environment` msg, it got past the eval, and was building systemPackages when it failed
<clever> and it will auto-create a 2gig file for you
<clever> stevenroose: so, swapDevices = [ { device = "/var/lib/swap1"; size = 2048; } ];
<clever> swapDevices.*.device
<clever> swapDevices.*.size
<clever> stevenroose: yep
<clever> stevenroose: you can always make a swap file temporarily, fallocate, mkswap, and swapon
<clever> stevenroose: what about a pinch of swap?
<clever> stevenroose: is it doing anything in parallel? which process actually ran out of ram?
<clever> stevenroose: thats a performance problem with `nix-env -i`, nixos-rebuild doesnt have that problem to begin with
<clever> eyJhb: map can translate it over easily enough ^
<clever> stevenroose: nixops can build it on one machine, then deploy to another
<clever> > :p builtins.listToAttrs (map (x: { name = x; value = x; }) [ "domain.com" ])
<clever> > :p builtins.listToAttrs [ { name = "foo"; value = 42; } { name = "bar"; value = 43; } ]
<clever> > { a = 1; b = 2; } // { b = 3; c = 4; }
<clever> eyJhb: // will merge sets
<clever> due to the recursive nature of lib.sublist
<clever> eyJhb: lib.unique will also require 100,000 stack nix stack frames (which may each be 2 or 3 c++ stack frames)
<clever> so lib.uniq on a 100,000 element list, will have a cost of 100000 + 99999 + 99998 + 99997 ....
<clever> and array concat, has a cost equal to the output array size
<clever> along with array concat
<clever> and lib.sublist, will call lib.sublist recursively
<clever> the problem with lib.uniq, is that its based around lib.sublist
<clever> eyJhb: if you have duplicate keys, it will silently drop the duplicates (cant remeber if first or last is kept)
<clever> eyJhb: and builtins.listToAttrs is a single primop, to turn a list of { name = "foo"; value = "something"; } into { foo = "something"; }
<clever> eyJhb: it will invisibly translate all strings to ints as new keys are found
<clever> eyJhb: behind the scenes, an attrset is a int->value mapping, not a string->value mapping
<clever> eyJhb: https://github.com/NixOS/nix/pull/2459 solves that, but i never got around to finishing the edge cases (it can segfault if misused)
<clever> eyJhb: its slow due to the lib.subList function, partially
<clever> when networking and services both need it, you must do `let foo = 123; in { services.foo.port = foo; networking.foo.port = foo; }
<clever> you can do `services = let foo = 123; in { mysql.port = foo; httpd.port = foo; }`, but that will obviously fail due to a port collision
<clever> stevenroose: but, config.services.murmur.port is better, it lets you read the 1st part, even if its since been changed with mkForce elsewhere
<clever> stevenroose: you have to declare them at some common point, in this case, networking and services are split, so the only common point is the top
<clever> stevenroose: let foo = 123; in { stuff = foo; }
<clever> even when you change it and forget to update things
<clever> stevenroose: then it will always open the right port
<clever> stevenroose: also, its much much better to do networking.firewall.allowedTCPPorts = [ config.services.murmur.port ];
<clever> stevenroose: more that i havent audited things lately, a lot of this could be cleaned up
<clever> i havent used it in several years
<clever> stevenroose: ^
<clever> simpson: i forgot murmur was even running on that machine!
<clever> stevenroose: for example, the ts3 ports, and line 174-179 should be moved to a ts3-server.nix file
<clever> stevenroose: yeah, a lot of those could be moved to other files and cleaned up
<clever> and the openFirewall flag, its mostly a matter of somebody bothering to add it
<clever> stevenroose: ssh is a bit special, to make sure you dont lock yourself out of the machine
<clever> stevenroose: this is what it will usually look like after a while: https://github.com/cleverca22/nixos-configs/blob/master/nas.nix#L15-L32
<clever> stevenroose: imports = [ ./murmur.nix ];
<clever> simpson: and it will then merge things, using the module framework
<clever> simpson: you can do config = lib.mkMerge [ {...} {...} ];
<clever> i was expecting the config to get more complex, but then stopped using the service
<clever> stevenroose: a much simpler example
<clever> stevenroose: configuration.nix itself, is a module, so your already declaring modules!
<clever> and its trivial (editing 1 line) to disable that whole block at once
<clever> stevenroose: currently, only 1 machine uses it, but i still do `imports = [ ./media-center.nix ];` to enable it there
<clever> stevenroose: this for example, just sets up auto-login and runs plex on login
<clever> stevenroose: and making a dedicated module, makes it easy to repeat that on a 2nd machine, or turn the whole thing off with 1 comment
<clever> and then the module system can merge things as usual
<clever> stevenroose: splitting it up into seperate modules is another option
<clever> and thats a parse time error, rather then an eval-time error, so it happens somewhat earlier

2020-04-03

<clever> pjt_014: dont think there is one
<clever> sasycto: what do you get when you run `ls -l` on that path?

2020-04-01

<clever> pjt_014: yeah, you can use nix-copy-closure to move drv's to another machine, and still build them there

2020-03-31

<clever> typetetris: if your nixops expr defines multiple machines, then nixops will deploy to multiple machines at once

2020-03-30

<clever> gchristensen: and we got matrixed again, lol
<clever> mica[m]: so all state will be lost at stop, and it will start fresh from the image
<clever> mica[m]: the --rm says to delete the container, but not the image
<clever> mica[m]: but once in docker, it wont pull again
<clever> mica[m]: line 173, it just does `docker run --rm ...` against the name, which i think it pulls from dockerhub

2020-03-27

<clever> ottidmes: nixos will dynamically generate /etc/systemd/user to suit what is enabled
<clever> ratsclub: thats not an error daemon-reload can give
<clever> ratsclub: did it error, or not do what you wanted?
<clever> ratsclub: didnt work how?
<clever> ottidmes: enable will never work on nixos
<clever> ratsclub: does emacs.service exist in the above dir?
<clever> ratsclub: ls /etc/systemd/user
<clever> ratsclub: what about `systemctl status emacs` as root?
<clever> ratsclub: and did you rebuild switch?
<clever> you managed to spam while using a pastebin!
<clever> peelz_: fetchTarball is an eval-time fetch, that behaves more like ./.
<clever> Orbstheorem: this may bypass things
<clever> > :p pinentry.meta.outputsToInstall
<clever> > pinentry.meta.outputsToInstall
<clever> Orbstheorem: nix-env -iA nixos.hello.out
<clever> turion: runCommand "name" { outputHash = "hash"; outputHashMode = "recursive"; outputHashAlgo = "sha256"; }
<clever> ah, youll need a lock file then, to stop it from getting latest
<clever> betaboon: is there a lock file, that lists the hash of everything antibody is going to download?
<clever> betaboon: just give it the wrong hash on purpose, build it once, and then copy the real hash
<clever> ,tofu betaboon
<clever> betaboon: youll probably need to have nix download things with fetchurl, then point antibody to a dir of pre-fetched things
<clever> betaboon: what are you trying to do?
<clever> betaboon: add outputHash = "hash"; outputHashMode = "recursive"; outputHashAlgo = "sha256"; to a derivation, and it will enable network access
<clever> betaboon: define an output hash and nix will allow network

2020-03-26

<clever> ivegotasthma: just normal options
<clever> shor: read the shell script, then re-run nixos-install with `--option substituters ''` added to the cmd
<clever> shor: does it say what its trying to build?
<clever> shor: are you using the shell script i included?
<clever> shor: the `--system` should be telling it to skip directly to a pre-built nixos
<clever> shor: the 0fe... is the revision
<clever> shor: run realpath on that, does it include a partial git revision?
<clever> shor: nix-instantiate --find-file nixpkgs
<clever> shor: what does `nixos-version` report?
<clever> shor: using the same rev of nixpkgs?
<clever> shor: if it cant reach the binary cache, it will begin downloading sources
<clever> shor: which dependencies?
<clever> shor: what did it fail at?
<clever> ivegotasthma: like just "/"
<clever> ivegotasthma: it must be a mountpoint, not a device
<clever> ivegotasthma: fileSystems.<name?>.options
<clever> shor: i forgot to close the string for "/nixos" (facepalm)
<clever> shor: oh, i see the problem
<clever> shor: can you screenshot the terminal where your editing the file and running nix?
<clever> shor: and if you read the file with cat, can you confirm its all there?
<clever> shor: can you paste the exact error msg?
<clever> shor: can you re-paste what you have?
<clever> shor: does your file look identical to the example i gave?
<clever> shor: if you build an ISO from that, it will include a copy of other-configuration.nix fully built, and running thing will install it to /mnt
<clever> shor: yeah
<clever> shor: like use writeShellScriptBin to make a shell script that runs nixos-install --system ${anotherSystem}
<clever> shor: and then do something with ${anotherSystem} somewhere
<clever> shor: let anotherSystem = (import (pkgs.path + "/nixos) { configuration = ./another-configuration.nix; }).system; in
<clever> shor: then you do want that, the 2nd configuration.nix is the system you want to install
<clever> shor: do you want one configuration.nix to include the build of another configuration.nix?
<clever> pie_[bnc]: that can happen it malloc returns null and apps dont check
<clever> shor: (import (pkgs.path + "/nixos) { configuration = ./configuration.nix; }).system
<clever> shor: what exactly are you trying to do?
<clever> shor: <nixpkgs/nixos> returns a set, where system is a derivation for the entire nixos build
<clever> shor: `-A system` says to get the system attribute of the attrset that file returns
<clever> and none of them are gc roots, so the path may vanish at any time
<clever> and this then maps a given tarball to a storepath
<clever> lrwxrwxrwx 1 root root 62 Mar 17 2019 /root/.cache/nix/tarballs/z5a497qznwnjv7hcinbhvh3x4jczfgrb-nixos-16.03.tar.gz-unpacked -> /nix/store/ls6i5ysqm0k2dri00zfh0a0igcrn7bkf-nixos-16.03.tar.gz
<clever> this tracks the url, i think the etag? and the timestamp it was last checked
<clever> 1550707724
<clever> "2935a67eb946a208b1da7a453d125bc188fd9c33"
<clever> [root@amd-nixos:~]# cat ~/.cache/nix/tarballs/187scrklwbqay1nqb0qa9fyhzd8l376axzwl027pfkb4y84kxfch.info
<clever> if it lacks etag support, it will likely re-download the .tar.gz, but then notice the store already has an unpacked copy, and reuse that
<clever> ottidmes: if the http server supports etag's, it can use that to skip the download, and reuse what was in the store
<clever> ottidmes: if it has been over the ttl, it will try to re-download the file
<clever> ottidmes: thats controlled by the tarballttl in `nix.conf`
<clever> so it causes major slowdowns
<clever> tilpner: fetchTarball also cant be ran in parallel to other derivations
<clever> betaboon: self.config
<clever> betaboon: outside of nixos, it comes from a config.nix file by default
<clever> betaboon: thats the nixpkgs config, which you can also set via nixpkgs.config in configuration.nix
<clever> default is which os your on, true for linux
<clever> 12473 libao = callPackage ../development/libraries/libao {
<clever> 12474 usePulseAudio = config.pulseaudio or stdenv.isLinux;
<clever> default is false
<clever> 6479 scream-receivers = callPackage ../misc/scream-receivers {
<clever> 6480 pulseSupport = config.pulseaudio or false;
<clever> betaboon: also, things like nixpkgs.config.flag, can have different defaults for different packages
<clever> betaboon: yeah, so it works with an empty config
<clever> betaboon: nope
<clever> betaboon: nixos config or nixpkgs config?
<clever> ah, and thats what you want
<clever> aranea: `nix-shell -p nftables` will give a shell with nftables in PATH, `nix-shell -A nftables '<nixpkgs>'` will give a shell suitable to compile nftables
<clever> yeah
<clever> bqv[m]: do the builds in the background

2020-03-25

<clever> ZoomZoomZoom: try `linuxPackages` inside `nix repl '<nixpkgs>'`
<clever> ZoomZoomZoom: you can also use nix repl to test these things out
<clever> self and super are both versions of pkgs
<clever> that would change the kernel within the set
<clever> ZoomZoomZoom: you want linuxPackages_testing_bcachefs.extend (self: super: { kernel = super.kernel.something; })
<clever> ZoomZoomZoom: linuxPackages_testing_bcachefs is a set containing many kernel packages, not a single kernel
<clever> nilsirl[m]: nix-env -f default.nix -iA something
<clever> colemickens: you can use nix-copy-closure to copy a drv file, then run `nix-store -r` on the remote machine to build it
<clever> not sure what is happening then, ive not used network-manager
<clever> energizer: what is it a child of?
<clever> energizer: you could maybe use `--store local?root=$HOME`, but that has many bugs
<clever> energizer: everything in the nix store must always be readable
<clever> cole-h: after importing the file, it treats it as a function, and passes it an empty set
<clever> energizer: copyPathToStore is an internal function inside nix
<clever> energizer: pkgs.fetchurl is how most things work, but requires you to host it on an http server somewhere
<clever> energizer: then its in the store, and things work as normal
<clever> energizer: it gives you an error saying to download the thing, and run `nix-store --add-fixed sha256 ./foo`
<clever> energizer: requireFile is typically used for things behind a license agreement, like java
<clever> OmnipotentEntity: i think mesa is the right one, but you may need nvidia_x11 for the cuda headers
<clever> OmnipotentEntity: you should use /run/opengl-drivers/lib, so it picks up the right drivers for the kernel
<clever> energizer: pkgs.requireFile or pkgs.fetchurl if you actually want it in the store
<clever> energizer: if you want to just exclude the csv file entirely
<clever> energizer: builtins.filterSource
<clever> OmnipotentEntity adding it to the wrapProgram would also be a solution
<clever> OmnipotentEntity: try changing it to true?
<clever> OmnipotentEntity: oh, i see that, line 130 in the file i linked
<clever> OmnipotentEntity: looks pretty much identical on that revision
<clever> OmnipotentEntity: what about the output of `nixos-version` ?
<clever> OmnipotentEntity: how did you check?
<clever> OmnipotentEntity: what does glxinfo say?
<clever> OmnipotentEntity: all of that config looks like it should work
<clever> alienpirate5: status.nixos.org
<clever> OmnipotentEntity: i'm not seeing how it actually works on my machine yet
<clever> OmnipotentEntity: PAM sets those vars
<clever> aha
<clever> OmnipotentEntity: which isnt in my old example...
<clever> it goes via environment.sessionVariables
<clever> srid: its more the job of nix-channel to update the exprs, most of the time
<clever> srid: -u will just re-install all things currently installed, based on the given expr
<clever> srid: you can either use `--option tarball-ttl 1234` to change it, or you can just wipe ~/.cache/nix/tarballs
<clever> srid: it caches the tarball for 1 hour by default
<clever> srid: nix show-config | grep tarball-ttl
<clever> OmnipotentEntity: it may only run for "login shells", so a non-login bash wont do it
<clever> OmnipotentEntity: it could either be /etc/bashrc or /etc/profile
<clever> OmnipotentEntity: not sure whats going on then
<clever> OmnipotentEntity: https://nixos.org/nixos/options.html#zsh
<clever> OmnipotentEntity: did you enable zsh within configuration.nix? that might break some things
<clever> OmnipotentEntity: the container stuff may be breaking it
<clever> OmnipotentEntity: Yakuake?
<clever> OmnipotentEntity: are you running it from a shell or a systemd service?
<clever> OmnipotentEntity: if xorg is enabled, then LD_LIBRARY_PATH will contain /run/opengl-drivers/lib system wide
<clever> atemu12[m]: for example, clevers_machines.nix does a bunch of config that i put on many of my machines, but i could just omit that from the imports list on a pi
<clever> atemu12[m]: or use imports to group things into pi and non-pi stuff
<clever> atemu12[m]: then use an if statement and a config flag
<clever> atemu12[m]: what about modifying what put them into systemPackages, to not do that
<clever> atemu12[m]: what are you trying to remove from systemPackages?
<clever> atemu12[m]: an overlay cant modify systemPackages, the most you can do is make that package null, like `firefox = null;` so installing firefox does nothing
<clever> Jonathan44: depending on how you do it, that may give you an env with fcl pre-built, not fcl's deps
<clever> Jonathan44: you could just add them to the buildInputs
<clever> Jonathan44: i'm not sure its fully documented, but it basically lets you make a private set of packages, and you can still add overlays to it later
<clever> Jonathan44: either `-A libccd` or `-A fcl`
<clever> Jonathan44: you need to use -A to tell it which thing you want a shell on
<clever> yep
<clever> Jonathan44: https://gist.github.com/b0b199f9ddf1b217cdc182884a40ced2 and `nix-build -A fcl` and it builds on my end
<clever> Jonathan44: nearly done compiling
<clever> Jonathan44: already ahead of you
<clever> gchristensen: personal, i dont touch --upgrade, it conflicts with --rollback (which wont fully undo the upgrade)
<clever> gchristensen: i wonder what spured that on!
<clever> gchristensen: heh :D
<clever> Jonathan44: src = ./.; is most common
<clever> Jonathan44: it must contain a / and must not be quoted
<clever> Jonathan44: let me try something here...
<clever> Jonathan44: that would explain why its complaining about the missing project()
<clever> ?
<clever> Jonathan44: env is failing to build, which env?
<clever> Jonathan44: i meant the `name = "env";` in the file
<clever> Jonathan44: its hard to tell which one is which in the build log