Commit 3b4ce822741f

Vincent Demeester <vincent@sbr.pm>
2024-12-03 17:00:11
Add atuin to core…
… and a atuin server on sakhalin… Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent d90fa49
Changed files (3)
systems
users
systems/hosts/sakhalin.nix
@@ -76,55 +76,69 @@ in
   fileSystems."/export/toshito" = { device = "/mnt/toshito"; options = [ "bind" ]; };
 
   services = {
+    atuin = {
+      enable = true;
+      host = "0.0.0.0";
+      openRegistration = false;
+    };
+
+    # services.postgresql.enable = true;
+    # services.postgresql.package = pkgs.postgresql_15;
+    # services.postgresql.dataDir = "/var/lib/postgresql/15";
+    # services.postgresqlBackup.databases = [ "atuin" "homepage_production" "nextcloud" ];
+    # services.postgresqlBackup.enable = true;
+    # services.postgresqlBackup.location = "/var/backup/postgresql";
+    # services.postgresqlBackup.startAt = "*-*-* 02:15:00";
+
     grafana = {
       enable = true;
       settings = {
-	server = {
-	  http_addr = "0.0.0.0";
-	  http_port = 3000;
-	  domain = "graphana.sbr.pm";
-	};
+        server = {
+          http_addr = "0.0.0.0";
+          http_port = 3000;
+          domain = "graphana.sbr.pm";
+        };
       };
     };
     prometheus = {
       enable = true;
       port = 9001;
       scrapeConfigs = [
-	{
-	  job_name = "node";
-	  static_configs = [
-	    {
-	      # TODO: make this dynamic
-	      targets = [
-		"aion.sbr.pm:9100"
-		"aomi.sbr.pm:9000"
-		"athena.sbr.pm:9000"
-		"demeter.sbr.pm:9000"
-		"kerkouane.sbr.pm:9000"
-		"sakhalin.sbr.pm:9000"
-		"shikoku.sbr.pm:9000"
-	      ];
-	    }
-	  ];
-	}
-	{
-	  job_name = "bind";
-	  static_configs = [{
-	    targets = ["demeter.sbr.pm:9009" "athena.sbr.pm:9009"];
-	  }];
-	}
-	{
-	  job_name = "nginx";
-	  static_configs = [{
-	    targets = ["kerkouane.sbr.pm:9001"];
-	  }];
-	}
+        {
+          job_name = "node";
+          static_configs = [
+            {
+              # TODO: make this dynamic
+              targets = [
+                "aion.sbr.pm:9100"
+                "aomi.sbr.pm:9000"
+                "athena.sbr.pm:9000"
+                "demeter.sbr.pm:9000"
+                "kerkouane.sbr.pm:9000"
+                "sakhalin.sbr.pm:9000"
+                "shikoku.sbr.pm:9000"
+              ];
+            }
+          ];
+        }
+        {
+          job_name = "bind";
+          static_configs = [{
+            targets = [ "demeter.sbr.pm:9009" "athena.sbr.pm:9009" ];
+          }];
+        }
+        {
+          job_name = "nginx";
+          static_configs = [{
+            targets = [ "kerkouane.sbr.pm:9001" ];
+          }];
+        }
       ];
       exporters.node = {
-	enable = true;
-	port = 9000;
-	enabledCollectors = [ "systemd" "processes" ];
-	extraFlags = ["--collector.ethtool" "--collector.softirqs" "--collector.tcpstat"];
+        enable = true;
+        port = 9000;
+        enabledCollectors = [ "systemd" "processes" ];
+        extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" ];
       };
     };
     tarsnap = {
users/vincent/core/default.nix
@@ -38,6 +38,49 @@ in
     ];
   };
 
+  programs.atuin = {
+    enable = true;
+    flags = [ "--disable-up-arrow" ];
+    settings = {
+      auto_sync = true;
+      sync_frequency = "10m";
+      sync_address = "http://sakhalin.sbr.pm:8888";
+      search_mode = "skim";
+      filter_mode = "global";
+      enter_accept = false;
+      prefers_reduced_motion = true;
+      common_prefix = [ "sudo" ];
+      ignored_commands = [
+        "cd"
+        "fg"
+        "ls"
+        "rm"
+        "vi"
+        "vim"
+        "p"
+        "d"
+        "ll"
+        "j"
+        "g"
+        ":"
+        "mv"
+        "cat"
+        "echo"
+      ];
+      # history_filter = [
+      #   "^curl"
+      #   "^wget"
+      #   "^monolith"
+      #   "^sherlock"
+      #   "^yt-dlp"
+      #   "^yt-dl"
+      #   "^gallery-dl"
+      #   "^archivebox"
+      #   "^fanficfare"
+      # ];
+    };
+  };
+
   # manpages are broken on 21.05 and home-manager (for some reason..)
   # (versionOlder nixosConfig.system.nixos.release "21.11");
   manual.manpages.enable = true;
users/vincent/core/zsh.nix
@@ -33,54 +33,55 @@ in
     };
     envExtra = shellConfig.env;
     initExtra = ''
-      # c.f. https://wiki.gnupg.org/AgentForwarding
-      gpgconf --create-socketdir &!
-      path+="$HOME/${config.programs.zsh.dotDir}/functions"
-      fpath+="$HOME/.nix-profile/share/zsh/site-functions"
-      fpath+="$HOME/${config.programs.zsh.dotDir}/functions"
-      for func ($HOME/${config.programs.zsh.dotDir}/functions) autoload -U $func/*(x:t)
-      autoload -Uz select-word-style; select-word-style bash
-      if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
-      #if [ -n "$INSIDE_EMACS" ]; then
-      #  chpwd() { print -P "\033AnSiTc %d" }
-      #  print -P "\033AnSiTu %n"
-      #  print -P "\033AnSiTc %d"
-      #fi
-      if [[ "$TERM" == "dumb" || "$TERM" == "emacs" ]]
-      then
-        TERM=eterm-color
-        unsetopt zle
-        unsetopt prompt_cr
-        unsetopt prompt_subst
-        unfunction precmd
-        unfunction preexec
-        PS1='$ '
-        return
-      fi
-      # make sure navigation using emacs keybindings works on all non-alphanumerics
-      # syntax highlighting
-      source $HOME/${config.programs.zsh.dotDir}/plugins/zsh-nix-shell/nix-shell.plugin.zsh
-      source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-      ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
-      ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red')
-      ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red')
-      source $HOME/${config.programs.zsh.dotDir}/completion.zsh
-      source $HOME/${config.programs.zsh.dotDir}/plugins/powerlevel10k/powerlevel10k.zsh-theme
-      source $HOME/${config.programs.zsh.dotDir}/prompt.zsh
-      source $HOME/${config.programs.zsh.dotDir}/plugins/kubectl-config-switcher/kubectl-config-switcher.plugin.zsh
-      setopt HIST_IGNORE_SPACE
-      alias -g L="|less"
-      alias -g EEL=' 2>&1 | less'
-      alias -g GB='`git rev-parse --abbrev-ref HEAD`'
-      alias -g GR='`git rev-parse --show-toplevel`'
-      alias -s {ape,avi,flv,m4a,mkv,mov,mp3,mp4,mpeg,mpg,ogg,ogm,wav,webm}=mpv
-      alias -s org=emacs
-      (( $+commands[jq] )) && alias -g MJ="| jq -C '.'"  || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool"
-      (( $+functions[zshz] )) && compdef _zshz j
-      [[ -n $INSIDE_EMACS ]] && \
-      function ff () {
-        print "\e]51;Efind-file $(readlink -f $1)\e\\"
-      }
+            # c.f. https://wiki.gnupg.org/AgentForwarding
+            gpgconf --create-socketdir &!
+            path+="$HOME/${config.programs.zsh.dotDir}/functions"
+            fpath+="$HOME/.nix-profile/share/zsh/site-functions"
+            fpath+="$HOME/${config.programs.zsh.dotDir}/functions"
+            for func ($HOME/${config.programs.zsh.dotDir}/functions) autoload -U $func/*(x:t)
+            autoload -Uz select-word-style; select-word-style bash
+            if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
+            #if [ -n "$INSIDE_EMACS" ]; then
+            #  chpwd() { print -P "\033AnSiTc %d" }
+            #  print -P "\033AnSiTu %n"
+            #  print -P "\033AnSiTc %d"
+            #fi
+            if [[ "$TERM" == "dumb" || "$TERM" == "emacs" ]]
+            then
+              TERM=eterm-color
+              unsetopt zle
+              unsetopt prompt_cr
+              unsetopt prompt_subst
+              unfunction precmd
+              unfunction preexec
+              PS1='$ '
+              return
+            fi
+      			# eval "$(${config.programs.atuin.package}/bin/atuin init zsh)"
+            # make sure navigation using emacs keybindings works on all non-alphanumerics
+            # syntax highlighting
+            source $HOME/${config.programs.zsh.dotDir}/plugins/zsh-nix-shell/nix-shell.plugin.zsh
+            source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+            ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
+            ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red')
+            ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red')
+            source $HOME/${config.programs.zsh.dotDir}/completion.zsh
+            source $HOME/${config.programs.zsh.dotDir}/plugins/powerlevel10k/powerlevel10k.zsh-theme
+            source $HOME/${config.programs.zsh.dotDir}/prompt.zsh
+            source $HOME/${config.programs.zsh.dotDir}/plugins/kubectl-config-switcher/kubectl-config-switcher.plugin.zsh
+            setopt HIST_IGNORE_SPACE
+            alias -g L="|less"
+            alias -g EEL=' 2>&1 | less'
+            alias -g GB='`git rev-parse --abbrev-ref HEAD`'
+            alias -g GR='`git rev-parse --show-toplevel`'
+            alias -s {ape,avi,flv,m4a,mkv,mov,mp3,mp4,mpeg,mpg,ogg,ogm,wav,webm}=mpv
+            alias -s org=emacs
+            (( $+commands[jq] )) && alias -g MJ="| jq -C '.'"  || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool"
+            (( $+functions[zshz] )) && compdef _zshz j
+            [[ -n $INSIDE_EMACS ]] && \
+            function ff () {
+              print "\e]51;Efind-file $(readlink -f $1)\e\\"
+            }
     '';
     loginExtra = ''
       if [[ -z $DISPLAY && $TTY = /dev/tty1 ]]; then