diff --git a/flake.nix b/flake.nix index b082752..034a8e8 100644 --- a/flake.nix +++ b/flake.nix @@ -229,6 +229,7 @@ (mkModule extra-modules domain system inputs stateVersion modules hostname) ]; }; + # TODO: move this to a file or separate flake mkReport = extra-modules: domain: system: inputs: stateVersion: modules: hostname: let nixos = mkConfig extra-modules domain system inputs stateVersion modules hostname; cfg = nixos.config; @@ -247,14 +248,16 @@ users = lib.pipe cfg.users.users [ (lib.filterAttrs (uname: user: user.isNormalUser)) (builtins.mapAttrs (uname: user: { + inherit (user) home; authorizedKeys = lib.forEach user.openssh.authorizedKeys.keys (key: builtins.concatStringsSep " " ( lib.take (lib.length (lib.splitString " " key)) [ - (builtins.elemAt (lib.splitString " " key) 0) - "..." - (builtins.elemAt (lib.splitString " " key) 2) - ])); + (builtins.elemAt (lib.splitString " " key) 0) + "..." + (builtins.elemAt (lib.splitString " " key) 2) + ] + )); })) ]; nix-system-features = cfg.nix.settings.system-features; @@ -265,6 +268,7 @@ (lib.filterAttrs (mount: fs: fs.fsType != "nfs")) (lib.mapAttrs (mount: fs: "${fs.fsType}://${fs.device}")) ]; + } // lib.optionalAttrs cfg.services.nginx.enable { nginx-vhosts = lib.pipe cfg.services.nginx.virtualHosts [ #(lib.filterAttrs (domain: vhost: ) (lib.mapAttrs (domain: vhost: vhost.serverAliases or [])) diff --git a/justfile b/justfile index fa8fdda..029e7d7 100644 --- a/justfile +++ b/justfile @@ -10,6 +10,9 @@ export GUM_FILTER_HEIGHT := "15" eval hostname=`just _a_host`: nix eval .#nixosConfigurations."{{hostname}}".config.system.build.toplevel.outPath --show-trace +repl $hostname=`just _a_host`: + NIX_NO_NOM=1 nixos-rebuild --flake .#"$hostname" repl + report hostname=`just _a_host`: nix eval .#nixosReports."{{hostname}}" --json | yq . --yaml-output | bat --language yaml --style plain --paging never diff --git a/profiles/code-remote/default.nix b/profiles/code-remote/default.nix index 05a861b..2b1b2e4 100644 --- a/profiles/code-remote/default.nix +++ b/profiles/code-remote/default.nix @@ -107,6 +107,8 @@ in { #group = "code.server"; # a nice tool if you don't care about security: https://argon2.online/ + # otherwise: + # echo -n 'password' | nix run nixpkgs#libargon2 -- "$(pwgen 20 -n1)" -e hashedPassword = "$argon2i$v=19$m=16,t=2,p=1$MHh5UGNtU1lWR1UySnhIZw$ITg8U7Gq2CXByuOOnrKVUg"; # hunter2 extraArguments = [ diff --git a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh index cb23a45..aafebbe 100644 --- a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh +++ b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh @@ -36,6 +36,8 @@ zeditor-remote() { local -a hosts readarray -d $'\n' -t hosts < <( cut <"$HOME"/.ssh/known_hosts -d' ' -f1 | sort -u \ + | grep -vE '^\[' \ + | grep -v '[,@]' \ | grep -Ev '^([0-9]{0,3}\.){3}[0-9]{0,3}$' \ | grep -Ev '^([0-9a-fA-F]{0,4}:){0,7}:?([0-9a-fA-F]{0,4}:){0,6}[0-9a-fA-F]{0,4}$' ) @@ -45,7 +47,7 @@ zeditor-remote() { ) printf '%s\n' "${hosts[@]}" \ | sed -E "s/\\.($(IFS='|'; printf "%s" "${domains[*]}"))\$//g" \ - | grep -v '\.' + | grep -v '[.:]' fi } | grep -v '^localhost$' | sort -u } | fzf --multi --reverse --bind 'ctrl-a:toggle-all' --height=25 --cycle \ @@ -100,6 +102,9 @@ zeditor-remote() { printf >&2 "%s\n" "+ ${ssh_cd_cmd}" eval ${ssh_cd_cmd} else + if [[ "$?" -eq 130 ]]; then + return 1 # ctrl-c + fi # history -s "${zed_cmd}" eval ${zed_cmd} printf >&2 "%s\n" "+$(printf " %q" cd "${choice}")" diff --git a/users/pbsds/home/profiles/desktop/salert.nix b/users/pbsds/home/profiles/desktop/salert.nix index ec89e1a..caaf74e 100644 --- a/users/pbsds/home/profiles/desktop/salert.nix +++ b/users/pbsds/home/profiles/desktop/salert.nix @@ -5,6 +5,7 @@ let in { programs = let + # TODO: a notification based variant rcScript = '' salert() { local retval=$? diff --git a/users/pbsds/home/profiles/desktop/zed/remote.nix b/users/pbsds/home/profiles/desktop/zed/remote.nix index 860de9c..8ab8d9b 100644 --- a/users/pbsds/home/profiles/desktop/zed/remote.nix +++ b/users/pbsds/home/profiles/desktop/zed/remote.nix @@ -26,6 +26,7 @@ unstable.nixfmt-rfc-style # nix harper # harper typos-lsp # typos + tinymist # typst # I prefer these in shell.nix / virtual environments # python3Packages.python-lsp-server # pylsp diff --git a/users/pbsds/home/profiles/git.nix b/users/pbsds/home/profiles/git.nix index 3304387..7e125b3 100644 --- a/users/pbsds/home/profiles/git.nix +++ b/users/pbsds/home/profiles/git.nix @@ -61,6 +61,7 @@ #".envrc" ".remote.toml" ".remoteenv" + ".zed" "result" "result-*" "results" diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix index abae020..0bb2e56 100644 --- a/users/pbsds/home/profiles/shell.nix +++ b/users/pbsds/home/profiles/shell.nix @@ -3,6 +3,7 @@ let _tmp_func_name = "_tmp_func_Oaw5aifeeniezeiquonaipheNahthae9caik4Rai"; # pwgen ftw + # TODO: trap the 'unset'? mkArgsAlias = alias: ''${_tmp_func_name}() { ${alias}; unset -f ${_tmp_func_name}; }; ${_tmp_func_name}''; in @@ -115,7 +116,6 @@ in # old -> new home.shellAliases.vimv = "edir"; - #home.shellAliases.atom = "pulsar"; # Be conservative with files # --preserver-root is for GNU versions, preventing changing perms on / @@ -131,6 +131,8 @@ in home.shellAliases.fda = "fd --no-ignore --hidden"; home.shellAliases.afd = "fd --no-ignore --hidden"; + home.shellAliases.nlocate = "nix-locate --top-level --regex"; # via nix-index-with-full-db + home.shellAliases.inom = mkArgsAlias ''nom "$@" --system i686-linux -j0''; home.shellAliases.inix = mkArgsAlias ''nix "$@" --system i686-linux -j0''; home.shellAliases.rnom = mkArgsAlias ''nom "$@" --system riscv64-linux -j0''; @@ -172,6 +174,7 @@ in #tldr stress entr + faketty axel aria aria2 xe # xargs alternative sd # sed alternative