From f17e32e30d79a632f01710b3cc6ae1947fe5a8cb Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Sat, 4 Nov 2023 18:58:09 +0100
Subject: [PATCH] Add tldr persistence and much more

---
 common/themes/default.nix                     |   2 +-
 devshells/haskell.nix                         |   1 +
 dotfiles/neovim/ftplugin/tex.lua              | 143 +++++++++---------
 .../vscode-snippets/snippets/latex/core.json  |   2 +-
 home/features/desktop/firefox/userContent.css |   5 -
 home/features/persistence.nix                 |   5 +
 hosts/nixos/common/optional/slambda.nix       |   2 +-
 hosts/nixos/tethys/default.nix                |   3 +
 hosts/nixos/tethys/services/syncthing.nix     |  21 +--
 9 files changed, 97 insertions(+), 87 deletions(-)

diff --git a/common/themes/default.nix b/common/themes/default.nix
index 4bccea8..d99330b 100644
--- a/common/themes/default.nix
+++ b/common/themes/default.nix
@@ -13,7 +13,7 @@ let
 
     catppuccin-latte = {
       stylix = {
-        image = ./wallpapers/watercag.png;
+        image = ./wallpapers/needygirloverdose.jpg;
         base16Scheme = "${inputs.catppuccin-base16}/base16/latte.yaml";
         polarity = "light";
       };
diff --git a/devshells/haskell.nix b/devshells/haskell.nix
index 96495de..0091fc0 100644
--- a/devshells/haskell.nix
+++ b/devshells/haskell.nix
@@ -6,6 +6,7 @@ pkgs.mkShell {
     hpack
     stack
     cabal-install
+    haskell-language-server
     haskellPackages.implicit-hie # Automatically generate hie.yaml!
   ];
 }
diff --git a/dotfiles/neovim/ftplugin/tex.lua b/dotfiles/neovim/ftplugin/tex.lua
index d5028b3..aae6589 100644
--- a/dotfiles/neovim/ftplugin/tex.lua
+++ b/dotfiles/neovim/ftplugin/tex.lua
@@ -6,8 +6,8 @@ require("my.helpers.wrapMovement").setup()
 vim.opt.conceallevel = 0
 
 -- vim.opt.foldcolumn = "1"
-vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
-vim.opt.foldmethod = "expr"
+-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
+-- vim.opt.foldmethod = "expr"
 
 -- {{{ Older functions for calculating things inside vim
 -- vim.keymap.set("n", "<leader>lg", function()
@@ -33,79 +33,82 @@ vim.opt.foldmethod = "expr"
 
 local abbreviations = {
   -- Other fancy symvols
-  { "tmat", "^T" }, -- Tranpose of a matrix
-  { "cmat", "^*" }, -- Conjugate of a matrix
-  { "sneg", "^C" }, -- Set complement
-  { "ortco", "^\\bot" }, -- Orthogonal complement
+  { "tmat",   "^T" },      -- Tranpose of a matrix
+  { "cmat",   "^*" },      -- Conjugate of a matrix
+  { "sneg",   "^C" },      -- Set complement
+  { "ortco",  "^\\bot" },  -- Orthogonal complement
   { "sinter", "^\\circ" }, -- Interior of a set
-  { "nuls", "\\varnothing" },
+  { "nuls",   "\\varnothing" },
 
   -- Basic commands
   { "mangle", "\\measuredangle" },
   { "aangle", "\\angle" },
-  { "sdiff", "\\setminus" },
-  { "sst", "\\subset" },
-  { "spt", "\\supset" },
-  { "sseq", "\\subseteq" },
-  { "speq", "\\supseteq" },
-  { "nin", "\\not\\in" },
-  { "iin", "\\in" },
-  { "tto", "\\to" },
-  { "land", "\\land" },
-  { "lor", "\\lor" },
-  { "ssin", "\\sin" },
-  { "ccos", "\\cos" },
-  { "ttan", "\\ttan" },
-  { "ssec", "\\sec" },
-  { "lln", "\\ln" },
-  { "frl", "\\forall" },
-  { "exs", "\\exists" },
-  { "iinf", "\\infty" },
-  { "ninf", "-\\infty" },
-  { "nlnl", "\\pm" }, -- had this as npnp first but it was hard-ish to type
-  { "ccup", "\\cup" },
-  { "ccap", "\\cap" },
-  { "nope", "\\bot" },
-  { "yee", "\\top" },
-  { "ccan", "\\cancel" },
-  { "com", "\\circ" },
-  { "mul", "\\cdot" },
-  { "smul", "\\times" },
-  { "card", "\\#" },
-  { "div", "\\|" },
-  { "ndiv", "\\not\\|\\:" },
-  { "perp", "\\perp" },
+  { "sdiff",  "\\setminus" },
+  { "sst",    "\\subset" },
+  { "spt",    "\\supset" },
+  { "sseq",   "\\subseteq" },
+  { "speq",   "\\supseteq" },
+  { "nin",    "\\not\\in" },
+  { "iin",    "\\in" },
+  { "tto",    "\\to" },
+  { "land",   "\\land" },
+  { "lor",    "\\lor" },
+  { "ssin",   "\\sin" },
+  { "ccos",   "\\cos" },
+  { "ttan",   "\\ttan" },
+  { "ssec",   "\\sec" },
+  { "lln",    "\\ln" },
+  { "frl",    "\\forall" },
+  { "exs",    "\\exists" },
+  { "iinf",   "\\infty" },
+  { "ninf",   "-\\infty" },
+  { "nlnl",   "\\pm" }, -- had this as npnp first but it was hard-ish to type
+  { "ccup",   "\\cup" },
+  { "ccap",   "\\cap" },
+  { "nope",   "\\bot" },
+  { "yee",    "\\top" },
+  { "ccan",   "\\cancel" },
+  { "com",    "\\circ" },
+  { "mul",    "\\cdot" },
+  { "smul",   "\\times" },
+  { "card",   "\\#" },
+  { "div",    "\\|" },
+  { "ndiv",   "\\not\\|\\:" },
+  { "perp",   "\\perp" },
+  { "cdots",  "\\cdots" },   -- center dots
+  { "ldots",  "\\ldots" },   -- low dots
+  { "cldots", ",\\ldots," }, -- comma, low dots
 
   -- Decorations
-  { "hat", "\\hat" },
-  { "bar", "\\bar" },
+  { "hat",    "\\hat" },
+  { "bar",    "\\bar" },
 
   -- Custom commands
-  { "abs", "\\abs" }, -- custom abs command
-  { "norm", "\\norm" }, -- custom norm command
-  { "iprod", "\\iprod" }, -- custom inner product command
+  { "abs",    "\\abs" },   -- custom abs command
+  { "norm",   "\\norm" },  -- custom norm command
+  { "iprod",  "\\iprod" }, -- custom inner product command
   { "diprod", "\\dprod" }, -- custom self inner product command
-  { "prob", "\\prob" }, -- custom probability function
-  { "dist", "\\dist" }, -- custom dist function
-  { "diam", "\\diam" }, -- custom diam operator
-  { "gen", "\\gen" }, -- custom command for group generated by element
-  { "ord", "\\ordop" }, -- order of a group
-  { "vsm", "\\vecspace" }, -- custom math vector space
+  { "prob",   "\\prob" },  -- custom probability function
+  { "dist",   "\\dist" },  -- custom dist function
+  { "diam",   "\\diam" },  -- custom diam operator
+  { "gen",    "\\gen" },   -- custom command for group generated by element
+  { "ord",    "\\ordop" }, -- order of a group
+  { "vsm",    "\\vecspace" }, -- custom math vector space
 }
 
 -- Todo: convert exponents and subscripts
 -- to use this more concise notation.
 local abolishAbbreviations = {
   -- {{{ General phrases
-  { "thrf", "therefore" },
-  { "bcla", "by contradiction let's assume" },
-  { "wlg", "without loss of generality" },
-  { "tits", "that is to say," },
-  { "wpbd", "we will prove the statement in both directions." },
-  { "stam{,s}", "statement{}" },
+  { "thrf",         "therefore" },
+  { "bcla",         "by contradiction let's assume" },
+  { "wlg",          "without loss of generality" },
+  { "tits",         "that is to say," },
+  { "wpbd",         "we will prove the statement in both directions." },
+  { "stam{,s}",     "statement{}" },
   { "{ww,tt}{m,i}", "{which,this} {means,implies}" },
-  { "cex{,s}", "counterexample{}" },
-  { "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
+  { "cex{,s}",      "counterexample{}" },
+  { "er{t,s,r}",    "{transitivity,symmetry,reflexivity}" },
   -- }}}
   -- {{{ Exponents and subscripts:
   --   {operation}{argument}
@@ -131,7 +134,7 @@ local abolishAbbreviations = {
   -- to `\\foo` directly (so I saved some keystrokes by letting scrap.nvim
   -- repeat everything for me).
   {
-    "{,e,s}{{eps,lam},{star,delta,Delta,pi,psi,sigma,alpha,beta,theta,gamma,omega,Omega}}",
+    "{,e,s}{{eps,lam},{star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega}}",
     "{,^,_}\\\\{{epsilon,lambda},{}}",
     options = A.no_capitalization,
   },
@@ -180,20 +183,20 @@ local abolishAbbreviations = {
   },
   -- }}}
   -- {{{ Calculus & analysis
-  { "ib{p,s}", "integration by {parts,substitution}" },
-  { "nb{,h}{,s}", "neighbour{,hood}{}" },
+  { "ib{p,s}",         "integration by {parts,substitution}" },
+  { "nb{,h}{,s}",      "neighbour{,hood}{}" },
   -- }}}
   -- {{{ Linear algebra
-  { "rref", "reduced row echalon form" },
+  { "rref",            "reduced row echalon form" },
   { "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
-  { "mx{,s}", "matri{x,ces}" },
-  { "dete{,s}", "determinant{}" },
-  { "ort{n,g}", "orto{normal,gonal}" },
-  { "l{in,de}", "linearly {independent,dependent}" },
-  { "lcon{,s}", "linear combination{}" },
-  { "vst{,s}", "vector space{}" }, -- text vector space
+  { "mx{,s}",          "matri{x,ces}" },
+  { "dete{,s}",        "determinant{}" },
+  { "ort{n,g}",        "orto{normal,gonal}" },
+  { "l{in,de}",        "linearly {independent,dependent}" },
+  { "lcon{,s}",        "linear combination{}" },
+  { "vst{,s}",         "vector space{}" }, -- text vector space
   {
-    "rizz", -- ok please ignore this one 💀
+    "rizz",                        -- ok please ignore this one 💀
     "Riesz vector",
     options = A.no_capitalization,
   },
@@ -206,7 +209,7 @@ local abolishAbbreviations = {
   },
   -- }}}
   -- {{{ Graph theory
-  { "vx{,s}", "vert{ex,ices}" },
+  { "vx{,s}",  "vert{ex,ices}" },
   { "edg{,s}", "edge{}" },
 
   -- Graph theory function syntax:
diff --git a/dotfiles/vscode-snippets/snippets/latex/core.json b/dotfiles/vscode-snippets/snippets/latex/core.json
index 6d808dc..f17733e 100644
--- a/dotfiles/vscode-snippets/snippets/latex/core.json
+++ b/dotfiles/vscode-snippets/snippets/latex/core.json
@@ -36,7 +36,7 @@
   "Self inner product": {
     "prefix": "diprod",
     "description": "Inner product of a vector with itself",
-    "body": "\\dprod{$1}{$1}$0"
+    "body": "\\dprod{$1}$0"
   },
   "Lemma": {
     "prefix": "lemma",
diff --git a/home/features/desktop/firefox/userContent.css b/home/features/desktop/firefox/userContent.css
index e2b4691..e69de29 100644
--- a/home/features/desktop/firefox/userContent.css
+++ b/home/features/desktop/firefox/userContent.css
@@ -1,5 +0,0 @@
-/* add '[pdf]' next to links to PDF files */
-a[href$=".pdf"]:after {
-    font-size: smaller;
-    content: " [pdf]";
-}
diff --git a/home/features/persistence.nix b/home/features/persistence.nix
index e0848f3..21ff062 100644
--- a/home/features/persistence.nix
+++ b/home/features/persistence.nix
@@ -96,4 +96,9 @@
   #   "${config.xdg.configHome}/syncthing" # Syncthing config data
   # ];
   # # }}}
+  # {{{ Tldr
+  satellite.persistence.at.cache.apps.tldr.directories = [
+    "${config.home.homeDirectory}/.tldrc" # tldr cache
+  ];
+  # }}}
 }
diff --git a/hosts/nixos/common/optional/slambda.nix b/hosts/nixos/common/optional/slambda.nix
index 174fcf8..ea74df7 100644
--- a/hosts/nixos/common/optional/slambda.nix
+++ b/hosts/nixos/common/optional/slambda.nix
@@ -13,7 +13,7 @@ let
     (chord [ "j" "k" "l" ] [ "rightctrl" "rightshift" ])
     (chord [ "s" "d" "f" ] [ "leftctrl" "leftshift" ])
     (unmap [ "leftalt" ])
-    (unmap [ "leftshift" ])
+    # (unmap [ "leftshift" ]) # Useful for touhou
     (unmap [ "leftctrl" ])
     (unmap [ "rightshift" ])
     (unmap [ "rightctrl" ])
diff --git a/hosts/nixos/tethys/default.nix b/hosts/nixos/tethys/default.nix
index 8f3c599..da679cb 100644
--- a/hosts/nixos/tethys/default.nix
+++ b/hosts/nixos/tethys/default.nix
@@ -12,6 +12,7 @@
     ../common/optional/xdg-portal.nix
     ../common/optional/hyprland.nix
     ../common/optional/quietboot.nix
+    ../common/optional/gitea.nix
 
     ./hardware
     ./services/syncthing.nix
@@ -36,7 +37,9 @@
   # }}}
   # {{{ A few ad-hoc programs
   programs.kdeconnect.enable = true;
+  programs.firejail.enable = true;
   programs.extra-container.enable = true;
+  virtualisation.docker.enable = true;
   # }}}
   # {{{ Ad-hoc stylix targets
   # TODO: include this on all gui hosts
diff --git a/hosts/nixos/tethys/services/syncthing.nix b/hosts/nixos/tethys/services/syncthing.nix
index 6462d71..84844d8 100644
--- a/hosts/nixos/tethys/services/syncthing.nix
+++ b/hosts/nixos/tethys/services/syncthing.nix
@@ -1,3 +1,13 @@
+let
+  # TODO: remove this once I switch to zfs
+  commonVersioning = {
+    type = "staggered";
+    params = {
+      cleanInterval = "3600"; # 1 hour in seconds
+      maxAge = "604800"; # 14 days in seconds.
+    };
+  };
+in
 {
   imports = [ ../../common/optional/syncthing.nix ];
 
@@ -5,19 +15,12 @@
     "mythical-vault" = {
       path = "/home/adrielus/.password-store";
       devices = [ "enceladus" "lapetus" ];
+      versioning = commonVersioning;
     };
     "stellar-sanctum" = {
       path = "/home/adrielus/Projects/stellar-sanctum/";
       devices = [ "enceladus" "lapetus" ];
-
-      # TODO: remove this once I switch to zfs
-      versioning = {
-        type = "staggered";
-        params = {
-          cleanInterval = "3600"; # 1 hour in seconds
-          maxAge = "604800"; # 14 days in seconds.
-        };
-      };
+      versioning = commonVersioning;
     };
   };
 }