Compare commits

...

14 commits

Author SHA1 Message Date
Benjamin Bädorf 7b024bba84
Enable Ctrl+R in bash vim normal mode
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-08 00:35:10 +01:00
Benjamin Bädorf 40a0106e9f
Update zshrc config to bashrc 2023-02-08 00:34:34 +01:00
Benjamin Bädorf 31f1ad338f
Update paperless config 2023-02-08 00:34:23 +01:00
Benjamin Bädorf 4febb87d2a
Use latest paperless version 2023-02-08 00:31:55 +01:00
Benjamin Bädorf 354a373795
Merge branch 'b12f-bash' into b12f 2023-02-07 15:56:37 +01:00
Benjamin Bädorf b6b7720382
Update b12f for paperless 2023-02-07 15:56:30 +01:00
Benjamin Bädorf 892aa2e4fa
Update paperless module 2023-02-07 15:56:19 +01:00
Benjamin Bädorf 5da339191d
Add changed vi keybindings
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-07 13:14:30 +01:00
Benjamin Bädorf fb01e684a8
Working bash system 2023-02-03 01:31:34 +01:00
Benjamin Bädorf 59adbfe8c0
Merge branch 'feature/bash-blesh-starship' into b12f-bash 2023-02-03 01:14:07 +01:00
teutat3s c5c6f1b098
bash: agenix secret only exists in teutat3s branch
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-02-02 17:50:23 +01:00
teutat3s 35c276bb49
bash: clean up unneeded starship.toml
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2023-02-02 17:46:00 +01:00
teutat3s a50ae3df10
bash: ble.sh tweaks and starship ricing
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2023-02-02 17:38:04 +01:00
teutat3s 9153af8809
terminal-life: switch from zsh to bash & starship 2023-02-02 17:37:42 +01:00
17 changed files with 372 additions and 34 deletions

View file

