infra/nixos-configuration/steveej-laptop/system.nix

218 lines
5.5 KiB
Nix
Raw Normal View History

2015-10-23 01:26:53 +02:00
{ config, lib, pkgs, ... }:
rec {
nix.binaryCachePublicKeys = [
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
];
2017-01-18 16:11:26 +01:00
nix.binaryCaches = [
2015-10-23 01:26:53 +02:00
"https://cache.nixos.org"
"https://hydra.nixos.org"
2015-10-23 01:26:53 +02:00
];
2017-01-18 16:11:26 +01:00
nix.trustedBinaryCaches = [
2015-10-23 01:26:53 +02:00
"https://cache.nixos.org"
"https://hydra.nixos.org"
2015-10-23 01:26:53 +02:00
];
nix.daemonNiceLevel = 19;
nix.daemonIONiceLevel = 7;
2015-10-23 01:26:53 +02:00
# The NixOS release to be compatible with for stateful data such as databases.
# system.stateVersion = "unstable";
networking.hostName = "steveej-laptop"; # Define your hostname.
networking.firewall.enable = false;
networking.networkmanager = {
enable = true;
unmanaged = [
"interface-name:veth*"
"interface-name:virbr*"
"interface-name:br*"
"interface-name:*vbox*"
"interface-name:*cni*"
];
};
networking.bridges."virbr1".interfaces = [];
networking.interfaces."virbr1".ip4 = [
{ address = "10.254.254.254"; prefixLength = 24; }
];
2017-05-04 13:56:14 +02:00
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
syntaxHighlighting.patterns = {};
ohMyZsh = {
enable = true;
theme = "tjkirch";
};
promptInit = ''
autoload -U promptinit
promptinit
ZSH_THEME_GIT_PROMPT_PREFIX='@ '
PROMPT='%F{%(!.red.green)}%n%f@%m %(?.%F{green}%f.%F{red} ($?%))%f %F{blue}%~%f %F{magenta}$(git_prompt_info)%f
%_%F{%(!.red.green)}$(prompt_char)%f '
RPROMPT=""
'';
interactiveShellInit = ''
'';
2017-05-04 13:56:14 +02:00
};
2015-10-23 01:26:53 +02:00
programs.bash = {
enableCompletion = true;
promptInit = ''
2016-05-23 00:35:47 +02:00
function exitstatus() {
if [[ $? -eq 0 ]]; then
printf ''
else
printf ''
fi
}
function nixshellEval {
if [[ "$1" != "" ]]; then
printf "»$1« "
fi
}
function setPS1 {
if test "$TERM" != "dumb"; then
# Provide a nice prompt.
BLUE="\[\033[0;34m\]"
RED="\[\033[1;31m\]"
GREEN="\[\033[1;32m\]"
NO_COLOR="\[\033[0m\]"
2015-10-23 01:26:53 +02:00
2016-05-23 00:35:47 +02:00
PROMPT_COLOR=$RED
let $UID && PROMPT_COLOR=$GREEN
PS1="$PROMPT_COLOR\u$NO_COLOR@\h \$(exitstatus) \$(nixshellEval $1)$BLUE\w$NO_COLOR\n$PROMPT_COLOR\\$ $NO_COLOR"
if test "$TERM" = "xterm"; then
PS1="\[\033]2;\h:\u:\w\007\]$PS1"
2015-10-23 01:26:53 +02:00
fi
2016-05-23 00:35:47 +02:00
fi
}
setPS1
'';
2015-10-23 01:26:53 +02:00
};
# Package configuration
environment.systemPackages = with pkgs; [
];
environment.sessionVariables = {
EDITOR = "vim";
NIXPKGS_ALLOW_UNFREE = "1";
# Don't create .pyc files.
PYTHONDONTWRITEBYTECODE = "1";
};
environment.etc."lvm/lvm.conf".text = ''
devices {
issue_discards = 1
}
'';
# Fonts, I18N, Date ...
fonts = {
enableCoreFonts = true;
};
i18n = {
consoleFont = "lat9w-16";
defaultLocale = "en_US.UTF-8";
};
2016-08-31 17:44:30 +02:00
time.timeZone = "Europe/Berlin";
#time.timeZone = "America/Los_Angeles";
2015-10-23 01:26:53 +02:00
# Services
services.gpm.enable = true;
services.openssh.enable = true;
services.openssh.permitRootLogin = "yes";
services.teamviewer.enable = false;
2015-10-23 01:26:53 +02:00
services.printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
services.pcscd.enable = true;
2015-10-23 01:26:53 +02:00
services.xserver = {
2018-01-26 12:48:31 +01:00
enable = true;
libinput.enable = true;
libinput.naturalScrolling = true;
videoDrivers = [ "qxl" "modesetting" ];
2018-01-26 12:48:31 +01:00
xkbVariant = "altgr-intl";
xkbOptions = "nodeadkeys,caps:swapescape";
2015-10-23 01:26:53 +02:00
windowManager.qtile.enable = true;
windowManager.default = "qtile";
desktopManager = {
2018-01-26 12:48:31 +01:00
gnome3.enable = true;
xterm.enable = true;
2018-01-26 12:48:31 +01:00
plasma5.enable = false;
2015-10-23 01:26:53 +02:00
};
displayManager = {
2018-01-26 12:48:31 +01:00
gdm.enable = true;
gdm.wayland = false;
# ${pkgs.xautolock}/bin/xautolock -time 10 -locker slimlock &
# ${pkgs.redshift}/bin/redshift-gtk -v -b 1.0:1.0 -l 47.6691:9.1698 -t 7000:4500 -m randr &
2016-06-28 11:35:43 -07:00
sessionCommands = ''
2018-01-26 12:48:31 +01:00
${pkgs.redshift}/bin/redshift-gtk -v -l 47.6691:9.1698 -t 7000:4500 -m randr &
2016-06-28 11:35:43 -07:00
${pkgs.networkmanagerapplet}/bin/nm-applet &
2018-01-26 12:48:31 +01:00
${pkgs.xorg.xsetroot}/bin/xsetroot -solid darkblue &
${pkgs.autorandr}/bin/autorandr -l common &
2016-06-28 11:35:43 -07:00
'';
2015-10-23 01:26:53 +02:00
};
};
services.udev.packages = [
2018-01-26 12:48:31 +01:00
pkgs.libu2f-host
pkgs.yubikey-personalization
];
2015-10-23 01:26:53 +02:00
services.udev.extraRules = ''
# OnePlusOne
ATTR{idVendor}=="05c6", ATTR{idProduct}=="6764", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", TAG+="uaccess"
ATTR{idVendor}=="05c6", ATTR{idProduct}=="6765", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", TAG+="uaccess"
2017-01-18 16:11:26 +01:00
''
;
2015-10-23 01:26:53 +02:00
2018-01-26 12:48:31 +01:00
services.packagekit.enable = true;
2016-08-31 17:45:03 +02:00
services.resolved.enable = false;
2016-06-28 11:36:11 -07:00
# hardware related services
2018-01-26 12:48:31 +01:00
services.illum.enable = true;
2015-10-23 01:26:53 +02:00
hardware = {
bluetooth.enable = true;
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
support32Bit = true;
};
};
2016-06-28 11:36:11 -07:00
# virtualization
virtualisation = {
libvirtd.enable = true;
2016-08-31 17:44:04 +02:00
virtualbox.host.enable = true;
virtualbox.host.addNetworkInterface = true;
};
2016-08-09 22:50:23 +02:00
2018-01-26 12:48:31 +01:00
# Activation scripts for impure set up of paths in /
2016-08-09 22:50:23 +02:00
system.activationScripts.bin = ''
echo "setting up /bin..."
ln -sfn ${pkgs.bash}/bin/bash /tmp/.binbash
mv /tmp/.binbash /bin/bash
'';
2018-01-26 12:48:31 +01:00
system.activationScripts.etcX11sessinos = ''
echo "setting up /etc/X11/sessions..."
mkdir -p /etc/X11
[[ ! -L /etc/X11/sessions ]] || rm /etc/X11/sessions
ln -sf ${config.services.xserver.displayManager.session.desktops} /etc/X11/sessions
'';
2015-10-23 01:26:53 +02:00
}