nix: beautify configuration

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay Pai 2018-08-01 18:40:05 +05:30
parent a126f9c9b6
commit d1701fe1c2
Signed by: thunderbottom
GPG Key ID: 75507BE256F40CED
3 changed files with 231 additions and 196 deletions

View File

@ -6,8 +6,9 @@ bspc monitor -d 1 2 3 4 5 6
bspc config border_width 4
bspc config window_gap 16
bspc config focused_border_color \#f0f0f0
bspc config normal_border_color \#151515
bspc config presel_feedback_colo '#EEEEEE'
bspc config focused_border_color '#EEEEEE'
bspc config normal_border_color '#032C36'
bspc config split_ratio 0.50
bspc config borderless_monocle true

View File

@ -6,49 +6,59 @@
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.cleanTmpDir = true;
boot.consoleLogLevel = 3;
boot.extraModprobeConfig = ''
options snd_hda_intel power_save=1
options i915 enable_rc6=1 enable_fbc=1 fastboot=1 lvds_downclock=1
'';
boot.kernelParams = [
"quiet"
"intremap=off"
"elevator=deadline"
];
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
cleanTmpDir = true;
consoleLogLevel = 3;
extraModprobeConfig = ''
options snd_hda_intel power_save=1
options i915 semaphores=1 enable_rc6=1 enable_fbc=1 fastboot=1
'';
boot.kernel.sysctl = {
"vm.swappiness" = 5;
"vm.vfs_cache_pressure" = 50;
"vm.dirty_background_ratio" = 25;
"vm.dirty_background_bytes" = 0;
"vm.dirty_ratio" = 75;
"vm.dirty_bytes" = 0;
"vm.dirty_expire_centisecs" = 6000;
"vm.dirty_writeback_centisecs" = 2000;
"ipv6.disable" = 1;
kernelParams = [
"quiet"
"intremap=off"
"elevator=deadline"
];
kernel.sysctl = {
"vm.swappiness" = 5;
"vm.vfs_cache_pressure" = 50;
"vm.dirty_background_ratio" = 25;
"vm.dirty_background_bytes" = 0;
"vm.dirty_ratio" = 75;
"vm.dirty_bytes" = 0;
"vm.dirty_expire_centisecs" = 6000;
"vm.dirty_writeback_centisecs" = 2000;
"ipv6.disable" = 1;
};
blacklistedKernelModules = ["uvcvideo" "wl" "bluetooth" "btusb"];
};
boot.blacklistedKernelModules = [ "uvcvideo" "wl" "bluetooth" "btusb" ];
networking = {
hostName = "tuxbox";
wireless.enable = true;
enableB43Firmware = true;
extraHosts = ''
127.0.0.1
'';
# Networking configuration.
networking.hostName = "tuxbox"; # Define your hostname.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.enableB43Firmware = true;
networking.extraHosts = ''
127.0.0.1 tuxbox
'';
networking.enableIPv6 = false;
networking.dhcpcd.persistent = true;
networking.dhcpcd.extraConfig = ''
noarp
ipv4only
noipv6
'';
enableIPv6 = false;
dhcpcd = {
persistent = true;
extraConfig = ''
noarp
ipv4only
noipv6
'';
};
};
# Select internationalisation properties.
@ -58,173 +68,198 @@
defaultLocale = "en_US.UTF-8";
};
# Set your time zone.
time.timeZone = "Asia/Kolkata";
# Fonts
fonts.enableFontDir = true;
fonts.enableCoreFonts = true;
fonts.enableGhostscriptFonts = true;
fonts = {
enableFontDir = true;
enableCoreFonts = true;
enableGhostscriptFonts = true;
fonts = with pkgs; [
anonymousPro
corefonts
dejavu_fonts
font-droid
freefont_ttf
google-fonts
inconsolata
liberation_ttf
source-code-pro
terminus_font
ttf_bitstream_vera
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
vim
git
acpi
screen
zip
unzip
which
file
ntfs3g
sshfsFuse
curl
dunst
file
git
ntfs3g
screen
sshfsFuse
termite
unzip
vim
wget
which
zip
];
# Use sandbox
nix.useSandbox = true;
# Allow non-free packages
nixpkgs.config.allowUnfree = true;
# Enable Thunderbolt module.
nixpkgs.config.packageOverrides = pkgs: {
linux = pkgs.linuxPackages.override {
extraConfig = ''
THUNDERBOLT m
'';
nixpkgs = {
config = {
allowUnfree = true;
packageOverrides = pkgs: {
linux = pkgs.linuxPackages.override {
extraConfig = ''
THUNDERBOLT m
'';
};
};
};
};
# disable udev-settle
systemd.services.systemd-udev-settle.enable = false;
# Enable power management.
powerManagement.enable = true;
services.tlp.enable = true;
services.tlp.extraConfig = ''
USB_BLACKLIST_PHONE=1
'';
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.bash.enableCompletion = true;
programs.bash.shellAliases = {
ls = "ls --color=auto";
la = "ls -la";
vim = "nvim";
weessh = "ssh pi@smolboye.nerdpol.ovh -p11532 -t screen -D -RR weechat weechat";
systemd = {
services.systemd-udev-settle.enable = false;
user.services."dunst" = {
enable = true;
description = "";
wantedBy = [ "default.target" ];
serviceConfig = {
Restart = "always";
RestartSec = 2;
ExecStart = "${pkgs.dunst}/bin/dunst";
};
};
};
# programs.mtr.enable = true;
programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# Disable nscd
services.nscd.enable = false;
programs = {
bash = {
enableCompletion = true;
shellAliases = {
ls = "ls --color=auto";
la = "ls -la";
vim = "nvim";
weessh = "ssh pi@smolboye.nerdpol.ovh -p11532 -t screen -D -RR weechat weechat";
};
};
# Enable upower
services.upower.enable = true;
gnupg.agent = {
enable = true; enableSSHSupport = true;
};
# Enable fstrim.
services.fstrim.enable = true;
light.enable = true;
kbdlight.enable = true;
};
# Enable openssh daemon.
services.openssh.enable = true;
services.openssh.ports = [ 22 ];
powerManagement.enable = true;
# Enable acpid.
services.acpid.enable = true;
services.logind.lidSwitchDocked = "suspend";
services.logind.extraConfig = ''
HandlePowerKey=suspend
'';
# Enable mbpfan.
services.mbpfan.enable = true;
# Enable thermald.
services.thermald.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable microcode updates.
hardware.cpu.intel.updateMicrocode = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true;
# Bluetooth configuration.
hardware.bluetooth.enable = false;
# OpenGL VAAPI
hardware.opengl.extraPackages = [ pkgs.vaapiIntel pkgs.vaapiVdpau ];
# Enable the X11 windowing system.
# services.xserver.autorun = false;
services.xserver.enable = true;
services.xserver.layout = "us";
services.xserver.videoDrivers = [ "intel" ];
services.xserver.xkbVariant = "mac";
services.xserver.xkbOptions = "terminate:ctrl_alt_bksp, ctrl:nocaps";
# Libinput configuration.
services.xserver.libinput.enable = true;
services.xserver.libinput.accelSpeed = "0.6";
services.xserver.libinput.disableWhileTyping = true;
services.xserver.libinput.naturalScrolling = true;
services.xserver.libinput.tappingDragLock = false;
services.xserver.libinput.additionalOptions = ''
Option "TappingDrag" "off"
'';
# Display manager and desktop manager.
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.setupScript = ''
${pkgs.xorg.xrandr}/bin/xrandr --output LVDS1 --pos 640x1080 --rotate normal
'';
#services.xserver.displayManager.sddm.autoLogin = {
# enable = true;
# user = "smolboye";
#};
services.xserver.windowManager.bspwm.enable = true;
services.xserver.windowManager.bspwm.configFile = "/etc/nixos/bspwmrc";
services.xserver.windowManager.bspwm.sxhkd.configFile = "/etc/nixos/sxhkdrc";
services.xserver.desktopManager.default = "none";
services.xserver.windowManager.default = "bspwm";
services.xserver.desktopManager.xterm.enable = false;
# Monitor configuration
services.xserver.xrandrHeads = [
{
output = "HDMI1";
monitorConfig = ''
Modeline "2560x1080_52.00" 196.50 2560 2712 2976 3392 1080 1083 1093 1115 -hsync +vsync
Option "PreferredMode" "2560x1080_52.00"
services = {
tlp = {
enable = true;
extraConfig = ''
USB_BLACKLIST_PHONE=1
'';
}
];
};
nscd.enable = false;
upower.enable = true;
fstrim.enable = true;
openssh = {
enable = true;
ports = [ 22 ];
};
acpid.enable = true;
logind = {
lidSwitchDocked = "suspend";
extraConfig = ''
HandlePowerKey=suspend
'';
};
mbpfan.enable = true;
thermald.enable = true;
xserver = {
enable = true;
layout = "us";
videoDrivers = [ "intel" ];
xkbVariant = "mac";
xkbOptions = "ctrl:nocaps";
libinput = {
enable = true;
accelSpeed = "0.6";
disableWhileTyping = true;
naturalScrolling = true;
tappingDragLock = false;
additionalOptions = ''
Option "TappingDrag" "off"
'';
};
displayManager.sddm = {
enable = true;
setupScript = ''
${pkgs.xorg.xrandr}/bin/xrandr --output LVDS1 --pos 640x1080 --rotate normal
'';
};
windowManager = {
default = "bspwm";
bspwm = {
enable = true;
configFile = "/etc/nixos/bspwmrc";
sxhkd.configFile = "/etc/nixos/sxhkdrc";
};
};
desktopManager = {
default = "none";
xterm.enable = false;
};
xrandrHeads = [
{
output = "HDMI1";
monitorConfig = ''
Modeline "2560x1080_52.00" 196.50 2560 2712 2976 3392 1080 1083 1093 1115 -hsync +vsync
Option "PreferredMode" "2560x1080_52.00"
'';
}
];
};
};
hardware = {
cpu.intel.updateMicrocode = true;
pulseaudio = {
enable = true;
support32Bit = true;
};
bluetooth.enable = false;
opengl.extraPackages = [ pkgs.vaapiIntel pkgs.vaapiVdpau ];
};
# Enable udev rule.
# services.udev.extraRules = ''
# KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/smolboye/.Xauthority", RUN+="/etc/nixos/bspwmrc"
# '';
# Enable sudo.
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = true;
security.sudo = {
enable = true;
wheelNeedsPassword = true;
};
# User account configuration.
users.extraUsers.smolboye = {
isNormalUser = true;
uid = 1000;
@ -240,21 +275,20 @@
home = "/home/smolboye";
};
# Mount filesystems.
fileSystems."/home/smolboye/hdd" =
{
device = "/dev/disk/by-uuid/02b58034-d250-4a2d-b854-484c399c687e";
fsType = "ext4";
};
fileSystems = {
"/home/smolboye/hdd" = {
device = "/dev/disk/by-uuid/02b58034-d250-4a2d-b854-484c399c687e";
fsType = "ext4";
};
fileSystems."/home/smolboye/seagate" =
{
device = "${pkgs.sshfsFuse}/bin/sshfs#pi@192.168.0.107:/home/pi/seagate";
fsType = "fuse";
options = [ "noauto" "_netdev" "x-systemd.automount" "port=22693" "user" "allow_other"
"noatime" "follow_symlinks" "IdentityFile=/home/smolboye/.ssh/id_rsa"
"reconnect" "uid=1000" "gid=1000"
];
"/home/smolboye/seagate" = {
device = "${pkgs.sshfsFuse}/bin/sshfs#pi@192.168.0.107:/home/pi/seagate";
fsType = "fuse";
options = [ "noauto" "_netdev" "x-systemd.automount" "port=22693" "user" "allow_other"
"noatime" "follow_symlinks" "IdentityFile=/home/smolboye/.ssh/id_rsa"
"reconnect" "uid=1000" "gid=1000"
];
};
};
# This value determines the NixOS release with which your system is to be

View File

@ -78,13 +78,13 @@ XF86Audio{Raise,Lower}Volume
XF86AudioMute
pactl set-sink-mute 0 toggle
XF86MonBrightnessUp
xbacklight -inc 10
light -A 10
XF86MonBrightnessDown
xbacklight -dec 10
light -U 10
XF86KbdBrightnessUp
/etc/nixos/kbdbacklight up
kbdlight up 10
XF86KbdBrightnessDown
/etc/nixos/kbdbacklight down
kbdlight down 10
XF86AudioPlay
playerctl play-pause
XF86AudioNext