@ -221,11 +221,11 @@
}, },
"latest": { "latest": {
"locked": { "locked": {
"lastModified": 1675115703, "lastModified": 1675673983,
"narHash": "sha256-4zetAPSyY0D77x+Ww9QBe8RHn1akvIvHJ/kgg8kGDbk=", "narHash": "sha256-8hzNh1jtiPxL5r3ICNzSmpSzV7kGb3KwX+FS5BWJUTo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2caf4ef5005ecc68141ecb4aac271079f7371c44", "rev": "5a350a8f31bb7ef0c6e79aea3795a890cf7743d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -237,11 +237,11 @@
}, },
"master": { "master": {
"locked": { "locked": {
"lastModified": 1675254005, "lastModified": 1675775932,
"narHash": "sha256-n1qq2Qcz7DvPiB6emdRk/dx4uUgaFy0ojgKg3NBIwTU=", "narHash": "sha256-ysv4pFsZBU+/CZ01LbQW2T9HxRcR0LXBcAP1vYWQZag=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1efc432d4f72c0e3146c1dd2e8a3ffa705be8a04", "rev": "e521a883757b06720d28d4a303e0b4f7f0d7fcfc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -268,11 +268,11 @@
}, },
"nixos": { "nixos": {
"locked": { "locked": {
"lastModified": 1675154384, "lastModified": 1675681488,
"narHash": "sha256-gUXzyTS3WsO3g2Rz0qOYR2a26whkyL2UfTr1oPH9mm8=", "narHash": "sha256-0E/oYpixC+joFk7UrY60TwZcdthzP2BXmJwne3Ni8ZI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0218941ea68b4c625533bead7bbb94ccce52dceb", "rev": "13fdd3945d8a2da5e4afe35d8a629193a9680911",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -37,6 +37,8 @@ in {
runnerVarsFile = config.age.secrets.drone-runner-exec-config.path; runnerVarsFile = config.age.secrets.drone-runner-exec-config.path;
}; };
pub-solar.paperless.scannerDefaultDevice = "hp3900:libusb:005:002";
services.openssh.openFirewall = true; services.openssh.openFirewall = true;
networking.firewall.allowedTCPPorts = networking.firewall.allowedTCPPorts =
[443] [443]

View file

@ -79,8 +79,8 @@ in {
config.pub-solar.paperless.enable config.pub-solar.paperless.enable
'' ''
paperless.local:80 { paperless.local:80 {
request_header Host localhost:28981 request_header Host localhost:${builtins.toString config.services.paperless.port}
reverse_proxy localhost:28981 reverse_proxy localhost:${builtins.toString config.services.paperless.port}
} }
'') '')

View file

@ -2,6 +2,7 @@
lib, lib,
config, config,
pkgs, pkgs,
masterModulesPath,
... ...
}: }:
with lib; let with lib; let
@ -9,6 +10,14 @@ with lib; let
cfg = config.pub-solar.paperless; cfg = config.pub-solar.paperless;
xdg = config.home-manager.users."${psCfg.user.name}".xdg; xdg = config.home-manager.users."${psCfg.user.name}".xdg;
in { in {
imports = [
"${masterModulesPath}/services/misc/paperless.nix"
];
disabledModules = [
"services/misc/paperless.nix"
];
options.pub-solar.paperless = { options.pub-solar.paperless = {
enable = mkEnableOption "All you need to go paperless"; enable = mkEnableOption "All you need to go paperless";
ocrLanguage = mkOption { ocrLanguage = mkOption {
@ -17,11 +26,35 @@ in {
example = "eng+deu"; example = "eng+deu";
default = "eng"; default = "eng";
}; };
dataDir = mkOption {
description = "Directory to save data in";
type = types.str;
example = "/home/pub_solar/Paperless";
default = "/home/${psCfg.user.name}/Paperless";
};
consumptionDir = mkOption { consumptionDir = mkOption {
description = "Directory to be watched"; description = "Directory to be watched";
type = types.str; type = types.str;
example = "/var/lib/paperless/consume"; example = "/var/lib/paperless/consume";
default = "/home/${psCfg.user.name}/Documents"; default = "/var/lib/paperless/consume";
};
scannerDefaultDevice = mkOption {
description = ''
The scanner device. To find this, use `scanimage -L`.
For example, your output might be the following:
```
device `v4l:/dev/video3' is a Noname Logitech StreamCam virtual device
device `hp3900:libusb:005:002' is a Hewlett-Packard Scanjet G3010 flatbed scanner
```
Here, the scannerDevice is `hp3900:libusb:005:002`.
'';
type = types.str;
}; };
}; };
@ -30,10 +63,27 @@ in {
enable = true; enable = true;
user = psCfg.user.name; user = psCfg.user.name;
consumptionDir = cfg.consumptionDir; consumptionDir = cfg.consumptionDir;
dataDir = cfg.dataDir;
address = "paperless.local";
extraConfig = { extraConfig = {
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage; PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
PAPERLESS_ADMIN_USER = psCfg.user.name; PAPERLESS_ADMIN_USER = psCfg.user.name;
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name; PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
PAPERLESS_URL = "http://paperless.local";
};
};
home-manager = pkgs.lib.setAttrByPath ["users" psCfg.user.name] {
home.packages = with pkgs; [
scan2paperless
];
home.sessionVariables = {
SCANNER_DEFAULT_DEVICE = cfg.scannerDefaultDevice;
SCANNER_OUTPUT_DIR = cfg.consumptionDir;
};
systemd.user.sessionVariables = {
SCANNER_DEFAULT_DEVICE = cfg.scannerDefaultDevice;
SCANNER_OUTPUT_DIR = cfg.consumptionDir;
}; };
}; };
}; };

View file

@ -0,0 +1,97 @@
{
config,
pkgs,
self,
...
}: let
psCfg = config.pub-solar;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
in {
enable = true;
historyControl = ["ignorespace"];
# Run when initializing a login shell
profileExtra = ''
[ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service
'';
# Run when initializing an interactive shell
initExtra = ''
# If a command is not found, show me where it is
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
# Helps you navigate directories faster
# https://github.com/gsamokovarov/jump
eval "$(${pkgs.jump}/bin/jump shell --bind=z)"
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
# Syntax highlighting, auto suggestions, vim modes, etc.
# https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs
source "$(blesh-share)" --attach=none
# ctrl + space to accept autocomplete suggestion
ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end'
# Meta (Alt) + Backspace to delete a word
ble-bind -m 'emacs' -f 'M-C-?' 'kill-backward-cword'
# Meta (Alt) + p to jump one word backwards
ble-bind -m 'emacs' -f M-p '@nomarked backward-cword'
# Meta (Alt) + n to jump one word forwards
ble-bind -m 'emacs' -f M-n '@nomarked forward-cword'
# Arrow up and Ctrl + p searches history for entered input
ble-bind -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end'
ble-bind -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end'
# Arrow down and Ctrl + n searches history for entered input
ble-bind -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end'
ble-bind -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end'
function my/complete-load-hook {
bleopt complete_auto_delay=300
}
blehook/eval-after-load complete my/complete-load-hook
bleopt exec_errexit_mark=
bleopt history_share=1
bleopt filename_ls_colors="$LS_COLORS"
# Bash vim mode keybindings
if [[ $- == *i* ]]; then # in interactive session
set -o vi
ble-bind -m vi_imap -f 'ENTER' 'vi_imap/complete'
ble-bind -m vi_imap -f 'TAB' 'vi_imap/complete'
ble-bind -m vi_imap -f 'j j' 'vi_imap/normal-mode'
ble-bind -m vi_imap -f 'ESC' 'vi_imap/normal-mode'
ble-bind -m vi_nmap -f 'h' 'vi_nmap/insert-mode'
ble-bind -m vi_nmap -f 'i' 'vi-command/backward-line'
ble-bind -m vi_nmap -f 'j' 'vi-command/backward-char'
ble-bind -m vi_nmap -f 'k' 'vi-command/forward-line'
ble-bind -m vi_nmap -f 'l' 'vi-command/forward-char'
ble-bind -m vi_nmap -f 'C-r' '__fzf_history__'
fi
# end of .bashrc
[[ ''${BLE_VERSION-} ]] && ble-attach
'';
shellAliases = {
nano = "nvim";
vi = "nvim";
vim = "nvim";
mutt = "neomutt";
ls = "exa";
la = "exa --group-directories-first -lag";
fm = "vifm .";
vifm = "vifm .";
wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts";
irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi";
drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone";
no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix";
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
};
}

View file

@ -24,27 +24,29 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
# Needed to get zsh completion for system packages (e.g. systemd).
environment.pathsToLink = ["/share/zsh"];
environment.shells = with pkgs; [
zsh
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
screen screen
]; ];
# Starship is a fast and featureful shell prompt
# starship.toml has sane defaults that can be changed there
programs.starship = {
enable = true;
settings = import ./starship.toml.nix;
};
home-manager = with pkgs; home-manager = with pkgs;
pkgs.lib.setAttrByPath ["users" psCfg.user.name] { pkgs.lib.setAttrByPath ["users" psCfg.user.name] {
home.packages = [ home.packages = [
ack ack
asciinema asciinema
bat bat
blesh
exa exa
fd fd
gh gh
glow glow
jump
nnn nnn
powerline powerline
silver-searcher silver-searcher
@ -52,18 +54,18 @@ in {
watson watson
]; ];
programs.neovim = import ./nvim { programs.bash = import ./bash {
inherit config; inherit config;
inherit pkgs; inherit pkgs;
inherit self;
}; };
programs.fzf = import ./fzf { programs.fzf = import ./fzf {
inherit config; inherit config;
inherit pkgs; inherit pkgs;
}; };
programs.zsh = import ./zsh { programs.neovim = import ./nvim {
inherit config; inherit config;
inherit pkgs; inherit pkgs;
inherit self;
}; };
}; };
}; };

View file

@ -10,5 +10,5 @@
"--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062"
"--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7"
]; ];
enableZshIntegration = true; enableBashIntegration = true;
} }

