Skip to content

Instantly share code, notes, and snippets.

@rycee
Created September 17, 2017 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rycee/699ca43cb31e8cca4bd029edfd51552c to your computer and use it in GitHub Desktop.
Save rycee/699ca43cb31e8cca4bd029edfd51552c to your computer and use it in GitHub Desktop.
{ config, pkgs, lib, ... }:
let
secrets = import ./secrets.nix;
in
{
home.packages = [
pkgs.atool
pkgs.elinks
pkgs.fortune
pkgs.httpie
pkgs.iftop
pkgs.iotop
pkgs.moreutils
pkgs.mtr
pkgs.ncdu
pkgs.nethogs
pkgs.pv
pkgs.reptyr
pkgs.unzip
pkgs.zip
];
# Setup language. Want mostly American English but with some
# customization.
home.language = {
base = "en_US.UTF-8";
address = "sv_SE.UTF-8";
monetary = "sv_SE.UTF-8";
paper = "en_DK.UTF-8";
time = "en_DK.UTF-8";
};
home.keyboard = {
layout = "us,bg";
variant = ",phonetic";
options = [
"ctrl:nocaps"
"altwin:no_win"
"compose:menu"
"grp:shifts_toggle"
"grp_led:caps"
];
};
home.sessionVariables = {
# Don't let python spew pyc-files all over.
PYTHONDONTWRITEBYTECODE = "foo";
# Prepare for Java.
MAVEN_OPTS = "-Xmx1g -XX:+CMSClassUnloadingEnabled";
# _JAVA_OPTIONS = "-Dawt.useSystemAAFontSettings=lcd";
_JAVA_AWT_WM_NONREPARENTING = "1"; # I prefer non-gray windows.
EDITOR = "emacs";
GS_OPTIONS = "-sPAPERSIZE=a4";
# Add hunspell dictionaries under NixOS.
DICPATH = "\${HOME}/.nix-profile/share/hunspell";
# In GTK+ programs I always want XIM.
GTK_IM_MODULE = "xim";
# Use GTK+ style in QT.
QT_STYLE_OVERRIDE = "gtk";
};
# Some extra dotfiles that don't have their own modules.
home.file = lib.mkMerge [
{
".ghci".source = dotfiles/ghci;
".inputrc".source = dotfiles/inputrc;
".screenrc".source = dotfiles/screenrc;
}
(lib.mkIf config.programs.emacs.enable {
".emacs.d/init.el".source = dotfiles/emacs/init.el;
".emacs.d/sv-kalender.el".source = dotfiles/emacs/sv-kalender.el;
".emacs.d/nxml-schemas".source = dotfiles/emacs/nxml-schemas;
})
];
gtk = {
fontName = "DejaVu Sans 8";
themeName = "Vertex-Dark";
iconThemeName = "Tango";
gtk2.extraConfig = ''
gtk-recent-files-max-age = 0
gtk-cursor-blink = 0
# To make Eclipse a bit more compact. In particular, the tabs.
style "compact-toolbar" {
GtkToolbar::internal-padding = 0
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
}
class "GtkToolbar" style "compact-toolbar"
'';
gtk3.extraConfig = {
gtk-recent-files-max-age = 0;
gtk-recent-files-limit = 0;
gtk-cursor-blink = false;
gtk-application-prefer-dark-theme = true;
};
gtk3.extraCss = ''
@binding-set NoKeyboardNavigation {
unbind "<shift>F10"
}
* {
gtk-key-bindings: NoKeyboardNavigation
}
GtkToolbar#swt-toolbar-flat {
padding: 0px;
}
'';
};
programs.home-manager.enable = true;
programs.info.enable = true;
programs.htop = {
enable = true;
hideThreads = true;
};
# Disabled by default since I don't want it everywhere.
programs.eclipse = {
enable = lib.mkDefault false;
jvmArgs = [ "-Xmx1024m" ];
plugins = with pkgs.eclipses.plugins; [
acejump
autodetect-encoding
bytecode-outline
checkstyle
color-theme
eclemma
emacsplus
findbugs
jdt
testng
yedit
];
};
programs.emacs = {
enable = lib.mkDefault false;
extraPackages = epkgs: [
epkgs.ac-haskell-process
epkgs.ac-octave
epkgs.ac-php
epkgs.ace-window
epkgs.ag # Silver searcher.
epkgs.auctex
epkgs.auto-complete
epkgs.auto-complete-nxml
epkgs.avy
epkgs.back-button
epkgs.buffer-move
epkgs.color-theme-sanityinc-tomorrow
epkgs.diminish
epkgs.ebib
epkgs.fill-column-indicator
epkgs.flx-ido
epkgs.flycheck
epkgs.flycheck-haskell
epkgs.flycheck-plantuml
epkgs.flycheck-tip
epkgs.ggtags
epkgs.git-messenger
epkgs.haskell-mode
epkgs.ido-ubiquitous
epkgs.magit
epkgs.markdown-mode
epkgs.melpaPackages.wc-mode
epkgs.melpaStablePackages.nyan-mode
epkgs.multiple-cursors
epkgs.nix-mode
epkgs.org
epkgs.org-ac
epkgs.pandoc-mode
epkgs.pdf-tools
epkgs.php-mode
epkgs.plantuml-mode
epkgs.projectile
epkgs.protobuf-mode
epkgs.smart-mode-line
epkgs.smart-tabs-mode
epkgs.smartparens
epkgs.smex
epkgs.string-inflection
epkgs.systemd
epkgs.tt-mode
epkgs.undo-tree
epkgs.use-package
epkgs.writeroom-mode
epkgs.yaml-mode
epkgs.yasnippet
];
};
programs.firefox = {
package = pkgs.firefox-esr;
enableAdobeFlash = true;
enableGoogleTalk = true;
};
programs.texlive = {
enable = lib.mkDefault false;
extraPackages = tpkgs: {
inherit (tpkgs)
algorithms
babel-swedish
bera # E.g. the beramono font.
collection-fontsrecommended
collection-genericrecommended
collection-latexrecommended
collection-xetex
hyphen-swedish
mathdesign
moderncv
qrcode
relsize
ticket
wrapfig
;
};
};
programs.git = {
userName = "Robert Helgesson";
signing.key = "9E65DC86";
signing.signByDefault = true;
aliases = {
co = "checkout";
snapshot = "!git stash save \"snapshot: $(date)\" && git stash apply \"stash@{0}\"";
};
extraConfig = ''
[hub]
username = rycee
oauthtoken = ${secrets.gitHubOAuthToken}
'';
};
programs.lesspipe.enable = true;
programs.bash = {
enable = true;
enableAutojump = true;
shellAliases = {
# Make life a bit less stressful.
mv = "mv -i";
cp = "cp -i";
rm = "rm -I";
ls = "ls --color=auto";
l = "ls -l";
ll = "ls -Al";
".." = "cd ..";
"..." = "cd ../..";
x = "exit";
e = "$EDITOR";
ew = "emacs -nw";
# Colorific grep.
grep = "grep --color=auto";
egrep = "egrep --color=auto";
# Colorific cat.
ccat = "${pkgs.pythonPackages.pygments}/bin/pygmentize -O bg=dark -g";
# Avoid eating the whole system on space leak.
ghci = "ghci +RTS -M500m -RTS";
# A nice command to generate PDF from Markdown file.
pandoc2pdf = "pandoc -t latex --latex-engine=xelatex -V papersize=a4paper -V mainfont=\"TeX Gyre Pagella\"";
# Shortcut for a universal open command.
o = "${pkgs.mimeo}/bin/mimeo";
tsocksl = "TSOCKS_CONF_FILE=~/.tsocks.conf tsocks";
# Shorter trash command.
t = "trash";
};
historyControl = [ "ignoredups" "ignorespace" ];
historyIgnore = [ "l" "x" "fg" "ls" "cd" ".." ];
profileExtra = ''
# Set a soft memory limit on processes to 3 GB.
ulimit -S -m 3000000
'';
initExtra = ''
# Print working directory with truncation if too long.
function shortPwd()
{
MAXLENGTH=25
DIR=''${PWD/$HOME/\~}
PREFIX=''${DIR:0:1}
OFFSET=$(( ''${#DIR} - MAXLENGTH ))
if [ $OFFSET -gt 1 ] ; then
SUFFIX=''${DIR:$OFFSET}
FILL="…"
else
SUFFIX=''${DIR:1}
FILL=""
fi
echo -n "$PREFIX$FILL$SUFFIX"
}
# Visualize exit code.
function exitCodeViz()
{
exit=$?
if [[ $exit != 0 ]] ; then
echo -ne " (✗ $exit)"
fi
}
export PS1='\[\033[38;5;64m\]\u@\h\[\033[01;31m\]$(exitCodeViz)\[\033[00m\]:\[\033[38;5;143m\]$(shortPwd)\[\033[00m\]\$ '
eval "$(dircolors -b)"
# Colorific GCC.
export GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"
# Colorific less.
export LESS="-R -X"
# Colorific darcs whatsnew.
export DARCS_DO_COLOR_LINES=1
# Must C-d at least thrice to close shell.
export IGNOREEOF=2
# A colorific less. This needs to be a function since the
# arguments have to be put in the right place.
function cless() {
pygmentize -O bg=dark -g "$@" | less
}
'';
};
services.gpg-agent = {
defaultCacheTtl = 1800;
enableSshSupport = true;
};
services.redshift = {
# temperature.day = 6000;
# temperature.night = 3800;
# Lund, Sweden
latitude = "55.704";
longitude = "13.195";
# # Sofia, Bulgaria.
# latitude = "42.698";
# longitude = "23.323";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment