From 585f95a247132294a9605045b9513874f6ae96ad Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 23 Dec 2023 00:11:26 +0100 Subject: [PATCH] add vault and atuin --- flake.lock | 12 ++-- flake.nix | 4 +- nixos/components/terminal/zsh.nix | 40 ------------- .../0001-make-atuin-on-zfs-fast-again.patch | 45 +++++++++++++++ nixos/homes/palo/packages/default.nix | 1 + nixos/homes/palo/packages/development.nix | 2 + nixos/homes/palo/packages/packages.nix | 2 + nixos/homes/palo/packages/terminal.nix | 57 +++++++++++++++++++ .../chungus => legacy}/media-tdarr.nix | 0 nixos/machines/chungus/atuin.nix | 2 +- nixos/machines/chungus/configuration.nix | 8 ++- nixos/machines/chungus/sync-torrent.nix | 2 +- nixos/machines/chungus/vault.nix | 6 ++ nixos/system/all/default.nix | 6 +- 14 files changed, 132 insertions(+), 55 deletions(-) create mode 100644 nixos/homes/palo/packages/0001-make-atuin-on-zfs-fast-again.patch create mode 100644 nixos/homes/palo/packages/terminal.nix rename nixos/{machines/chungus => legacy}/media-tdarr.nix (100%) create mode 100644 nixos/machines/chungus/vault.nix diff --git a/flake.lock b/flake.lock index a81b7d3..3c16408 100644 --- a/flake.lock +++ b/flake.lock @@ -1185,16 +1185,18 @@ }, "private_assets": { "locked": { - "dirtyRev": "ee1b2c870d19e0ed1fe15f8501499e4561ec55b2-dirty", - "dirtyShortRev": "ee1b2c8-dirty", - "lastModified": 1699629396, + "lastModified": 1702625488, "narHash": "sha256-IPSyCKFKk6y/lEpzZKd5YiQuzZRqZKBqDS8/EyJXdHU=", + "ref": "main", + "rev": "a80acb46535c5efa69a0aa982d92e2efd1f1f377", + "revCount": 18, "type": "git", - "url": "file:///home/palo/dev/nixos/nixos-private-assets" + "url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git" }, "original": { + "ref": "main", "type": "git", - "url": "file:///home/palo/dev/nixos/nixos-private-assets" + "url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git" } }, "retiolum": { diff --git a/flake.nix b/flake.nix index 20b32bc..3b6f337 100644 --- a/flake.nix +++ b/flake.nix @@ -42,8 +42,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; private_assets = { - url = "git+file:///home/palo/dev/nixos/nixos-private-assets"; - #url = "git+ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git?ref=main"; + #url = "git+file:///home/palo/dev/nixos/nixos-private-assets"; + url = "git+ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git?ref=main"; flake = true; }; retiolum = { diff --git a/nixos/components/terminal/zsh.nix b/nixos/components/terminal/zsh.nix index d9c2ad1..6996fc4 100644 --- a/nixos/components/terminal/zsh.nix +++ b/nixos/components/terminal/zsh.nix @@ -8,46 +8,6 @@ with lib; config = mkIf (config.components.terminal.zsh.enable) { - home-manager.sharedModules = [ - { - programs.zsh = { - enable = true; - defaultKeymap = "viins"; - }; - - # a better cat - programs.bat = { - enable = true; - config.theme = "gruvbox-light"; - }; - home.shellAliases.cat = "${pkgs.bat}/bin/bat --theme='gruvbox-light'"; - - # a better ls - # todo what's the new shit? - #programs.eza = { - # enable = true; - # enableAliases = true; - #}; - home.shellAliases.llt = "${pkgs.eza}/bin/exa -a --tree"; - - # use z instead of cd - # use zi to fuzzy search through all registered directories - programs.zoxide = { - enable = true; - enableZshIntegration = true; - }; - - # provide better `Ctrl+r` command in terminal - programs.mcfly = { - enable = true; - keyScheme = "vim"; - fuzzySearchFactor = 3; - enableZshIntegration = true; - enableBashIntegration = true; - }; - } - ]; - programs.zsh = { enable = true; diff --git a/nixos/homes/palo/packages/0001-make-atuin-on-zfs-fast-again.patch b/nixos/homes/palo/packages/0001-make-atuin-on-zfs-fast-again.patch new file mode 100644 index 0000000..e965e3d --- /dev/null +++ b/nixos/homes/palo/packages/0001-make-atuin-on-zfs-fast-again.patch @@ -0,0 +1,45 @@ +From b75e6fd3159896966dce2cf3af5b5be7e286ce1a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Mon, 6 Nov 2023 15:56:26 +0100 +Subject: [PATCH] make atuin on zfs fast again +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jörg Thalheim +--- + atuin-client/src/database.rs | 3 ++- + atuin-client/src/record/sqlite_store.rs | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs +index c4b45302..29006d59 100644 +--- a/atuin-client/src/database.rs ++++ b/atuin-client/src/database.rs +@@ -130,7 +130,8 @@ pub async fn new(path: impl AsRef) -> Result { + } + + let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())? +- .journal_mode(SqliteJournalMode::Wal) ++ .journal_mode(SqliteJournalMode::Memory) ++ .synchronous(sqlx::sqlite::SqliteSynchronous::Off) + .create_if_missing(true); + + let pool = SqlitePoolOptions::new().connect_with(opts).await?; +diff --git a/atuin-client/src/record/sqlite_store.rs b/atuin-client/src/record/sqlite_store.rs +index db709f20..eaed6f7a 100644 +--- a/atuin-client/src/record/sqlite_store.rs ++++ b/atuin-client/src/record/sqlite_store.rs +@@ -37,7 +37,8 @@ pub async fn new(path: impl AsRef) -> Result { + } + + let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())? +- .journal_mode(SqliteJournalMode::Wal) ++ .journal_mode(SqliteJournalMode::Memory) ++ .synchronous(sqlx::sqlite::SqliteSynchronous::Off) + .create_if_missing(true); + + let pool = SqlitePoolOptions::new().connect_with(opts).await?; +-- +2.42.0 + diff --git a/nixos/homes/palo/packages/default.nix b/nixos/homes/palo/packages/default.nix index a5fa0a0..9356f7e 100644 --- a/nixos/homes/palo/packages/default.nix +++ b/nixos/homes/palo/packages/default.nix @@ -5,5 +5,6 @@ ./nextcloud.nix ./social.nix ./packages.nix + ./terminal.nix ]; } diff --git a/nixos/homes/palo/packages/development.nix b/nixos/homes/palo/packages/development.nix index 1843f91..55cac9a 100644 --- a/nixos/homes/palo/packages/development.nix +++ b/nixos/homes/palo/packages/development.nix @@ -126,6 +126,8 @@ with lib; gum yq-go gojq + jq + ijq # nomad nomad diff --git a/nixos/homes/palo/packages/packages.nix b/nixos/homes/palo/packages/packages.nix index 5afd845..2b8c405 100644 --- a/nixos/homes/palo/packages/packages.nix +++ b/nixos/homes/palo/packages/packages.nix @@ -5,6 +5,8 @@ with lib; config = mkIf config.gui.enable { + + # ¯\_(ツ)_/¯ home.packages = [ diff --git a/nixos/homes/palo/packages/terminal.nix b/nixos/homes/palo/packages/terminal.nix new file mode 100644 index 0000000..07a385f --- /dev/null +++ b/nixos/homes/palo/packages/terminal.nix @@ -0,0 +1,57 @@ +{ pkgs, ... }: +{ + + programs.zsh = { + enable = true; + defaultKeymap = "viins"; + }; + + programs.bash = { + enable = true; + bashrcExtra = '' + set -o vi + ''; + }; + + # a better cat + programs.bat = { + enable = true; + config.theme = "gruvbox-light"; + }; + + home.shellAliases.cat = "${pkgs.bat}/bin/bat --theme='gruvbox-light'"; + home.shellAliases.llt = "${pkgs.eza}/bin/exa -a --tree"; + + # use z instead of cd + # use zi to fuzzy search through all registered directories + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; + + # provide better `Ctrl+r` command in terminal + #programs.mcfly = { + # enable = true; + # keyScheme = "vim"; + # fuzzySearchFactor = 3; + # enableZshIntegration = true; + # enableBashIntegration = true; + #}; + + # provide better `Ctrl+r` command in terminal + programs.atuin = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + package = pkgs.atuin.overrideAttrs (_old: { + # as cursed as doing mitigations=off in the kernel command line + patches = [ ./0001-make-atuin-on-zfs-fast-again.patch ]; + }); + settings = { + auto_sync = true; + sync_frequency = "5m"; + sync_address = "http://chungus.private"; + #search_mode = "prefix"; + }; + }; +} diff --git a/nixos/machines/chungus/media-tdarr.nix b/nixos/legacy/media-tdarr.nix similarity index 100% rename from nixos/machines/chungus/media-tdarr.nix rename to nixos/legacy/media-tdarr.nix diff --git a/nixos/machines/chungus/atuin.nix b/nixos/machines/chungus/atuin.nix index c3f9103..cc17438 100644 --- a/nixos/machines/chungus/atuin.nix +++ b/nixos/machines/chungus/atuin.nix @@ -1,7 +1,7 @@ { config, ... }: { services.atuin = { enable = true; - host = config.tinc.private.ipv4; + host = "${config.networking.hostName}.private"; maxHistoryLength = 999999; openRegistration = true; }; diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 4cf755f..fa92d64 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -2,10 +2,10 @@ imports = [ + ../../system/server ../../components ./hardware-configuration.nix - ../../system/server ./disko-config.nix ./disko-syncoid.nix ./packages.nix @@ -26,7 +26,6 @@ ./media-share.nix ./media-audiobookshelf.nix - #./media-tdarr.nix ./media-jellyfin.nix ./media-youtube.nix ./media-castget.nix @@ -52,10 +51,12 @@ #./kiosk.nix ./trilium.nix ./gitea.nix - #./atuin.nix + ./atuin.nix ./cache.nix + ./vault.nix + ]; components.gui.enable = false; @@ -117,6 +118,7 @@ # balance = false; #}; + system.stateVersion = "23.11"; } diff --git a/nixos/machines/chungus/sync-torrent.nix b/nixos/machines/chungus/sync-torrent.nix index 77c8a12..aa7b1ea 100644 --- a/nixos/machines/chungus/sync-torrent.nix +++ b/nixos/machines/chungus/sync-torrent.nix @@ -26,7 +26,7 @@ in config = { config, pkgs, lib, ... }: { - system.stateVersion = "22.11"; + system.stateVersion = "23.11"; services.journald.extraConfig = "SystemMaxUse=1G"; services.transmission = { diff --git a/nixos/machines/chungus/vault.nix b/nixos/machines/chungus/vault.nix new file mode 100644 index 0000000..bedcea7 --- /dev/null +++ b/nixos/machines/chungus/vault.nix @@ -0,0 +1,6 @@ +{ + services.vault = { + enable = true; + #adress = "chungus.private:8200"; + }; +} diff --git a/nixos/system/all/default.nix b/nixos/system/all/default.nix index 33d574e..052155c 100644 --- a/nixos/system/all/default.nix +++ b/nixos/system/all/default.nix @@ -8,8 +8,8 @@ ./defaults.nix ./grub.nix - ./nginx-landingpage.nix - ./nginx.nix + #./nginx-landingpage.nix + #./nginx.nix ./packages.nix ./borg-jobs.nix ./borg-scripts.nix @@ -31,6 +31,6 @@ # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you # should. - system.stateVersion = lib.mkDefault "19.03"; # Did you read the comment? + #system.stateVersion = lib.mkDefault "19.03"; # Did you read the comment? }