Initial Commit

This commit is contained in:
~vern 2022-11-22 14:19:19 +00:00
parent 1eb15dc17e
commit 8cefe14d04
13 changed files with 1288 additions and 0 deletions

162
nixos/configuration.nix Normal file
View File

@ -0,0 +1,162 @@
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
<home-manager/nixos>
./override/fcgiwrap.nix
./override/phpfpm.nix
];
disabledModules = [ "services/web-servers/fcgiwrap.nix" "services/web-servers/phpfpm/default.nix" ]; # Overrides
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
#boot.kernelPackages = pkgs.linuxPackages_latest-libre;
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = [ "zfs" ];
networking.hostId = "38661127";
networking.hostName = "verntil"; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
networking.nameservers = [ "45.90.28.127" ];
services.zfs.autoScrub.enable = true;
services.iperf3.enable = true;
# Set your time zone.
time.timeZone = "UTC";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [
zfs
coreutils-full
check-uptime
vim
wget
curl
home-manager
audit
cached-nix-shell
iptables
zsh
fish
dash
nushell
ksh
tcsh
neofetch
emacs
neovim
git
profanity
tut
irssi
weechat
neomutt
gomuks
python310
python310Packages.pip
figlet
lua
nix-index
aerc
];
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
passwordAuthentication = false;
permitRootLogin = "prohibit-password";
extraConfig = "TCPKeepAlive yes\nClientAliveInterval 30\nClientAliveCountMax 99999\nX11UseLocalhost no\nX11DisplayOffset 10\nMatch address 192.168.122.1\n\tPasswordAuthentication yes";
forwardX11 = true;
};
services.acpid.enable = true;
environment.extraInit = "if echo \"$-\" | grep i > /dev/null; then bash /etc/motd.script; if [ -r ~/README ]; then printf '\nHello %s, there is a README file in your home directory. See the contents below:\n\n%s\n' $USER \"$(<~/README)\"; fi; if [ -r /var/tmp/poll ]; then printf '\nTHERE IS AN ONGOING POLL.\n%s\nPoll ends on %s\nPlace your vote in ~/.vote\n' \"$(</var/tmp/poll)\" \"$(date -d @$(($(stat -c %Y /var/tmp/poll)+604800)))\"; fi; fi";
security.auditd.enable = true;
# services.phpfpm.pools.mypool.socket = "";
services.phpfpm.pools.mypool = {
user = "php";
group = "php";
phpPackage = pkgs.php;
listen = "192.168.122.30:9000";
settings = {
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
# "pm.status_listen" = "127.0.0.1:9000";
"catch_workers_output" = true;
};
};
services.fcgiwrap.user = "php";
services.fcgiwrap.group = "php";
services.fcgiwrap.enable = true;
services.fcgiwrap.socketType = "tcp";
services.fcgiwrap.socketAddress = "192.168.122.30:9001";
networking.firewall.enable = false;
networking.nftables.enable = true;
services.syslogd.enable = true;
services.journald.extraConfig = "ForwardToWall=no";
virtualisation.docker.enable = true;
virtualisation.lxc.enable = true;
systemd.services.gemini = {
description = "Gemini Server";
after = [ "network-online.target" ];
wants = [ "network-online.target" ]; # systemd-networkd-wait-online.service
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStartPre = "/var/gemini/conf/updateusersites";
ExecStart = "/var/gemini/gemserv/target/release/gemserv /var/gemini/conf/gemserv.toml";
Type = "simple";
User = "gemini";
Group = "gemini";
Restart = "on-abnormal";
KillMode = "mixed";
KillSignal = "SIGQUIT";
TimeoutStopSec = "5s";
};
};
systemd.services.rathole = {
description = "Forward ports";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = "/root/rathole -c /etc/rathole.toml";
Type = "simple";
Restart = "on-abnormal";
KillMode = "mixed";
KillSignal = "SIGQUIT";
TimeotStopSec = "5s";
};
};
services.xinetd.enable = true;
#services.xinetd.services = [ vger
services.xinetd.services = [ {
name = "gophernicus";
user = "gopher";
server = "/var/lib/gopher/gophernicus";
serverArgs = "-r/var/lib/gopher -hvern.cc";
protocol = "tcp";
port = 70;
unlisted = true;
} ];
programs.command-not-found.enable = false;
programs.bash.interactiveShellInit = ''
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
'';
services.cron = {
enable = true;
systemCronJobs = [
"@weekly root cd /var/lib/nix-index && nix-shell -p nix-index --run 'nix-index --db ./x86_64-linux-index' --option system x86_64-linux --extra-platforms x86_64-linux && cp files files.bak && cp x86_64-linux-index/files ./files"
];
};
security.pam.services.su.text = "account required pam_unix.so\nauth sufficient pam_rootok.so\nauth required pam_faillock.so\nauth required pam_deny.so\npassword sufficient pam_unix.so nullok sha512\nsession required pam_env.so conffile=/etc/pam/environment readenv=0\nsession required pam_unix.so";
system.stateVersion = "22.05"; # Did you read the comment?
}