View file

@ -0,0 +1,162 @@
{
format = "$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#86BBD8 bg:#06969A))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character";
# Disable the blank line at the start of the prompt
add_newline = false;
# You can also replace your username with a neat symbol like  to save some space
#username = {
# show_always = true;
# style_user = "bg:#9A348E";
# style_root = "bg:#9A348E";
# format = ''[$user ]($style)'';
#};
character = {
success_symbol = "[](bold purple)";
error_symbol = "[](#FF4B00)";
};
status = {
disabled = false;
style = "#FF4B00";
};
fill = {
symbol = "-";
#style = "bold green";
style = "black";
};
directory = {
style = "#F85E84";
truncate_to_repo = false;
fish_style_pwd_dir_length = 1;
truncation_symbol = "/";
format = "[](fg:black bg:#F85E84)[$path[$read_only](bg:$style fg:black)](bg:$style fg:black)[](fg:$style)";
read_only = " ";
};
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
directory.substitutions = {
"Documents" = " ";
"Downloads" = " ";
"Music" = " ";
"Pictures" = " ";
};
# Keep in mind that the order matters. For example:
# "Important Documents" = "  "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important  " = "  "
c = {
symbol = " ";
style = "bg:#86BBD8";
format = ''[ $symbol ($version) ]($style)'';
};
#container = {};
custom = {
triton = {
command = "echo $TRITON_PROFILE";
when = "test $TRITON_PROFILE";
format = "[ ](fg:#F85E84 bg:#1A181A)[$output](fg:#F85E84 bg:#1A181A)";
description = "The current triton profile";
};
};
docker_context = {
symbol = " ";
style = "bg:#06969A";
format = ''[ $symbol $context ]($style) $path'';
};
#deno = {};
git_branch = {
style = "#E5C463";
format = "[](fg:black bg:$style)[ $symbol$branch](fg:black bg:$style)[](fg:$style)";
};
git_commit = {
style = "#E5C463";
# ^H is the literal backspace character which renders to \b in the final
# starship config TOML, produced in insert mode via ctrl+v then ctrl+h.
# We use the literal character, because escaping a single \ doesn't work
# with pkgs.formats.toml, see: https://github.com/NixOS/nixpkgs/issues/97310 and
# https://jdhao.github.io/2020/10/07/nvim_insert_unicode_char/
format = "[ ](bg:$style)[\\($hash$tag\\)](fg:black bg:$style)[](fg:$style)";
};
git_state = {
style = "#E5C463";
format = "[ ](bg:$style)[ \\($state( $progress_current/$progress_total)\\)](fg:black bg:$style)[](fg:$style)";
};
git_status = {
style = "#E5C463";
format = "([ ](bg:$style fg:black)$conflicted$staged$modified$renamed$deleted$untracked$stashed$ahead_behind[](fg:$style))";
conflicted = "[ ](bold fg:88 bg:#E5C463)[ \${count} ](fg:black bg:#E5C463)";
staged = "[ $count ](fg:black bg:#E5C463)";
modified = "[ \${count} ](fg:black bg:#E5C463)";
renamed = "[ \${count} ](fg:black bg:#E5C463)";
deleted = "[ \${count} ](fg:black bg:#E5C463)";
untracked = "[?\${count} ](fg:black bg:#E5C463)";
stashed = "[ \${count} ](fg:black bg:#E5C463)";
ahead = "[ \${count} ](fg:#523333 bg:#E5C463)";
behind = "[ \${count} ](fg:black bg:#E5C463)";
diverged = "[ ](fg:88 bg:#E5C463)[ ](fg:black bg:#E5C463)[ \${ahead_count} ](fg:black bg:#E5C463)[ \${behind_count} ](fg:black bg:#E5C463)";
};
golang = {
symbol = " ";
style = "bg:#86BBD8";
format = ''[ $symbol ($version) ]($style)'';
};
haskell = {
symbol = " ";
style = "bg:#86BBD8";
format = ''[ $symbol ($version) ]($style)'';
};
nix_shell = {
format = ''[$symbol]($style) '';
symbol = " ";
};
nodejs = {
symbol = "";
style = "bg:#86BBD8";
format = ''[ $symbol ($version) ]($style)'';
};
php = {
symbol = " ";
};
python = {
symbol = " ";
};
ruby = {
symbol = " ";
};
rust = {
symbol = "";
style = "bg:#86BBD8";
format = ''[ $symbol ($version) ]($style)'';
};
#terraform = {};
time = {
disabled = false;
time_format = "%R"; # Hour:Minute Format
style = "bg:#33658A";
format = ''[ $time ]($style)'';
};
}

