From 24c79f50d347307093adc6431424feee8b670936 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Sat, 15 Mar 2025 02:15:12 -0400 Subject: [PATCH] Fixes for vscode-fhs issues with ssh --- home/toph/common/core/default.nix | 2 +- home/toph/common/core/ssh.nix | 26 ------------- home/toph/common/core/ssh/config | 17 +++++++++ home/toph/common/core/ssh/default.nix | 32 ++++++++++++++++ .../common/optional/development/default.nix | 3 +- .../common/optional/development/fleet.nix | 37 ------------------- .../common/optional/development/openssh.patch | 13 +++++++ .../common/optional/development/vscode.nix | 12 ++++++ 8 files changed, 76 insertions(+), 66 deletions(-) delete mode 100644 home/toph/common/core/ssh.nix create mode 100644 home/toph/common/core/ssh/config create mode 100644 home/toph/common/core/ssh/default.nix delete mode 100644 home/toph/common/optional/development/fleet.nix create mode 100644 home/toph/common/optional/development/openssh.patch create mode 100644 home/toph/common/optional/development/vscode.nix diff --git a/home/toph/common/core/default.nix b/home/toph/common/core/default.nix index 5ea4280..d08debf 100644 --- a/home/toph/common/core/default.nix +++ b/home/toph/common/core/default.nix @@ -22,7 +22,7 @@ ./git.nix ./ranger.nix ./screen.nix - ./ssh.nix + ./ssh ./zoxide.nix ]; diff --git a/home/toph/common/core/ssh.nix b/home/toph/common/core/ssh.nix deleted file mode 100644 index 88e78a0..0000000 --- a/home/toph/common/core/ssh.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - inputs, - lib, - ... -}: -{ - programs.ssh = { - enable = true; - # Avoids infinite hang if control socket connection interrupted. ex: vpn goes down/up - serverAliveCountMax = 3; - serverAliveInterval = 5; - addKeysToAgent = "yes"; - - extraConfig = '' - IdentityFile ~/.ssh/pve - UpdateHostKeys ask - ''; - - matchBlocks = { - "git.ryot.foo" = { - identityFile = "~/git/.ssh/git"; - }; - }; - }; -} diff --git a/home/toph/common/core/ssh/config b/home/toph/common/core/ssh/config new file mode 100644 index 0000000..2ee0ec8 --- /dev/null +++ b/home/toph/common/core/ssh/config @@ -0,0 +1,17 @@ +Host git.ryot.foo + IdentityFile ~/git/.ssh/git + +Host * + ForwardAgent no + AddKeysToAgent yes + Compression no + ServerAliveInterval 5 + ServerAliveCountMax 3 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/master-%r@%n:%p + ControlPersist no + + IdentityFile ~/.ssh/pve + UpdateHostKeys ask diff --git a/home/toph/common/core/ssh/default.nix b/home/toph/common/core/ssh/default.nix new file mode 100644 index 0000000..36adcae --- /dev/null +++ b/home/toph/common/core/ssh/default.nix @@ -0,0 +1,32 @@ +{ + config, + inputs, + lib, + ... +}: +{ + # programs.ssh = { + # enable = true; + # # Avoids infinite hang if control socket connection interrupted. ex: vpn goes down/up + # serverAliveCountMax = 3; + # serverAliveInterval = 5; + # addKeysToAgent = "yes"; + + # extraConfig = '' + # IdentityFile ~/.ssh/pve + # UpdateHostKeys ask + # ''; + + # matchBlocks = { + # "git.ryot.foo" = { + # identityFile = "~/git/.ssh/git"; + # }; + # }; + # }; + + home.file.".ssh/config" = { + source = ./config; + target = ".ssh/config_source"; + onChange = ''cat .ssh/config_source > .ssh/config && chmod 400 .ssh/config''; + }; +} diff --git a/home/toph/common/optional/development/default.nix b/home/toph/common/optional/development/default.nix index 97465cf..8d5dd6e 100644 --- a/home/toph/common/optional/development/default.nix +++ b/home/toph/common/optional/development/default.nix @@ -5,7 +5,7 @@ ... }: { - # imports = lib.custom.scanPaths ./.; + imports = lib.custom.scanPaths ./.; home.packages = lib.flatten [ (builtins.attrValues { @@ -18,7 +18,6 @@ logisim-evolution mcaselector prettierd - vscode-fhs # nix nixpkgs-review diff --git a/home/toph/common/optional/development/fleet.nix b/home/toph/common/optional/development/fleet.nix deleted file mode 100644 index 8732bc2..0000000 --- a/home/toph/common/optional/development/fleet.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -# Same idea as package itself, not working might remove - -let - fleet = pkgs.callPackage ../../../../../pkgs/common/fleet/package.nix { }; -in -{ - home.packages = [ - fleet - ]; - - xdg.desktopEntries = { - fleet = { - name = "Fleet"; - comment = "Jetbrains Fleet"; - exec = "fleet %u"; - icon = "${config.home.homeDirectory}/.local/share/JetBrains/Toolbox/apps/fleet/lib/Fleet.png"; - type = "Application"; - terminal = false; - mimeType = [ - "text/plain" - "inode/directory" - "x-scheme-handler/fleet" - ]; - categories = [ - "Development" - "IDE" - ]; - }; - }; -} diff --git a/home/toph/common/optional/development/openssh.patch b/home/toph/common/optional/development/openssh.patch new file mode 100644 index 0000000..27cc5ce --- /dev/null +++ b/home/toph/common/optional/development/openssh.patch @@ -0,0 +1,13 @@ +diff --git a/readconf.h b/readconf.h +index ded13c9..94f489e 100644 +--- a/readconf.h ++++ b/readconf.h +@@ -203,7 +203,7 @@ typedef struct { + #define SESSION_TYPE_SUBSYSTEM 1 + #define SESSION_TYPE_DEFAULT 2 + +-#define SSHCONF_CHECKPERM 1 /* check permissions on config file */ ++#define SSHCONF_CHECKPERM 0 /* check permissions on config file */ + #define SSHCONF_USERCONF 2 /* user provided config file not system */ + #define SSHCONF_FINAL 4 /* Final pass over config, after canon. */ + #define SSHCONF_NEVERMATCH 8 /* Match/Host never matches; internal only */ \ No newline at end of file diff --git a/home/toph/common/optional/development/vscode.nix b/home/toph/common/optional/development/vscode.nix new file mode 100644 index 0000000..e98b1e3 --- /dev/null +++ b/home/toph/common/optional/development/vscode.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +let + patched-openssh = pkgs.openssh.overrideAttrs (prev: { + patches = (prev.patches or [ ]) ++ [ ./openssh.patch ]; + }); +in +{ + programs.vscode = { + enable = true; + package = pkgs.vscode.fhsWithPackages (_: [ patched-openssh ]); + }; +}