View File

@ -0,0 +1,29 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/754934cb-d76e-4dcb-8f1e-d65f277ba735";
fsType = "btrfs";
options = [ "subvol=@" "noatime" "ssd" "compress=zstd" "space_cache=v2" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/111B-9661";
fsType = "vfat";
};
boot.zfs.extraPools = [ "pool1" ];
swapDevices = [ { device = "/swapfile"; } ];
networking.useDHCP = lib.mkDefault true;
}

View File

@ -0,0 +1,73 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fcgiwrap;
in {
options = {
services.fcgiwrap = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable fcgiwrap, a server for running CGI applications over FastCGI.";
};
preforkProcesses = mkOption {
type = types.int;
default = 1;
description = "Number of processes to prefork.";
};
socketType = mkOption {
type = types.enum [ "unix" "tcp" "tcp6" ];
default = "unix";
description = "Socket type: 'unix', 'tcp' or 'tcp6'.";
};
socketAddress = mkOption {
type = types.str;
default = "/run/fcgiwrap.sock";
example = "1.2.3.4:5678";
description = "Socket address. In case of a UNIX socket, this should be its filesystem path.";
};
user = mkOption {
type = types.nullOr types.str;
default = null;
description = "User permissions for the socket.";
};
group = mkOption {
type = types.nullOr types.str;
default = null;
description = "Group permissions for the socket.";
};
};
};
config = mkIf cfg.enable {
systemd.services.fcgiwrap = {
script = ''
set -a
. /var/lib/php/env
set +a
fcgiwrap -c 1 -s tcp:192.168.122.30:9001
'';
after = [ "nss-user-lookup.target" ];
wantedBy = optional (cfg.socketType != "unix") "multi-user.target";
serviceConfig = {
User = "php";
Group = "php";
};
};
systemd.sockets = if (cfg.socketType == "unix") then {
fcgiwrap = {
wantedBy = [ "sockets.target" ];
socketConfig.ListenStream = cfg.socketAddress;
};
} else { };
};
}

278
nixos/override/phpfpm.nix Normal file
View File

