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

229 lines
6 KiB
Nix

{ config, lib, pkgs, ... }:
rec {
nix.binaryCachePublicKeys = [
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
];
nix.binaryCaches = [
"https://cache.nixos.org"
"https://hydra.nixos.org"
];
nix.trustedBinaryCaches = [
"https://cache.nixos.org"
"https://hydra.nixos.org"
];
nix.daemonNiceLevel = 19;
nix.daemonIONiceLevel = 7;
# 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; }
];
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 = ''
'';
};
programs.bash = {
enableCompletion = true;
promptInit = ''
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\]"
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"
fi
fi
}
setPS1
'';
};
# 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";
};
time.timeZone = "Europe/Berlin";
#time.timeZone = "America/Los_Angeles";
# Services
services.gpm.enable = true;
services.openssh.enable = true;
services.openssh.permitRootLogin = "yes";
services.teamviewer.enable = false;
services.printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
services.pcscd.enable = true;
services.xserver = {
enable = true;
libinput.enable = true;
libinput.naturalScrolling = true;
videoDrivers = [ "qxl" "modesetting" ];
xkbVariant = "altgr-intl";
xkbOptions = "nodeadkeys,caps:swapescape";
windowManager.qtile.enable = true;
windowManager.default = "qtile";
desktopManager = {
gnome3.enable = true;
xterm.enable = true;
plasma5.enable = false;
};
displayManager = {
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 &
sessionCommands = ''
${pkgs.redshift}/bin/redshift-gtk -v -l 47.6691:9.1698 -t 7000:4500 -m randr &
${pkgs.networkmanagerapplet}/bin/nm-applet &
${pkgs.xorg.xsetroot}/bin/xsetroot -solid darkblue &
${pkgs.autorandr}/bin/autorandr -l common &
'';
};
};
services.udev.packages = [
pkgs.libu2f-host
pkgs.yubikey-personalization
];
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"
# Plantronics BackBeat PRO
SUBSYSTEM=="usb", ATTR{idVendor}=="047f", ATTR{idProduct}=="011a", GROUP="users", MODE="0777"
SUBSYSTEM=="usb", ATTR{idVendor}=="047f", ATTR{idProduct}=="fffe", GROUP="users", MODE="0777"
SUBSYSTEM=="usb", ATTR{idVendor}=="047f", ATTR{idProduct}=="0001", GROUP="users", MODE="0777"
''
;
services.packagekit.enable = true;
services.resolved.enable = false;
services.nix-serve.enable = true;
services.samba.enable = true;
services.samba.extraConfig = ''
client max protocol = SMB3
'';
# hardware related services
services.illum.enable = true;
hardware = {
bluetooth.enable = true;
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
support32Bit = true;
};
};
# virtualization
virtualisation = {
libvirtd.enable = true;
virtualbox.host.enable = true;
virtualbox.host.addNetworkInterface = true;
docker.enable = true;
};
# Activation scripts for impure set up of paths in /
system.activationScripts.bin = ''
echo "setting up /bin..."
ln -sfn ${pkgs.bash}/bin/bash /tmp/.binbash
mv /tmp/.binbash /bin/bash
'';
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
'';
}