From 22950ff17da1d197f55f1e73783da9077c2e3cdb Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Nov 2021 12:16:34 -0600 Subject: extract programs.{ssh,emacs} --- lib/common.nix | 78 ++----------------------------- lib/emacs.nix | 9 ++++ lib/packages.nix | 125 +++++++++++++++++++++++++------------------------- lib/ssh.nix | 76 ++++++++++++++++++++++++++++++ profiles/darwin.nix | 28 +++++------ profiles/groq.nix | 4 +- profiles/laptop.nix | 2 + profiles/workshop.nix | 2 + 8 files changed, 174 insertions(+), 150 deletions(-) create mode 100644 lib/emacs.nix create mode 100644 lib/ssh.nix diff --git a/lib/common.nix b/lib/common.nix index b51d3fe..011e7e7 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -7,7 +7,6 @@ let in { home = { - packages = import ./packages.nix { inherit pkgs; }; sessionVariables = { GPGID = gpgid; EDITOR = "vim"; @@ -148,7 +147,11 @@ in for f in extrakto.sh open.sh tmux-extrakto.sh; do wrapProgram $target/scripts/$f \ --prefix PATH : ${with pkgs; lib.makeBinPath ( - [pkgs.fzf pkgs.python3 pkgs.xclip] + [ + pkgs.fzf + pkgs.python3 + pkgs.xclip + ] )} done ''; @@ -202,72 +205,6 @@ in #shading = 10; }; - ssh = { - enable = true; - forwardAgent = true; - extraConfig = '' - StrictHostKeyChecking=accept-new - - # sft ssh-config - Match exec "/usr/local/bin/sft resolve -q %h" - ProxyCommand "/usr/local/bin/sft" proxycommand %h - UserKnownHostsFile "/Users/bsima/Library/Application Support/ScaleFT/proxycommand_known_hosts" - ''; - matchBlocks = { - "github.com" = { - hostname = "github.com"; - user = "git"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - - # groq - "groq" = { - hostname = "bsima"; # must be on vpn - user = "bsima"; - identityFile = [ "${homedir}/.ssh/groq" ]; - identitiesOnly = true; - }; - - # simatime - "sabten" = { - hostname = "142.93.81.26"; - user = "root"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - "serval.simatime.com" = { - hostname = "serval.simatime.com"; - user = "ben"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - "simatime.com" = { - hostname = "simatime.com"; - user = "git"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - "lithium" = { - hostname = "192.168.1.9"; - user = "ben"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - "dev.simatime.com" = { - user = "ben"; - identityFile = [ "${homedir}/.ssh/id_rsa" ]; - identitiesOnly = true; - }; - "git.platonic.systems" = { - hostname = "git.platonic.systems"; - user = "git"; - identityFile = [ "${homedir}/.ssh/platonic.systems" ]; - identitiesOnly = true; - }; - }; - }; - direnv = { enable = true; }; @@ -420,10 +357,5 @@ in "v." = "vim ."; }; }; - - emacs = { - enable = true; - extraPackages = epkgs: import ./emacs-packages.nix { inherit epkgs; }; - }; }; } diff --git a/lib/emacs.nix b/lib/emacs.nix new file mode 100644 index 0000000..df7b036 --- /dev/null +++ b/lib/emacs.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.emacs = { + enable = true; + extraPackages = epkgs: import ./emacs-packages.nix { inherit epkgs; }; + }; +} + diff --git a/lib/packages.nix b/lib/packages.nix index 41acbef..e73eafc 100644 --- a/lib/packages.nix +++ b/lib/packages.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{ pkgs, ... }: # All common packages go here. Linux-specific should go in `linux.nix' @@ -19,64 +19,65 @@ let cp ./zebra $out/bin ''; }; -in [ -asciinema -ag -amfora -aspellDicts.en -bat -bc -cabal2nix -cloc -cmatrix -ctags -dhall -direnv -entr -eternal-terminal -expect -fd -figlet -file -font-awesome_5 -gitAndTools.stgit -git-lfs -git-revise -github-cli -hashcash -htop -httpstat -ispell -jq -lsof -material-icons -mononoki -mpc_cli -ncdu -ncmpc -nix-prefetch-scripts -nixos-generators -noto-fonts-emoji -opentimestamps-client -ormolu -paperkey -pass -perlPackages.GitAutofixup -pianobar -pup -pwgen -python37Packages.black -ranger -ripgrep -shellcheck -tmux -tree -unrar -unzip -urlscan -vimpager -w3m -whois -zebra -zip -] +in { + home.packages = [ + asciinema + ag + amfora + aspellDicts.en + bat + bc + cabal2nix + cloc + cmatrix + ctags + dhall + direnv + entr + eternal-terminal + expect + fd + figlet + file + font-awesome_5 + gitAndTools.stgit + git-lfs + git-revise + github-cli + hashcash + htop + httpstat + ispell + jq + lsof + material-icons + mononoki + mpc_cli + ncdu + ncmpc + nix-prefetch-scripts + nixos-generators + noto-fonts-emoji + opentimestamps-client + ormolu + paperkey + pass + perlPackages.GitAutofixup + pianobar + pup + pwgen + ranger + ripgrep + shellcheck + tmux + tree + unrar + unzip + urlscan + vimpager + w3m + whois + zebra + zip + ]; +} diff --git a/lib/ssh.nix b/lib/ssh.nix new file mode 100644 index 0000000..9cbb05b --- /dev/null +++ b/lib/ssh.nix @@ -0,0 +1,76 @@ +{ ... }: + +let + homedir = builtins.getEnv "HOME"; +in { + programs.ssh = { + enable = true; + forwardAgent = true; + extraConfig = '' + StrictHostKeyChecking=accept-new + + # sft ssh-config + Match exec "/usr/local/bin/sft resolve -q %h" + ProxyCommand "/usr/local/bin/sft" proxycommand %h + UserKnownHostsFile "/Users/bsima/Library/Application Support/ScaleFT/proxycommand_known_hosts" + ''; + matchBlocks = { + "github.com" = { + hostname = "github.com"; + user = "git"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + + # groq + "groq" = { + hostname = "bsima"; # must be on vpn + user = "bsima"; + identityFile = [ "${homedir}/.ssh/groq" ]; + identitiesOnly = true; + forwardAgent = true; + extraOptions = { + #"RemoteCommand" = "tmux -CC new -As0"; + "RequestTTY" = "force"; + }; + }; + + # simatime + "sabten" = { + hostname = "142.93.81.26"; + user = "root"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + "serval.simatime.com" = { + hostname = "serval.simatime.com"; + user = "ben"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + "simatime.com" = { + hostname = "simatime.com"; + user = "git"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + "lithium" = { + hostname = "192.168.1.9"; + user = "ben"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + "dev.simatime.com" = { + user = "ben"; + identityFile = [ "${homedir}/.ssh/id_rsa" ]; + identitiesOnly = true; + }; + "git.platonic.systems" = { + hostname = "git.platonic.systems"; + user = "git"; + identityFile = [ "${homedir}/.ssh/platonic.systems" ]; + identitiesOnly = true; + }; + }; + }; +} diff --git a/profiles/darwin.nix b/profiles/darwin.nix index c221e9e..9640d22 100644 --- a/profiles/darwin.nix +++ b/profiles/darwin.nix @@ -2,29 +2,29 @@ let homedir = builtins.getEnv "HOME"; - haskellOverlay = self: super: { - haskellPackages = super.haskellPackages.override (old: { - overrides = self: super: { - hledger = self.callPackage ./pkgs/hledger-1.19.1.nix {}; - hledger-lib = self.callPackage ./pkgs/hledger-lib-1.19.1.nix {}; - }; - }); - }; + #haskellOverlay = self: super: { + # haskellPackages = super.haskellPackages.override (old: { + # overrides = self: super: { + # hledger = self.callPackage ./pkgs/hledger-1.19.1.nix {}; + # hledger-lib = self.callPackage ./pkgs/hledger-lib-1.19.1.nix {}; + # }; + # }); + #}; in { nixpkgs.overlays = [ - haskellOverlay + #haskellOverlay ]; imports = [ - ./lib/common.nix - ./lib/email.nix + ../lib/common.nix + #../lib/email.nix + ../lib/ssh.nix ]; home = { - sessionVariables.PATH = "/usr/local/opt/mysql@5.7/bin:${homedir}/bin:${homedir}/.cabal/bin:${homedir}/.local/bin:$PATH"; packages = with pkgs; [ - muchsync - (haskellPackages.ghcWithPackages (ps: with ps; [hledger])) + #muchsync + #(haskellPackages.ghcWithPackages (ps: with ps; [hledger])) coreutils ]; }; diff --git a/profiles/groq.nix b/profiles/groq.nix index d1214b3..dc7df02 100644 --- a/profiles/groq.nix +++ b/profiles/groq.nix @@ -5,7 +5,9 @@ let in { imports = [ - ./common.nix + ../lib/common.nix + ../lib/packages.nix + ../lib/ssh.nix ]; accounts = { diff --git a/profiles/laptop.nix b/profiles/laptop.nix index e8bdbba..6104901 100644 --- a/profiles/laptop.nix +++ b/profiles/laptop.nix @@ -4,6 +4,8 @@ { imports = [ ../lib/linux.nix + ../lib/ssh.nix + ../lib/packages.nix ]; home = { packages = [ diff --git a/profiles/workshop.nix b/profiles/workshop.nix index 0691b61..25d2d9f 100644 --- a/profiles/workshop.nix +++ b/profiles/workshop.nix @@ -4,6 +4,8 @@ { imports = [ ../lib/linux.nix + ../lib/ssh.nix + ../lib/packages.nix ]; home = { sessionVariables = { -- cgit v1.2.3