infra/configuration/steveej-laptop/system.nix

171 lines
4.2 KiB
Nix

{ config, lib, pkgs, ... }:
{
nix.binaryCachePublicKeys = [ "hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" ];
nix.binaryCaches = [
"https://cache.nixos.org"
"http://hydra.nixos.org"
];
nix.trustedBinaryCaches = [
"https://cache.nixos.org"
"http://hydra.nixos.org"
];
# 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*"
];
};
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; [
xorg.xmodmap
];
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 = true;
services.printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
services.etcd.enable = true;
services.xserver = {
synaptics.enable = false;
# synaptics.palmDetect = true;
# synaptics.horizEdgeScroll = true;
# synaptics.horizontalScroll = true;
# synaptics.twoFingerScroll = true;
# synaptics.vertEdgeScroll = true;
videoDrivers = [ "qxl" "intel" ];
enable = true;
layout = "us";
windowManager.qtile.enable = true;
windowManager.default = "qtile";
desktopManager = {
xterm.enable = false;
xfce.enable = true;
};
displayManager = {
slim = {
enable = true;
theme = pkgs.fetchFromGitHub {
owner = "steveej";
repo = "nixos-slim-theme";
rev = "eec04a624113db835f2b5960d305e242da9dbc2a";
sha256 = "146zmr5rzwxq5mz6b7108a3ksf3nvqxrr8bvi82jsw6xqji4i5f5";
};
autoLogin = true;
defaultUser = "steveej";
};
sessionCommands = ''
xscreensaver -no-splash &
${pkgs.networkmanagerapplet}/bin/nm-applet &
$(sleep 2; xmodmap /home/steveej/.Xmodmap) &
'';
};
};
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"
'';
services.resolved.enable = true;
# hardware related services
hardware = {
bluetooth.enable = true;
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
support32Bit = true;
};
};
# virtualization
virtualisation.libvirtd.enable = true;
virtualisation.virtualbox.host.enable = true;
virtualisation.virtualbox.host.addNetworkInterface = true;
}