1
0
mirror of https://github.com/kmein/niveum synced 2026-03-19 03:21:10 +01:00

feat: atuin

This commit is contained in:
2022-11-30 10:21:59 +01:00
parent 03d40a488b
commit 90550dc18b
4 changed files with 67 additions and 13 deletions

View File

@@ -7,6 +7,15 @@
# nothing to see here # nothing to see here
''; '';
environment.systemPackages = [pkgs.atuin];
environment.variables.ATUIN_CONFIG_DIR = toString (pkgs.writeTextDir "/config.toml" ''
auto_sync = true
update_check = false
sync_address = "http://zaatar.r:8888"
sync_frequency = 0
style = "compact"
'');
programs.zsh = let programs.zsh = let
zsh-completions = pkgs.fetchFromGitHub { zsh-completions = pkgs.fetchFromGitHub {
owner = "zsh-users"; owner = "zsh-users";
@@ -14,12 +23,6 @@
rev = "cf565254e26bb7ce03f51889e9a29953b955b1fb"; rev = "cf565254e26bb7ce03f51889e9a29953b955b1fb";
sha256 = "1yf4rz99acdsiy0y1v3bm65xvs2m0sl92ysz0rnnrlbd5amn283l"; sha256 = "1yf4rz99acdsiy0y1v3bm65xvs2m0sl92ysz0rnnrlbd5amn283l";
}; };
zsh-history-substring-search = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "aae3388491c2312c4efb2e86bcb999927bb2900e";
sha256 = "0lgmq1xcccnz5cf7vl0r0qj351hwclx9p80cl0qczxry4r2g5qaz";
};
in { in {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
@@ -54,12 +57,6 @@
autoload -U zmv run-help autoload -U zmv run-help
fpath=(${zsh-completions}/src $fpath) fpath=(${zsh-completions}/src $fpath)
source ${zsh-history-substring-search}/zsh-history-substring-search.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
''; '';
promptInit = with config.niveum; '' promptInit = with config.niveum; ''
autoload -Uz vcs_info autoload -Uz vcs_info
@@ -71,6 +68,13 @@
zstyle ':vcs_info:*' formats "%c%u%F{cyan}%b%f" zstyle ':vcs_info:*' formats "%c%u%F{cyan}%b%f"
zstyle ':vcs_info:*' actionformats "(%a) %c%u%F{cyan}%b%f" zstyle ':vcs_info:*' actionformats "(%a) %c%u%F{cyan}%b%f"
# atuin distributed shell history
export ATUIN_NOBIND="true" # disable all keybdinings of atuin
eval "$(atuin init zsh)"
bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin
# use zsh only session history
fc -p
precmd () { precmd () {
vcs_info vcs_info
RPROMPT="$vcs_info_msg_0_" RPROMPT="$vcs_info_msg_0_"

View File

@@ -172,7 +172,7 @@
sources = sources =
["nix-writers" "nixpkgs" "retiolum" "stockholm"] ["nix-writers" "nixpkgs" "retiolum" "stockholm"]
++ { ++ {
zaatar = ["traadfri"]; zaatar = ["traadfri" "nixos-unstable"];
ful = []; ful = [];
tahina = []; tahina = [];
tabula = []; tabula = [];

49
systems/zaatar/atuin.nix Normal file
View File

@@ -0,0 +1,49 @@
{config, ...}: let
inherit (import <niveum/lib>) tmpfilesConfig;
unstable = import <nixos-unstable> {inherit (config.nixpkgs) config;};
in {
services.postgresql = {
enable = true;
dataDir = "/var/state/postgresql/${config.services.postgresql.package.psqlSchema}";
ensureDatabases = ["atuin"];
ensureUsers = [
{
name = "atuin";
ensurePermissions."DATABASE atuin" = "ALL PRIVILEGES";
}
];
};
systemd.tmpfiles.rules = [
(tmpfilesConfig {
type = "d";
path = "/var/state/postgresql";
mode = "0700";
user = "postgres";
group = "postgres";
})
];
users.groups.atuin = {};
users.users.atuin = {
isSystemUser = true;
group = "atuin";
home = "/run/atuin";
createHome = true;
};
systemd.services.atuin = {
wantedBy = ["multi-user.target"];
environment = {
ATUIN_HOST = "0.0.0.0";
ATUIN_PORT = "8888";
ATUIN_OPEN_REGISTRATION = "true";
ATUIN_DB_URI = "postgres:///atuin";
};
serviceConfig = {
User = "atuin";
ExecStart = "${unstable.atuin}/bin/atuin server start";
};
};
networking.firewall.allowedTCPPorts = [8888];
}

View File

@@ -7,6 +7,7 @@
inherit (import <niveum/lib>) retiolumAddresses restic; inherit (import <niveum/lib>) retiolumAddresses restic;
in { in {
imports = [ imports = [
./atuin.nix
./backup.nix ./backup.nix
./gaslight.nix ./gaslight.nix
./hardware-configuration.nix ./hardware-configuration.nix