diff --git a/flake.nix b/flake.nix index c393369..7c708ca 100644 --- a/flake.nix +++ b/flake.nix @@ -224,9 +224,8 @@ modules = [ # TODO: specify this in mkModule? { - nixpkgs.system = system; # workaround - nixpkgs.hostPlatform.system = system; - #nixpkgs.buildPlatform.system = system; + nixpkgs.hostPlatform = system; + #nixpkgs.buildPlatform = system; } (mkModule extra-modules domain system inputs stateVersion modules hostname) ]; diff --git a/lib.nix b/lib.nix index 3755138..77aea63 100644 --- a/lib.nix +++ b/lib.nix @@ -30,7 +30,7 @@ let buildPlatform = cfg.nixpkgs.buildPlatform.system; }; inherit (cfg.boot.binfmt) emulatedSystems; - inherit (cfg.networking) fqdn; + inherit (cfg.networking) hostName fqdn search; inherit (cfg.networking.firewall) allowedTCPPorts allowedUDPPorts; buildMachines = lib.pipe cfg.nix.buildMachines [ (map (buildMachine: "${buildMachine.protocol}:${buildMachine.sshUser}@${buildMachine.hostName}")) diff --git a/users/pbsds/home/profiles/bashrc.d/nix-shell.sh b/users/pbsds/home/profiles/bashrc.d/nix-shell.sh index 1824acb..ba7697a 100644 --- a/users/pbsds/home/profiles/bashrc.d/nix-shell.sh +++ b/users/pbsds/home/profiles/bashrc.d/nix-shell.sh @@ -155,7 +155,8 @@ ne() { fi ns "$@" - storepath="$(nix --extra-experimental-features "nix-command flakes" build --impure "$pkg" --print-out-paths --no-link)" + # storepath="$(nix --extra-experimental-features "nix-command flakes" build --impure "$pkg" --print-out-paths --no-link | head -n1)" + storepath="$(nix --extra-experimental-features "nix-command flakes" eval --impure "$pkg" --raw)" printf >&2 "+ cd %q\n" "$storepath" cd "$storepath" } diff --git a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh index 143988a..9e8ce71 100644 --- a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh +++ b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh @@ -128,9 +128,9 @@ zeditor-remote() { } if [[ -n "$ssh_cd_cmd" ]]; then - local do_ssh=false - if gum confirm "SSH in there now?" --default=yes; then - do_ssh=true + if gum confirm "Open zed?" --default=yes; then + # history -s "${zed_cmd}" # TODO: this too? + eval ${zed_cmd} elif [[ "$?" -eq 130 ]]; then return 1 fi @@ -138,33 +138,35 @@ zeditor-remote() { lru_push "$host" "$statedir"/ssh-host-history lru_push "$choice" "$statedir"/ssh-repo-history - # history -s "${zed_cmd}" # TODO: this too? - eval ${zed_cmd} - # TODO: find a way to not push the rest of the unpushed history history -s "${ssh_cd_cmd}" history -a - if $do_ssh; then + if gum confirm "SSH in there now?" --default=yes; then printf >&2 "%s\n" "+ ${ssh_cd_cmd}" eval ${ssh_cd_cmd} + do_ssh=true + elif [[ "$?" -eq 130 ]]; then + return 1 fi else - if [[ "$?" -eq 130 ]]; then - return 1 # ctrl-c - fi if command -v direnv >/dev/null; then # TODO: need i find a way to load the direnv on remotes? # https://github.com/zed-industries/zed/issues/4977#issuecomment-2536680602 zed_cmd="direnv exec ${choice} $zed_cmd" fi + if gum confirm "Open zed?" --default=yes; then + # history -s "${zed_cmd}" + eval ${zed_cmd} + elif [[ "$?" -eq 130 ]]; then + return 1 + fi + # lru_push "$host" "$statedir"/ssh-host-history lru_push "$choice" "$statedir"/ssh-repo-history - # history -s "${zed_cmd}" - eval ${zed_cmd} - printf >&2 "%s\n" "+$(printf " %q" cd "${choice}")" eval cd "${choice}" # 'eval' to expand the tilde fi + unset -f lru_push } diff --git a/users/pbsds/home/profiles/bat.nix b/users/pbsds/home/profiles/bat.nix index 3f7463e..b319cb9 100644 --- a/users/pbsds/home/profiles/bat.nix +++ b/users/pbsds/home/profiles/bat.nix @@ -2,8 +2,10 @@ let + # TODO: deduplicate, move to some lib _tmp_func_name = "_tmp_func_Oaw5aifeeniezeiquonaipheNahthae9caik4Rai"; # pwgen ftw - mkArgsAlias = alias: ''${_tmp_func_name}() { ${alias}; unset -f ${_tmp_func_name}; }; ${_tmp_func_name}''; + mkArgsAlias = alias: ''${_tmp_func_name}() { unset -f ${_tmp_func_name}; ${alias}; }; ${_tmp_func_name}''; + mkArgsAliasX = alias: ''${_tmp_func_name}() { unset -f ${_tmp_func_name}; (set -x; ${alias}; ); }; ${_tmp_func_name}''; in @@ -19,6 +21,7 @@ in home.shellAliases.bata = mkArgsAlias ''printf "echo + "$@"; bat --style plain %q\n" "$@" | xargs -d'\n' ${lib.getExe pkgs.mprocs}''; #home.shellAliases.man = "batman"; #home.shellAliases.man = "PAGER=${pkgs.most}/bin/most man"; + home.shellAliases.zbat = mkArgsAliasX ''atool "$1" --cat | bat --file-name "$1"''; # TODO: implement programs.bat.enableAliases programs.bat = { diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix index 28ca12d..eebc060 100644 --- a/users/pbsds/home/profiles/shell.nix +++ b/users/pbsds/home/profiles/shell.nix @@ -86,7 +86,9 @@ in #programs.zoxide.enable = true; #programs.zoxide.options = [ "--cmd cd --cmd dc" ]; + # https://carapace-sh.github.io/carapace-bin/completers.html programs.carapace.enable = true; # completions + programs.bash.sessionVariables.CARAPACE_EXCLUDES = "just"; # comma-separated # i can't type home.shellAliases.sl = "ls";