2020-02-06

<clever> noonien: /usr/bin/env is missing in the nix sandbox
<clever> evanjs: you may also want to look at my kexec test stuff too
<clever> evanjs: what happens if you boot without -nographic?
<clever> evanjs: got a link?
<clever> evanjs: with qemu, you can just use -kernel and -initrd to load both
<clever> evanjs: i implemented proper initrd support in my firmware, just to avoid using it
<clever> evanjs: i find that INITRAMFS_SOURCE is a pain to deal within, within nix, because you have to rebuild the entire kernel every time you change something
<clever> nixlanguagestuff: so you want `import ./coresimple.nix {}`
<clever> nixlanguagestuff: the `{}` says that it accepts a set, that must have exectly nothing in it
<clever> nixlanguagestuff: can you link an example file?

2020-02-05

<clever> nix-build --argstr logAdapterRev 123456789abcd12345678 package_name.nix
<clever> what you did, is basically: let logAdapterRev = 123456789abcd12345678; in ...
<clever> ilya_g: 123456789abcd12345678 is not a valid nix expression, you want --argstr there
<clever> it will parse the 2nd part as nix, so strings have to be quoted, and then quoted again to stop bash from parsing it, like --arg foo '"bar"', or use --argstr foo bar, to make nix treat it directly as a string
<clever> ilya_g: --arg can set those params, --arg paramname nixexpr
<clever> WinchellsM: wrapProgram and prepend to PATH
<clever> it does also support ssh agent
<clever> (note, somebody deleted it from nixpkgs)
<clever> evanjs: you want pkgs.fetchgitprivate, if you want private submodules
<clever> evanjs: the function also works in nix-shell
<clever> dashkal: and after single-stepping thru linux for .... 40 minutes? linux has finished decompressing itself, lol
<clever> Uncompressing Linux... done, booting the kernel.
<clever> then changes i make to the usb stick will persist
<clever> rather then using the iso image
<clever> i like doing nixos-install against a usb stick
<clever> ah, yeah
<clever> dashkal: my yak shaving involves single-stepping thru the linux decompressor, on an rpi2

2020-02-04

