From 5382c0dc613ae7a821e800d33a4a47cef49b93a4 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Tue, 9 Jan 2024 18:47:47 -0800 Subject: [PATCH] added atuin shell history --- flake.nix | 6 ++++-- home.nix | 3 ++- hosts/Alaska/modules/atuin.nix | 32 ++++++++++++++++++++++++++++++ hosts/Alaska/modules/dns.nix | 5 +++++ hosts/Alaska/modules/headscale.nix | 4 ++-- modules/atuin.nix | 25 +++++++++++++++++++++++ 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 hosts/Alaska/modules/atuin.nix create mode 100644 modules/atuin.nix diff --git a/flake.nix b/flake.nix index 22916e3..30cfcb5 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ }; kmonad.url = "github:kmonad/kmonad?dir=nix"; + atuin.url = "github:atuinsh/atuin"; headscale = { # url = "github:kradalby/headscale/bbb4c357268998fd02780b7f8f2013f76e3ab80a"; url = "github:juanfont/headscale/6049ec758ca46b5c6ee7abba4f3d472fb1e2ffa6"; @@ -39,6 +40,7 @@ home-manager, ewwtilities, kmonad, + atuin ... }: let @@ -58,7 +60,7 @@ Alaska = lib.nixosSystem { inherit system; specialArgs = { - inherit user headscale; + inherit user headscale atuin; }; modules = [ @@ -137,7 +139,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit user ewwtilities pkgs-stable; + inherit user ewwtilities atuin pkgs-stable; }; users.${user} = { imports = [ diff --git a/home.nix b/home.nix index ee93d6d..eaaebd1 100644 --- a/home.nix +++ b/home.nix @@ -1,5 +1,5 @@ -{ inputs, config, osConfig, pkgs, pkgs-stable, ewwtilities, user, ... }: +{ inputs, config, osConfig, pkgs, pkgs-stable, ewwtilities, atuin, user, ... }: let moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); @@ -18,6 +18,7 @@ let install_packages = with pkgs; [ # (pkgs.callPackage ./modules/minecraft-bedrock/minecraft-bedrock-server.nix {}) # the possible minecraft-bedrock-server package for testing # utilities + atuin.packages.${pkgs.system}.atuin bat # cat with wings (better cat) bottom # system monitor du-dust # directory disk-space analyzer diff --git a/hosts/Alaska/modules/atuin.nix b/hosts/Alaska/modules/atuin.nix new file mode 100644 index 0000000..483e7db --- /dev/null +++ b/hosts/Alaska/modules/atuin.nix @@ -0,0 +1,32 @@ +{ config, ...}: + +let +in +{ + services.atuin = { + enable = true; + openFirewall = true; + port = 8910; + host = "127.0.0.1"; + openRegistration = true; + database = { + createLocally = true; + }; + }; + + services.nginx.virtualHosts = { + "atuin.nickiel.net" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://127.0.0.1:${builtins.toString config.services.atuin.port}"; + proxyWebsockets = true; + extraConfig = '' + allow 100.64.0.0/16; + allow 127.0.0.1; + deny all; + ''; + }; + }; + }; +} diff --git a/hosts/Alaska/modules/dns.nix b/hosts/Alaska/modules/dns.nix index 2f1e1e2..1707cd1 100644 --- a/hosts/Alaska/modules/dns.nix +++ b/hosts/Alaska/modules/dns.nix @@ -19,4 +19,9 @@ type = "A"; value = "100.64.0.1"; } + { + name = "atuin.nickiel.net"; + type = "A"; + value = "100.64.0.1"; + } ] diff --git a/hosts/Alaska/modules/headscale.nix b/hosts/Alaska/modules/headscale.nix index aa5718a..fee39b9 100644 --- a/hosts/Alaska/modules/headscale.nix +++ b/hosts/Alaska/modules/headscale.nix @@ -1,4 +1,4 @@ -{ config, headscale, ... }: +{ config, pkgs, headscale, ... }: let tailscale_dns_entries = import ./dns.nix; @@ -16,7 +16,7 @@ in { # https://carjorvaz.com/posts/setting-up-headscale-on-nixos/ services.headscale = { - package = headscale.packages."x86_64-linux".headscale; + package = headscale.packages.${pkgs.system}.headscale; enable = true; address = "0.0.0.0"; port = 8082; diff --git a/modules/atuin.nix b/modules/atuin.nix new file mode 100644 index 0000000..7989269 --- /dev/null +++ b/modules/atuin.nix @@ -0,0 +1,25 @@ +{config, pkgs, atuin, ...}: + +let +in +{ + programs.atuin = { + enable = true; + package = atuin.packages.${pkgs.system}.atuin; + enableZshIntegration = true; + flags = [ + + ]; + settings = { + auto_sync = true; + sync_frequency = "20m"; + sync_address = "https://atuin.nickiel.net"; + # filter_mode = "global" | "host" | "session" | "directory" + inline_height = 40; + show_preview = true; + show_help = true; + exit_mode = "return-query"; + secrets_filter = true; + }; + }; +}