Sprinkle a bit of standard library in home config

This commit is contained in:
2026-05-15 15:25:24 +00:00
parent 0160a8aa80
commit a57b0f2fef

View File

@@ -1,23 +1,32 @@
_: { {
home.homeDirectory = "/home/artem"; config,
lib,
pkgs,
...
}:
let
utils = import "${pkgs.path}/nixos/lib/utils.nix" { inherit lib pkgs config; };
haremote-path = "${config.home.homeDirectory}/src/haremote";
haremote-unit = utils.escapeSystemdPath haremote-path;
in
{
services.vscode-server.enable = true; services.vscode-server.enable = true;
services.vscode-server.installPath = [ services.vscode-server.installPath = [
"$HOME/.vscode-server" "$HOME/.vscode-server"
"$HOME/.antigravity-server" "$HOME/.antigravity-server"
]; ];
systemd.user.mounts.home-artem-src-haremote = { systemd.user.mounts."${haremote-unit}" = {
Unit = { Unit = {
Description = "Mount ~/src/haremote"; Description = "Mount ${haremote-path}";
After = [ "network-online.target" ]; After = [ "network-online.target" ];
Wants = [ "network-online.target" ]; Wants = [ "network-online.target" ];
}; };
Mount = { Mount = {
What = "root@homeassistant.home.arpa:/homeassistant"; What = "root@homeassistant.home.arpa:/homeassistant";
Where = "/home/artem/src/haremote"; Where = haremote-path;
Type = "fuse.sshfs"; Type = "fuse.sshfs";
Options = "reconnect,ServerAliveInterval=15,uid=1000,gid=1000,IdentityAgent=/home/artem/.ssh/ssh_auth_sock"; Options = "reconnect,ServerAliveInterval=15,uid=1000,gid=1000,IdentityAgent=${config.home.homeDirectory}/.ssh/ssh_auth_sock";
}; };
Install = { Install = {
WantedBy = [ "default.target" ]; WantedBy = [ "default.target" ];
@@ -26,8 +35,8 @@ _: {
programs.zsh.loginExtra = '' programs.zsh.loginExtra = ''
if [ -n "$SSH_AUTH_SOCK" ]; then if [ -n "$SSH_AUTH_SOCK" ]; then
mkdir -p ~/src/haremote mkdir -p ${haremote-path}
[ -z "$(ls -A ~/src/haremote 2>/dev/null)" ] && systemctl --user restart home-artem-src-haremote.mount [ -z "$(ls -A ${haremote-path} 2>/dev/null)" ] && systemctl --user restart ${haremote-unit}.mount
fi fi
''; '';
} }