13
overlays/blesh.nix Normal file
View file

@ -0,0 +1,13 @@
final: prev: {
blesh = prev.blesh.overrideAttrs (oldAttrs: rec {
version = "unstable-2023-02-01";
src = prev.fetchFromGitHub {
owner = "akinomyoga";
repo = "ble.sh";
rev = "0ceb0cb38157c2c37650ffb069098783338eb02c";
hash = "sha256-f3w3gHKysRafBGcZbCPUvy9e/fOrQc9TBZAjb0ioxpo=";
fetchSubmodules = true;
leaveDotGit = true;
};
});
}

View file

@ -31,6 +31,7 @@ channels: final: prev: {
inherit inherit
(channels.master) (channels.master)
factorio-headless factorio-headless
paperless-ngx
; ;
haskellPackages = haskellPackages =

View file

@ -1,4 +1,17 @@
self: self:
with self; '' with self; ''
export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.sane-frontends pkgs.sane-backends pkgs.ghostscript pkgs.imagemagick]} export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.sane-frontends pkgs.sane-backends pkgs.ghostscript pkgs.imagemagick]}
while true;
do
read -p "Press Enter to continue or Ctrl+C to stop" < /dev/tty
DATETIME=$(date -Iseconds)
scanimage \
-d "''${SCANNER_DEFAULT_DEVICE}" \
--format=jpeg \
--resolution 300 \
--progress \
-o "''${SCANNER_OUTPUT_DIR}/''${DATETIME}.jpg"
done
'' ''