<clever> ,paste
<clever> ,pastebin drew__b
<clever> drew__b: i try to ensure stack is never in ~/.nix-profile/bin/
<clever> drew__b: why is ~/.nix-profile being in PATH a problem?
<clever> drew__b: also, nix-shell runs bash
<clever> drew__b: what does it do then?
<clever> what does .zshrc do?
<clever> yep
<clever> and nix wont work without those, thats how nix itself gets into PATH
<clever> nix.sh
<clever> root's profile is a default fallback for all users
<clever> drew__b: ~/.nix-profile is for the current user, profiles/default/bin is roots profile
<clever> drew__b: what is installed into that dir, that is causing problems?
<clever> pie_[bnc]: and i have an example already: https://gist.github.com/cleverca22/be6d6bd78230f5e624d2b626d5b677a5
<clever> pie_[bnc]: nix already has an FFI interface
<clever> arianvp: i had started that over in https://github.com/cleverca22/nix-tests/tree/master/ip-magic
<clever> logand: something ive done is `let template = { ... }; in { "foo.example.com" = template; "bar.example.com" = template; }
<clever> logand: `rec { a=42; b=a; }` can do the same thing, but needing to quote the attribute makes it not compatible with rec
<clever> tester123: "${fetchFromGitHub { ...}}/wlroots.nix"
<clever> logand: lib.fix will pass the return value of a function, back into itself
<clever> > :p lib.fix (self: { "x.a" = 42; y = self."x.a"; })
<clever> tester123: what does the default.nix in the root of the repo contain?
<clever> tester123: you need to do something like run callPackage on the return value of fetchFromGitHub
<clever> AmandaC: you get what you pay for!
<clever> infinisil: the demo.nix profile?
<clever> enless you use the home-manager nixos module
<clever> wild_buffalo: thats what home-manager does
<clever> yeah
<clever> that sounds like a configuration.nix only option
<clever> wild_buffalo: configuration.nix is for nixos options, which are used to build /run/current-system/
<clever> wild_buffalo: config.nix is only for nixpkgs level flags
<clever> wild_buffalo: and how did you define that in config.nix?
<clever> wild_buffalo: what are you trying to do?
<clever> wild_buffalo: each time you run a nix command, it re-reads it
<clever> monadplus: other way around
<clever> monadplus: if nixops is being ran on darwin, it cant build linux things, so it will try to configure the remote machine as a build machine, automatically
<clever> monadplus: if the machine running nixops is linux, it will build it locally, but also obey any build machines configured in /etc/nix/machines
<clever> monadplus: nixops always compiles it locally
<clever> ?
<clever> evanjs: phases="configurePhase" genericBuild
<clever> evanjs: because you need to `eval "$configurePhase"` instead
<clever> but in your case, you want to run part of the phase, and inspect after each part
<clever> will let you run just one phase, while obeying that
<clever> phases="configurePhase" genericBuild
<clever> genericBuild will detect the override, and eval that instead
<clever> configurePhase is a bash function, $configurePhase is the override from the expr
<clever> yeah
<clever> evanjs: you can `echo "$configurePhase"` to see what nix changed along the way
<clever> evanjs: manually run each command inside the configurePhase
<clever> evanjs: try running each of those steps by hand, in nix-shell, and look at the .config after each one
<clever> evanjs: which phase in the default.nix does something with extraConfig?
<clever> evanjs: if the option depends on something else, which is disabled, then it entirely vanishes from the .config
<clever> evanjs: something i noticed while playing with the kernel lately, is that it only says "# not defined" if the option can be enabled but isnt
<clever> kvda: youll find it in ~/.nix-profile/bin/
<clever> kvda: nix-env -i adds it to ~/.nix-profile
<clever> rename as needed
<clever> dashkal: gist updated, it will now give you a `whatever` command, that is in the default $PATH
<clever> dashkal: you could also change it to be in systemPackages, one sec...
<clever> dashkal: yeah, you could probably just delete the word xmonad from both scripts, then script2 will do nothing, and script1 will prefix it
<clever> dashkal: save that file to /etc/nixos, and add ./module.nix to the imports list, then do a nixos-rebuild switch, and `cat /etc/whatever`
<clever> kvda: then you can just add it to the buildInputs of anything else within that nixpkgs dir, and it should just work like any other package
<clever> kvda: you need to build it with nix-build, thats the only way that another package can then depend on it
<clever> dashkal: what command do you need to run when bumblebee is active?
<clever> then you have 2 different scripts, that both do basically the same thing, and nixos installs the right one
<clever> dashkal: you could also just make a shell script, that does the right thing, and choose which shell script to install, based on hardware.bumblebee.enable
<clever> dashkal: so you need to either look for the side-effects that hardware.bumblebee.enable causes, or just make your own side-effect that is obvious (the above example)
<clever> dashkal: nixos doesnt keep the configuration.nix around after it builds
<clever> dashkal: but if your config generates an answer in /etc, that answer will always match your current state
<clever> dashkal: if you edit configuration.nix and dont nixos-rebuild, then querying configuration.nix gives you the wrong answer, and everything breaks
<clever> dashkal: the reason i say to make a file like this, is state vs config
<clever> dashkal: environment.etc.whatever.text = if config.hardware.bumblebee.enable then "bumblee on" else "wheres the bee";
<clever> might want to use if though, toString does weird things with bools
<clever> dashkal: if you add that to your nixos config, it will generate a /etc/whatever file, that contains the bool
<clever> dashkal: environment.etc.whatever.text = toString config.hardware.bumblebee.enable;
<clever> dashkal: via a nixos module
<clever> dashkal: you might be better off just creating your own file in /etc/
<clever> dashkal: nixos-option

2020-02-03

<clever> kvda: patchelf
<clever> kvda: linux binaries
<clever> kvda: any elf binary must be patched with patchelf first
<clever> kvda: did you add it to all-packages.nix ?
<clever> kvda: you can then test it with ./result/bin/foo
<clever> kvda: nix-build will create a result symlink pointing to the result
<clever> kvda: just run nix-build -A package, in the root of the git repo
<clever> kvda: it doesnt need to be in nix-channel
<clever> yep
<clever> brano543: yep
<clever> brano543: you want services.postgresql.package = pkgs.postgresql_12;
<clever> brano543: its not a list type
<clever> services.postgresql.package = [ pkgs.postgresql_12 ];
<clever> brano543: oh, theres the problem
<clever> brano543: also, what does `niv show nixpkgs` report?
<clever> brano543: can you build with --show-trace, and then pastebin the entire error
<clever> brano543: change <nixpkgs/nixos> to (sources.nixpkgs + "/nixos") and see if that helps
<clever> brano543: line 6 is using the host nixpkgs, not the niv nixpkgs, which could be a problem
<clever> genesis: just have nix-build always spit out a .img
<clever> genesis: what i mean, is to automate it so you dont even have to run pfsshell
<clever> genesis: so you can just dd that to a drive, and your done
<clever> genesis: what about having nix use pfsshell in a derivation, to spit out a pre-made disk image?
<clever> brano543: that makes it much simpler to read
<clever> brano543: gist supports putting several files into a single entry
<clever> genesis: nice, though i dont have a ps2, only ps3 and snes
<clever> brano543: can you put all of the files into a gist? gist.github.com
<clever> brano543: is your overlay changing postgresql_12 ?
<clever> WinchellsM: it would be more pure to spin up your own X server inside the build, something like Xvnc would be an option
<clever> brano543: services.postgresql.package
<clever> jared-w: that only works for fixed-output derivations, and wont actually let you connect to the unix socket
<clever> brano543: yeah
<clever> brano543: so everything is already working perfectly
<clever> brano543: if you read the .service file in result, where is it getting the postgresql binary from?
<clever> das_j: and if you use ssh://big-fat-host, that host wont know what hydra has done recently, and what to keep, so any GC will potentially delete recent things
<clever> das_j: the s3 based hydra has zero garbage collection
<clever> das_j: and then your hydra will push everything to another machine
<clever> das_j: in theory, ssh://big-fat-host could also be used, where s3://bucket was
<clever> das_j: if the build machine has aws secrets, you can also use s3://bucket to keep things private
<clever> das_j: that configures hydra to upload everything to an S3 bucket, then you can just use https://bucket.awssomething.com as your cache
<clever> brano543: for example, nix-build -A services
<clever> brano543: you need to add another attribute to -A to make it more specific
<clever> brano543: it created a result-3 because your -A pointed to a set of many things, not one thing
<clever> brano543: how are you looking to see if it got copied?
<clever> das_j: have you looked into the S3 config?
<clever> das_j: so the hydra is your central cache
<clever> das_j: when a build is done, hydra will copy the product back to itself
<clever> das_j: why?
<clever> das_j: and line 255 sets it to true
<clever> das_j: the useSubstitutes variable here, is passed over the nix protocol, and controls if the remote machine will useSubstitutes
<clever> das_j: one second
<clever> brano543: you want the extensions to be installed to $out/share/postgresql/extension
<clever> das_j: hydra-queue-runner does the closure copy, using a similar protocol
<clever> brano543: `nix-build '<nixpkgs>' -A postgis && ls -l result/` would show how it should look
<clever> brano543: .withPackages will merge the $out of everything you put into extraPlugins
<clever> brano543: mapnik must create plugins in $out, not ${postgresql}
<clever> samueldr: callCabal2nix is doing a filterSource to get hello.cabal, and then it fails in a weird way if you had a Hello.cabal
<clever> astk52: ls -l Hello/hello.cabal
<clever> astk52: does Hello/hello.cabal exist, with that exact casing?
<clever> hello = self.callCabal2nix "hello" ./Hello {};
<clever> astk52: can you paste the entire error message
<clever> brano543: you must set nixpkgs.overlays = [ ... ]; in configuration.nix
<clever> astk52: and ends with?
<clever> astk52: what is the exact error it gives?
<clever> brano543: which https://pastebin.com/Ayi2jEJs already did
<clever> brano543: that will work even outside of nixos, you just have to combine `import <nixpkgs/nixos> { configuration = ./configuration.nix; }` and the eval.config.systemd.units."postgresql.service".unit your already doing
<clever> brano543: and your done!
<clever> brano543: services.postgresql.extraPlugins = [ something ]; services.postgresql.enable = true;
<clever> astk52: and if those packages have a dependency, the dep must have the right casing in its keys
<clever> astk52: and its case sensitive
<clever> astk52: when using -A, you must use the keys you defined in here
<clever> brano543: you want import <nixpkgs/nixos> { configuration = ./configuration.nix; }
<clever> m15k: so ~/.ssh/ and your ssh agent
<clever> m15k: builtins.fetchGit just uses whatever keys ssh would use by default
<clever> m15k: builtins.fetchGit
<clever> brano543: why cant you use those default options?
<clever> brano543: is the enable option still set?
<clever> brano543: and what does `nix eval nixpkgs.lib.version ; nix-channel --list` report?
<clever> brano543: can you post the rest of the https://pastebin.com/4fqJ2sbc file?
<clever> brano543: now try deleting everything thats under systemd.services.postgresql and see if it still builds
<clever> brano543: services and systemd.services are 2 different things
<clever> brano543: i said services.postgresql.extraPlugins not systemd.services.postgresql.extraPlugins
<clever> brano543: the same place you set services.postgresql.enable
<clever> brano543: now try setting services.postgresql.extraPlugins and build again
<clever> brano543: comment that line out in your config, and build again
<clever> brano543: what happens if you set services.postgresql.enable = true; and then use https://pastebin.com/4fqJ2sbc again?
<clever> brano543: you might save yourself a lot of work, if you just set options within services.postgresql
<clever> brano543: ahh, your entirely skipping the postgresql module
<clever> brano543: can you pastebin your current code?
<clever> systemd.services.postgresql the nixos module for systemd, it will then use those options, to auto-generate a postgresql.service file
<clever> brano543: services.postgresql is a nixos module, that defines postgresql options, it will then set systemd.services.postgresql options for you
<clever> brano543: no, it should be inside services.postgresql
<clever> and what problem its having
<clever> brano543: can you pastebin the code your using, when you try to use services.postgresql.extraPlugins ?
<clever> brano543: the postgresql module calls .withPackages for you, so stacking it like that may fail
<clever> brano543: .withPackages will then create a new derivation, that symlinks all of the chosen extensions together, and tells postgresql to look there
<clever> brano543: that will automatically call pkgs.postgresql.withPackages, and give it a list of plugins
<clever> brano543: you use the services.postgresql.extraPlugins option in nixos
<clever> brano543: you dont
<clever> brano543: you can only ever create files in $out, not your inputs
<clever> evanjs: thats from the platform set, passed to crossSystem i think
<clever> pkgsCross.musl64
<clever> evanjs: there is also the musl "cross compile" target
<clever> evanjs: this adds the vc4 binutils/gcc/newlib
<clever> evanjs: https://github.com/NixOS/nixpkgs/pull/72657 sort of has an example
<clever> embedded may use newlib for a libc
<clever> Orbstheorem: and the non-embedded ones, expect a linux kernel and glibc
<clever> Orbstheorem: i think the embedded ones lack glibc
<clever> Orbstheorem: you can just aim nix-shell at such a derivation and leave the body empty, if you only want its toolchain
<clever> evanjs: this lets me (cross) compile an initrd for the rpi, and then copy it to an sd card to boot under my custom firmware
<clever> evanjs: line 171 loads nixos.nix as a configuration file, and line 210 is a reference to the initrd of it
<clever> evanjs: you can use nix-build to compile fragments of a configuration.nix as well
<clever> evanjs: and you can use `boot.kernelPackages = pkgs.linuxPackages.extend (self: super: { foo = self.callPackage ./foo.nix {}; });` to add a new thing in
<clever> amd-wg.nix: boot.extraModulePackages = [ config.boot.kernelPackages.wireguard ];
<clever> amd-nixos.nix: #extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
<clever> boot.extraModulePackages
<clever> evanjs: oh, and...
<clever> evanjs: you want boot.kernelPackages and boot.initrd.availableKernelModules
<clever> m15k: you want either pkgs.fetchgitprivate (which was deleted) or builtins.fetchGit
<clever> virus_dave: you want to split it into 2 pieces, the fixed-output half that works on any platform, and then a non-fixed half that is platform specific
<clever> virus_dave: anything with a runtime dependency (such as on a shell) must not be fixed-output
<clever> if the bool is false, it will use "" instead of the string you gave it
<clever> optionalString takes a bool and a string
<clever> WinchellsM: ${lib.optionalString (file_path != null) "echo ${file_path"}
<clever> not sure, the 32bit stuff isnt covered much by hydra
<clever> AmandaC: cross or native?
<clever> AmandaC: the simplest answer is to just `ls -ltrh /tmp/` and look at the names in the nix-build dirs
<clever> WinchellsM: yeah, just make sure to not quote the path
<clever> Taneb: nix will re-create that cache when its missing
<clever> Taneb: rm /root/.cache/nix/binary-cache-v6.sqlite*
<clever> yeah
<clever> ramses_: toString prevents the copy
<clever> so fixing things wont turn into a game of whack-a-mole
<clever> ramses_: the advantage that this option has, is that nixos can eval the entire system, an report multiple errors at once
<clever> assertions = [ [ assertion = !cfg.zfsSupport || cfg.version == 2; message = "Only GRUB version 2 provides ZFS support"; } ...
<clever> :tabe ~/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix
<clever> ramses_: for nixos itself, there is a special option assertions
<clever> and throw an error when it doesnt
<clever> ramses_: ah, then you want builtins.pathExists
<clever> ramses_: i believe it should still fail if the key isnt there
<clever> ramses_: `toString ./foo.key` will give you the absolute path, rather then the path of the copy in the store
<clever> and then nix never parses the string
<clever> lovesegfault: you could also put it into a .sh file, and then just `source ${./foo.sh}`
<clever> heh
<clever> now its not in a ''string''
<clever> > '' foo ${"'\${FOO}"} bar ''
<clever> ,escape"
<clever> how about this:
<clever> > '' foo ''''${ bar ''
<clever> yeah, thats tricky
<clever> > '' foo ' ''${ bar ''
<clever> > '' foo '''${ bar ''
<clever> ,escape''
<clever> i077: thats exactly what makeWrapper and wrapProgram do
<clever> i077: if your already generating a shell script with cat, no real need to use makeWrapper though
<clever> yeah
<clever> i077: try LD_LIBRARY_PATH anyways, just to see what happens
<clever> i077: does it say which thing needs pulse?
<clever> i077: if you play with LD_DEBUG, you can make ld.so print stuff as it searches
<clever> i077: which arch is the binary for?
<clever> i077: then you have to get ugly, and use LD_LIBRARY_PATH
<clever> i077: if its dynamically loading it using dlopen, it will never obey the RPATH
<clever> yep
<clever> not sure
<clever> that would definitely explain the error
<clever> ah
<clever> i077: though, it could also be resources.pak? not sure entirely
<clever> i077: thats a special type of compressed archive that electron uses
<clever> i077: i think app.asar is the target you want
<clever> i077: what files are in that directory?
<clever> i077: try giving electron that dir anyways, and see what happens
<clever> if no args are given, it defaults to that dir
<clever> i077: its usually the same directory the original ELF binary was in
<clever> i077: and pass it that
<clever> i077: find the directory with the package.json file
<clever> i077: reusing the pre-compiled js in the .deb is sometimes simpler
<clever> javascript aint as simple as it used to be, lol
<clever> i077: if your using the github source, you may need to "compile" it first
<clever> xavierzwirtz[m]: lib.cleanSourceWith
<clever> but that register is also overwritten by any other thing you call
<clever> kandinski: and behind the scenes c sort of does that, the return value is just whatever was last put into a given register, which can lead to fun bugs if you forget the return statement
<clever> kandinski: haskell sort of does that, though it looks more like a function called return, which sets it
<clever> you can do the same with cat
<clever> writeScriptBin is a helper to create a "package" with only a $out/bin/daedalus-frontend
<clever> ${rawapp}/share/daedalus is a directory with a package.json file
<clever> i'll grab an example...