@ -0,0 +1,278 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.phpfpm;
runtimeDir = "/run/phpfpm";
toStr = value:
if true == value then "yes"
else if false == value then "no"
else toString value;
fpmCfgFile = pool: poolOpts: pkgs.writeText "phpfpm-${pool}.conf" ''
[global]
${concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${toStr v}") cfg.settings)}
${optionalString (cfg.extraConfig != null) cfg.extraConfig}
[${pool}]
${concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${toStr v}") poolOpts.settings)}
${concatStringsSep "\n" (mapAttrsToList (n: v: "env[${n}] = ${toStr v}") poolOpts.phpEnv)}
${optionalString (poolOpts.extraConfig != null) poolOpts.extraConfig}
'';
phpIni = poolOpts: pkgs.runCommand "php.ini" {
inherit (poolOpts) phpPackage phpOptions;
preferLocalBuild = true;
passAsFile = [ "phpOptions" ];
} ''
cat ${poolOpts.phpPackage}/etc/php.ini $phpOptionsPath > $out
'';
poolOpts = { name, ... }:
let
poolOpts = cfg.pools.${name};
in
{
options = {
socket = mkOption {
type = types.str;
readOnly = true;
description = ''
Path to the unix socket file on which to accept FastCGI requests.
<note><para>This option is read-only and managed by NixOS.</para></note>
'';
example = "${runtimeDir}/<name>.sock";
};
listen = mkOption {
type = types.str;
default = "";
example = "/path/to/unix/socket";
description = ''
The address on which to accept FastCGI requests.
'';
};
phpPackage = mkOption {
type = types.package;
default = cfg.phpPackage;
defaultText = literalExpression "config.services.phpfpm.phpPackage";
description = ''
The PHP package to use for running this PHP-FPM pool.
'';
};
phpOptions = mkOption {
type = types.lines;
description = ''
"Options appended to the PHP configuration file <filename>php.ini</filename> used for this PHP-FPM pool."
'';
};
phpEnv = lib.mkOption {
type = with types; attrsOf str;
default = {};
description = ''
Environment variables used for this PHP-FPM pool.
'';
example = literalExpression ''
{
HOSTNAME = "$HOSTNAME";
TMP = "/tmp";
TMPDIR = "/tmp";
TEMP = "/tmp";
}
'';
};
user = mkOption {
type = types.str;
description = "User account under which this pool runs.";
};
group = mkOption {
type = types.str;
description = "Group account under which this pool runs.";
};
settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool ]);
default = {};
description = ''
PHP-FPM pool directives. Refer to the "List of pool directives" section of
<link xlink:href="https://www.php.net/manual/en/install.fpm.configuration.php"/>
for details. Note that settings names must be enclosed in quotes (e.g.
<literal>"pm.max_children"</literal> instead of <literal>pm.max_children</literal>).
'';
example = literalExpression ''
{
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
}
'';
};
extraConfig = mkOption {
type = with types; nullOr lines;
default = null;
description = ''
Extra lines that go into the pool configuration.
See the documentation on <literal>php-fpm.conf</literal> for
details on configuration directives.
'';
};
};
config = {
socket = if poolOpts.listen == "" then "${runtimeDir}/${name}.sock" else poolOpts.listen;
group = mkDefault poolOpts.user;
phpOptions = mkBefore cfg.phpOptions;
settings = mapAttrs (name: mkDefault){
listen = poolOpts.socket;
user = poolOpts.user;
group = poolOpts.group;
};
};
};
in {
imports = [
(mkRemovedOptionModule [ "services" "phpfpm" "poolConfigs" ] "Use services.phpfpm.pools instead.")
(mkRemovedOptionModule [ "services" "phpfpm" "phpIni" ] "")
];
options = {
services.phpfpm = {
settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool ]);
default = {};
description = ''
PHP-FPM global directives. Refer to the "List of global php-fpm.conf directives" section of
<link xlink:href="https://www.php.net/manual/en/install.fpm.configuration.php"/>
for details. Note that settings names must be enclosed in quotes (e.g.
<literal>"pm.max_children"</literal> instead of <literal>pm.max_children</literal>).
You need not specify the options <literal>error_log</literal> or
<literal>daemonize</literal> here, since they are generated by NixOS.
'';
};
extraConfig = mkOption {
type = with types; nullOr lines;
default = null;
description = ''
Extra configuration that should be put in the global section of
the PHP-FPM configuration file. Do not specify the options
<literal>error_log</literal> or
<literal>daemonize</literal> here, since they are generated by
NixOS.
'';
};
phpPackage = mkOption {
type = types.package;
default = pkgs.php;
defaultText = literalExpression "pkgs.php";
description = ''
The PHP package to use for running the PHP-FPM service.
'';
};
phpOptions = mkOption {
type = types.lines;
default = "";
example =
''
date.timezone = "CET"
'';
description = ''
Options appended to the PHP configuration file <filename>php.ini</filename>.
'';
};
pools = mkOption {
type = types.attrsOf (types.submodule poolOpts);
default = {};
example = literalExpression ''
{
mypool = {
user = "php";
group = "php";
phpPackage = pkgs.php;
settings = {
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
};
}
}'';
description = ''
PHP-FPM pools. If no pools are defined, the PHP-FPM
service is disabled.
'';
};
};
};
config = mkIf (cfg.pools != {}) {
warnings =
mapAttrsToList (pool: poolOpts: ''
Using config.services.phpfpm.pools.${pool}.listen is deprecated and will become unsupported in a future release. Please reference the read-only option config.services.phpfpm.pools.${pool}.socket to access the path of your socket.
'') (filterAttrs (pool: poolOpts: poolOpts.listen != "") cfg.pools) ++
mapAttrsToList (pool: poolOpts: ''
Using config.services.phpfpm.pools.${pool}.extraConfig is deprecated and will become unsupported in a future release. Please migrate your configuration to config.services.phpfpm.pools.${pool}.settings.
'') (filterAttrs (pool: poolOpts: poolOpts.extraConfig != null) cfg.pools) ++
optional (cfg.extraConfig != null) ''
Using config.services.phpfpm.extraConfig is deprecated and will become unsupported in a future release. Please migrate your configuration to config.services.phpfpm.settings.
''
;
services.phpfpm.settings = {
error_log = "syslog";
daemonize = false;
};
systemd.slices.phpfpm = {
description = "PHP FastCGI Process manager pools slice";
};
systemd.targets.phpfpm = {
description = "PHP FastCGI Process manager pools target";
wantedBy = [ "multi-user.target" ];
};
systemd.services = mapAttrs' (pool: poolOpts:
nameValuePair "phpfpm-${pool}" {
description = "PHP FastCGI Process Manager service for pool ${pool}";
after = [ "network.target" ];
wantedBy = [ "phpfpm.target" ];
partOf = [ "phpfpm.target" ];
serviceConfig = let
cfgFile = fpmCfgFile pool poolOpts;
iniFile = phpIni poolOpts;
in {
Slice = "phpfpm.slice";
# XXX: We need AF_NETLINK to make the sendmail SUID binary from postfix work
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
Type = "notify";
ExecStart = "${poolOpts.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${iniFile}";
ExecReload = "${pkgs.coreutils}/bin/kill -USR2 $MAINPID";
RuntimeDirectory = "phpfpm";
RuntimeDirectoryPreserve = true; # Relevant when multiple processes are running
Restart = "always";
};
}
) cfg.pools;
};
}

