2021-10-23 23:14:04 +00:00
|
|
|
|
{ config, pkgs, lib, self, ... }:
|
2021-06-14 19:44:38 +00:00
|
|
|
|
with lib;
|
|
|
|
|
let
|
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
imports = [
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
config = {
|
2021-10-23 23:14:04 +00:00
|
|
|
|
age.secrets.environment-secrets = {
|
|
|
|
|
file = "${self}/secrets/environment-secrets.age";
|
|
|
|
|
mode = "700";
|
|
|
|
|
owner = "teutat3s";
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-06 16:59:46 +00:00
|
|
|
|
pub-solar.virtualisation.enable = true;
|
2021-06-14 19:44:38 +00:00
|
|
|
|
|
|
|
|
|
# fix backlight for keyboard and brightness, adjust function key binding
|
2022-01-05 22:16:35 +00:00
|
|
|
|
boot.kernelParams = [ "acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=passive" "resume_offset=47366144" ];
|
2021-06-14 19:44:38 +00:00
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
2022-01-05 22:16:35 +00:00
|
|
|
|
boot.resumeDevice = "/dev/mapper/cryptroot";
|
|
|
|
|
|
|
|
|
|
systemd.sleep.extraConfig = ''
|
|
|
|
|
HibernateMode=shutdown
|
|
|
|
|
'';
|
2021-06-14 19:44:38 +00:00
|
|
|
|
|
|
|
|
|
hardware = {
|
|
|
|
|
cpu.intel.updateMicrocode = true;
|
|
|
|
|
facetimehd.enable = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking = import ./networking.nix;
|
|
|
|
|
|
|
|
|
|
security.pki.certificateFiles = [ ./consul-agent-ca.pem ];
|
|
|
|
|
|
|
|
|
|
services.unbound = import ./unbound.nix;
|
|
|
|
|
|
2022-01-05 22:16:35 +00:00
|
|
|
|
# Disable dedicated GPU, use integrated Intel GPU to save battery
|
|
|
|
|
# Set default brightness to 50%
|
|
|
|
|
# https://ubuntuforums.org/showthread.php?t=2409856
|
|
|
|
|
services.cron.systemCronJobs = [
|
|
|
|
|
"@reboot root ${pkgs.util-linux}/bin/rfkill block bluetooth"
|
|
|
|
|
"@reboot root ${pkgs.coreutils}/bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
|
|
|
|
|
"@reboot root ${pkgs.coreutils}/bin/echo 510 > /sys/class/backlight/gmux_backlight/brightness"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Increase console font size for HiDPI display
|
|
|
|
|
console = {
|
|
|
|
|
earlySetup = true;
|
|
|
|
|
font = lib.mkForce "ter-i32b";
|
|
|
|
|
packages = [ pkgs.terminus_font ];
|
|
|
|
|
};
|
2021-06-14 19:44:38 +00:00
|
|
|
|
|
|
|
|
|
# Thunderbolt tools
|
|
|
|
|
services.hardware.bolt.enable = true;
|
|
|
|
|
|
2022-01-05 22:16:35 +00:00
|
|
|
|
powerManagement = {
|
|
|
|
|
# Use new schedutil govenor
|
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/42330
|
|
|
|
|
# https://www.kernel.org/doc/html/v5.10/admin-guide/pm/cpufreq.html#schedutil
|
|
|
|
|
cpuFreqGovernor = lib.mkDefault "schedutil";
|
|
|
|
|
|
|
|
|
|
# brcmfmac being loaded during hibernation would inhibit a successful resume
|
|
|
|
|
# https://bugzilla.kernel.org/show_bug.cgi?id=101681#c116.
|
|
|
|
|
# Also brcmfmac could randomly crash on resume from sleep.
|
|
|
|
|
powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac";
|
|
|
|
|
powerDownCommands = lib.mkBefore "${pkgs.kmod}/bin/rmmod brcmfmac";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# change lid switch behaviour
|
|
|
|
|
#services.logind.lidSwitch = "hibernate";
|
|
|
|
|
|
2021-06-20 13:38:01 +00:00
|
|
|
|
# TLP for power management
|
|
|
|
|
services.tlp = {
|
|
|
|
|
enable = true;
|
|
|
|
|
settings = {
|
|
|
|
|
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
2022-01-05 22:16:35 +00:00
|
|
|
|
CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
|
2021-06-20 13:38:01 +00:00
|
|
|
|
CPU_BOOST_ON_AC = 1;
|
|
|
|
|
CPU_BOOST_ON_BAT = 0;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-14 19:44:38 +00:00
|
|
|
|
services.udev.extraRules =
|
|
|
|
|
# Disable XHC1 wakeup signal to avoid resume getting triggered some time
|
|
|
|
|
# after suspend. Reboot required for this to take effect.
|
2022-01-05 22:16:35 +00:00
|
|
|
|
lib.optionalString
|
|
|
|
|
(lib.versionAtLeast config.boot.kernelPackages.kernel.version "3.13")
|
|
|
|
|
''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"'';
|
2021-06-14 19:44:38 +00:00
|
|
|
|
|
|
|
|
|
services.printing.enable = true;
|
|
|
|
|
services.printing.drivers = [ pkgs.brlaser ];
|
|
|
|
|
|
|
|
|
|
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
|
|
|
|
# Custom device sway configs
|
|
|
|
|
xdg.configFile = mkIf psCfg.sway.enable {
|
|
|
|
|
"sway/config.d/10-applications.conf".source = ./.config/sway/config.d/applications.conf;
|
|
|
|
|
"sway/config.d/autostart.conf".source = ./.config/sway/config.d/autostart.conf;
|
|
|
|
|
"sway/config.d/10-custom-keybindings.conf".source = ./.config/sway/config.d/custom-keybindings.conf;
|
|
|
|
|
"sway/config.d/input-defaults.conf".source = ./.config/sway/config.d/input-defaults.conf;
|
|
|
|
|
"sway/config.d/screens.conf".source = ./.config/sway/config.d/screens.conf;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
users.users.teutat3s = {
|
|
|
|
|
extraGroups = [ "unbound" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# WLAN frequency compliance (e.g. check for radar with DFS)
|
2022-01-05 22:16:35 +00:00
|
|
|
|
#
|
|
|
|
|
# Radeon driver seems to work better than amdgpu with Radeon R9 M370X
|
2021-06-14 19:44:38 +00:00
|
|
|
|
hardware.firmware = with pkgs; [ wireless-regdb ];
|
|
|
|
|
boot.extraModprobeConfig = ''
|
|
|
|
|
options cfg80211 ieee80211_regdom="DE"
|
2022-01-05 22:16:35 +00:00
|
|
|
|
blacklist amdgpu
|
2021-06-14 19:44:38 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "21.05"; # Did you read the comment?
|
|
|
|
|
};
|
|
|
|
|
}
|