{ user, home }: { lib, inputs, system, ... }: { home-manager.users.${user}.programs.zsh = { shellAliases.nd = "nix-develop"; initContent = let devShells = lib.strings.concatStringsSep " " ( lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells.${system} ); in '' nix-develop() { local devshell="" while getopts "s:" opt; do case $opt in s) devshell=$OPTARG ;; *) echo "Usage: nix-develop [-s ]" return 1 ;; esac done if [[ -z "$devshell" ]]; then if [ ! -f flake.nix ]; then cp "${./template.nix}" flake.nix chmod 755 flake.nix fi if [ ! treefmt.nix ]; then cp "${./treefmt.nix}" treefmt.nix chmod 755 treefmt.nix fi nix develop -c "$SHELL" else nix develop self#"$devshell" -c "$SHELL" fi } _nix-develop_completion() { local options=( '-s[Dev shell from root flake]:shell:(${devShells})' ) _arguments -s $options } compdef _nix-develop_completion nix-develop ''; }; }