mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
35c3
+ 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:
2
.todo
Normal file
2
.todo
Normal file
@@ -0,0 +1,2 @@
|
||||
2018-12-29 find out why urxvt uses so much CPU
|
||||
load is at almost 4, mem usage at 100%
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 485 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 379 KiB |
111
config.nix
111
config.nix
@@ -1,6 +1,5 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
scripts = import ./dot/scripts.nix { inherit pkgs; };
|
||||
helpers = import ./helpers.nix;
|
||||
in {
|
||||
imports = [
|
||||
@@ -45,11 +44,12 @@ in {
|
||||
|
||||
users.users.kfm = {
|
||||
name = "kfm";
|
||||
description = config.constants.user.name;
|
||||
home = "/home/kfm";
|
||||
createHome = true;
|
||||
group = "users";
|
||||
extraGroups = [ "wheel" "audio" ];
|
||||
password = "kfm";
|
||||
extraGroups = [ "wheel" "audio" "docker" ];
|
||||
hashedPassword = "$6$w9hXyGFl/.IZBXk$5OiWzS1G.5hImhh1YQmZiCXYNAJhi3X6Y3uSLupJNYYXPLMsQpx2fwF4Xr2uYzGMV8Foqh8TgUavx1APD9rcb/";
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
@@ -72,20 +72,7 @@ in {
|
||||
terminal = "screen-256color";
|
||||
};
|
||||
|
||||
# for kdeconnect
|
||||
networking.firewall = {
|
||||
allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
|
||||
allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = config.constants.user.name;
|
||||
@@ -99,110 +86,24 @@ in {
|
||||
unstage = "reset HEAD --";
|
||||
sdiff = "diff --staged";
|
||||
last = "log -1 HEAD";
|
||||
pull-all = "!${scripts.git-pull-all}";
|
||||
pull-all = "!pull-all"; # from dot/scripts.nix
|
||||
};
|
||||
ignores = config.constants.ignore;
|
||||
};
|
||||
|
||||
programs.rofi = with import ./theme.nix; {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
separator = "solid";
|
||||
scrollbar = false;
|
||||
terminal = config.defaultApplications.terminal;
|
||||
borderWidth = 0;
|
||||
lines = 5;
|
||||
font = "${uiFont.name} ${toString (uiFont.size + 1)}";
|
||||
colors = rec {
|
||||
window = { background = black; border = black; separator = gray.dark; };
|
||||
rows = {
|
||||
normal = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = gray.light;
|
||||
highlight = { foreground = white; inherit (window) background; };
|
||||
};
|
||||
active = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = blue.dark;
|
||||
highlight = { foreground = blue.light; inherit (window) background; };
|
||||
};
|
||||
urgent = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = red.dark;
|
||||
highlight = { foreground = red.light; inherit (window) background; };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.kdeconnect = {
|
||||
enable = true;
|
||||
indicator = true;
|
||||
};
|
||||
|
||||
services.dunst = with import ./theme.nix; {
|
||||
enable = true;
|
||||
iconTheme = config.constants.theme.icon;
|
||||
settings = {
|
||||
global = {
|
||||
transparency = 10;
|
||||
font = "${uiFont.name} ${toString uiFont.size}";
|
||||
geometry = "200x5-30+20";
|
||||
frame_color = veryDark;
|
||||
follow = "mouse";
|
||||
indicate_hidden = true;
|
||||
notification_height = 0;
|
||||
separator_height = 2;
|
||||
padding = 8;
|
||||
horizontal_padding = 8;
|
||||
separator_color = "auto";
|
||||
sort = true;
|
||||
markup = "full";
|
||||
format = ''%a\n<b>%s</b>\n%b'';
|
||||
alignment = "left";
|
||||
show_age_threshold = 60;
|
||||
bounce_freq = 0;
|
||||
word_wrap = true;
|
||||
ellipsize = "middle";
|
||||
ignore_newline = false;
|
||||
stack_duplicates = true;
|
||||
hide_duplicate_count = false;
|
||||
max_icon_size = 32;
|
||||
sticky_history = true;
|
||||
history_length = 20;
|
||||
dmenu = "${pkgs.rofi}/bin/rofi -display-run dunst -show run";
|
||||
browser = "${pkgs.xdg_utils}/bin/xdg-open";
|
||||
verbosity = "mesg";
|
||||
corner_radius = 0;
|
||||
mouse_left_click = "do_action";
|
||||
mouse_right_click = "close_current";
|
||||
mouse_middle_click = "close_all";
|
||||
};
|
||||
urgency_low = { frame_color = veryDark; background = veryDark; foreground = gray.light; timeout = 5; };
|
||||
urgency_normal = { frame_color = veryDark; background = gray.light; foreground = veryDark; timeout = 10; };
|
||||
urgency_critical = { frame_color = veryDark; background = red.dark; foreground = veryDark; timeout = 0; };
|
||||
};
|
||||
matchBlocks = import dot/ssh.nix { inherit lib; };
|
||||
};
|
||||
|
||||
home.file = {
|
||||
# ".background-image".source = ./art/37333571_p0_master1200.jpg;
|
||||
".config/mpv/input.conf".text = import ./dot/mpv.nix;
|
||||
".config/Typora/themes/base.user.css".text = import ./dot/typora.nix;
|
||||
".config/zathura/zathurarc".text = "set selection-clipboard clipboard";
|
||||
".ghc/ghci.conf".text = import ./dot/ghci.nix { inherit pkgs; };
|
||||
".ssh/config".text = import ./dot/ssh.nix { inherit lib; };
|
||||
".stack/config.yaml".text = import ./dot/stack.nix { user = config.constants.user; };
|
||||
".Xresources".text = import ./dot/xresources.nix;
|
||||
".zshrc".text = "# nothing to see here";
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"tinc/retiolum/rsa_key.priv" = {
|
||||
text = (import ./secrets.nix).retiolum.scardanelli.privateKey;
|
||||
mode = "400";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
];
|
||||
}
|
||||
|
||||
@@ -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 ];
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
45
dot/dunst.nix
Normal file
45
dot/dunst.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{ config, pkgs }:
|
||||
with import ../theme.nix;
|
||||
{
|
||||
enable = true;
|
||||
iconTheme = config.constants.theme.icon;
|
||||
settings = {
|
||||
global = {
|
||||
transparency = 10;
|
||||
font = "${uiFont.name} ${toString uiFont.size}";
|
||||
geometry = "200x5-30+20";
|
||||
frame_color = invertedColorScheme.background;
|
||||
follow = "mouse";
|
||||
indicate_hidden = true;
|
||||
notification_height = 0;
|
||||
separator_height = 2;
|
||||
padding = 8;
|
||||
horizontal_padding = 8;
|
||||
separator_color = "auto";
|
||||
sort = true;
|
||||
markup = "full";
|
||||
format = ''%a\n<b>%s</b>\n%b'';
|
||||
alignment = "left";
|
||||
show_age_threshold = 60;
|
||||
bounce_freq = 0;
|
||||
word_wrap = true;
|
||||
ellipsize = "middle";
|
||||
ignore_newline = false;
|
||||
stack_duplicates = true;
|
||||
hide_duplicate_count = false;
|
||||
max_icon_size = 32;
|
||||
sticky_history = true;
|
||||
history_length = 20;
|
||||
dmenu = "${pkgs.rofi}/bin/rofi -display-run dunst -show run";
|
||||
browser = "${pkgs.xdg_utils}/bin/xdg-open";
|
||||
verbosity = "mesg";
|
||||
corner_radius = 0;
|
||||
mouse_left_click = "do_action";
|
||||
mouse_right_click = "close_current";
|
||||
mouse_middle_click = "close_all";
|
||||
};
|
||||
urgency_low = { frame_color = invertedColorScheme.background; background = invertedColorScheme.background; foreground = invertedColorScheme.foreground; timeout = 5; };
|
||||
urgency_normal = { frame_color = invertedColorScheme.background; background = invertedColorScheme.background; foreground = invertedColorScheme.foreground; timeout = 10; };
|
||||
urgency_critical = { frame_color = invertedColorScheme.red.dark; background = invertedColorScheme.red.dark; foreground = invertedColorScheme.foreground; timeout = 0; };
|
||||
};
|
||||
}
|
||||
90
dot/i3.nix
Normal file
90
dot/i3.nix
Normal file
@@ -0,0 +1,90 @@
|
||||
{ pkgs, config, lib }:
|
||||
let
|
||||
unstable = import <nixos-unstable> {};
|
||||
i3blocks_conf = import ./i3blocks.nix { inherit pkgs; };
|
||||
new-workspace = unstable.writers.writeDash "new-workspace" ''
|
||||
i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
|
||||
'';
|
||||
move-to-new-workspace = unstable.writers.writeDash "new-workspace" ''
|
||||
i3-msg move container to workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
|
||||
'';
|
||||
in with import ../theme.nix;
|
||||
rec {
|
||||
fonts = [ "${uiFont.name} ${toString uiFont.size}" ];
|
||||
modifier = "Mod4";
|
||||
window = {
|
||||
titlebar = false;
|
||||
border = 1;
|
||||
hideEdgeBorders = "smart";
|
||||
};
|
||||
floating = {
|
||||
titlebar = false;
|
||||
border = 1;
|
||||
};
|
||||
colors =
|
||||
let scheme = { background = colorScheme.background; text = colorScheme.foreground; };
|
||||
in {
|
||||
focused = scheme // {
|
||||
border = colorScheme.background;
|
||||
indicator = colorScheme.background;
|
||||
childBorder = colorScheme.background;
|
||||
};
|
||||
focusedInactive = scheme // {
|
||||
border = colorScheme.background;
|
||||
indicator = colorScheme.background;
|
||||
childBorder = colorScheme.background;
|
||||
};
|
||||
unfocused = scheme // {
|
||||
border = colorScheme.background;
|
||||
indicator = colorScheme.background;
|
||||
childBorder = colorScheme.background;
|
||||
};
|
||||
urgent = scheme // {
|
||||
border = colorScheme.red.light;
|
||||
indicator = colorScheme.red.light;
|
||||
childBorder = colorScheme.red.light;
|
||||
};
|
||||
placeholder = scheme // {
|
||||
border = colorScheme.green.light;
|
||||
indicator = colorScheme.green.light;
|
||||
childBorder = colorScheme.green.light;
|
||||
};
|
||||
};
|
||||
bars = [];
|
||||
keybindings = {
|
||||
"${modifier}+Down" = "focus down";
|
||||
"${modifier}+Left" = "focus left";
|
||||
"${modifier}+Return" = "exec ${config.defaultApplications.terminal}";
|
||||
"${modifier}+Right" = "focus right";
|
||||
"${modifier}+Shift+Down" = "move down";
|
||||
"${modifier}+Shift+Left" = "move left";
|
||||
"${modifier}+Shift+Right" = "move right";
|
||||
"${modifier}+Shift+Up" = "move up";
|
||||
"${modifier}+Shift+c" = "reload";
|
||||
"${modifier}+Shift+n" = "rove window to workspace next";
|
||||
"${modifier}+Shift+b" = "move window to workspace prev";
|
||||
"${modifier}+Shift+q" = "kill";
|
||||
"${modifier}+Shift+r" = "restart";
|
||||
"${modifier}+Shift+w" = "exec ${pkgs.xautolock}/bin/xautolock -locknow";
|
||||
"${modifier}+Shift+x" = "exec --no-startup-id ${move-to-new-workspace}";
|
||||
"${modifier}+Shift+z" = "floating toggle";
|
||||
"${modifier}+Up" = "focus up";
|
||||
"${modifier}+a" = "exec ${pkgs.rofi}/bin/rofi -display-window — -show window";
|
||||
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -display-run — -show run";
|
||||
"${modifier}+e" = "layout toggle split";
|
||||
"${modifier}+f" = "fullscreen toggle";
|
||||
"${modifier}+h" = "split h";
|
||||
"${modifier}+n" = "workspace next";
|
||||
"${modifier}+b" = "workspace prev";
|
||||
"${modifier}+r" = "mode resize";
|
||||
"${modifier}+s" = "layout stacking";
|
||||
"${modifier}+t" = "exec ${config.defaultApplications.fileManager}";
|
||||
"${modifier}+v" = "split v";
|
||||
"${modifier}+w" = "layout tabbed";
|
||||
"${modifier}+x" = "exec --no-startup-id ${new-workspace}";
|
||||
"${modifier}+y" = "exec ${config.defaultApplications.browser}";
|
||||
"XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks";
|
||||
"XF86AudioMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks";
|
||||
"XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks";
|
||||
};
|
||||
}
|
||||
183
dot/i3blocks.nix
Normal file
183
dot/i3blocks.nix
Normal file
@@ -0,0 +1,183 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
unstable = import <nixos-unstable> {};
|
||||
spotify_info = unstable.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 = unstable.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 = unstable.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 = unstable.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;
|
||||
}
|
||||
'';
|
||||
in 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]
|
||||
''
|
||||
34
dot/rofi.nix
Normal file
34
dot/rofi.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{ config }:
|
||||
with import ../theme.nix;
|
||||
{
|
||||
enable = true;
|
||||
separator = "solid";
|
||||
scrollbar = false;
|
||||
terminal = config.defaultApplications.terminal;
|
||||
borderWidth = 0;
|
||||
lines = 5;
|
||||
font = "${uiFont.name} ${toString (uiFont.size + 1)}";
|
||||
colors = rec {
|
||||
window = { background = invertedColorScheme.background; border = invertedColorScheme.background; separator = invertedColorScheme.black.light; };
|
||||
rows = {
|
||||
normal = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = invertedColorScheme.foreground;
|
||||
highlight = { foreground = invertedColorScheme.cyan.dark; inherit (window) background; };
|
||||
};
|
||||
active = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = invertedColorScheme.yellow.dark;
|
||||
highlight = { foreground = invertedColorScheme.green.dark; inherit (window) background; };
|
||||
};
|
||||
urgent = {
|
||||
background = window.background;
|
||||
backgroundAlt = window.background;
|
||||
foreground = invertedColorScheme.red.dark;
|
||||
highlight = { foreground = invertedColorScheme.magenta.dark; inherit (window) background; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
473
dot/scripts.nix
473
dot/scripts.nix
@@ -1,6 +1,8 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
bingWallpaper = pkgs.writers.writeBash "bing-wallpaper.sh" ''
|
||||
theme = import ../theme.nix;
|
||||
unstable = import <nixos-unstable> {};
|
||||
bingWallpaper = unstable.writers.writeBash "bing-wallpaper.sh" ''
|
||||
PICTURE_DIR="$HOME/pictures/external/bing/"
|
||||
|
||||
mkdir -p $PICTURE_DIR
|
||||
@@ -17,18 +19,7 @@ let
|
||||
fi
|
||||
done
|
||||
'';
|
||||
colorize = pkgs.writers.writeDash "colorize.sh" ''
|
||||
colorize() {
|
||||
${pkgs.python36Packages.pygments}/bin/pygmentize -l $1 -O bg=dark
|
||||
}
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
colorize "$1"
|
||||
else
|
||||
cat "$2" | colorize "$1"
|
||||
fi
|
||||
'';
|
||||
easyBackup = pkgs.writers.writeDash "easy-backup.sh" ''
|
||||
easyBackup = unstable.writers.writeDash "easy-backup" ''
|
||||
if [ -d "$1" ]; then
|
||||
OUTPUT_ROOT=''${1}/backup/current
|
||||
rsync -hav --delete --stats --progress --exclude-from=$HOME/bin/backup.exclude $HOME/* $OUTPUT_ROOT/
|
||||
@@ -37,107 +28,7 @@ let
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
compile = pkgs.writers.writeBash "compile.sh" ''
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: compile <source file>"
|
||||
fi
|
||||
|
||||
file="$1"
|
||||
ext="''${file##*.}"
|
||||
name="''${file%.*}"
|
||||
|
||||
case "$ext" in
|
||||
asm)
|
||||
echo Compiling "$name" with the Netwide Assembler...
|
||||
nasm -felf64 -o "$name".o "$file"
|
||||
gcc -o "$name" "$name".o;;
|
||||
c)
|
||||
echo Compiling "$name" with the GNU C Compiler...
|
||||
gcc -std=c11 -Wall -Wpedantic -Ofast -o "$name" "$file";;
|
||||
cpp|cxx|cc)
|
||||
echo Compiling "$name" with the GNU C++ Compiler...
|
||||
g++ -std=c++11 -Wall -O3 -o "$name" "$file";;
|
||||
bf)
|
||||
echo Compiling "$name" with the BrainFuck Compiler...
|
||||
bf2c "$file" "$name".c && compile "$name".c && rm "$name".c;;
|
||||
s)
|
||||
echo Assembling "$name" with the GNU Assembler...
|
||||
gcc -o "$name" "$file";;
|
||||
hs)
|
||||
echo Compiling "$name" with the Glasgow Haskell Compiler...
|
||||
stack ghc -- -Wall -O3 --make "$file" && rm "$name".hi "$name".o;;
|
||||
java)
|
||||
echo Compiling "$name" with the Oracle Java Compiler...
|
||||
javac "$file";;
|
||||
rb)
|
||||
echo Compiling "$name" with Ruby...
|
||||
ruby -c "$file";;
|
||||
lua)
|
||||
echo Compiling "$name" with the Lua Compiler...
|
||||
luac -o "$name".luac "$file";;
|
||||
py)
|
||||
if [ ""$2"" = "--optimize" ]; then
|
||||
echo Compiling "$name" with the optimizing Python Compiler...
|
||||
if [ -e "$name".pyo ]; then
|
||||
rm "$name".pyo
|
||||
fi
|
||||
python3 -O -mpy_compile "$file"
|
||||
mv __pycache__/"$name".cpython-33.pyo ./"$name".pyo
|
||||
rmdir __pycache__
|
||||
else
|
||||
echo Compiling "$name" with the Python Compiler...
|
||||
if [ -e "$name".pyc ]; then
|
||||
rm "$name".pyc
|
||||
fi
|
||||
python3 -mpy_compile "$file"
|
||||
mv __pycache__/"$name".cpython-33.pyc ./"$name".pyc
|
||||
rmdir __pycache__
|
||||
fi;;
|
||||
ml)
|
||||
echo Compiling "$name" with the OCaml Compiler...
|
||||
ocamlc -o "$name" "$file" && rm "$name".cmo "$name".cmi;;
|
||||
cs)
|
||||
echo Compiling "$name" with the Mono C£ Compiler...
|
||||
mono-csc -out:"$name" "$file";;
|
||||
fs)
|
||||
echo Compiling "$name" with the F£ Compiler...
|
||||
fsharpc -out:"$name" "$file";;
|
||||
vala)
|
||||
echo Compiling "$name" with the Vala Compiler...
|
||||
valac --pkg=gtk+-3.0 "$file";;
|
||||
md)
|
||||
echo Converting "$name" to PDF with Pandoc...
|
||||
pandoc --latex-engine=xelatex -V documentclass=scrartcl -o "$name".pdf "$file";;
|
||||
tex)
|
||||
echo Compiling "$name" to PDF with LaTeX...
|
||||
latexmk -pdf "$file";;
|
||||
lhs)
|
||||
echo Compiling "$name" with the Glasgow Haskell Compiler...
|
||||
ghc -Wall -O3 --make "$file"
|
||||
echo Converting "$name" to PDF Markup with Pandoc...
|
||||
pandoc "$file" -f markdown+lhs --latex-engine=xelatex -V documentclass=scrartcl -o "$name".pdf;;
|
||||
d)
|
||||
echo Compiling "$name" with the GNU D Compiler...
|
||||
gdc -Wall -O3 -o "$name" "$file";;
|
||||
m)
|
||||
echo Compiling "$name" with the GNU/GNUstep Objective C Compiler...
|
||||
£ gcc -Wall -o "$name" -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -DGSWARN -Wno-import -g -O2 -fgnu-runtime -fconstant-string-class=NSConstantString -fexec-charset=UTF-8 -I. -I/usr/local/include/GNUstep -I/usr/include/GNUstep -lobjc -lgnustep-base "$file"
|
||||
gcc `gnustep-config --objc-flags` "$file" -o "$name" -lgnustep-base -lobjc
|
||||
;;
|
||||
pas)
|
||||
echo Compiling "$name" with the FreePascal Compiler...
|
||||
fpc "$file";;
|
||||
rs)
|
||||
echo Compiling "$name" with the Rust Compiler...
|
||||
rustc "$file";;
|
||||
ts)
|
||||
echo Compiling "$name" with the TypeScript Compiler...
|
||||
tsc "$file";;
|
||||
*)
|
||||
echo Compiler for "$ext" not found!;;
|
||||
esac
|
||||
'';
|
||||
gitPullAll = pkgs.writers.writeDash "git-pull-all.sh" ''
|
||||
gitPullAll = unstable.writers.writeDashBin "pull-all" ''
|
||||
# store the current dir
|
||||
CUR_DIR=$(pwd)
|
||||
# Let the person running the script know what's going on.
|
||||
@@ -156,196 +47,7 @@ let
|
||||
done
|
||||
echo -e "\n\033[32mComplete!\033[0m\n"
|
||||
'';
|
||||
gripe = pkgs.writers.writeBash "gripe.sh" ''${sidepipe} '(:\d+:|-\d+-|--)(\x1b[[]K)?' "$@"'';
|
||||
haskellDefinition = pkgs.writers.writeBash "hdef.sh" ''
|
||||
paths=""
|
||||
while true; do
|
||||
if [ -d "$1" ]; then
|
||||
paths="$paths $1"
|
||||
else
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
str="$1"
|
||||
shift
|
||||
|
||||
lower=$(echo "$str" | tr A-Z a-z)
|
||||
if [ "''${lower:0:1}" == "''${str:0:1}" ]; then
|
||||
expr="($str( |$)|[[:space:]]+$str[[:space:]]*::)"
|
||||
else
|
||||
kws="(class|data|type|newtype)"
|
||||
eow="([ \n\t]|$)"
|
||||
expr="$kws[[:space:]]+($str$eow|[^=]+=>[[:space:]]+$str$eow)"
|
||||
fi
|
||||
|
||||
${haskellFind} $paths -print0 | xargs -0 grep -En --colour=never -A10 "$@" "^$expr" | ${gripe} hcol | ${highlight} $str
|
||||
'';
|
||||
haskellFind = pkgs.writers.writeDash "hfind.sh" ''
|
||||
paths=""
|
||||
while true; do
|
||||
if [ -d "$1" ]; then
|
||||
paths="$paths $1"
|
||||
else
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
find $paths \( -name "*.hs" -or -name "*.hsi" -or -name "*.lhs" -or -name "*.hs-boot" \) -a -not \( -name ".*" -or -path "*/_darcs/*" -o -name '.£*' \) "$@"
|
||||
'';
|
||||
haskellGrep = pkgs.writers.writeDash "hgrep.sh" ''
|
||||
if [ -z "$1" -o "$1" == "--help" -o "$1" == "-h" ]; then
|
||||
echo "Usage: hg [PATH] IDENTIFIER [GREP OPTIONS...]"
|
||||
echo "Seaches for uses of the given Haskell identifier."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
paths=""
|
||||
while true; do
|
||||
if [ -d "$1" ]; then
|
||||
paths="$paths $1"
|
||||
else
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
colour=always
|
||||
if [ "$TERM" == "dumb" -o "$NO_COLORS" == "1" ]; then
|
||||
colour=never
|
||||
fi
|
||||
${haskellFind} $paths -print0 | xargs -0 grep -nw --colour=$colour "$@"
|
||||
'';
|
||||
highlight = pkgs.writers.writePython3 "hl.py" {
|
||||
libraries = [ pkgs.python36Packages.ansicolors ];
|
||||
flakeIgnore = [ "E302" "E999" "E231" "E701" "W605" "E231" "E305" ];
|
||||
} ''
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
from ansicolors import *
|
||||
|
||||
def replfun((re,colfun)):
|
||||
def onmatch(m):
|
||||
if m.groups() != ():
|
||||
buf = []
|
||||
p = m.start(0)
|
||||
mstr = m.string
|
||||
try:
|
||||
i = 1
|
||||
while True:
|
||||
(s,e) = m.span(i)
|
||||
if s == -1: continue
|
||||
buf.append(mstr[p:s])
|
||||
buf.append(colfun(mstr[s:e]))
|
||||
p = e
|
||||
i += 1
|
||||
except IndexError:
|
||||
buf.append(mstr[p:m.end(0)])
|
||||
return '\'.join(buf)
|
||||
else:
|
||||
return colfun(m.expand("\g<0>"))
|
||||
return lambda s: re.subn(onmatch,s)[0]
|
||||
|
||||
colfuns = [green, red, magenta, cyan, blue]
|
||||
flags = re.L
|
||||
if len(sys.argv) > 1 and sys.argv[1] == '-i':
|
||||
flags = flags | re.I
|
||||
exps = sys.argv[2:]
|
||||
else:
|
||||
exps = sys.argv[1:]
|
||||
regexps = map(lambda e: re.compile(e, flags), exps)
|
||||
hlfuns = map(replfun, zip(regexps, colfuns))
|
||||
|
||||
term = os.getenv("TERM")
|
||||
no_colors = os.getenv("NO_COLORS")
|
||||
if term == "dumb" or no_colors == "1":
|
||||
for line in sys.stdin:
|
||||
sys.stdout.write(line)
|
||||
else:
|
||||
for line in sys.stdin:
|
||||
sys.stdout.write(reduce(lambda s, f: f(s), hlfuns, line))
|
||||
'';
|
||||
haskellTags = pkgs.writers.writeDash "htags.sh" ''
|
||||
id="[a-z_][a-zA-Z0-9_\']*"
|
||||
ws="[ \\t]"
|
||||
ID="[A-Z][a-zA-Z0-9_\']*"
|
||||
|
||||
${pkgs.ctags}/bin/ctags --tag-relative=no \
|
||||
'--langdef=haskell' \
|
||||
'--langmap=haskell:.hs.lhs' \
|
||||
'--regex-haskell=/^(type|data|newtype)[ \t]+([^ \t=]+)/\2/' \
|
||||
'--regex-haskell=/^class[^=]+=>[ \t]*([^ \t]+)/\1/' \
|
||||
'--regex-haskell=/^class[ \t]+([^ \t]+)[^=]*$/\1/' \
|
||||
"--regex-haskell=/^$ws*($id)$ws*::/\1/" \
|
||||
"--regex-haskell=/^($id)/\1/" \
|
||||
"$@"
|
||||
'';
|
||||
sidepipe = pkgs.writers.writePython3 "sidepipe.py" { flakeIgnore = [ "E302" "E231" "E999" "E265" "E305" ]; } ''
|
||||
import sys
|
||||
import re
|
||||
import os.path
|
||||
from Queue import Queue
|
||||
from subprocess import Popen, PIPE
|
||||
from threading import Thread
|
||||
|
||||
pipeIsLeft = os.path.basename(sys.argv[0]) == "leftpipe"
|
||||
regex = sys.argv[1]
|
||||
cmd = sys.argv[2:]
|
||||
|
||||
class WorkerThread(Thread):
|
||||
def __init__(self, queue, instream, outstream, pipeIsLeft):
|
||||
Thread.__init__(self)
|
||||
self.queue = queue
|
||||
self.instream = instream
|
||||
self.outstream = outstream
|
||||
self.pipeIsLeft = pipeIsLeft
|
||||
|
||||
class SplitThread(WorkerThread):
|
||||
def run(self):
|
||||
try:
|
||||
for line in self.instream:
|
||||
match = re.search(regex,line)
|
||||
if not match:
|
||||
print >> sys.stderr, "No match: %r in %r" % (regex,line)
|
||||
continue
|
||||
index = match.end()
|
||||
left, right = line[:index], line[index:]
|
||||
if pipeIsLeft:
|
||||
self.outstream.write(left)
|
||||
self.queue.put(right)
|
||||
else:
|
||||
self.outstream.write(right)
|
||||
self.queue.put(left)
|
||||
self.outstream.close()
|
||||
except IOError, e:
|
||||
print >> sys.stderr, e[1]
|
||||
self.outstream.close()
|
||||
while not queue.full():
|
||||
queue.put("")
|
||||
|
||||
class JoinThread(WorkerThread):
|
||||
def run(self):
|
||||
for pipeline in self.instream:
|
||||
#print >> sys.stderr, "wait"
|
||||
passline = self.queue.get()
|
||||
#print >> sys.stderr, "ok"
|
||||
if pipeIsLeft:
|
||||
self.outstream.write(pipeline)
|
||||
self.outstream.write(passline)
|
||||
else:
|
||||
self.outstream.write(passline)
|
||||
self.outstream.write(pipeline)
|
||||
|
||||
pipe = Popen(cmd, shell=False,stdin=PIPE,stdout=PIPE)
|
||||
queue = Queue(250)
|
||||
t1 = SplitThread(queue, sys.stdin, pipe.stdin, pipeIsLeft)
|
||||
t2 = JoinThread(queue, pipe.stdout, sys.stdout, pipeIsLeft)
|
||||
t1.start()
|
||||
t2.start()
|
||||
t2.join()
|
||||
'';
|
||||
spotifyCli = pkgs.writers.writeBash "sp.sh" ''
|
||||
spotifyCli = unstable.writers.writeBashBin "sp" ''
|
||||
# This is sp, the command-line Spotify controller. It talks to a running
|
||||
# instance of the Spotify Linux client over dbus, providing an interface not
|
||||
# unlike mpc.
|
||||
@@ -616,29 +318,158 @@ let
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
spotifyGenius = pkgs.writers.writeBash "spgenius.sh" ''
|
||||
spotifyGenius = unstable.writers.writeDashBin "spgenius.sh" ''
|
||||
function normalise {
|
||||
echo ''${1// /-}
|
||||
echo "$1" | tr ' ' -
|
||||
}
|
||||
eval $(${spotifyCli} eval)
|
||||
${pkgs.xdg_utils}/bin/xdg-open "http://genius.com/$(normalise "$SPOTIFY_ARTIST")-$(normalise "$SPOTIFY_TITLE")-lyrics"
|
||||
'';
|
||||
generateShellNix = pkgs.fetchurl {
|
||||
generateShellNix =
|
||||
let generateShellNixPath = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/kmein/generate-shell-nix/81f77661705ee628d1566f2dea01f2d731fda79d/generate-shell-nix";
|
||||
sha256 = "0r661z9s5zw0gas2f73aakplfblj1jjlbijmm7gf513xkq61jxm8";
|
||||
executable = true;
|
||||
};
|
||||
in {
|
||||
compile = compile;
|
||||
easy-backup = easyBackup;
|
||||
colorize = colorize;
|
||||
bing-wallpaper = bingWallpaper;
|
||||
git-pull-all = gitPullAll;
|
||||
hdef = haskellDefinition;
|
||||
hfind = haskellFind;
|
||||
hgrep = haskellGrep;
|
||||
htags = haskellTags;
|
||||
sp = spotifyCli;
|
||||
spgenius = spotifyGenius;
|
||||
generate-shell-nix = generateShellNix;
|
||||
}
|
||||
in unstable.writers.writeDashBin "generate-shell-nix" ''${generateShellNixPath} $*'';
|
||||
dic =
|
||||
let dicPath = pkgs.fetchurl {
|
||||
url = "https://cgit.krebsco.de/dic/plain/dic?id=beeca40313f68874e05568f4041423c16202e9da";
|
||||
sha256 = "1d25pm420fnbrr273i96syrcd8jkh8qnflpfgxlsbzmbmfizfzld";
|
||||
executable = true;
|
||||
};
|
||||
in unstable.writers.writeDashBin "dic" ''${dicPath} $*'';
|
||||
font-size = unstable.writers.writeDashBin "font-size" ''
|
||||
set -efu
|
||||
|
||||
# set_font NORMAL_FONT BOLD_FONT
|
||||
set_font() {
|
||||
printf '\033]710;%s\007' "$1"
|
||||
printf '\033]711;%s\007' "$2"
|
||||
}
|
||||
|
||||
case ''${1-} in
|
||||
'''|0|--reset)
|
||||
set_font \
|
||||
"xft:${theme.terminalFont.name}:size=${toString theme.terminalFont.size}" \
|
||||
"xft:${theme.terminalFont.name}:size=${toString theme.terminalFont.size}:bold" \
|
||||
;;
|
||||
[2-9]|[1-9][0-9]|[1-9][0-9][0-9])
|
||||
set_font \
|
||||
"xft:${theme.terminalFont.name}:size=$1" \
|
||||
"xft:${theme.terminalFont.name}:size=$1:bold" \
|
||||
;;
|
||||
*)
|
||||
echo "$0: bad argument: $1" >&2
|
||||
exit 1
|
||||
esac
|
||||
'';
|
||||
wttr = unstable.writers.writeDashBin "wttr" ''
|
||||
${pkgs.curl}/bin/curl -s -H "Accept-Language: ''${LANG%_*}" --compressed "wttr.in/''${1-$(${pkgs.curl}/bin/curl -s ipinfo.io | ${pkgs.jq}/bin/jq .loc)}?0"
|
||||
'';
|
||||
q =
|
||||
let
|
||||
q-performance = ''
|
||||
show_load() {
|
||||
${pkgs.coreutils}/bin/cat /proc/loadavg | ${pkgs.gawk}/bin/gawk '{ print $1, $2, $3}'
|
||||
}
|
||||
|
||||
show_memory() {
|
||||
${pkgs.procps}/bin/free -h | ${pkgs.gnugrep}/bin/grep "Mem" | ${pkgs.gawk}/bin/gawk '{print $3}'
|
||||
}
|
||||
|
||||
printf "\x1b[33m%s \x1b[1m%s\x1b[0m\n" "$(show_load)" "$(show_memory)"
|
||||
'';
|
||||
q-isodate = ''
|
||||
${pkgs.coreutils}/bin/date '+[1m%Y-%m-%d[0m [35m%H:%M[0m:%S%:z'
|
||||
'';
|
||||
q-volume = ''
|
||||
is_mute() {
|
||||
if $(${pkgs.pamixer}/bin/pamixer --get-mute); then
|
||||
echo "(Mute)"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
current_volume() {
|
||||
${pkgs.pamixer}/bin/pamixer --get-volume
|
||||
}
|
||||
|
||||
printf "\x1b[36m%d%%\x1b[0m %s\n" "$(current_volume)" "$(is_mute)"
|
||||
'';
|
||||
q-online = ''
|
||||
if ${pkgs.curl}/bin/curl -s google.com >/dev/null; then
|
||||
echo '[32;1monline[0m'
|
||||
else
|
||||
echo '[31;1moffline[0m'
|
||||
fi
|
||||
'';
|
||||
q-battery = ''
|
||||
BAT_DIR="/sys/class/power_supply/BAT1/"
|
||||
if test ! -d "$BAT_DIR"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -e "$BAT_DIR/charge_now" -a -e "$BAT_DIR/charge_full"; then
|
||||
FULL_CHARGE="$BAT_DIR/charge_full"
|
||||
CURR_CHARGE="$BAT_DIR/charge_now"
|
||||
elif test -e "$BAT_DIR/energy_now" -a -e "$BAT_DIR/energy_full"; then
|
||||
FULL_CHARGE="$BAT_DIR/energy_full"
|
||||
CURR_CHARGE="$BAT_DIR/energy_now"
|
||||
else
|
||||
ls >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATUS="$BAT_DIR/status"
|
||||
|
||||
charge_d=$((100 * $(${pkgs.coreutils}/bin/cat $CURR_CHARGE) / $(${pkgs.coreutils}/bin/cat $FULL_CHARGE)))
|
||||
if [[ "$charge_d" -lt 10 ]]; then
|
||||
printf "\x1b[31m"
|
||||
elif [[ "$charge_d" -lt 20 ]]; then
|
||||
printf "\x1b[33m"
|
||||
else
|
||||
printf "\x1b[32m"
|
||||
fi
|
||||
|
||||
printf '%s%%\x1b[0m (%s)\n' "$charge_d" $(${pkgs.coreutils}/bin/cat "$STATUS")
|
||||
'';
|
||||
q-todo = ''
|
||||
TODO_file=$PWD/.todo
|
||||
if test -e "$TODO_file"; then
|
||||
printf "\n\x1b[1mTodo\x1b[0m\n"
|
||||
${pkgs.coreutils}/bin/cat "$TODO_file" \
|
||||
| ${pkgs.gawk}/bin/gawk -v now=$(${pkgs.coreutils}/bin/date +%s) '
|
||||
BEGIN { print "remind=0" }
|
||||
/^[0-9]/{
|
||||
x = $1
|
||||
gsub(".", "\\\\&", x)
|
||||
rest = substr($0, index($0, " "))
|
||||
rest = $0
|
||||
sub(" *", "", rest)
|
||||
gsub(".", "\\\\&", rest)
|
||||
print "test $(${pkgs.coreutils}/bin/date +%s -d"x") -lt "now" && \
|
||||
echo \"\x1b[93m\""rest esc "\"\x1b[m\" && \
|
||||
(( remind++ ))"
|
||||
}
|
||||
END { print "test $remind = 0 && echo \"nothing to remind\"" }
|
||||
' \
|
||||
| {
|
||||
# bash needed for (( ... ))
|
||||
${pkgs.bash}/bin/bash
|
||||
}
|
||||
fi
|
||||
'';
|
||||
in unstable.writers.writeBashBin "q" ''
|
||||
set -eu
|
||||
export PATH=/var/empty
|
||||
${q-isodate}
|
||||
${q-performance}
|
||||
(${q-volume}) &
|
||||
(${q-battery}) &
|
||||
(${q-online}) &
|
||||
wait
|
||||
(${q-todo}) || :
|
||||
'';
|
||||
in [ spotifyCli dic easyBackup gitPullAll font-size generateShellNix q wttr ]
|
||||
|
||||
28
dot/ssh.nix
28
dot/ssh.nix
@@ -1,22 +1,10 @@
|
||||
{ lib }:
|
||||
with lib;
|
||||
let huServer = name: ''
|
||||
Host ${name}
|
||||
User ${(import ../secrets.nix).eduroam.identity}
|
||||
HostName ${name}.informatik.hu-berlin.de
|
||||
IdentityFile ~/.ssh/hu
|
||||
'';
|
||||
in ''
|
||||
Host github
|
||||
User git
|
||||
HostName github.com
|
||||
|
||||
Host gitlab
|
||||
User git
|
||||
HostName gitlab.informatik.hu-berlin.de
|
||||
|
||||
Host happysrv
|
||||
User meinhark
|
||||
HostName v22017123717458308.happysrv.de
|
||||
Port 49000
|
||||
'' + strings.concatMapStringsSep "\n\n" huServer [ "rabe" "star" "gruenau" "gruenau1" "gruenau2" "gruenau3" "gruenau4" "gruenau5" "gruenau6" "gruenau7" "gruenau8" ]
|
||||
let huServer = name: {
|
||||
"${name}" = {
|
||||
hostname = "${name}.informatik.hu-berlin.de";
|
||||
user = (import ../secrets.nix).eduroam.identity;
|
||||
identityFile = "~/.ssh/hu";
|
||||
};
|
||||
};
|
||||
in lists.foldr (x: xs: huServer x // xs) {} [ "rabe" "star" "gruenau" "gruenau1" "gruenau2" "gruenau3" "gruenau4" "gruenau5" "gruenau6" "gruenau7" "gruenau8" ]
|
||||
|
||||
15
dot/urxvt.nix
Normal file
15
dot/urxvt.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ pkgs }:
|
||||
with import ../theme.nix;
|
||||
{
|
||||
enable = true;
|
||||
package = pkgs.rxvt_unicode-with-plugins;
|
||||
keybindings = {
|
||||
"Shift-Control-C" = "eval:selection_to_clipboard";
|
||||
"Shift-Control-V" = "eval:paste_clipboard";
|
||||
};
|
||||
scroll.bar.enable = false;
|
||||
extraConfig = {
|
||||
perl-ext-common = "default,clipboard,url-select,keyboard-select";
|
||||
fading = 50;
|
||||
};
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
''
|
||||
XTerm*termName: xterm-256color
|
||||
XTerm*locale: true
|
||||
XTerm*saveLines: 4096
|
||||
XTerm*geometry: 80x32
|
||||
XTerm*reverseVideo: true
|
||||
XTerm*faceName: Source Code Pro for Powerline:size=10:antialias=true
|
||||
XTerm*font: 7x13
|
||||
Xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
|
||||
XTerm*translations: #override \n\
|
||||
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
|
||||
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
|
||||
''
|
||||
{ lib }:
|
||||
let theme = import ../theme.nix;
|
||||
in with lib; lists.foldr
|
||||
(i: cs: cs // { "*color${toString i}" = builtins.elemAt theme.colorPalette i; })
|
||||
{
|
||||
"*background" = theme.colorScheme.background;
|
||||
"*foreground" = theme.colorScheme.foreground;
|
||||
"*fadeColor" = theme.colorScheme.fadeColor;
|
||||
"*cursorColor" = theme.colorScheme.cursorColor;
|
||||
"*pointerColorForeground" = theme.colorScheme.pointerColorForeground;
|
||||
"*pointerColorBackground" = theme.colorScheme.pointerColorBackground;
|
||||
"*.font" = "xft:${theme.terminalFont.name}:size=${toString theme.terminalFont.size}";
|
||||
"*.boldFont" = "xft:${theme.terminalFont.name}:style=Bold:size=${toString theme.terminalFont.size}";
|
||||
"*.italicFont" = "xft:${theme.terminalFont.name}:style=Italic:size=${toString theme.terminalFont.size}";
|
||||
}
|
||||
(lists.range 0 15)
|
||||
|
||||
5
dot/zathura.nix
Normal file
5
dot/zathura.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
options = {
|
||||
selection-clipboard = "clipboard";
|
||||
};
|
||||
}
|
||||
15
options.nix
15
options.nix
@@ -13,11 +13,11 @@ let
|
||||
default = def;
|
||||
};
|
||||
in {
|
||||
options.defaultApplications = mapAttrs (const stringOption) {
|
||||
terminal = "${pkgs.xterm}/bin/xterm";
|
||||
options.defaultApplications = mapAttrs (const stringOption) rec {
|
||||
terminal = "${pkgs.rxvt_unicode-with-plugins}/bin/urxvtc";
|
||||
browser = "${pkgs.chromium}/bin/chromium";
|
||||
fileManager = "${pkgs.xterm}/bin/xterm ${pkgs.ranger}/bin/ranger";
|
||||
locker = "${pkgs.i3lock}/bin/i3lock -e -c ${strings.removePrefix "#" gray.dark}";
|
||||
fileManager = "${terminal} ${pkgs.ranger}/bin/ranger";
|
||||
locker = "${pkgs.i3lock}/bin/i3lock -u -c ${strings.removePrefix "#" colorScheme.background}";
|
||||
};
|
||||
|
||||
options.constants = {
|
||||
@@ -29,12 +29,13 @@ in {
|
||||
|
||||
ignore = mkOption {
|
||||
type = types.listOf types.string;
|
||||
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.o" "*.hi" "*.aux" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
|
||||
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.py[co]" "*.o" "*.hi" "*.aux" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
|
||||
};
|
||||
|
||||
theme = mapAttrs (const themeOption) {
|
||||
gtk = { name = "Paper"; package = pkgs.paper-gtk-theme; };
|
||||
icon = { name = "Paper"; package = pkgs.paper-icon-theme; };
|
||||
gtk = { name = "Breeze-Dark"; package = pkgs.breeze-gtk; };
|
||||
icon = { name = "Adwaita"; package = pkgs.gnome3.adwaita-icon-theme; };
|
||||
cursor = { name = "capitaine-cursors"; package = pkgs.capitaine-cursors; };
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
67
theme.nix
67
theme.nix
@@ -1,28 +1,53 @@
|
||||
rec {
|
||||
uiFont = { name = "Roboto"; size = 10; };
|
||||
terminalFont = {
|
||||
regular = { name = "Source Code Pro for Powerline"; };
|
||||
bold = { name = "Source Code Pro Bold for Powerline"; };
|
||||
italic = { name = "Source Code Pro Italic for Powerline"; };
|
||||
boldItalic = { name = "Source Code Pro Bold Italic for Powerline"; };
|
||||
size = 10;
|
||||
};
|
||||
|
||||
white = "#ffffff";
|
||||
black = "#000000";
|
||||
veryDark = "#080808";
|
||||
|
||||
colorPalette = [
|
||||
gray.dark red.dark green.dark yellow.dark blue.dark magenta.dark cyan.dark gray.light
|
||||
gray.dark red.light green.light yellow.light blue.light magenta.light cyan.light gray.light
|
||||
];
|
||||
|
||||
# Antares color scheme
|
||||
gray = { light = "#bbbbbb"; dark = "#151515"; medium = "#aaaaaa"; };
|
||||
let
|
||||
antares = rec {
|
||||
black = { light = "#151515"; dark = "#000000"; };
|
||||
red = { light = "#de575c"; dark = "#de575c"; };
|
||||
yellow = { light = "#ebe971"; dark = "#ebe971"; };
|
||||
green = { light = "#00b853"; dark = "#00b853"; };
|
||||
blue = { light = "#90d0f0"; dark = "#7fc6f0"; };
|
||||
magenta = { light = "#cf9ffa"; dark = "#cf9ffa"; };
|
||||
cyan = { light = "#4ae5e8"; dark = "#4ae5e8"; };
|
||||
white = { light = "#ffffff"; dark = "#bbbbbb"; };
|
||||
background = black.dark;
|
||||
foreground = white.dark;
|
||||
};
|
||||
solarizedDark = rec {
|
||||
black = { dark = "#073642"; light = "#002b36"; };
|
||||
red = { dark = "#dc322f"; light = "#cb4b16"; };
|
||||
yellow = { dark = "#b58900"; light = "#657b83"; };
|
||||
green = { dark = "#859900"; light = "#586e75"; };
|
||||
blue = { dark = "#268bd2"; light = "#839496"; };
|
||||
magenta = { dark = "#d33682"; light = "#6c71c4"; };
|
||||
cyan = { dark = "#2aa198"; light = "#93a1a1"; };
|
||||
white = { dark = "#eee8d5"; light = "#fdf6e3"; };
|
||||
background = black.light;
|
||||
foreground = blue.light;
|
||||
fadeColor = black.light;
|
||||
cursorColor = cyan.light;
|
||||
pointerColorBackground = green.light;
|
||||
pointerColorForeground = cyan.light;
|
||||
};
|
||||
solarizedLight = solarizedDark // {
|
||||
background = solarizedDark.white.light;
|
||||
foreground = solarizedDark.yellow.light;
|
||||
fadeColor = solarizedDark.white.light;
|
||||
cursorColor = solarizedDark.green.light;
|
||||
pointerColorBackground = solarizedDark.cyan.light;
|
||||
pointerColorForeground = solarizedDark.green.light;
|
||||
};
|
||||
in rec {
|
||||
uiFont = { name = "Roboto"; size = 9; };
|
||||
terminalFont = { name = "Source Code Pro for Powerline"; size = 9; };
|
||||
|
||||
white = "#ffffff";
|
||||
black = "#000000";
|
||||
gray = "#888888";
|
||||
|
||||
colorScheme = solarizedDark;
|
||||
invertedColorScheme = solarizedLight;
|
||||
|
||||
colorPalette = [
|
||||
colorScheme.white.dark colorScheme.red.dark colorScheme.green.dark colorScheme.yellow.dark colorScheme.blue.dark colorScheme.magenta.dark colorScheme.cyan.dark colorScheme.black.dark
|
||||
colorScheme.white.light colorScheme.red.light colorScheme.green.light colorScheme.yellow.light colorScheme.blue.light colorScheme.magenta.light colorScheme.cyan.light colorScheme.black.light
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user