7
skel/.bash_logout Normal file
View File

@ -0,0 +1,7 @@
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

1
skel/.cache/nix-index/files Symbolic link
View File

@ -0,0 +1 @@
/var/lib/nix-index/files

View File

@ -0,0 +1,8 @@
[~vern]
source = imaps://replaceme%40vern.cc@mail.vern.cc
outgoing = smtps+plain://replaceme%40vern.cc@mail.vern.cc
default = INBOX
from = replaceme@vern.cc
copy-to = Sent
source-cred-cmd = cat "$USER"/priv/mailpasswd
outgoing-cred-cmd = cat "$USER"/priv/mailpasswd

310
skel/.config/aerc/aerc.conf Normal file
View File

@ -0,0 +1,310 @@
#
# aerc main configuration
[general]
#
# If set to "gpg", aerc will use system gpg binary and keystore for all crypto
# operations. Otherwise, the internal openpgp implemenation will be used.
#
# Default: internal
pgp-provider=internal
# By default, the file permissions of accounts.conf must be restrictive and
# only allow reading by the file owner (0600). Set this option to true to
# ignore this permission check. Use this with care as it may expose your
# credentials.
#
# Default: false
unsafe-accounts-conf=false
[ui]
#
# Describes the format for each row in a mailbox view. This field is compatible
# with mutt's printf-like syntax.
#
# Default: %D %-17.17n %Z %s
index-format=%-20.20D %-17.17n %Z %s
#
# See time.Time#Format at https://godoc.org/time#Time.Format
#
# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
timestamp-format=2006-01-02 03:04 PM
#
# Index-only time format for messages that were received/sent today.
# If this is not specified, timestamp-format is used instead.
#
# Default: "03:04 PM" (12 hour time)
this-day-time-format=03:04 PM
#
# Index-only time format for messages that were received/sent within the last
# 7 days. If this is not specified, timestamp-format is used instead.
#
# Default: "Monday 03:04 PM" (Week day + 12 hour time)
this-week-time-format=Monday 03:04 PM
#
# Index-only time format for messages that were received/sent this year.
# If this is not specified, timestamp-format is used instead.
#
# Default: "January 02" (Month + month day)
this-year-time-format=January 02
#
# Width of the sidebar, including the border.
#
# Default: 20
sidebar-width=20
#
# Message to display when viewing an empty folder.
#
# Default: (no messages)
empty-message=(no messages)
# Message to display when no folders exists or are all filtered
#
# Default: (no folders)
empty-dirlist=(no folders)
# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
#
# Default: false
mouse-enabled=true
#
# Ring the bell when new messages are received
#
# Default: true
new-message-bell=true
# Marker to show before a pinned tab's name.
#
# Default: `
pinned-tab-marker='`'
# Describes the format string to use for the directory list
#
# Default: %n %>r
dirlist-format=%n %>r
# Delay after which the messages are actually listed when entering a directory.
# This avoids loading messages when skipping over folders and makes the UI more
# responsive. If you do not want that, set it to 0s.
#
# Default: 200ms
dirlist-delay=200ms
# Display the directory list as a foldable tree that allows to collapse and
# expand the folders.
#
# Default: false
dirlist-tree=false
# List of space-separated criteria to sort the messages by, see *sort*
# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
# reverses that criterion.
#
# Example: "from -r date"
#
# Default: ""
sort=
# Moves to next message when the current message is deleted
#
# Default: true
next-message-on-delete=true
# The directories where the stylesets are stored. It takes a colon-separated
# list of directories. If this is unset or if a styleset cannot be found, the
# following paths will be used as a fallback in that order:
#
# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
# /usr/local/share/aerc/stylesets
# /usr/share/aerc/stylesets
#
# default: ""
stylesets-dirs=
# Uncomment to use box-drawing characters for vertical and horizontal borders.
#
# Default: spaces
# border-char-vertical=│
# border-char-horizontal=─
# Sets the styleset to use for the aerc ui elements.
#
# Default: default
styleset-name=default
# Activates fuzzy search in commands and their arguments: the typed string is
# searched in the command or option in any position, and need not be
# consecutive characters in the command or option.
#fuzzy-complete=false
#[ui:account=foo]
#
# Enable threading in the ui. Only works with notmuch:// and imap:// accounts
# (when the server supports it). If this is not supported by the server,
# you can enable it on the fly by issuing the :toggle-threads command. The
# threading will be done client side instead of on the server.
#
# Default: false
#threading-enabled=false
[statusline]
# Describes the format string for the statusline.
#
# Default: [%a] %S %>%T
render-format=[%a] %S %>%T
# Specifies the separator between grouped statusline elements.
#
# Default: " | "
# separator=
# Defines the mode for displaying the status elements.
# Options: text, icon
#
# Default: text
# display-mode=
[viewer]
#
# Specifies the pager to use when displaying emails. Note that some filters
# may add ANSI codes to add color to rendered emails, so you may want to use a
# pager which supports ANSI codes.
#
# Default: less -R
pager=less -R
#
# If an email offers several versions (multipart), you can configure which
# mimetype to prefer. For example, this can be used to prefer plaintext over
# html emails.
#
# Default: text/plain,text/html
alternatives=text/plain,text/html
#
# Default setting to determine whether to show full headers or only parsed
# ones in message viewer.
#
# Default: false
show-headers=false
#
# Layout of headers when viewing a message. To display multiple headers in the
# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
# none of their specified headers are present in the message.
#
# Default: From|To,Cc|Bcc,Date,Subject
header-layout=From|To,Cc|Bcc,Date,Subject
# Whether to always show the mimetype of an email, even when it is just a single part
#
# Default: false
always-show-mime=false
# How long to wait after the last input before auto-completion is triggered.
#
# Default: 250ms
completion-delay=250ms
#
# Global switch for completion popovers
#
# Default: true
completion-popovers=true
[compose]
#
# Specifies the command to run the editor with. It will be shown in an embedded
# terminal, though it may also launch a graphical window if the environment
# supports it. Defaults to $EDITOR, or vi.
editor=
#
# Default header fields to display when composing a message. To display
# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
#
# Default: To|From,Subject
header-layout=To|From,Subject
#
# Specifies the command to be used to tab-complete email addresses. Any
# occurrence of "%s" in the address-book-cmd will be replaced with what the
# user has typed so far.
#
# The command must output the completions to standard output, one completion
# per line. Each line must be tab-delimited, with an email address occurring as
# the first field. Only the email address field is required. The second field,
# if present, will be treated as the contact name. Additional fields are
# ignored.
address-book-cmd=
#
# Allow to address yourself when replying
#
# Default: true
reply-to-self=true
[filters]
#
# Filters allow you to pipe an email body through a shell command to render
# certain emails differently, e.g. highlighting them with ANSI escape codes.
#
# The first filter which matches the email's mimetype will be used, so order
# them from most to least specific.
#
# You can also match on non-mimetypes, by prefixing with the header to match
# against (non-case-sensitive) and a comma, e.g. subject,text will match a
# subject which contains "text". Use header,~regex to match against a regex.
#subject,~^\[PATCH=colordiff
text/plain=sed 's/^>\+.*/\x1b[36m&\x1b[0m/'
#text/html=pandoc -f html -t plain
#image/*=catimg -w $(tput cols) -
[triggers]
#
# Triggers specify commands to execute when certain events occur.
#
# Example:
# new-email=exec notify-send "New email from %n" "%s"
#
# Executed when a new email arrives in the selected folder
new-email=
[templates]
# Templates are used to populate email bodies automatically.
#
# The directories where the templates are stored. It takes a colon-separated
# list of directories. If this is unset or if a template cannot be found, the
# following paths will be used as a fallback in that order:
#
# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates
# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates
# /usr/local/share/aerc/templates
# /usr/share/aerc/templates
#
# default: ""
template-dirs=
# The default template to be used for new messages.
#
# default: new_message
new-message=new_message
# The default template to be used for quoted replies.
#
# default: quoted_reply
quoted-reply=quoted_reply
# The default template to be used for forward as body.
#
# default: forward_as_body
forwards=forward_as_body

