1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
+ scripts as derivations
~ move home-mananger stuff to the right modules / dot
+ home-manager ssh config
- vim: powerline symbols
~ toggle keyboard with alt+shift
+ ssh agent at startup
~ retiolum ipv6
~ texlive packages
~ shell: vim mode
+ THEMING
~ i3 minimaler + q
~ terminal: use urxvt
This commit is contained in:
Kierán Meinhardt
2018-12-30 14:34:39 +01:00
parent 9f55b9fe69
commit d4af2f2eee
21 changed files with 735 additions and 811 deletions

View File

@@ -9,6 +9,7 @@ let vim_conf = ''
colorscheme delek
filetype plugin indent on
set title
set nocompatible
set smartcase
set shiftwidth=2 tabstop=2 expandtab
@@ -120,24 +121,24 @@ let vim_conf = ''
set noshowmode laststatus=0 noruler
let g:airline#extensions#tabline#close_symbol = 'X'
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
"let g:airline#extensions#tabline#left_alt_sep = ''
"let g:airline#extensions#tabline#left_sep = ''
"let g:airline#extensions#tabline#right_alt_sep = ''
"let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#show_close_button = 1
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#tab_nr_type = 0
let g:airline#extensions#tmuxline#enabled = 0
let g:airline#extensions#wordcount#enabled = 1
let g:airline_left_alt_sep = ''
let g:airline_left_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_right_sep = ''
"let g:airline#extensions#wordcount#enabled = 1
"let g:airline_left_alt_sep = ''
"let g:airline_left_sep = ''
"let g:airline_right_alt_sep = ''
"let g:airline_right_sep = ''
let g:airline_section_z = '%{line(".")}/%{line("$")} %{col(".")}'
"endif
"if exists("g:loaded_airline_themes")
let g:airline_theme='simple'
let g:airline_theme='base16'
"endif
'';
in {

View File

@@ -1,282 +1,10 @@
{ pkgs, lib, config, ... }:
let
spotify_info = pkgs.writers.writeBash "spotify.info" ''
if $(pgrep spotify); then
STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$)
if [[ "$STATUS" == 'Playing' ]]; then
printf '\uf1bc '
printf '\uf04b'
elif [[ "$STATUS" == 'Paused' ]]; then
printf '\uf1bc '
printf '\uf04c'
elif [[ "$STATUS" == 'Stopped' ]]; then
printf '\uf1bc '
printf '\uf04d'
else
exit 1
fi
printf ' '
METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata')
ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$)
TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$)
printf "%s \u2237 %s" "$ARTIST" "$TITLE"
fi
'';
battery_info = pkgs.writers.writeBash "battery.info" ''
BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/"
if [ -d "$BAT_DIR" ]; then
cd "$BAT_DIR"
else
exit 1
fi
if [ -e charge_now ] && [ -e charge_full ]; then
FULL_CHARGE=charge_full
CURR_CHARGE=charge_now
elif [ -e energy_now ] && [ -e energy_full ]; then
FULL_CHARGE=energy_full
CURR_CHARGE=energy_now
else
ls >&2
exit 1
fi
status=$(cat status)
charge_f=$((100 * $(cat $CURR_CHARGE) / $(cat $FULL_CHARGE)))
if [[ "$charge_f" -lt 20 ]]; then
printf '\uf244'
elif [[ "$charge_f" -lt 40 ]]; then
printf '\uf243'
elif [[ "$charge_f" -lt 60 ]]; then
printf '\uf242'
elif [[ "$charge_f" -lt 80 ]]; then
printf '\uf241'
else
printf '\uf240'
fi
printf ' '
if [[ "$status" == 'Charging' ]]; then
printf '\uf106'
elif [[ "$status" == 'Discharging' ]]; then
printf '\uf107'
elif [[ "$status" == 'Full' ]]; then
printf '\uf0e7'
else
printf '[%s]' "$status"
fi
printf ' '
if [[ "$status" != 'Full' ]]; then
rate_raw=$(($(cat voltage_now) * $(cat power_now)))
rate=$(bc <<< "scale=1; $rate_raw / 10^12")
printf '%s\u2009W, ' "$rate"
fi
charge_d=$((100 * $(cat $CURR_CHARGE) / $(cat $FULL_CHARGE)))
printf '%s%%\n' "$charge_d"
if [[ "$status" == 'Discharging' ]]; then
if [[ "$charge_d" -lt 10 ]]; then
printf '\n#E41C28'
elif [[ "$charge_d" -lt 20 ]]; then
printf '\n#EEBF13'
fi
fi
'';
volume_info = pkgs.writers.writeBash "volume.info" ''
if [[ "$BLOCK_BUTTON" == 1 ]]; then
${pkgs.pamixer}/bin/pamixer -i 5
elif [[ "$BLOCK_BUTTON" == 3 ]]; then
${pkgs.pamixer}/bin/pamixer -d 5
elif [[ "$BLOCK_BUTTON" == 2 ]]; then
${pkgs.pamixer}/bin/pamixer -t
fi
if $(${pkgs.pamixer}/bin/pamixer --get-mute); then
printf '\uf026 0%%\n\n#EEBF13'
else
volume=$(${pkgs.pamixer}/bin/pamixer --get-volume)
printf '\uf028 %s%%' "$volume"
fi
'';
fancyDate = pkgs.writers.writeC "fancy_date.c" {} ''
#include <stdio.h>
#include <time.h>
#include <wchar.h>
int main(void) {
time_t now = time(NULL);
struct tm *today = localtime(&now);
wchar_t roman_month = 0x2160 + today->tm_mon;
wprintf(L"%d\u2009%lc\u2009%d [%d|%d]\n", today->tm_mday, roman_month, 1900 + today->tm_year, today->tm_wday == 0 ? 7 : today->tm_wday, today->tm_yday/7 + 1);
return 0;
}
'';
i3blocks_conf = with import ../theme.nix; ''
markup=pango
align=center
color=${white}
[spotify]
command=${spotify_info}
interval=2
[separator]
[volume]
command=${volume_info}
min_width= 100%
interval=once
signal=3
[separator]
[cpu_usage]
command=cut -d' ' -f 1-3 < /proc/loadavg
label=
interval=2
[separator]
[ram_usage]
command=free -h | grep "Mem" | awk '{print $3}'
label=
interval=2
align=center
[separator]
[battery]
command=${battery_info}
interval=10
instance=BAT1
[separator]
[date]
command=${fancyDate}
interval=1
label=
[separator]
[time]
command=date +'%H:%M'
interval=1
label=
[separator]
command=${pkgs.xkblayout-state}/bin/xkblayout-state print %s
label=
interval=2
[separator]
'';
i3_conf = with import ../theme.nix; ''
set $mod Mod4
font pango:${uiFont.name} ${toString uiFont.size}
floating_modifier $mod
default_border pixel 2
hide_edge_borders smart
default_floating_border none
bindsym $mod+Return exec ${config.defaultApplications.terminal}
bindsym $mod+y exec ${config.defaultApplications.browser}
bindsym $mod+t exec ${config.defaultApplications.fileManager}
bindsym $mod+Shift+w exec ${pkgs.xautolock}/bin/xautolock -locknow
bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -display-run -show run
bindsym $mod+a exec ${pkgs.rofi}/bin/rofi -display-window -show window
bindsym $mod+Shift+q kill
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
bindsym $mod+p workspace prev
bindsym $mod+n workspace next
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
bindsym $mod+h split h
bindsym $mod+v split v
bindsym $mod+f fullscreen toggle
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+Shift+z floating toggle
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
${with lib;
strings.concatMapStringsSep "\n"
(i: let n = toString i; ws = "$workspace" + n; in
''set ${ws} ${n}
bindsym $mod+${n} workspace ${ws}
bindsym $mod+Shift+${n} move container to workspace ${ws}'')
(lists.range 1 9)
}
set $workspace10 X
bindsym $mod+0 workspace $workspace10
bindsym $mod+Shift+0 move container to workspace $workspace10
bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks
bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks
bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks
mode " " {
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
bindsym Escape mode "default"
bindsym Space mode "default"
}
bindsym $mod+r mode " "
#class container-border container-bg fg indicator window-border
client.focused ${gray.dark} ${black} ${white} ${white} ${gray.medium}
client.focused_inactive ${black} ${black} ${gray.medium} ${white} ${black}
client.unfocused ${black} ${black} ${gray.medium} ${white} ${black}
client.urgent ${red.light} ${black} ${white} ${white} ${red.light}
client.placeholder ${black} ${black} ${gray.medium} ${white} ${black}
bar {
status_command "${pkgs.i3blocks}/bin/i3blocks -c ${pkgs.writeText "i3blocks.conf" i3blocks_conf}"
position top
font pango:${uiFont.name},FontAwesome ${toString uiFont.size}
separator_symbol "// "
colors {
separator ${gray.medium}
background ${black}
statusline ${gray.medium}
# border bg fg
focused_workspace ${black} ${black} ${white}
active_workspace ${black} ${black} ${gray.medium}
inactive_workspace ${black} ${black} ${gray.medium}
urgent_workspace ${black} ${black} ${red.light}
binding_mode ${black} ${black} ${red.light}
}
}
'';
in {
{
services.xserver = with import ../helpers.nix; with import ../theme.nix; {
enable = true;
layout = commaSep [ "de" "gr" "ru" ];
xkbVariant = commaSep [ "T3" "polytonic" "phonetic_winkeys" ];
xkbOptions = commaSep [ "terminate:ctrl_alt_bksp" "grp:alt_space_toggle" ];
xkbOptions = commaSep [ "terminate:ctrl_alt_bksp" "grp:alt_shift_toggle" ];
libinput.enable = true;
xautolock = {
enable = true;
@@ -286,19 +14,21 @@ in {
enableNotifier = true;
notifier = ''${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking soon" "The screen will lock in 10 seconds."'';
};
displayManager.auto = { enable = true; user = "kfm"; };
displayManager.sessionCommands = ''
${pkgs.feh}/bin/feh --bg-fill $(find ${../art} -type f | shuf -n 1) &
${pkgs.dropbox-cli}/bin/dropbox start &
${pkgs.seafile-client}/bin/seafile-applet &
${pkgs.openssh}/bin/ssh-add
'';
displayManager.lightdm.greeters.gtk = {
enable = true;
theme = { name = config.constants.theme.gtk.name; package = config.constants.theme.gtk.package; };
iconTheme = { name = config.constants.theme.icon.name; package = config.constants.theme.icon.package; };
indicators = [ "~spacer" "~host" "~spacer" "~session" ];
};
desktopManager.xterm.enable = false;
windowManager.default = "i3";
windowManager.i3 = {
enable = true;
configFile = pkgs.writeText "i3.conf" i3_conf;
extraPackages = [];
};
windowManager.i3.enable = true;
xrandrHeads = {
homeros = [ "LVDS1" { output = "HDMI1"; primary = true; } ];
scardanelli = [ "eDP1" ];
@@ -308,7 +38,7 @@ in {
i18n = {
defaultLocale = "en_GB.UTF-8";
consoleKeyMap = "de";
# consoleColors = with import ../theme.nix; map (c: lib.strings.removePrefix "#" c) colorPalette;
consoleColors = with import ../theme.nix; map (c: lib.strings.removePrefix "#" c) colorPalette;
};
services.compton = {
@@ -330,4 +60,31 @@ in {
enable = true;
timeout = 10;
};
home-manager.users.kfm = {
gtk = {
enable = true;
font = with import ../theme.nix; { package = pkgs.roboto; name = uiFont.name; };
iconTheme = config.constants.theme.icon;
theme = config.constants.theme.gtk;
};
qt = {
enable = true;
useGtkTheme = true;
};
xsession.pointerCursor = config.constants.theme.cursor // { size = 16; };
xsession.windowManager.i3 = {
enable = true;
config = import ../dot/i3.nix { inherit lib pkgs config; };
};
xresources.properties = import ../dot/xresources.nix { inherit lib; };
programs.rofi = import ../dot/rofi.nix { inherit config; };
services.dunst = import ../dot/dunst.nix { inherit pkgs config; };
programs.urxvt = import ../dot/urxvt.nix { inherit pkgs; };
programs.zathura = import ../dot/zathura.nix;
};
}

View File

@@ -31,30 +31,46 @@ in {
eduroam = eduroamConfig;
"Asoziales Netzwerk" = { pskRaw = "8e234041ec5f0cd1b6a14e9adeee9840ed51b2f18856a52137485523e46b0cb6"; };
"c-base-public" = {};
"FlixBus" = {};
"FlixBus Wi-Fi" = {};
};
};
# for kdeconnect
networking.firewall = {
allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
};
home-manager.users.kfm = {
services.kdeconnect = {
enable = true;
indicator = true;
};
};
networking.retiolum = {
scardanelli = {
ipv4 = "10.243.2.2";
ipv6 = "42:2:5ca:da:3111::1";
ipv6 = "42:0:3c46:4007:5bce:f1bc:606b:2b18";
};
homeros = {
ipv4 = "10.243.2.1";
ipv6 = "42:2::0:3:05::1";
ipv6 = "42:0:3c46:53e:e63d:e62a:56ea:c705";
};
}.${config.networking.hostName};
environment.etc."tinc/retiolum/rsa_key.priv" = {
text = (import ../secrets.nix).retiolum.scardanelli.privateKey;
mode = "400";
};
services.openvpn.servers = {
hu-berlin = {
config = ''config ${pkgs.fetchurl {
url = https://www.cms.hu-berlin.de/de/dl/netze/vpn/openvpn/hu-berlin.ovpn;
sha256 = "d61a644b1e8bd313a8c4bdf1024d8445d56d1fb4a85d2574d597fc020c4901dc";
}}
route-nopull
route 141.20.0.0 255.255.0.0'';
# route-nopull
# route 141.20.0.0 255.255.0.0'';
authUserPass = {
username = eduroam.identity;
password = eduroam.password;

View File

@@ -1,11 +1,13 @@
{ config, pkgs, ... }:
with pkgs;
let scripts = import ../dot/scripts.nix { inherit pkgs; };
in with pkgs;
{
nixpkgs.config.allowUnfree = true;
fonts.enableDefaultFonts = true;
fonts.fonts = [
corefonts
xlibs.fontschumachermisc
eb-garamond
fira
font-awesome-ttf
@@ -16,30 +18,34 @@ with pkgs;
];
environment.systemPackages = [
abiword
arandr
bat
blueman
chromium
config.constants.theme.gtk.package
config.constants.theme.icon.package
config.constants.theme.cursor.package
dos2unix
ffmpeg
file
firefox
git
gnumake
gnumeric
gthumb
htop
imagemagick
libnotify
# libreoffice
lsof
lxappearance
mpv
pamixer
pavucontrol
perl
pmount
ranger
ripgrep tree
ripgrep
tree
rlwrap
tor-browser-bundle-bin
unzip
@@ -48,11 +54,8 @@ with pkgs;
whois
xclip
sxiv
xorg.xbacklight
xorg.xcursorthemes
xorg.xkill
wpa_supplicant_gui
youtubeDL
zathura
];
@@ -61,17 +64,35 @@ with pkgs;
enable = true;
package = pkgs.openjdk;
};
virtualisation.docker.enable = true;
services.urxvtd.enable = true;
services.dbus.packages = [ pkgs.gnome3.dconf ];
users.users.kfm.packages = [
(texlive.combine { inherit (pkgs.texlive) scheme-full latexmk; })
users.users.kfm.packages = scripts ++ [
(texlive.combine { inherit (pkgs.texlive)
scheme-tetex
latexmk
biblatex
comment
csquotes
enumitem
fontaxes
ifnextok
imakeidx
libertine
logreq
marginnote
mweights
pbox
stdclsdv
xstring;
})
audacity
cabal-install
cabal2nix
calibre
cloc
clojure
ctags
dot2tex
dropbox-cli
fsharp
gcc
@@ -84,16 +105,15 @@ with pkgs;
haskellPackages.hasktags
haskellPackages.hindent
haskellPackages.hoogle
haskellPackages.pandoc
pandoc
haskellPackages.pandoc-citeproc
hlint
idris
inkscape
jo
jo jq
lua
maxima
memo
mypy
nasm
nix-prefetch-git
nodejs
ocaml
@@ -106,9 +126,9 @@ with pkgs;
scala
seafile-client
shellcheck
youtubeDL
spotify
stack
typora
zeroad
# zeroad
];
}

View File

@@ -46,7 +46,7 @@ in {
name = "retiolum.hosts";
url = "https://lassul.us/retiolum.hosts";
# FIXME
sha256 = "1p7mbam6bkdxzli9znmj7051d64v4vzbjzv7r1fcs89n9fw65fr5";
sha256 = "1jdrbj5bilaaw36s9llnq73bhf8dz5r6c01vx7wl3k1ayvw1mlq9";
});
environment.systemPackages = [ config.services.tinc.networks.${netname}.package ];

View File

@@ -1,18 +1,16 @@
{ pkgs, ... }:
let scripts = import ../dot/scripts.nix { inherit pkgs; };
in {
{
environment.shellAliases =
let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}";
in {
o = "xdg-open";
o = "${pkgs.xdg_utils}/bin/xdg-open";
n = "nix-shell --command zsh";
":r" = ''echo "You stupid!"'';
clipboard = "${pkgs.xclip}/bin/xclip -se c";
external-ip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @resolver1.opendns.com";
ip = "${pkgs.iproute}/bin/ip -c";
ocaml = rlwrap "${pkgs.ocaml}/bin/ocaml";
tmux = "${pkgs.tmux}/bin/tmux -2";
} // scripts;
};
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.local/bin:$HOME/.cargo/bin";
@@ -25,11 +23,17 @@ in {
interactiveShellInit = ''
setopt INTERACTIVE_COMMENTS
setopt MULTIOS
setopt CORRECT
setopt AUTO_NAME_DIRS
setopt PUSHD_MINUS PUSHD_TO_HOME AUTO_PUSHD
export KEYTIMEOUT=1
bindkey -v
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
'';
promptInit = ''
PROMPT="%{$fg_bold[white]%}%~ \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")\$(test $IN_NIX_SHELL && echo λ || echo %#)%{$reset_color%} "
PROMPT=$'%{\e[1m%}%~%{\e[0m%}'
PROMPT="$PROMPT \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")\$(test $IN_NIX_SHELL && echo λ || echo %#)%{$reset_color%} "
RPROMPT='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@@ -41,6 +45,9 @@ in {
programs.bash = {
promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) "'';
interactiveShellInit = ''
set -o vi
'';
enableCompletion = true;
};