Cant find corect syntax for shell.nix

I am having issues with (non Nixos) GLX but progress is hindered by:
The script (copied from web) is:

{ config, pkgs, ... }:

let nixGLIntel = ( pkgs.callPackage "${builtins.fetchTarball {
      url = "https://github.com/guibou/nixGL/archive/17c1ec63b969472555514533569004e5f31a921f.tar.gz";
      sha256 = "0yh8zq746djazjvlspgyy1hvppaynbqrdqpgk447iygkpkp3f5qr";
    }}/nixGL.nix" {}).nixGLIntel;

in {
  programs.qutebrowser = {
    enable = true;
    keyBindings = {
      normal = {
        "m" = "spawn mpv ${config.qutebrowser.url}";
      };
    };
    package =
      pkgs.writeShellScriptBin "qutebrowser"
      ''#!/bin/sh
        ${nixGLIntel}/bin/nixGLIntel ${pkgs.qutebrowser}/bin/qutebrowser "$@"
      '';
    };
  }
}

AI cant fix this for me so trying here.

Looks like what you’re wanting is a shell.nix with that script? Should be:

{ pkgs ? import <nixpkgs> {} }:

let
  nixGLIntel = ( pkgs.callPackage "${builtins.fetchTarball {
      url = "https://github.com/guibou/nixGL/archive/17c1ec63b969472555514533569004e5f31a921f.tar.gz";
      sha256 = "0yh8zq746djazjvlspgyy1hvppaynbqrdqpgk447iygkpkp3f5qr";
    }}/nixGL.nix" {}).nixGLIntel;
  script = pkgs.writeShellScriptBin "qutebrowser"
      ''#!/bin/sh
        ${nixGLIntel}/bin/nixGLIntel ${pkgs.qutebrowser}/bin/qutebrowser "$@"
      '';
in
pkgs.mkShell {
  packages = [
    script
  ];
}

(Haven’t tried. EDIT: edited per the replies below).

programs.qutebrowser looks like it belongs in a NixOS or Home Manager module.

Thanks for the quick response, but I get:

error: syntax error, unexpected '}', expecting ';'

       at /home/me/Documents/Nix/dcshell.ans/shell.nix:17:1:

           16|   ]
           17| }
             | ^
           18|

Whoops. I left out a semicolon after the ]. Should be packages = [ ... ];.

Solved the syntax thank you.
But now getting:

building '/nix/store/87nighds6qcywnp9zbp3qpnl3ab624l8-nixGLIntel.drv'...

In /nix/store/2i5cxs3z75dyfx33i9fzrg3r0lp9xg42-nixGLIntel/bin/nixGLIntel line 3:
export LD_LIBRARY_PATH=/nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib:/nix/store/s5xqdc8k1zwy5pjccsghxibq982qjmnv-mesa-23.1.9-drivers/lib:$LD_LIBRARY_PATH
                                                                                                                                                               ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
export LD_LIBRARY_PATH=/nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib:/nix/store/s5xqdc8k1zwy5pjccsghxibq982qjmnv-mesa-23.1.9-drivers/lib:"$LD_LIBRARY_PATH"

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
error: builder for '/nix/store/87nighds6qcywnp9zbp3qpnl3ab624l8-nixGLIntel.drv' failed with exit code 1;
       last 10 log lines:
       >
       > In /nix/store/2i5cxs3z75dyfx33i9fzrg3r0lp9xg42-nixGLIntel/bin/nixGLIntel line 3:
       > export LD_LIBRARY_PATH=/nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib:/nix/store/s5xqdc8k1zwy5pjccsghxibq982qjmnv-mesa-23.1.9-drivers/lib:$LD_LIBRARY_PATH
       >                                                                                                                                                                ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
       >
       > Did you mean: 
       > export LD_LIBRARY_PATH=/nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib:/nix/store/s5xqdc8k1zwy5pjccsghxibq982qjmnv-mesa-23.1.9-drivers/lib:"$LD_LIBRARY_PATH"
       >
       > For more information:
       >   https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
       For full logs, run 'nix log /nix/store/87nighds6qcywnp9zbp3qpnl3ab624l8-nixGLIntel.drv'.
error: 1 dependencies of derivation '/nix/store/jmcw9gzb5x89vizf9fvr84hsbliqa2al-qutebrowser.drv' failed to build

So I guess I need to try upstream.

This is, unfortunately, a great example of what I had in mind when I wrote this recently:

You might be able to use overrideAttrs to set doCheck = false until upstream responds.

2 Likes