Fresh repo without sensitive data.

This commit is contained in:
Kevin Baensch 2019-02-26 13:44:40 +01:00
commit 9003080a64
44 changed files with 2039 additions and 0 deletions

14
config/default.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
let
cfg = import ("/etc/nixos/machines/" + (builtins.replaceStrings ["\n"] [""] (builtins.readFile /etc/hostname)) + "/configuration.nix");
in {
imports = [
./etc.nix
./locale.nix
./networking.nix
./nix.nix
./users.nix
./zsh.nix
] ++ (if cfg.conf.networking.hostName != "Ophanim" then [./fonts.nix] else [./security.nix]);
}

18
config/etc.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
{
environment.etc = {
"i3/config".source = ./etc/i3/config;
"i3/py3status".source = ./etc/i3/py3status;
"mpv/input.conf".source = ./etc/mpv/input.conf;
"mpv/mpv.conf".source = ./etc/mpv/mpv.conf;
"youtube-dl.conf".source = ./etc/youtube-dl.conf;
};
environment.variables = {
EDITOR="emacsclient -ca nano";
NIXPKGS_ALLOW_UNFREE="1";
WINEDLLOVERRIDES="winemenubuilder.exe=d";
LC_CTYPE="zh_CN.UTF-8";
};
}

15
config/etc/gitconfig Normal file
View file

@ -0,0 +1,15 @@
[user]
name = derped
email = derped@ophanim.de
[alias]
get = clone --recursive
blame = -w -M
update = !git pull && git submodule update --init --recursive
comma = commit --amend
uncommit = reset --soft HEAD^
pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr"
pru = !"pr() { git fetch upstream pull/$1/head:pr-$1; git checkout pr-$1; }; pr"
backport = cherry-pick -x
reset-pr = reset --hard FETCH_HEAD
publish = !git pull && git push

279
config/etc/i3/config Normal file
View file

@ -0,0 +1,279 @@
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
### INIT xfce session stuff ###
exec redshift-gtk -l 51.0504:13.7373
### START USER CONFIG ###
set $mod Mod4
workspace "HDMI" output HDMI1
workspace_auto_back_and_forth yes
new_window pixel
hide_edge_borders both
exec setxkbmap de
#exec compton -f
exec feh --bg-scale Pictures/wallpaper.jpg
#exec pulseaudio -D
#exec fcitx
#exec env=LC_CTYPE=zh_CN.UTF-8 emacs --daemon
#exec conky -c $HOME/.my_little_conky/.conkyrc
#exec xsnow -nosanta -norudolf -notrees
#exec $LOCK
### END USER CONFIG ###
### START USER PROGRAMMS ###
### END USER PROGRAMMS ###
### START SYSKEY BINDSYM ###
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+Mod1+space exec playerctl play-pause
bindsym $mod+Mod1+Right exec playerctl next
bindsym $mod+Mod1+Left exec playerctl previous
bindsym $mod+Shift+w sticky toggle
### END SYSKEY BINDSYM ###
### START BINDSYM ###
bindsym $mod+b border toggle
bindsym $mod+m bar mode toggle
bindsym $mod+y move container to output left
bindsym $mod+x move container to output right
bindsym $mod+Shift+y move workspace to output left
bindsym $mod+Shift+x move workspace to output right
bindsym $mod+minus exec amixer -c 0 sset Master 1%-
bindsym $mod+plus exec amixer -c 0 sset Master 1%+
bindsym $mod+Mod1+minus exec amixer -D pulse sset Master 1%-
bindsym $mod+Mod1+plus exec amixer -D pulse sset Master 1%+
bindsym $mod+Shift+minus exec xbacklight -5
bindsym $mod+Shift+plus exec xbacklight +5
bindsym $mod+Ctrl+0 exec xbacklight -set 0
bindsym $mod+Ctrl+1 exec xbacklight -set 10
bindsym $mod+Ctrl+2 exec xbacklight -set 20
bindsym $mod+Ctrl+3 exec xbacklight -set 30
bindsym $mod+Ctrl+4 exec xbacklight -set 40
bindsym $mod+Ctrl+5 exec xbacklight -set 50
bindsym $mod+Ctrl+6 exec xbacklight -set 60
bindsym $mod+Ctrl+7 exec xbacklight -set 70
bindsym $mod+Ctrl+8 exec xbacklight -set 80
bindsym $mod+Ctrl+9 exec xbacklight -set 90
bindsym $mod+p move scratchpad
bindsym $mod+Shift+p scratchpad show
bindsym --release $mod+Shift+S exec scrot
bindsym --release $mod+Ctrl+S exec "scrot --select"
bindsym $mod+o exec pcmanfm
### END BINDSYM ###
### START MODES ###
mode "ACPI Events" {
bindsym p exec systemctl poweroff; mode "default"
bindsym h exec systemctl hibernate; mode "default"
bindsym s exec systemctl suspend; mode "default"
bindsym r exec systemctl reboot; mode "default"
bindsym h exec systemctl halt; mode "default"
bindsym e exec systemctl exit; mode "default"
bindsym l exec $LOCK; mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "Power Mode"{
bindsym s exec xbacklight -set 5; exec rfkill block all ; exec xset -b +dpms; mode "default"
bindsym p exec xbacklight -set 100; exec rfkill unblock all; exec xset -dpms; mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "No Keybinds" {
bindsym $mod+Shift+Escape mode "default"
}
bindsym $mod+F12 mode "ACPI Events"
bindsym $mod+F11 mode "No Keybinds"
bindsym $mod+F10 mode "Power Mode"
### END MODES ###
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:monospace 8
#font pango:System San Francisco Display 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Shift+Return exec emacsclient -c
bindsym $mod+Return exec gnome-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
#bindsym $mod+d exec rofi -show run -lines 3 -eh 2 -width 100 -padding 330 -opacity "85" -config ~/.config/rofi.cfg -font "System San Francisco Display 12"
bindsym $mod++d exec dmenu_run -fn 'Droid Sans Mono-8'
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+odiaeresis focus right
#bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right
#bindsym $mod+Shift+semicolon1 move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
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
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
status_command py3status -c /etc/i3/py3status
# status_command i3status
colors {
separator #586e75
background #002b36
statusline #aea79f
focused_workspace #586e75 #586e75 #ffffff
active_workspace #073642 #073642 #ffffff
inactive_workspace #002b36 #002b36 #aea79f
urgent_workspace #77216f #77216f #ffffff
}
}
client.focused #008666 #000000 #ffffff
client.focused_inactive #000000 #222222 #ffffff
client.unfocused #002b36 #333333 #ffffff #ffffff
client.urgent #aa0000 y#990000 #ffffff
#client.focused #586e75 #586e75 #fdf6e3 #268bd2
#client.focused_inactive #073642 #073642 #93a1a1 #002b36
#client.unfocused #002b36 #002b36 #586e75 #002b36
#client.urgent #dc322f #dc322f #fdf6e3 #dc322f

79
config/etc/i3/py3status Normal file
View file

@ -0,0 +1,79 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
# output_format = "dzen2"
colors = true
interval = 1
}
order += "group network"
order += "disk /"
order += "dpms"
order += "load"
order += "volume_status"
order += "group tz"
group network {
format = "{output}"
button_next = 1
button_previous = 2
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
}
group tz {
format = "{output}"
button_next = 1
button_previous = 2
tztime local {
format = "GER %Y-%m-%d %H:%M:%S"
timezone = "Europe/Berlin"
}
tztime PRC {
format = "PRC %Y-%m-%d %H:%M:%S"
timezone = "Asia/Shanghai"
}
tztime UTC {
format = "UTC %Y-%m-%d %H:%M:%S"
timezone = "Etc/UTC"
}
tztime PST {
format = "PST %Y-%m-%d %H:%M:%S"
timezone = "PST8PDT"
}
uptime {
format = "{weeks}:{days}:{hours}:{minutes}:{seconds}"
}
}
volume_status {
button_up = 4
button_down = 5
button_mute = 2
}
load {
format = "%1min"
}
disk "/" {
format = "%avail"
}

View file

@ -0,0 +1,9 @@
ALT+LEFT add video-pan-x -0.01
ALT+DOWN add video-pan-y +0.01
ALT+UP add video-pan-y -0.01
ALT+RIGHT add video-pan-x +0.01
ALT++ add video-zoom +0.1
ALT+- add video-zoom -0.1
ALT+0 cycle video-unscaled
ALT+m vf add mirror
MOUSE_BTN1 quit

180
config/etc/mpv/mpv.conf Normal file
View file

@ -0,0 +1,180 @@
###########
# General #
###########
input-ipc-server=/tmp/mpvsocket # listen for IPC on this socket
load-stats-overlay=yes # use local stats.lua
#save-position-on-quit # handled by a script
fs
no-border # no window title bar
msg-module # prepend module name to log messages
msg-color # color log messages on terminal
#term-osd-bar # display a progress bar on the terminal
use-filedir-conf # look for additional config files in the directory of the opened file
#pause # no autoplay
keep-open # keep the player open when a file's end is reached
autofit-larger=100%x95% # resize window in case it's larger than W%xH% of the screen
#cursor-autohide-fs-only # don't autohide the cursor in window mode, only fullscreen
#input-media-keys=no # enable/disable OSX media keys
cursor-autohide=1000 # autohide the curser after 1s
prefetch-playlist=yes
load-unsafe-playlists=yes
force-seekable=yes
screenshot-format=png
screenshot-png-compression=9
screenshot-template='~/Desktop/%F (%P) %n'
hls-bitrate=max # use max quality for HLS streams
[ytdl-desktop]
profile-desc=cond:is_desktop()
ytdl-format=bestvideo[height<=?1080]+bestaudio/best
[ytdl-laptop]
profile-desc=cond:is_laptop()
ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9][protocol!=http_dash_segments]+bestaudio/best
[default]
#########c
# Cache #
#########
# Configure the cache to be really big (multiple GBs)
# We have a lot of memory, so why not use it for something
cache=auto
cache-default=4000000 # size in KB
cache-backbuffer=250000 # size in KB
demuxer-max-bytes=1147483647 # ~1 GiB in bytes
demuxer-seekable-cache=yes
#############
# OSD / OSC #
#############
osc=no
#osd-level=1 # enable osd and display --osd-status-msg on interaction
#osd-duration=2500 # hide the osd after x ms
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}${?frame-drop-count:${!frame-drop-count==0: Dropped: ${frame-drop-count}}}\n${?chapter:Chapter: ${chapter}}'
#osd-font='Source Sans Pro'
osd-font-size=32
osd-color='#CCFFFFFF' # ARGB format
osd-border-color='#DD322640' # ARGB format
#osd-shadow-offset=1 # pixel width for osd text and progress bar
#osd-bar-align-y=0 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
#osd-border-size=2 # size for osd text and progress bar
#osd-bar-h=2 # height of osd bar as a fractional percentage of your screen height
#osd-bar-w=60 # width of " " "
#############
# Subtitles #
#############
sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload
sub-file-paths-append=ass # search for external subs in these relative subdirectories
sub-file-paths-append=srt
sub-file-paths-append=sub
sub-file-paths-append=subs
sub-file-paths-append=subtitles
sub-file-paths-append=ENG
sub-file-paths-append=CHI
demuxer-mkv-subtitle-preroll # try to correctly show embedded subs when seeking
embeddedfonts=yes # use embedded fonts for SSA/ASS subs
sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases)
sub-ass-force-style=Kerning=yes # allows you to override style parameters of ASS scripts
sub-use-margins
sub-ass-force-margins
# the following options only apply to subtitles without own styling (i.e. not ASS but e.g. SRT)
sub-font="Source Sans Pro Semibold"
sub-font-size=36
sub-color="#FFFFFFFF"
sub-border-color="#FF262626"
sub-border-size=3.2
sub-shadow-offset=1
sub-shadow-color="#33000000"
sub-spacing=0.5
#############
# Languages #
#############
slang=enm,en,eng,de,deu,ger # automatically select these subtitles (decreasing priority)
alang=ja,jp,jpn,en,eng,de,deu,ger # automatically select these audio tracks (decreasing priority)
#########
# Audio #
#########
ao=pulse,alsa,jack
audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload
audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed
volume-max=200 # maximum volume in %, everything above 100 results in amplification
volume=70 # default volume, 100 = unchanged
audio-channels=stereo
################
# Video Output #
################
# Active VOs (and some other options) are set conditionally
# See here for more information: https://github.com/wm4/mpv-scripts/blob/master/auto-profiles.lua
# on_battery(), is_laptop() and is_dektop() are my own additional functions imported from scripts/auto-profiles-functions.lua
# Defaults for all profiles
profile=opengl-hq
vo=gpu
hwdec=vaapi-copy
vd-lavc-threads = 2
video-aspect=16:9
interpolation
video-sync=display-resample
deband=no
deinterlace=no
vf=lavfi="gradfun"
#scale=ewa_lanczossharp
scale=catmull_rom
cscale=spline64
dscale=mitchell
#dscale-param1=
#dscale-param2=
tscale=sinc
scale-antiring=0
cscale-antiring=0
dither-depth=auto
correct-downscaling=yes
sigmoid-upscaling=yes
opengl-early-flush=no
opengl-pbo=no # "yes" may cause mpv to crash: https://github.com/mpv-player/mpv/issues/4988
#icc-profile=~/.config/mpv/sufrace.icc
###################################
# Protocol Specific Configuration #
###################################
[protocol.https]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'
[protocol.http]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'
[extension.flac]
video-aspect=no
########################
# Plugin Configuration #
########################

View file

@ -0,0 +1,10 @@
########################
# /etc/youtube-dl.conf #
########################
--add-metadata
--all-subs
--embed-subs
--embed-thumbnail
--audio-quality 0
-f best
-o '%(playlist_index)s - %(title)s.%(ext)s'

27
config/fonts.nix Normal file
View file

@ -0,0 +1,27 @@
{ pkgs, config, ... }:
{
fonts = {
enableFontDir = true;
enableGhostscriptFonts = true;
fontconfig = {
enable = true;
ultimate.enable = true;
includeUserConf = false;
};
fonts = with pkgs; [
corefonts # Microsoft free fonts
dejavu_fonts
inconsolata # monospaced
noto-fonts-cjk
powerline-fonts
source-han-sans-japanese
source-han-sans-korean
source-han-sans-simplified-chinese
source-han-sans-traditional-chinese
symbola
ubuntu_font_family
wqy_microhei
];
};
}

13
config/locale.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
{
i18n = {
consoleKeyMap = "de";
defaultLocale = "en_US.UTF-8";
inputMethod = {
enabled = if config.services.xserver.enable then "fcitx" else null;
fcitx.engines = with pkgs.fcitx-engines; [ chewing mozc ];
};
};
}

16
config/networking.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
let
cfg = import ("/etc/nixos/machines/" + (builtins.replaceStrings ["\n"] [""] (builtins.readFile /etc/hostname)) + "/configuration.nix");
in {
networking = {
hostName = cfg.conf.networking.hostName;
# should probably add some etc file for this....
firewall = {
enable = true;
allowPing = cfg.conf.networking.firewall.allowPing;
allowedUDPPorts = cfg.conf.networking.firewall.allowedUDPPorts;
allowedTCPPorts = cfg.conf.networking.firewall.allowedTCPPorts;
};
};
}

21
config/nix.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
{
nix = {
maxJobs = 4;
buildCores = 1;
autoOptimiseStore = true;
sshServe.enable = false;
#sshServe.keys = [];
useSandbox = true;
extraOptions = ''
build-timeout = 86400 # 24 hours
'';
trustedBinaryCaches = [
"http://cache.nixos.org"
];
binaryCaches = [
"http://cache.nixos.org"
];
};
}

9
config/security.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, lib, pkgs, ... }:
{
security = {
audit.enable = true;
auditd.enable = true;
hideProcessInformation = true;
};
}

27
config/users.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }:
let
cfg = with lib; import ("/etc/nixos/machines/" + (replaceStrings ["\n"] [""] (readFile /etc/hostname)) + "/configuration.nix");
in {
users = {
mutableUsers = false;
users.derped = {
isNormalUser = true;
home = "/home/derped";
createHome = true;
description = "";
group = "derped";
extraGroups = [ "audio" "wheel" "network" ] ++ (if cfg.conf.networking.hostName != "Ophanim" then ["input" "cups" "lp"] else []);
uid = 1337;
shell = "/run/current-system/sw/bin/zsh";
passwordFile = "/secret/derped";
openssh.authorizedKeys.keyFiles = (if cfg.conf.networking.hostName != "Ophanim" then [] else [ "/secret/derped.pub" ]);
};
groups.derped = {
name = "derped";
gid = 1337;
members = [ "derped" ];
};
};
}

15
config/zsh.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
programs.zsh = {
enable = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
ohMyZsh = {
enable = true;
plugins = [ "git" "python" "man" ];
theme = "gentoo";
};
};
}