From 10b1faa2501350156fa2d8794874b5caed3e3c9f Mon Sep 17 00:00:00 2001 From: sstent Date: Wed, 1 Mar 2023 16:51:24 +0000 Subject: [PATCH] sync --- cat | 1 + flake.nix | 11 ++- home-manager/users/sstent/default.nix | 3 - modules/home-manager/ssh-proxy/default.nix | 84 +++++++++++----------- 4 files changed, 52 insertions(+), 47 deletions(-) create mode 100644 cat diff --git a/cat b/cat new file mode 100644 index 0000000..341acb7 --- /dev/null +++ b/cat @@ -0,0 +1 @@ +/nix/store/x958rg592dqk6cr7rh2kqab3y5nvgi9h-start-proxy diff --git a/flake.nix b/flake.nix index a680804..89241dc 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,10 @@ packages = forEachPkgs (pkgs: import ./pkgs { inherit pkgs; }); devShells = forEachPkgs (pkgs: import ./shell.nix { inherit pkgs; }); overlays = import ./overlays { inherit inputs; }; + + + # Output all modules in ./modules to flake. Modules should be in + # individual subdirectories and contain a default.nix file nixosModules = builtins.listToAttrs (map (x: { name = x; @@ -69,6 +73,9 @@ }) (builtins.attrNames (builtins.readDir ../modules/nixos))); + + ##import our HM modules + ## -- imported in ./home-manger/general homeManagerModules = builtins.listToAttrs (map (name: { inherit name; @@ -107,7 +114,7 @@ # > Our main home-manager configuration file < ./home-manager/users/sstent inputs.sops-nix.homeManagerModules.sops - ]++ (builtins.attrValues self.homeManagerModules); + ]; }; "sstent@StuPC" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance @@ -116,7 +123,7 @@ # > Our main home-manager configuration file < ./home-manager/users/sstent inputs.sops-nix.homeManagerModules.sops - ]++ (builtins.attrValues self.homeManagerModules); + ]; }; }; diff --git a/home-manager/users/sstent/default.nix b/home-manager/users/sstent/default.nix index a8e3c27..1f51914 100644 --- a/home-manager/users/sstent/default.nix +++ b/home-manager/users/sstent/default.nix @@ -45,7 +45,6 @@ terraform wget curl - socat p7zip #git-run mr @@ -61,8 +60,6 @@ ssh-proxy.enable = true; beets.enable = true; keybase.enable = true; - - }; # home.file.".mrconfig".source = config.lib.file.mkOutOfStoreSymlink "${config._secrets}/mrconfig"; diff --git a/modules/home-manager/ssh-proxy/default.nix b/modules/home-manager/ssh-proxy/default.nix index 0ab9ce0..98885ce 100644 --- a/modules/home-manager/ssh-proxy/default.nix +++ b/modules/home-manager/ssh-proxy/default.nix @@ -1,43 +1,43 @@ -{ lib, pkgs, config, ... }: -with lib; - -let cfg = config.custom.ssh-proxy; -in { - options.custom.ssh-proxy = { - enable = mkOption { - type = types.bool; - default = false; - description = '' - Enable ssh-proxy for WSL - ''; - }; - }; - - config = mkIf cfg.enable { - - home.packages = with pkgs; [ - npiperelay - socat - ]; - - - systemd.user = { - - startServices = true; - - services.ssh-proxy = { - Unit = { Description = "WSL Proxy"; }; - Service = { - ExecStart = "${pkgs.writeShellScript "start-proxy" '' - # set -x - ${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock - ${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork - ''}"; - }; - #Install = { WantedBy = [ "default.target" ]; }; - }; - }; - - - }; +{ lib, pkgs, config, ... }: +with lib; + +let cfg = config.custom.ssh-proxy; +in { + options.custom.ssh-proxy = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enable ssh-proxy for WSL + ''; + }; + }; + + config = mkIf cfg.enable { + + home.packages = with pkgs; [ + npiperelay + socat + ]; + + + systemd.user = { + + startServices = true; + + services.ssh-proxy = { + Unit = { Description = "WSL Proxy"; After = "network.target";}; + Service = { + ExecStart = "${pkgs.writeShellScript "start-proxy" '' +set -x -o xtrace # print commands +${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock +${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork + ''}"; + }; + #Install = { WantedBy = [ "default.target" ]; }; + }; + }; + + + }; } \ No newline at end of file