View File

@ -0,0 +1,116 @@
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-t> = :term<Enter>
[messages]
q = :quit<Enter>
j = :next<Enter>
<Down> = :next<Enter>
<C-d> = :next 50%<Enter>
<C-f> = :next 100%<Enter>
<PgDn> = :next 100%<Enter>
k = :prev<Enter>
<Up> = :prev<Enter>
<C-u> = :prev 50%<Enter>
<C-b> = :prev 100%<Enter>
<PgUp> = :prev 100%<Enter>
g = :select 0<Enter>
G = :select -1<Enter>
J = :next-folder<Enter>
K = :prev-folder<Enter>
H = :collapse-folder<Enter>
L = :expand-folder<Enter>
v = :mark -t<Enter>
V = :mark -v<Enter>
T = :toggle-threads<Enter>
<Enter> = :view<Enter>
d = :prompt 'Really delete this message?' 'delete-message'<Enter>
D = :delete<Enter>
A = :archive flat<Enter>
C = :compose<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
c = :cf<space>
$ = :term<space>
! = :term<space>
| = :pipe<space>
/ = :search<space>
\ = :filter<space>
n = :next-result<Enter>
N = :prev-result<Enter>
<Esc> = :clear<Enter>
[view]
/ = :toggle-key-passthrough<Enter>/
q = :close<Enter>
O = :open<Enter>
S = :save<space>
| = :pipe<space>
D = :delete<Enter>
A = :archive flat<Enter>
f = :forward<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
H = :toggle-headers<Enter>
<C-k> = :prev-part<Enter>
<C-j> = :next-part<Enter>
J = :next<Enter>
K = :prev<Enter>
[view::passthrough]
$noinherit = true
$ex = <C-x>
<Esc> = :toggle-key-passthrough<Enter>
[compose]
# Keybindings used when the embedded terminal is not selected in the compose
# view
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<tab> = :next-field<Enter>
[compose::editor]
# Keybindings used when the embedded terminal is selected in the compose view
$noinherit = true
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
[compose::review]
# Keybindings used when reviewing a message to be sent
y = :send<Enter>
n = :abort<Enter>
p = :postpone<Enter>
q = :choose -o d discard abort -o p postpone postpone<Enter>
e = :edit<Enter>
a = :attach<space>
d = :detach<space>
[terminal]
$noinherit = true
$ex = <C-x>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>

