1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +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
'';
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
zsh-completions = pkgs.fetchFromGitHub {
owner = "zsh-users";
@@ -14,12 +23,6 @@
rev = "cf565254e26bb7ce03f51889e9a29953b955b1fb";
sha256 = "1yf4rz99acdsiy0y1v3bm65xvs2m0sl92ysz0rnnrlbd5amn283l";
};
zsh-history-substring-search = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "aae3388491c2312c4efb2e86bcb999927bb2900e";
sha256 = "0lgmq1xcccnz5cf7vl0r0qj351hwclx9p80cl0qczxry4r2g5qaz";
};
in {
enable = true;
enableCompletion = true;
@@ -54,12 +57,6 @@
autoload -U zmv run-help
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; ''
autoload -Uz vcs_info
@@ -71,6 +68,13 @@
zstyle ':vcs_info:*' formats "%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 () {
vcs_info
RPROMPT="$vcs_info_msg_0_"

View File

@@ -172,7 +172,7 @@
sources =
["nix-writers" "nixpkgs" "retiolum" "stockholm"]
++ {
zaatar = ["traadfri"];
zaatar = ["traadfri" "nixos-unstable"];
ful = [];
tahina = [];
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;
in {
imports = [
./atuin.nix
./backup.nix
./gaslight.nix
./hardware-configuration.nix