View file

@ -1,7 +1,6 @@
self: self:
with self; '' with self; ''
#!/usr/bin/env zsh #!/usr/bin/env bash
# terminal application launcher for sway, using fzf
# original command: # original command:
# Based on: https://github.com/swaywm/sway/issues/1367 # Based on: https://github.com/swaywm/sway/issues/1367
# bindsym $altkey+space exec termite --name=launcher -e \ # bindsym $altkey+space exec termite --name=launcher -e \

View file

@ -27,11 +27,11 @@ in {
"lp" "lp"
"scanner" "scanner"
]; ];
shell = pkgs.bash;
initialHashedPassword = initialHashedPassword =
if psCfg.user.password != null if psCfg.user.password != null
then psCfg.user.password then psCfg.user.password
else ""; else "";
shell = pkgs.zsh;
openssh.authorizedKeys.keys = openssh.authorizedKeys.keys =
if psCfg.user.publicKeys != null if psCfg.user.publicKeys != null
then psCfg.user.publicKeys then psCfg.user.publicKeys

View file

@ -26,7 +26,6 @@ in {
fonts.fontconfig.enable = mkForce true; fonts.fontconfig.enable = mkForce true;
programs.dircolors.enable = true; programs.dircolors.enable = true;
programs.dircolors.enableZshIntegration = true;
home.file."xinitrc".source = ./.xinitrc; home.file."xinitrc".source = ./.xinitrc;

View file

@ -42,9 +42,12 @@ in {
}; };
paperless = { paperless = {
enable = false; enable = true;
ocrLanguage = "nld+deu"; ocrLanguage = "nld+deu";
dataDir = "/home/${psCfg.user.name}/Nextcloud/Paperless";
consumptionDir = "/home/${psCfg.user.name}/.local/share/scandir";
}; };
arduino.enable = true; arduino.enable = true;
email.enable = true; email.enable = true;
uhk.enable = true; uhk.enable = true;

View file

@ -107,9 +107,9 @@ in {
xdg.configFile."msmtp/config".source = ./.config/msmtp/config; xdg.configFile."msmtp/config".source = ./.config/msmtp/config;
# xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg; # xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg;
programs.zsh = { programs.bash.initExtra = ''
initExtra = import ./zshrc.nix {inherit config;}; source ${config.age.secrets.b12f-env-secrets.path}
}; '';
}; };
age.secrets."mopidy.conf" = { age.secrets."mopidy.conf" = {

View file

@ -1,3 +0,0 @@
{config, ...}: ''
source ${config.age.secrets.b12f-env-secrets.path}
''