lkjdsalkjdsalkjad

This commit is contained in:
Peder Bergebakken Sundt 2025-03-19 17:36:58 +01:00
parent 36a6779fc0
commit 7b2203e6b6
8 changed files with 26 additions and 6 deletions
flake.nixjustfile
profiles/code-remote
users/pbsds/home/profiles

@ -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 []))

@ -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

@ -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 = [

@ -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}")"

@ -5,6 +5,7 @@ let
in
{
programs = let
# TODO: a notification based variant
rcScript = ''
salert() {
local retval=$?

@ -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

@ -61,6 +61,7 @@
#".envrc"
".remote.toml"
".remoteenv"
".zed"
"result"
"result-*"
"results"

@ -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