atlas-engineer / nyxt

Nyxt - the hacker's browser.

Home Page:https://nyxt-browser.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unify `shell.*.nix` into one

aadcg opened this issue · comments

It makes little sense to have several files to define the dev env in Nix.

I've tried it but got stuck. I have no experience with Nix, so help is highly appreciated.

# SPDX-FileCopyrightText: Atlas Engineer LLC
# SPDX-License-Identifier: BSD-3-Clause

{ pkgs ? import <nixpkgs> {} } :
with builtins;
let inherit (pkgs) stdenv; in
with pkgs;
stdenv.mkDerivation {
  name = "nyxt-dev";

  nativeBuildInputs = [
    pkgs.libressl.out
    pkgs.libfixposix.out
    pkgs.sqlite.out
    pkgs.pkg-config.out
    pkgs.sbcl
  ]
  ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
    pkgs.webkitgtk
  ];

  buildInputs = [
    pkgs.electron
    pkgs.sqlite
    pkgs.pkg-config
    pkgs.enchant.out
    pkgs.libfixposix.out
  ]
  ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
    pkgs.gobject-introspection
    pkgs.gsettings-desktop-schemas.out
    pkgs.glib-networking.out
    pkgs.pango.out
    pkgs.cairo.out
    pkgs.gdk-pixbuf.out
    pkgs.gtk3.out
    pkgs.glib.out
    pkgs.webkitgtk
  ]
  ++ (with gst_all_1; [
    gst-plugins-base
    gst-plugins-good
    gst-plugins-bad
    gst-plugins-ugly
    gst-libav
  ]);

  LD_LIBRARY_PATH = with lib; "${makeLibraryPath
    [ pkgs.enchant.out
      pkgs.sqlite.out
      pkgs.pkg-config.out
      pkgs.libfixposix.out
      pkgs.libressl.out
    ]
    ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
      pkgs.gobject-introspection
      pkgs.gsettings-desktop-schemas.out
      pkgs.glib-networking.out
      pkgs.pango.out
      pkgs.cairo.out
      pkgs.gdk-pixbuf.out
      pkgs.gtk3.out
      pkgs.glib.out
      pkgs.webkitgtk
    ]};";

  GIO_MODULE_DIR = "${pkgs.glib-networking.out}/lib/gio/modules/";
  GIO_EXTRA_MODULES = "${pkgs.glib-networking.out}/lib/gio/modules/";
}
$ nix-shell build-scripts/shell.nix
error:
       … while calling the 'derivationStrict' builtin

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

       … while evaluating derivation 'nyxt-dev'
         whose name attribute is located at /nix/store/ilsxjz1r5p29q11jbx5zdgy8vhzaydv4-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:354:7

       … while evaluating attribute 'LD_LIBRARY_PATH' of derivation 'nyxt-dev'

         at /home/aadcg/common-lisp/nyxt/build-scripts/shell.nix:48:3:

           47|
           48|   LD_LIBRARY_PATH = with lib; "${makeLibraryPath
             |   ^
           49|     [ pkgs.enchant.out

       error: value is a string with context while a list was expected

not sure... but it ran when doing this:

      LD_LIBRARY_PATH = with lib;
        makeLibraryPath (
          [
            pkgs.enchant.out
            pkgs.sqlite.out
            pkgs.pkg-config.out
            pkgs.libfixposix.out
            pkgs.libressl.out
          ]
          ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
            pkgs.gobject-introspection
            pkgs.gsettings-desktop-schemas.out
            pkgs.glib-networking.out
            pkgs.pango.out
            pkgs.cairo.out
            pkgs.gdk-pixbuf.out
            pkgs.gtk3.out
            pkgs.glib.out
            pkgs.webkitgtk
          ]
        );

Most likely, it won't make sense to pursue the goal of the original issue anymore due to atlas-engineer/cl-electron#43. In other words, the dev env for electron won't be based on Nix.

Most likely, it won't make sense to pursue the goal of the original issue anymore due to atlas-engineer/cl-electron#43. In other words, the dev env for electron won't be based on Nix.

On second thought, the nix environment is still helpful to handle the non-Node.js dependencies.

Fixed via 3abca58. Thanks @aliyss for the tip.