nixGL looses PATH and breaks all things nix

Since this is about using nix on Archlinux and Mac, is it perhaps off topic for this discourse, if so might you point me to the right place to ask?

I’m using nixGL to start kitty (the fancy terminal emulator)

Programs started by nixGL start with a fresh PATH and environment and in doing so loose all sense of Nix. so they can’t start other programs or interact with anything.

To work around this i have been running:

echo $PATH > .path
nixGL kitty
export PATH=`cat .path`

which is somewhat inelegant. What other approaches might help with this?

If you’re using home-manager, you probably missed step 4 of the standalone installation instructions: Home Manager Manual

If not, it definitely still sounds like your shell init isn’t set correctly.

I don’t have home manager

Fair enough, how exactly are you launching kitty then? How did you install nixGL and kitty? What else did you install and how?

to install nixgl i couldn’t make the overlay from my project flake so i installed it manually

nix-channel --add https://github.com/nix-community/nixGL/archive/main.tar.gz nixgl && nix-channel --update             
nix-env -iA nixgl.auto.nixGLDefault   

then start the flake

~/tmp/flake » nix develop                                                                                                                   130 ↵ (main⚡) arthur@a:15:23:45
warning: Git tree '/home/arthur/tmp/flake' is dirty
cp: cannot create regular file '/home/arthur/.emacs.d/init.el': Permission denied
arthur@a:~/tmp/flake$ echo $PATH
/nix/store/ywz6s6bzap4x6yhg2lrx3ibqcnv051c7-patchelf-0.15.0/bin:/nix/store/lbk30k56awz9vz9qpid93fkjns0xwlhd-gcc-wrapper-13.3.0/bin:/nix/store/wl7xs26116sswgw18pnc3yw9r5gxr6hx-gcc-13.3.0/bin:/nix/store/mg27y4zq8j0m8dn83azqmq02xvfmsd9i-glibc-2.39-52-bin/bin:/nix/store/w1iq3315z63558j04gnlzdd2yk1v1hfz-coreutils-9.5/bin:/nix/store/qrw9mznq4p1135k53aa5g9saz229srf4-binutils-wrapper-2.42/bin:/nix/store/x7yyxvwy1f9hlx72rzrgx069jyf7hxwr-binutils-2.42/bin:/nix/store/jav6m86f97cpj1l5d3waqhq1yz837pxp-cargo-1.80.1/bin:/nix/store/v191kl97751i0rpmvhhrsjfdl9lm38s2-rustc-wrapper-1.80.1/bin:/nix/store/829l25fb7gsf1k5yclzm3ggym2qr6bga-rustfmt-1.80.1/bin:/nix/store/3prj2gccvgpr5fmp0lrm25n7mriw8zba-pre-commit-3.7.1/bin:/nix/store/f2y25r57f7prlqnhiagzxdrnc3dgkyvv-clippy-1.80.1/bin:/nix/store/n0yhbikwy35h4pr4c802pxjh1vrpv8n7-emacs-29.4/bin:/nix/store/lngnavky30wxh3hj6hp3fsjsqhb5r6r5-ispell-3.4.06/bin:/nix/store/p45c31p2qhwjy4vf60v2d2mw9bvvpb67-git-2.45.2/bin:/nix/store/7n0s30gdikxm7axahp3l9gk4wza29sm5-kitty-0.35.2/bin:/nix/store/04gg5w1s662l329a8kh9xcwyp0k64v5a-python3-3.12.4/bin:/nix/store/w1iq3315z63558j04gnlzdd2yk1v1hfz-coreutils-9.5/bin:/nix/store/ajymwgc23snyw48wvkapw4qjggsi2vbw-findutils-4.10.0/bin:/nix/store/frx30r9405q0d4jfxnf969mgq4q8rjk2-diffutils-3.10/bin:/nix/store/d58flzaagmfb5pyvmknly4cnws45nc80-gnused-4.9/bin:/nix/store/7adzfq6lz76h928gmws5sn6nkli14ml6-gnugrep-3.11/bin:/nix/store/wab5wlc7rrn58z6ay4ls42av4n8rlqia-gawk-5.2.2/bin:/nix/store/k11rxbj9mvpgfk15rriqjn97by18r2xk-gnutar-1.35/bin:/nix/store/ybpxfq146szbqv8xxlc7ixnj9k6l1y5d-gzip-1.13/bin:/nix/store/07lm36zpghw8i9spwbcgkwzisw22k1kn-bzip2-1.0.8-bin/bin:/nix/store/nkza13k6khbmm7z2j6vj40k7081w6c9q-gnumake-4.4.1/bin:/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin:/nix/store/rr31bwb0jym6mgspqp54wdydr94skqvc-patch-2.7.6/bin:/nix/store/1idcyg3ldcggjzfznb5klr7b2wa1vznf-xz-5.6.2-bin/bin:/nix/store/2cqhdkxl71p1afk02g34hm3mbzwb8h1a-file-5.45/bin:/home/arthur/.local/bin:/home/arthur/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/bin/core_perl/:/home/arthur/.nix-profile/bin

then start kitty:

nixGL kitty

then in kitty check the PATH:

/home/arthur/.local/bin:/home/arthur/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/bin/core_perl/:/home/arthur/.nix-profile/bin
~/tmp/flake »                                      ```

PS: it’s likely not related, though here’s the flake with the nixGL commented out

{
  inputs = {
    naersk.url = "github:nix-community/naersk/master";

    nixgl.url = "github:nix-community/nixGL";

    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    utils.url = "github:numtide/flake-utils";
    # Add the GitHub repository as an input
    emacsConfig.url = "github:thearthur/arthur-s-emacs-config";
  };

  outputs = { self, nixpkgs, utils, naersk, emacsConfig, nixgl }:
    utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
             inherit system;
             overlays = [ nixgl.overlay ];
        };
        naersk-lib = pkgs.callPackage naersk { };
        #nixGL = nixgl.${system}.nixGLDefault;

      in
      {
        defaultPackage = naersk-lib.buildPackage ./.;

        devShell = with pkgs; mkShell {
          buildInputs = [
                          cargo
                          rustc
                          rustfmt
                          pre-commit
                          rustPackages.clippy
                          emacs
                          ispell
                          git
                          kitty
                          #nixGL
                        ];
          RUST_SRC_PATH = rustPlatform.rustLibSrc;
          # Fetch the init.el file from the GitHub repository
          shellHook = ''
            if [ ! -d ~/.emacs.d ]; then
              mkdir -p ~/.emacs.d
            fi
            cp ${emacsConfig}/init.el ~/.emacs.d/init.el
          '';

        };
      }
    );
}```

I have given up.
Will check back in 6 months and see if the kitty package is in a better state.
Nixgl seems to be un-flake-able with its ok for now