109
skel/.config/bash/bashrc Normal file
View File

@ -0,0 +1,109 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

171
skel/.config/bash/prompt Normal file
View File

@ -0,0 +1,171 @@
#!/bin/bash
# shebang for syntax highlighting purposes
# Colors
_NON="\[\033[0m\]"
_BLD="\[\033[1m\]" # YEP BALD
_BLK="\[\033[30m\]"
_RED="\[\033[31m\]"
_GRN="\[\033[32m\]"
_YLW="\[\033[33m\]"
_BLU="\[\033[34m\]"
_PRP="\[\033[35m\]"
_CYN="\[\033[36m\]"
_WHT="\[\033[37m\]"
__debug_trap() {
# Set necessary pre-command variables (PROMPT_COMMAND is a
# command so its excluded here)
if [[ "$BASH_COMMAND" != "$PROMPT_COMMAND"
&& "$LAST_BASH_COMMAND" == "$PROMPT_COMMAND" ]]; then
INC_TIME=1
LAST_RT="$EPOCHREALTIME" # This should be the last thing done in this function
fi
LAST_BASH_COMMAND="$BASH_COMMAND"
}
trap '__debug_trap' DEBUG
__get_cmd_time() {
# Set hours minutes seconds and remove preceding zeros
local YEAR=$((10#0$(($(TZ=UTC printf '%(%Y)T' $CMD_TIME)))-1970))
local DAYS=$((10#0$(TZ=UTC printf '%(%j)T' $CMD_TIME)))
local HOUR=$((10#0$(TZ=UTC printf '%(%H)T' $CMD_TIME)))
local MINS=$((10#0$(TZ=UTC printf '%(%M)T' $CMD_TIME)))
local SECS=$((10#0$(TZ=UTC printf '%(%S)T' $CMD_TIME)))
# Choose whether or not to print hours minutes and seconds
[[ $CMD_TIME -ge 31536000 ]] && printf '%sy ' ${YEAR}
[[ $CMD_TIME -ge 86400 ]] && printf '%sd ' ${DAYS}
[[ $CMD_TIME -ge 3600 ]] && printf '%sh ' ${HOUR}
[[ $CMD_TIME -ge 60 ]] && printf '%sm ' ${MINS}
[[ $CMD_TIME -ge 1 ]] && printf '%ss ' ${SECS}
# If you want to have a limit uncomment the next line and replace somenum with
# the minimum microseconds
# [[ $CMD_US -ge somenum ]] &&
printf '%sμs' ${CMD_US:-0}
}
__sig() {
# Giant switch case for getting the name of the signal (`kill -l`)
j=0
for i in $@; do
if [[ $j != 0 ]]; then
printf '%s|%s' "$_WHT" "$_RED"
fi
j=$((j+1))
case $i in
126) printf ACCES ;;
127) printf NOENT ;;
129) printf HUP ;;
130) printf INT ;;
131) printf QUIT ;;
132) printf ILL ;;
133) printf TRAP ;;
134) printf ABRT ;;
135) printf BUS ;;
136) printf FPE ;;
137) printf KILL ;;
138) printf USR1 ;;
139) printf SEGV ;;
140) printf USR2 ;;
141) printf PIPE ;;
142) printf ALRM ;;
143) printf TERM ;;
144) printf STKFLT ;;
145) printf CHLD ;;
146) printf CONT ;;
147) printf STOP ;;
148) printf TSTP ;;
149) printf TTIN ;;
150) printf TTOU ;;
151) printf URG ;;
152) printf XCPU ;;
153) printf XFSZ ;;
154) printf VTALRM ;;
155) printf PROF ;;
156) printf WINCH ;;
157) printf IO ;;
158) printf PWR ;;
159) printf SYS ;;
16[3-9]|1[7-8][0-9]|19[0-2]) printf RT$(($i-128)) ;; # Savagery
*) printf $i ;; # Print exit code if not in list
esac
done
}
__ssh() {
local CON=($SSH_CONNECTION)
local SRV_IP="${CON[2]}"
[[ -z "$SRV_IP" ]] && return
local SRV_PORT="${CON[3]}"
# 4 chars from startand 4 chars from end
local SRV_IP_CUT="${_CYN}${SRV_IP}"
[[ ${#SRV_IP} -gt 8 ]] && local SRV_IP_CUT="${_CYN}${SRV_IP:0:4}${_WHT}*${_CYN}${SRV_IP: -4}"
printf '%s' "${_GRN}${_BLU}[${SRV_IP_CUT}${_PRP}${_BLD}:${_NON}${_CYN}${SRV_PORT}${_BLU}]${_NON}"
}
__prompt() {
# Get exit code (must be first)
local PLC=(${PIPESTATUS[@]})
# Reset time when prompt was first displayed after command
# this contributes to the 40 microsecond difference in $CMD_US and the actual time it took
if [[ "$INC_TIME" != 0 ]]; then
PROMPT_RT="$EPOCHREALTIME"
INC_TIME=0
fi
# *_RT may not be set
LAST_RT="${LAST_RT:-$EPOCHREALTIME}"
PROMPT_RT="${PROMPT_RT:-$EPOCHREALTIME}"
# Get relative times
# Remove decimal point, simulating multiplying by 1 million
PROMPT_RT1M="${PROMPT_RT/.}"
LAST_RT1M="${LAST_RT/.}"
CMD_US="$(($PROMPT_RT1M-$LAST_RT1M))"
CMD_TIME=0
# Remove last 6 chars, simulating dividing by 1 million to get a more accurate difference
[[ ${#CMD_US} -lt 6 ]] || CMD_TIME="${CMD_US::-6}"
[[ ${#CMD_US} -lt 6 ]] || CMD_US="${CMD_US: -6}"
CMD_US="$((10#0$CMD_US))"
# Set prompt sections
# Text
# ssh detection and indicator
[[ "$SSH_CONNECTION" ]] && local SSH="$(__ssh) "
# [INT], [4], etc.
local i
for i in ${PLC[@]}; do
if [[ $i > 0 ]]; then
local SIG="$(printf '%s[%s%s%s] ' "$_BLU" "$_RED" "$(__sig ${PLC[@]})" "$_BLU")"
break
fi
done
# [user@homeserver:~]
local COL="$([[ $UID == 0 ]] && printf '%s' "$_RED" || printf '%s' "$_YLW")"
local UHD="${_BLD}${_BLU}[${COL}\u${_PRP}@${_CYN}\h${_PRP}:${_GRN}\w${_BLU}]"
# 2y 351d 12m 43s 382969μs
local TIME="${_YLW}$(__get_cmd_time)"
# Random colored $ or #
_RAND256="\[\033[38;2;$((RANDOM%256));$((RANDOM%256));$((RANDOM%256))m\]"
local IND="${_RAND256}\\$"
# Set the prompt
PS1="${_NON}${SSH}${SIG}${UHD} ${TIME} ${IND} ${_NON}"
}
PROMPT_COMMAND=__prompt

View File

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
## Please read the home-configuration.nix manpage for a list of all available options.
{
home.username = "USER";
home.homeDirectory = "/home/USER";
home.stateVersion = "22.05";
home.packages = with pkgs; [
nix-index
];
programs.fzf.enable = true;
programs.fzf.enableBashIntegration = true;
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

10
skel/.profile Normal file
View File

@ -0,0 +1,10 @@
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
for file in ~/.config/bash/*; do
. "$file"
done
fi
export PATH="/usr/local/bin${PATH:+:}$PATH"
mesg n 2> /dev/null || true