Skip Navigation

Help with Creating nix-shells

I'm trying to set up a simple script (linked to a hotkey in my window manager) that can launch a terminal window with a nix-shell containing packages I specify. So far, I got this:

set packages (fuzzel -d --lines 0 --prompt 'packages for nix-shell > ')
kitty nix-shell --packages $packages --run fish

If I type a single package into my runlauncher (fuzzel) (e.g. grim), the window spawns with a nix-shell as expected; if, however, I attempt to launch a shell with multiple packages (e.g. grim slurp), it fails to launch with the following error:

error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/store/cjz8w4dgc3rd2n3dqv5c208vygndjyba-source/pkgs/stdenv/generic/make-derivation.nix:336:7

       … while evaluating attribute 'buildInputs' of derivation 'shell'

         at /nix/store/cjz8w4dgc3rd2n3dqv5c208vygndjyba-source/pkgs/stdenv/generic/make-derivation.nix:383:7:

          382|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          383|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          384|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

       error: attempt to call something which is not a function but a set

       at «string»:1:107:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (grim slurp) ]; } ""
             |                                                                                                           ^

This happens with or without launching a new kitty window, and it happens with other runlaunchers as well. Why on earth isn't this working?

Any help appreciated---thanks, everyone.

2
2 comments