Skip to content

Instantly share code, notes, and snippets.

@zuigon
Last active December 5, 2020 17:51
Show Gist options
  • Save zuigon/cd7b224854ace8e116579b55a85eac26 to your computer and use it in GitHub Desktop.
Save zuigon/cd7b224854ace8e116579b55a85eac26 to your computer and use it in GitHub Desktop.
{ config, lib, ... }:
let
overlayLua = (import ./overlay_lua.nix);
overlayRofi = (import ./overlay_rofi.nix);
sources = import /home/b/.nixp/nix/sources.nix;
pkgs = import sources.nixpkgs {
config.allowUnfree = true;
overlays = [ overlayLua overlayRofi ];
};
in
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
#./hardware-configuration.nix
];
boot = {
# Use the systemd-boot EFI boot loader.
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
#loader.grub.configurationLimit = 10; # ??
#kernelPackages = pkgs.linuxPackagesFor pkgs.linux_testing;
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
#kernelModules = [ "kvm-intel" ];
initrd.kernelModules = [ "i915" ];
kernelParams = [
"ipv6.disable=1" "pcie_aspm=force" "iwlwifi.power_save=Y" "acpi_brightness=vendor"
"i915.enable_rc6=7" "i915.enable_psr=1" "i915.enable_fbc=1" "i915.lvds_downclock=1" "i915.semaphores=1"
"quiet" "vt.global_cursor_default=0" "vga=current"
];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ];
consoleLogLevel = 3;
extraModprobeConfig = ''
options snd-hda-intel model=laptop-dmic
'';
# clear screen
initrd.preLVMCommands = ''
printf '\033[2J'
printf '\e[3J'
'';
plymouth.enable = true;
cleanTmpDir = true;
};
# run on wake up
powerManagement.resumeCommands = ''
echo 1 > /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness
echo 1 > /sys/devices/platform/i8042/serio1/resetafter
'';
#${pkgs.alsaTools}/bin/hda-verb /dev/snd/hwC0D0 0x17 SET_CONNECT_SEL 1
#/run/current-system/sw/bin/ip ro add default via 192.168.1.250
# WiFi
services.connman = {
enable = true;
#package = "pkgs.connmanFull"
enableVPN = false;
extraFlags = [ "--nodnsproxy" ];
wifi.backend = "iwd";
};
# DNS-over-TLS
#services.stubby = {
# enable = true;
# listenAddresses = [ "127.0.0.1" ];
#};
services.dnsmasq = {
enable = true;
#servers = [ "1.1.1.1" ];
#servers = [ "1.1.1.2" ];
extraConfig = ''
domain-needed
bogus-priv
no-resolv
server=/lan/192.168.1.250
server=1.1.1.1
listen-address=127.0.0.1
bind-interfaces
'';
#resolv-file=/etc/resolv.personal
#addn-hosts=/etc/hosts.adblock
};
#services.unbound = {
# enable = true;
# forwardAdresses = [ "1.1.1.1" ];
#};
system.nssDatabases.hosts = lib.mkForce [ "files" "mymachines" "myhostname" "resolve" "[!UNAVAIL=return]" "dns" ];
networking = {
hostName = "x1";
usePredictableInterfaceNames = false;
useDHCP = false;
};
# Enable sound.
sound.enable = true;
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override {
enableHybridCodec = true;
};
};
hardware = {
opengl = {
enable = true;
extraPackages = with pkgs; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-media-driver
];
};
trackpoint = {
enable = true;
emulateWheel = true;
device = "TPPS/2 Elan TrackPoint";
sensitivity = 60;
speed = 255;
};
cpu.intel.updateMicrocode = true;
enableRedistributableFirmware = true;
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
#package = pulseaudioPkg;
extraConfig = ''
load-module module-alsa-sink device=hw:0,0 channels=4
load-module module-alsa-source device=hw:0,6 channels=4
'';
};
};
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# tty keymap
console = {
useXkbConfig = true;
earlySetup = true;
};
environment.variables = {
MOZ_USE_XINPUT2 = "1"; # firefox scroll fix
};
# Set your time zone.
time.timeZone = "Europe/Zagreb";
fonts = {
fonts = with pkgs; [
ibm-plex
fira-code
noto-fonts
noto-fonts-emoji
source-code-pro
weather-icons
jetbrains-mono
];
fontconfig = {
#dpi = 120;
#penultimate.enable = false;
defaultFonts = {
serif = [ "Tinos" ];
sansSerif = [ "Arimo" ];
monospace = [ "Cousine" ];
#serif = [ "Noto Serif" ];
#sansSerif = [ "Noto Sans" ];
#monospace = [ "Noto Mono" ];
};
};
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.vim.defaultEditor = true;
programs.light.enable = true;
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# TODO: use mkForce
networking.firewall.allowedTCPPorts = [ ];
networking.firewall.allowedUDPPorts = [ ];
networking.enableIPv6 = false;
# For redshift
location = {
latitude = 45.55;
longitude = 18.70;
};
systemd.services = {
systemd-udev-settle.enable = false;
musicUnmount = {
after = [ "network.target" ];
description = "Unmount music";
serviceConfig = {
Type = "oneshot";
ExecStart = ''umount -l /home/b/music 2> /dev/null'';
};
};
};
# stop stupid messages from pulseaudio, firefox, etc.
security.rtkit.enable = lib.mkForce false;
security.pam.services = {
login.fprintAuth = true;
xscreensaver.fprintAuth = true;
i3lock.fprintAuth = true;
};
services = {
fwupd.enable = true;
fprintd.enable = true;
logind.lidSwitch = "suspend";
#logind.lidSwitch = "ignore";
#physlock = {
# allowAnyUser = true;
# enable = true;
#};
redshift = {
enable = true;
temperature.night = 3200;
};
xserver = {
enable = true;
layout = "us";
xkbVariant = "colemak";
xkbOptions = "ctrl:nocaps";
libinput = {
enable = true;
naturalScrolling = true;
accelProfile = "adaptive";
#dev = "/dev/input/event6";
};
displayManager.lightdm = {
enable = true;
greeters.gtk = {
enable = true;
extraConfig = ''
active-monitor = 0
'';
theme.name = "Adwaita-dark";
};
#greeters.gtk.cursorTheme.size = 16;
};
#desktopManager = {
# xterm.enable = false;
# xfce = {
# enable = true;
# noDesktop = true;
# enableXfwm = false;
# };
#};
windowManager = {
bspwm = {
enable = true;
};
};
displayManager.defaultSession = "none+bspwm";
videoDrivers = [ "intel" ];
#Option "TearFree" "True"
deviceSection = ''
Option "AccelMethod" "sna"
Option "DRI" "2"
'';
};
tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "powersave";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_HWP_ON_BAT = "power";
PCIE_ASPM_ON_BAT = "powersupersave";
START_CHARGE_THRESH_BAT0 = "60";
STOP_CHARGE_THRESH_BAT0 = "85";
};
};
};
programs.zsh = {
enable = true;
promptInit = "";
interactiveShellInit = ''
HISTFILESIZE=500000
HISTSIZE=500000
export ZSH_COMPDUMP="$HOME/.cache/zcompdump-$HOST-$ZSH_VERSION"
#compinit -d $ZSH_COMPDUMP
# oh-my-zsh
export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh/
export FZF_BASE=$(fzf-share)
plugins=(git fzf)
ZSH_THEME="lambda"
COMPLETION_WAITING_DOTS="true"
source $ZSH/oh-my-zsh.sh
# leave bg jobs
setopt NO_HUP
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_DUPS
setopt INC_APPEND_HISTORY
'';
};
# @me
users.users.b = {
isNormalUser = true;
extraGroups = [ "wheel" "audio" "video" ];
uid = 1000;
shell = pkgs.zsh;
};
# System packages
environment.systemPackages = (import ./packages.nix {pkgs = pkgs;});
system.stateVersion = "20.03";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment