Skip to content

Instantly share code, notes, and snippets.

@domenkozar
Created February 18, 2014 14:19
Show Gist options
  • Save domenkozar/9071879 to your computer and use it in GitHub Desktop.
Save domenkozar/9071879 to your computer and use it in GitHub Desktop.
{ config, pkgs, ... }:
{
require = [
<nixos/modules/programs/virtualbox.nix>
./hardware.nix
./monitors.nix
# ./mailpile.nix
];
hardware.pulseaudio.enable = true;
networking.hostName = "borovnicke.kdoma.si";
networking.firewall = {
enable = false;
allowedTCPPorts = [
#80 # nginx
9102 # bacula-fd
];
};
networking.networkmanager.enable = true;
time.timeZone = "Europe/Ljubljana";
#nix.trustedBinaryCaches = [ "http://hydra.nixos.org/" ];
# build packages in chroot
nix.useChroot = true;
environment.etc."synergy-server.conf" = { text = ''
section: screens
borovnicke:
ananas:
end
section: links
borovnicke:
right = ananas
ananas:
left = borovnicke
end
''; };
#export NIX_PATH=/etc/nixos/borovnicke
environment.variables.EDITOR = pkgs.lib.mkOverride 0 "vim";
environment.variables.NIXOS_CONFIG = "/etc/nixos/borovnicke/configuration.nix";
programs.bash.enableCompletion = true;
environment.interactiveShellInit = ''
export PATH="$PATH:$HOME/bin"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/on \1/'
}
echo_tmux_title() {
printf "\033k`whoami`@`pwd`:\033\\"
}
PS1="$PS1\[\e[0;33;49m\]\$(parse_git_branch)\[\e[0;0m\]\$(echo_tmux_title)\n$ "
# append history instead of overwrite
shopt -s histappend
# big history, record everything
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=300000
export HISTFILESIZE=200000
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
#tmux attach || tmux new
'';
environment.systemPackages = with pkgs; [
# generally useful tools
links2
wgetpaste
pwgen
curl
vimHugeX
gitFull
gitAndTools.tig
subversion
mercurial
autojump # doesnt keep history
anki
sqlite
sshfsFuse
sshuttle
fuse
ncmpcpp
mplayer2
jwhois
dos2unix
gnumake
libevent
vifm
patchelf
bittorrentSync
reaverwps
unetbootin
ike
gcc
pythonPackages.tarman
sysstat
nixops
speedtest_cli
mosh
ngrok
# sys tools
rmlint
extundelete
hdparm
aircrackng
tmux
gnupg
wget
nmap
ncdu
telnet
unzip
unrar
psmisc
# X apps
dmenu
i3status
i3lock
i3minator
# TODO: make it a floating window so it's not annoying
p7zip
gmpc
pavucontrol
xarchive # TODO: add to xfce4 package
pa_applet
dunst # notifications
xfce.thunar_archive_plugin
arandr
wireshark
transmission_gtk
gnucash
gimp_2_8
calibre
skype
libreoffice
vlc
evince
wine
networkmanagerapplet
# TODO: changes hash all the time, didnt find an url that includes version name
#(pkgs.lib.overrideDerivation pkgs.teamviewer8 (attrs: {
#src = fetchurl { url = "http://download.teamviewer.com/download/teamviewer_linux.deb";
#sha256 = "1i1hi6s4nggcndfpp6rzr98cidh72gwx74kb70j84ib1l6lkb9zk"; };
#}))
# browsers
firefoxWrapper
chromiumWrapper
# games
spring
springLobby
teeworlds
#xonotic
# postgresql
pgadmin
# development
nodePackages.jshint
#nodePackages.ungit
phantomjs
# iphone
libimobiledevice
usbmuxd
# python stuff
pypy
cython
python27Full
python26Full
python33
python32
pythonPackages.virtualenv
pythonPackages.flake8
pythonPackages.pillow
pythonPackages.mrbob
pythonPackages.bpython
(pkgs.haskellPackages.ghcWithPackages (self : [
self.json
self.curl
]))
];
services = {
nixosManual.showManual = true;
locate.enable = true;
ntp.enable = true;
printing.enable = true;
postgresql.enable = true;
postgresql.package = pkgs.postgresql92;
synergy.server = {
enable = true;
autoStart = false;
screenName = "borovnicke";
address = "0.0.0.0";
};
bacula-fd = {
enable = true;
name = "borovnicke-fd";
director.ananas-dir.password = "foo";
};
#rabbitmq = {
#enable = true;
#};
redis = {
enable = true;
};
#dd-agent = {
# enable = true;
# api_key = "";
#};
#collectd.enable = true;
prey = {
enable = true;
apiKey = "aaa";
deviceKey = "aaa";
};
redshift = {
enable = true;
latitude = "46.055556";
longitude = "14.508333";
temperature.day = 5700;
temperature.night = 4600;
};
xserver = {
enable = true;
synaptics = {
enable = true;
twoFingerScroll = true;
additionalOptions = ''
Option "TapButton2" "3"
'';
};
xkbModel = "thinkpad60";
startGnuPGAgent = true;
startOpenSSHAgent = false;
windowManager.default = "i3";
windowManager.i3.enable = true;
desktopManager.default = "xfce";
desktopManager.xfce.enable = true;
#desktopManager.default = "gnome3";
#desktopManager.gnome3.enable = true;
displayManager.auto.user = "ielectric";
displayManager.auto.enable = true;
vaapiDrivers = [ pkgs.vaapiIntel ];
};
mesa.videoDrivers = [ "intel" ];
};
nixpkgs.config = {
firefox = {
jre = false;
enableGoogleTalkPlugin = true;
enableAdobeFlash = true;
};
chromium = {
jre = false;
enableGoogleTalkPlugin = true;
enableAdobeFlash = true;
};
};
#users.mutableUsers = false;
users.extraUsers.ielectric = {
name = "ielectric";
group = "ielectric";
uid = 499;
#uid = 1001;
createHome = true;
extraGroups = [ "wheel" "vboxusers" "networkmanager" ];
#passwordFile = "/etc/ielectricPassword";
home = "/home/ielectric";
shell = "/run/current-system/sw/bin/bash";
};
users.extraGroups.ielectric = {
gid = 498;
};
}
{ config, pkgs, ... }:
# auto configure monitors when you connect them
# xfce 4.12 will fix this, once released.
# TODO: save configuration state.
# https://github.com/wertarbyte/autorandr/blob/master/autorandr
let
autoconnect = pkgs.writeScript "automonitors.sh" ''
#!/bin/sh
export DISPLAY=:0.0
export XAUTHORITY=/home/ielectric/.Xauthority
XRANDR=${pkgs.xlibs.xrandr}/bin/xrandr
exec > /tmp/monitor 2>&1
$XRANDR --auto
'';
in {
powerManagement.resumeCommands = ''
${autoconnect}
'';
services.udev.extraRules = ''
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="${autoconnect}"
'';
}
{ config, pkgs, ... }:
{
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.version = 2;
boot.initrd.kernelModules = [ "dm-crypt" "ehci_hcd" "ahci" "ums_realtek" "usb_storage" ];
boot.initrd.luks.devices = [{name = "root"; device = "/dev/sda2"; allowDiscards = true; }];
boot.kernelModules = [ "kvm-intel" "tp_smapi" ];
boot.extraModulePackages = [ config.boot.kernelPackages.tp_smapi ];
boot.extraModprobeConfig = ''
#options iwlwifi 11n_disable=1 power_save=0
'';
# set kernel version
boot.kernelPackages = pkgs.linuxPackages_3_11;
boot.blacklistedKernelModules = [ "pcspkr" ];
#boot.extraKernelParams = [ "pcie_aspm=off" ];
hardware.enableAllFirmware = true;
#services.thinkfan.enable = true;
nix.maxJobs = 4;
fileSystems = [
{ mountPoint = "/"; label = "root"; options = "noatime"; }
{ mountPoint = "/boot"; label = "boot"; options = "noatime"; }
{ mountPoint = "/tmp"; device = "tmpfs"; fsType = "tmpfs"; options = "nosuid,nodev,relatime"; }
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment