Add current hummelberg-new state

This commit is contained in:
Fabian Hauser 2021-04-10 17:05:55 +02:00
parent dd204c8ba6
commit 51f5e7eab9
30 changed files with 1486 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{ pkgs, ... }: {
home-manager.users.fhauser.programs.alacritty = {
enable = true;
settings."background_opacity" = 0.95;
};
}

View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
#home-manager.users.fhauser = {
# home.packages = with pkgs; [ androidStudioPackages.beta ];
# pam.sessionVariables.STUDIO_JDK = "${pkgs.jdk14}/lib/openjdk";
#}; # TODO: This was extracted into a shell.nix
}

View file

@ -0,0 +1,76 @@
{ config, pkgs, lib, ... }:
{
imports = [
./firefox.nix
./gpg.nix
./ssh.nix
./scripts.nix
./webapps.nix
./vim.nix
./git.nix
./waybar.nix
./psql.nix
./android-studio.nix
./mako.nix
./redshift.nix
./alacritty.nix
./shell.nix
./swaylock.nix
];
home-manager.users.fhauser.home.packages = with pkgs;
[ # Networking
unison
transmission # GUI Tools, maybe extract...
] ++ [ # Desktop Environment Applications
google-chrome
chromium
#midori # TODO: Currently unused
#qutebrowser # TODO: Currently unused
gnome3.evolution # TODO: Suport for plugins with 21.05
#evolution-ews
synergy
#quicksynergy # Currently unused
nextcloud-client
owncloud-client
] ++ [ # office # TODO: Migrate to office.nix
# TODO: Build fails!
libreoffice-fresh # TODO: Dictionaries, nixos/nixpkgs#14430
# pdfgrep
# pdftk
# calibre
tectonic
# texstudio
# pandoc
# system-config-printer
# cups-pk-helper
# cups-bjnp
# gutenprint
# gutenprintBin
# hplipWithPlugin
simple-scan
gnome3.gnome-online-accounts
gnome3.gnome-control-center
] ++ [ # Communication
signal-desktop
tdesktop
discord
mattermost-desktop
# pidgin pidgin-otr pidgin-with-plugins #TODO: Pidgin needed?
#TODO: ekiga?
skype
slack
teams
jitsi-meet-electron
teamviewer
rdesktop
vmware-horizon-client
] ++ [ # Development
vscodium
gitlab-runner
docker-compose
vagrant
virt-manager
];
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }: {
home-manager.users.fhauser = {
programs.firefox = {
enable = true;
package = pkgs.firefox-wayland;
};
home.sessionVariables.MOZ_ENABLE_WAYLAND = "true";
};
}

View file

@ -0,0 +1,85 @@
{ pkgs, ... }: {
home-manager.users.fhauser.programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
aliases = {
s = "status --short --branch";
a = "add --patch";
c = "commit --message";
l =
"log --color --graph --pretty=format:'%Cred%h%Creset - %C(bold)%s%Creset%C(yellow)%d%Creset %C(green)%an%Creset %C(cyan)%cr%Creset (S: %G?)' --abbrev-commit";
d = "diff";
fup = "commit --fixup";
fuprebase = "rebase --interactive --autosquash";
ignore = "update-index --skip-worktree";
unignore = "update-index --no-skip-worktree";
ignored = ''!git ls-files -v | grep "^S"'';
};
#delta = {
# enable = true;
# options = {
# side-by-side = "true";
# line-numbers = "true";
# line-numbers-minus-style = "#444444";
# line-numbers-zero-style = "#444444";
# line-numbers-plus-style = "#444444";
# line-numbers-left-format = "{nm:>4}┊";
# line-numbers-right-format = "{np:>4}│";
# line-numbers-left-style = "blue";
# line-numbers-right-style = "blue";
# };
#};
extraConfig = {
core = {
packedGitWindowSize = "16m";
packedGitLimit = "64m";
};
pack = {
windowMemory = "64m";
packSizeLimit = "64m";
thread = "1";
deltaCacheSize = "1m";
};
color = {
branch = "auto";
diff = "auto";
status = "auto";
};
push.default = "simple";
pull.rebase = "true";
branch.autosetuprebase = "always";
};
includes = let
mkDefaultConfig = (dir: {
condition = "gitdir:${dir}";
contents = {
user = {
signingkey = "0x8A52A140BEBF7D2C";
email = "fabian@fh2.ch";
name = "Fabian Hauser";
};
};
});
in [
(mkDefaultConfig "~/private/")
(mkDefaultConfig "/etc/nixos/")
(mkDefaultConfig "~/.password-store")
((mkDefaultConfig "~/work/") // {
contents = {
commit.gpgsign = true;
tag.gpgsign = true;
user = {
signingkey = "0xE0CDD70E5D286D64";
email = "fabian.hauser@threema.ch";
};
url."git@work.github.com".insteadOf = "git@github.com";
};
})
];
ignores = [ "*~" "*.swp" ".direnv/" ];
lfs.enable = true;
};
}

View file

@ -0,0 +1,37 @@
{ pkgs, ... }: {
#TODO: ENV variabls for agent
home-manager.users.fhauser.home.sessionVariables.SSH_AUTH_SOCK =
"/run/user/1000/gnupg/S.gpg-agent.ssh";
home-manager.users.fhauser.programs.gpg = {
enable = true;
settings = {
"use-agent" = true;
"trust-model" = "tofu";
"no-emit-version" = true;
"no-comments" = true;
"sig-notation" = "issuer-fpr@notations.openpgp.fifthhorseman.net=%g";
"keyserver" = "hkp://pool.sks-keyservers.net";
"keyserver-options" = "auto-key-retrieve no-honor-keyserver-url";
"personal-cipher-preferences" = "AES256 AES192 AES CAST5";
"cert-digest-algo" = "SHA512";
"personal-digest-preferences" = "SHA512 SHA384 SHA256 SHA224";
"default-preference-list" =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
"display-charset" = "utf-8";
"fixed-list-mode" = true;
"with-fingerprint" = true;
"keyid-format" = "0xlong";
"verify-options" = "show-uid-validity";
"list-options" = "show-uid-validity";
};
};
home-manager.users.fhauser.services.gpg-agent = {
enable = true;
enableScDaemon = true;
enableSshSupport = true;
sshKeys = [
"99DFB0F28CF9420A2D6383139E86814A1568C81B" # 0x8193A5D218B553DD / fabian.hauser@threema.ch
"638143D3F6421377E9D4C7F1D2EDC5AA0A860351" # 0x3E957C9C8CB5D6B2 / fabian.hauser@qo.is
];
};
}

View file

@ -0,0 +1,14 @@
{ pkgs, ... }: {
home-manager.users.fhauser.programs.mako = {
enable = true;
backgroundColor = "#CCCCCCCC"; # TODO: Make layout colors in a central place
borderSize = 0;
#borderColor = "#4C7899FF";
defaultTimeout = 1500;
#ignoreTimeout = true;
#textColor = "#FFFFFFFF";
#width = 300;
#height = 100;
#font = "monospace 10";
}; # TODO
}

View file

@ -0,0 +1,21 @@
{ pkgs, ... }: {
home-manager.users.fhauser.home.file.".psqlrc".text = ''
\set QUIET 1
\pset linestyle unicode
\pset border 2
\set null [null]
\set COMP_KEYWORD_CASE upper
\set ON_ERROR_ROLLBACK interactive
\set PROMPT1 '%[%033[1m%]%M/%/%R%[%033[0m%]%# '
\set PROMPT2 ''''
\set VERBOSITY verbose
\timing
\x auto
\unset QUIET
\conninfo
'';
}

View file

@ -0,0 +1,13 @@
{ pkgs, ... }: {
home-manager.users.fhauser.services.redshift = {
enable = true;
package = pkgs.redshift-wlr;
brightness.night = "0.9";
temperature.day = 6300;
temperature.night = 5500;
latitude = "47.2";
longitude = "8.8";
tray = true;
};
}

View file

@ -0,0 +1,52 @@
{ pkgs, ... }:
let
passbemenu = pkgs.writeScriptBin "passbemenu" ''
#!${pkgs.stdenv.shell}
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
export BEMENU_BACKEND=wayland
prefix=''${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "''${password_files[@]#"$prefix"/}" )
password_files=( "''${password_files[@]%.gpg}" )
password=$(printf '%s\n' "''${password_files[@]}" | \
${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Pass: ' "$@")
[[ -n $password ]] || exit
${pkgs.pass-wayland}/bin/pass show -c "$password" 2>/dev/null
'';
threema-vpn = pkgs.writeScriptBin "threema-vpn" ''
#!${pkgs.stdenv.shell}
set -eo pipefail
SERVICE=openvpn-threema.service
if [[ "$1" == "restart" ]]; then
ACTION=restart
elif [[ "$1" == "start" ]]; then
ACTION=start
elif [[ "$1" == "stop" ]]; then
ACTION=stop
elif [[ "$1" == "status" ]]; then
ACTION=status
elif [[ "$1" == "tail" ]]; then
sudo journalctl -f -u $SERVICE
exit 0
else
echo "Usage: vpn (start|stop|restart|status|tail)"
exit 254
fi
sudo systemctl $ACTION $SERVICE
'';
in { home-manager.users.fhauser.home.packages = [ passbemenu threema-vpn ]; }

View file

@ -0,0 +1,59 @@
{ pkgs, ... }: {
home-manager.users.fhauser.programs = {
bash = {
enable = true;
historyIgnore = [ "ls" "cd" "exit" "j" ];
shellAliases = {
# Sane defaults
l = "ls -lah";
cp = "cp --reflink=auto";
pwgen = "pwgen -c -n -s -N 30";
bc = "bc --mathlib";
cal = "cal -m";
curl = "curl -L";
# Git helpers
git-fetch-pr =
"git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'";
git-config-fetchall = ''
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"'';
git-enable-signing =
"git config commit.gpgsign true && git config tag.gpgsign true";
# Common Typos
gits = "git s";
};
initExtra = ''
function o(){
xdg-open "$*" >/dev/null 2>&1 &
}
'';
shellOptions = [ "autocd" "checkjobs" "dotglob" "globstar" "histappend" ];
sessionVariables = {
#TODO: Some of these should be migrated to the according application.
GPG_TTY = "$(tty)";
PGDATABASE = "postgres";
};
};
autojump = {
enable = true;
enableBashIntegration = true;
};
powerline-go = {
enable = true;
settings = {
hostname-only-if-ssh = true;
numeric-exit-codes = true;
colorize-hostname = true;
cwd-max-depth = 4;
modules = "ssh,host,root,cwd,perms,dotenv,venv,node,git,jobs";
};
};
direnv = {
enable = true;
enableBashIntegration = true;
enableNixDirenvIntegration = true;
};
};
}

View file

@ -0,0 +1,26 @@
{ pkgs, lib, ... }: {
home-manager.users.fhauser.programs.ssh = let
forceIdentityThreema = {
identityFile = toString (pkgs.writeText "fabian.hauser@threema.ch.pub" ''
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7h492sXT7zdamf+nbOt+y6jiqxicOnm6+wiuEG1EvZ openpgp:0x18B553DD
'');
identitiesOnly = true;
};
forceIdentityPrivate = {
identityFile = toString (pkgs.writeText "fabian.hauser@qo.is.pub" ''
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000610954665
'');
identitiesOnly = true;
};
in {
enable = true;
matchBlocks = {
"work.github.com" = forceIdentityThreema // {
hostname = "github.com";
user = "git";
};
"github.com" = forceIdentityPrivate // { user = "git"; };
};
#TODO: Authorized keys implementation, see https://github.com/nix-community/home-manager/pull/9
};
}

View file

@ -0,0 +1,33 @@
{ pkgs, ... }: {
home-manager.users.fhauser.systemd.user.services.swayidle = let
lock =
"${pkgs.swaylock}/bin/swaylock --hide-keyboard-layout --ignore-empty-password --daemonize --show-failed-attempts --color=000000";
logTimeCmd = "${pkgs.coreutils}/bin/date --rfc-3339=seconds >> ~/locklog";
idleCmd = (action:
''${pkgs.sway}/bin/swaymsg "output * dpms ${action}" && ${logTimeCmd}'');
timeout-screens-off = 600;
timeout-lock = 630;
timeout-suspend = 1800;
in {
Unit = {
Description = "Idle Manager for Wayland";
Documentation = [ "man:swayidle(1)" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = "PATH=${pkgs.bash}/bin";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w -d \
timeout ${toString timeout-lock} '${lock}' \
timeout ${toString timeout-screens-off} '${idleCmd "off"}' \
resume '${idleCmd "on"}' \
timeout ${
toString timeout-suspend
} '${pkgs.systemd}/bin/systemctl suspend' \
lock '${lock}' \
before-sleep '${lock}';
''; # TODO: Make this configurable and add home-manager module. (Requires sway with systemd-target support)
};
Install = { WantedBy = [ "sway-session.target" ]; };
};
}

View file

@ -0,0 +1,54 @@
{ pkgs, ... }: {
home-manager.users.fhauser.programs.vim = {
enable = true;
extraConfig = ''
colorscheme elflord
set autoindent
set ruler
set pastetoggle=<F2>
set splitbelow
set splitright
set tabstop=2
set softtabstop=2
set listchars="eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:"
set grepprg=ack\ -k
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
"nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR>
" Rust
"let g:rustfmt_autosave = 1
let g:racer_cmd="~/.cargo/bin/racer"
"let g:racer_experimental_completer = 1
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
" Typescript
au BufRead,BufNewFile *.ts setfiletype typescript
" Options
filetype plugin indent on
syntax on
'';
plugins = with pkgs.vimPlugins; [ vim-sensible vim-airline ];
settings = {
background = "dark";
ignorecase = true;
mouse = "n";
hidden = true;
expandtab = true;
};
};
}

View file

@ -0,0 +1,382 @@
{ pkgs, lib, config, ... }: {
home-manager.users.fhauser = {
xsession.preferStatusNotifierItems = true;
wayland.windowManager.sway.config.bars = [ ];
programs.waybar = {
enable = true;
settings = [{
position = "top";
#height =
modules-left = [ "sway/mode" "sway/workspaces" ];
modules-center = [ "sway/window" ];
modules-right = [
"backlight"
"idle_inhibitor"
"bluetooth"
"cpu"
"temperature"
"memory"
"disk"
"network"
"pulseaudio"
#"custom/keyboard-layout"
"battery"
"tray"
"clock"
];
modules = {
backlight.format = " {percent}%";
disk.format = " {percentage_used}%";
clock.format = "{:%Y-%2m-%2d%H:%M}";
"sway/workspaces" = {
disable-scroll-wraparound = true;
enable-bar-scroll = true;
numeric-first = true;
};
battery = {
interval = 10;
states = {
warning = 15;
critical = 10;
};
format = " {capacity}% {time}"; # Icon: bolt
format-discharging = "{icon} {capacity}% {time}";
format-time = "{H}:{M}";
format-icons = [
"" # Icon: battery-full
"" # Icon: battery-three-quarters
"" # Icon: battery-half
"" # Icon: battery-quarter
"" # Icon: battery-empty
];
tooltip = "true";
};
cpu = {
interval = "5";
format = " {usage}% ({load})"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
#"custom/keyboard-layout" = {
# exec = pkgs.writeShellScript "keyboard-layout" "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4";
# # Interval set only as a fallback, as the value is updated by signal
# interval = "30";
# format = " {}"; # Icon: keyboard
# # Signal sent by Sway key binding (~/.config/sway/key-bindings)
# signal = "1"; # SIGHUP
# tooltip = "false";
#};
memory = {
interval = "5";
format = " {}%"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
network = {
interval = "5";
format-wifi = " {essid} ({signalStrength}%)"; # Icon: wifi
format-ethernet = "🔗 {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet
format-disconnected = "🔗";
tooltip-format = "{ifname}: {ipaddr}";
};
"sway/mode" = {
format =
''<span style="italic"> {}</span>''; # Icon: expand-arrows-alt
tooltip = "false";
};
"sway/window" = {
format = "{}";
max-length = "120";
};
"sway/workspaces" = {
all-outputs = false;
disable-scroll = true;
format = "{icon}";
format-icons = {
"10" = " 10";
"11" = " 11";
"12" = " 12";
"13" = " 13";
};
};
pulseaudio = {
scroll-step = 3;
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "🔇";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [ "" "" "" ];
};
on-click = "pavucontrol";
};
temperature = {
critical-threshold = 80;
interval = 5;
format = "{icon} {temperatureC}°C";
format-icons = [
"" # Icon: temperature-empty
"" # Icon: temperature-quarter
"" # Icon: temperature-half
"" # Icon: temperature-three-quarters
"" # Icon: temperature-full
];
tooltip = "true";
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
tray = {
icon-size = "21";
spacing = "10";
};
};
}];
systemd.enable = true;
style = ''
/* =============================================================================
*
* Waybar configuration
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
@keyframes blink-warning {
70% {
color: white;
}
to {
color: white;
background-color: orange;
}
}
@keyframes blink-critical {
70% {
color: white;
}
to {
color: white;
background-color: red;
}
}
/* -----------------------------------------------------------------------------
* Base styles
* -------------------------------------------------------------------------- */
/* Reset all styles */
* {
border: none;
border-radius: 0;
min-height: 0;
margin: 0;
padding: 0;
}
/* The whole bar */
#waybar {
background: #323232;
color: white;
/*font-family: Cantarell, Noto Sans, sans-serif;*/
font-size: 13px;
}
/* Each module */
#battery,
#clock,
#cpu,
#custom-keyboard-layout,
#memory,
#mode,
#network,
#pulseaudio,
#temperature,
#backlight,
#idle_inhibitor,
#tray {
margin-left: 5px;
margin-right: 5px;
padding-left: 5px;
padding-right: 5px;
/*border-right: solid 1px black;*/
}
#backlight {
margin-right: 0;
padding-right: 0;
}
#idle_inhibiter {
margin-left: 0;
padding-left: 0;
}
/* -----------------------------------------------------------------------------
* Module styles
* -------------------------------------------------------------------------- */
#battery {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#battery.warning {
color: orange;
}
#battery.critical {
color: red;
}
#battery.warning.discharging {
animation-name: blink-warning;
animation-duration: 4s;
}
#battery.critical.discharging {
animation-name: blink-critical;
animation-duration: 3s;
}
#clock {
font-weight: bold;
}
#cpu {
/* No styles */
}
#cpu.warning {
color: orange;
}
#cpu.critical {
color: red;
}
#memory {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#memory.warning {
color: orange;
}
#memory.critical {
color: red;
animation-name: blink-critical;
animation-duration: 2s;
}
#mode {
background: #64727D;
border-top: 2px solid white;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
}
#network {
/* No styles */
}
#network.disconnected {
color: orange;
}
#pulseaudio {
/* No styles */
}
#pulseaudio.muted {
/* No styles */
}
#custom-spotify {
color: rgb(102, 220, 105);
}
#temperature {
/* No styles */
}
#temperature.critical {
color: red;
}
#tray {
/* No styles */
}
#window {
font-weight: bold;
}
#workspaces button {
border-top: 2px solid transparent;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
color: #888888;
}
#workspaces button.focused {
border-color: #4c7899;
color: white;
background-color: #285577;
}
#workspaces button.urgent {
border-color: #c9545d;
color: #c9545d;
}
'';
};
systemd.user.services.waybar.Unit = {
Requisite = lib.mkForce [ ];
After = lib.mkForce [ ];
};
};
}

View file

@ -0,0 +1,26 @@
{ pkgs, ... }:
let
web-app = name: url:
pkgs.writeScriptBin name ''
#!${pkgs.stdenv.shell}
exec ${pkgs.chromium}/bin/chromium --user-data-dir=$HOME/.config/chromium-app-${name} --app="${url}"
'';
whatsapp = web-app "whatsapp" "https://web.whatsapp.com/";
threema = web-app "threema" "https://web-beta.threema.ch/";
threema-work = web-app "threema-work" "https://web-beta.threema.ch/";
threema-red = web-app "threema-red" "https://web-work-staging.threema.ch/";
threema-tickets = web-app "threema-tickets" "https://ticket.threema.ch/scp/";
netflix = web-app "netflix" "https://netflix.com/";
disneyplus = web-app "disneyplus" "https://disneyplus.com/";
in {
home-manager.users.fhauser.home.packages = [
whatsapp
netflix
disneyplus
threema
threema-work
threema-red
threema-tickets
];
}