Running shell scripts in Home Manager Standalone/Nix Flakes

I’m having the hardest time with getting Doom Emacs configured. The biggest issue I’m having is no matter what command I use inside my shell script, when I run home-manager switch, it says the command could not be found, despite the program associated with the command is installed. However the only commands the shell is able to run are the ones built into the shell (like echo). I can run the script normally within any terminal emulator and it works just fine, so I’m completely lost to what’s going on.

System Information:

system: "x86_64-linux", 
multi-user?: yes, 
version: nix-env (Nix) 2.13.3, 
channels(root): "home-manager-23.05.tar.gz, nixos-23.05", 
channels(novaviper): "home-manager-23.05.tar.gz", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

home.nix

{ config, pkgs, ... }:

{
  imports = [
    ./modules/zsh.nix
    ./modules/doom-emacs.nix
  #  ./modules/git.nix
  ];

  # Home Manager needs a bit of information about you and the paths it should
  # manage.
  home.username = "novaviper";
  home.homeDirectory = "/home/novaviper";
  # Enable XDG
  xdg.enable = true;

  # This value determines the Home Manager release that your configuration is
  # compatible with. This helps avoid breakage when a new Home Manager release
  # introduces backwards incompatible changes.
  #
  # You should not change this value, even if you update Home Manager. If you do
  # want to update the value, then make sure to first check the Home Manager
  # release notes.
  home.stateVersion = "23.05"; # Please read the comment before changing.

  # The home.packages option allows you to install Nix packages into your
  # environment.
  home.packages = with pkgs; [
    vivaldi
    firefox
    kate
    keepassxc
    discord
    btop
    alacritty

    # # Adds the 'hello' command to your environment. It prints a friendly
    # # "Hello, world!" when run.
    # pkgs.hello

    # # It is sometimes useful to fine-tune packages, for example, by applying
    # # overrides. You can do that directly here, just don't forget the
    # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
    # # fonts?
    # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })

    # # You can also create simple shell scripts directly inside your
    # # configuration. For example, this adds a command 'my-hello' to your
    # # environment:
    # (pkgs.writeShellScriptBin "my-hello" ''
    #   echo "Hello, ${config.home.username}!"
    # '')
  ];

  # Home Manager is pretty good at managing dotfiles. The primary way to manage
  # plain files is through 'home.file'.
  home.file = {
    # # Building this configuration will create a copy of 'dotfiles/screenrc' in
    # # the Nix store. Activating the configuration will then make '~/.screenrc' a
    # # symlink to the Nix store copy.
    # ".screenrc".source = dotfiles/screenrc;

    # # You can also set the file content immediately.
    # ".gradle/gradle.properties".text = ''
    #   org.gradle.console=verbose
    #   org.gradle.daemon.idletimeout=3600000
    # '';
  };

  xdg.configFile = {
    "git/config".source = ../dotfiles/git/config;
    "gtk-2.0/gtkrc".text = ''
      gtk-enable-animations=1
      gtk-primary-button-warps-slider=0
      gtk-toolbar-style=3
      gtk-menu-images=1
      gtk-button-images=1
      gtk-cursor-theme-size=24
      gtk-cursor-theme-name="breeze_cursors"
      gtk-icon-theme-name="breeze"
      gtk-font-name="Noto Sans,  10"
    '';
  };

  # You can also manage environment variables but you will have to manually
  # source
  #
  #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  /etc/profiles/per-user/novaviper/etc/profile.d/hm-session-vars.sh
  #
  # if you don't want to manage your shell through Home Manager.
  home.sessionVariables = {
    # EDITOR = "emacs";
    PYENV_ROOT                  = "${config.xdg.dataHome}/pyenv";
    GTK2_RC_FILES               = "${config.xdg.configHome}/gtk-2.0/gtkrc";
    WGETRC                      = "${config.xdg.configHome}/wgetrc";
    CARGO_HOME                  = "${config.xdg.dataHome}/cargo";
    ANSIBLE_HOME                = "${config.xdg.configHome}/ansible";
    ANSIBLE_CONFIG              = "${config.xdg.configHome}/ansible.cfg";
    ANSIBLE_GALAXY_CACHE_DIR    = "${config.xdg.cacheHome}/ansible/galaxy_cache";
  };

  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true;
}

doom-emacs.nix

{ config, pkgs, ... }:

{
  programs.emacs = {
    enable = true;
    package = pkgs.emacs-gtk;
  };

  services.emacs.enable = true;


  home.sessionVariables = {
    EMDOTDIR        = "${config.xdg.configHome}/emacs";
    DOOMDOTDIR      = "${config.xdg.configHome}/doom";
    DOOMLOCALDIR    = "${config.xdg.configHome}/doom-local";
  };

  home.sessionPath = [ "${config.xdg.configHome}/emacs/bin" ];

  xdg.configFile = {
    "doom" = {
        source = ../../dotfiles/doom;
        recursive = true;
        onChange = builtins.readFile ../../scripts/reload-doom.sh;
      };
  };
}

zsh.nix

{ config, pkgs, lib, ... }:

{
  # Shell
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    enableAutosuggestions = true;
    enableSyntaxHighlighting = true;

    profileExtra = lib.optionalString (config.home.sessionPath != [ ]) ''
      export PATH="$PATH''${PATH:+:}${lib.concatStringsSep ":" config.home.sessionPath}"
    '';

    #plugins = [


    #];
  };

}

flake.nix

{
  description = "Your new nix config";

  inputs = {
    # Specify the source of Home Manager and Nixpkgs.
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    home-manager = {
      url = "github:nix-community/home-manager/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, home-manager, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config.allowUnfree = true;
      };
    in {
      nixosConfigurations = {
        ryzennova = nixpkgs.lib.nixosSystem {
          inherit pkgs;
          modules = [ ./nixos/ryzennova.nix ];
          specialArgs = { };
        };
        thinknova = nixpkgs.lib.nixosSystem {
          inherit pkgs;
          modules = [ ./nixos/thinknova.nix ];
          specialArgs = { };
        };
      };
      homeConfigurations = {
        novaviper = home-manager.lib.homeManagerConfiguration {
          inherit pkgs;
          # Specify your home configuration modules here, for example,
          # the path to your home.nix.
          modules = [ ./home-manager/home.nix ];
          # Optionally use extraSpecialArgs
          # to pass through arguments to home.nix
          extraSpecialArgs = { };
        };
      };
    };
}

reload-doom.sh

#!/usr/bin/env bash
DOOM="$HOME/.config/emacs"

if [ ! -d "$DOOM" ]; then
	git clone https://github.com/hlissner/doom-emacs.git $DOOM
	$DOOM/bin/doom -y install
fi

$DOOM/bin/doom sync