system: add config for networking and hardware
This commit is contained in:
parent
6de9934ffe
commit
049fd348b2
8 changed files with 118 additions and 17 deletions
|
@ -7,4 +7,10 @@
|
||||||
device = "nodev";
|
device = "nodev";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
boot.plymouth = {
|
||||||
|
enable = true;
|
||||||
|
# font = "${pkgs.jetbrains-mono}/share/fonts/truetype/JetBrainsMono-Regular.ttf";
|
||||||
|
themePackages = [pkgs.catppuccin-plymouth];
|
||||||
|
theme = "catppuccin-macchiato";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
20
modules/system/hardware/bluetooth.nix
Normal file
20
modules/system/hardware/bluetooth.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
}: let
|
||||||
|
cfg = config.modules.system.hardware.bluetooth;
|
||||||
|
inherit (config.modules.other.system) username;
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
in {
|
||||||
|
confg = mkIf cfg.enable {
|
||||||
|
hardware.bluetooth = {
|
||||||
|
enable = true;
|
||||||
|
powerOnBoot = mkIf cfg.powerOnBoot true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.${username}.home.Packages = with pkgs; [
|
||||||
|
bluetuith
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
36
modules/system/hardware/graphics.nix
Normal file
36
modules/system/hardware/graphics.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.modules.system.hardware;
|
||||||
|
inherit (cfg) amd nvidia;
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
hardware = {
|
||||||
|
graphics = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = with pkgs;
|
||||||
|
mkIf amd.enable [
|
||||||
|
mesa
|
||||||
|
libva
|
||||||
|
vaapiVdpau
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
nvidia = mkIf nvidia.enable {
|
||||||
|
modesetting.enable = true;
|
||||||
|
open = false;
|
||||||
|
powerManagement = {
|
||||||
|
enable = true;
|
||||||
|
finegrained = false;
|
||||||
|
nvidiaSettings = false;
|
||||||
|
package = config.boot.kernelPackges.nvidiaPackages.beta;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
boot.initrd.kernelModules = mkIf amd.enable ["amdgpu"];
|
||||||
|
services.xserver.videoDrivers = mkIf nvidia.enable ["nvidia"];
|
||||||
|
};
|
||||||
|
}
|
0
modules/system/hardware/module.nix
Normal file
0
modules/system/hardware/module.nix
Normal file
0
modules/system/hardware/wifi.nix
Normal file
0
modules/system/hardware/wifi.nix
Normal file
|
@ -29,7 +29,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Automatically optimize nix store by removing hard links
|
# Automatically optimize nix store by removing hard links
|
||||||
# do it after the gc.
|
|
||||||
optimise = {
|
optimise = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = ["21:00"];
|
dates = ["21:00"];
|
||||||
|
@ -55,18 +54,16 @@
|
||||||
# the same as the number of cores your CPU has.
|
# the same as the number of cores your CPU has.
|
||||||
max-jobs = "auto";
|
max-jobs = "auto";
|
||||||
|
|
||||||
# Always build inside sandboxed environments
|
# If set, Nix will perform builds in a sandboxed environment
|
||||||
|
# that it will set up automatically for each build.
|
||||||
|
# This prevents impurities in builds by disallowing access
|
||||||
|
# to dependencies outside of the Nix store by using network
|
||||||
|
# and mount namespaces in a chroot environment.
|
||||||
sandbox = true;
|
sandbox = true;
|
||||||
sandbox-fallback = false;
|
|
||||||
|
|
||||||
# Continue building derivations even if one fails
|
# Continue building derivations even if one fails
|
||||||
keep-going = true;
|
keep-going = true;
|
||||||
|
|
||||||
# Fallback to local builds after remote builders are unavailable.
|
|
||||||
# Setting this too low on a slow network may cause remote builders
|
|
||||||
# to be discarded before a connection can be established.
|
|
||||||
connect-timeout = 5;
|
|
||||||
|
|
||||||
# If we haven't received data for >= 20s, retry the download
|
# If we haven't received data for >= 20s, retry the download
|
||||||
stalled-download-timeout = 20;
|
stalled-download-timeout = 20;
|
||||||
|
|
||||||
|
@ -120,8 +117,7 @@
|
||||||
# external builders can also pick up those substituters
|
# external builders can also pick up those substituters
|
||||||
builders-use-substitutes = true;
|
builders-use-substitutes = true;
|
||||||
|
|
||||||
# Substituters to pull from. While sigs are disabled, we must
|
# Substituters to pull from.
|
||||||
# make sure the substituters listed here are trusted.
|
|
||||||
substituters = [
|
substituters = [
|
||||||
"https://cache.nixos.org" # funny binary cache
|
"https://cache.nixos.org" # funny binary cache
|
||||||
"https://cache.privatevoid.net" # for nix-super
|
"https://cache.privatevoid.net" # for nix-super
|
||||||
|
@ -146,12 +142,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# By default nix-gc makes no effort to respect battery life by avoiding
|
# Do not run garbage collection on AC power.
|
||||||
# GC runs on battery and fully commits a few cores to collecting garbage.
|
# This makes a quite nice difference in battery life.
|
||||||
# This will drain the battery faster than you can say "Nix, what the hell?"
|
|
||||||
# and contribute heavily to you wanting to get a new desktop.
|
|
||||||
# For those curious (such as myself) desktops are always seen as "AC powered"
|
|
||||||
# so the system will not fail to fire if you are on a desktop system.
|
|
||||||
systemd.services.nix-gc = {
|
systemd.services.nix-gc = {
|
||||||
unitConfig.ConditionACPower = true;
|
unitConfig.ConditionACPower = true;
|
||||||
};
|
};
|
||||||
|
|
21
modules/system/os/networking/module.nix
Normal file
21
modules/system/os/networking/module.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{config, ...}: let
|
||||||
|
inherit (config.modules.other.system) username;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
./networkmanager.nix
|
||||||
|
];
|
||||||
|
networking = {
|
||||||
|
enableIPv6 = true;
|
||||||
|
nameservers = [
|
||||||
|
# quad9 DNS
|
||||||
|
"9.9.9.9"
|
||||||
|
"2620::fe::fe"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services.resolved = {
|
||||||
|
enable = true;
|
||||||
|
# quad9 dns
|
||||||
|
fallbackDns = ["9.9.9.9" "2620::fe::fe"];
|
||||||
|
};
|
||||||
|
users.users.${username}.extraGroups = ["networkmanager"];
|
||||||
|
}
|
26
modules/system/os/networking/networkmanager.nix
Normal file
26
modules/system/os/networking/networkmanager.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib) mkForce;
|
||||||
|
in {
|
||||||
|
networking.networkmanager = {
|
||||||
|
enable = true;
|
||||||
|
# Removes about 2GB of stuff we do no need.
|
||||||
|
plugins = mkForce [];
|
||||||
|
|
||||||
|
dns = "systemd-resolved";
|
||||||
|
unmanaged = [
|
||||||
|
# DO NOT manage my docker containers, thank you.
|
||||||
|
"interface-name:docker*"
|
||||||
|
];
|
||||||
|
wifi = {
|
||||||
|
# Generate a randomized value upon each connect
|
||||||
|
macAdress = "random";
|
||||||
|
|
||||||
|
# Enable Wi-Fi power saving
|
||||||
|
powersave = true;
|
||||||
|
|
||||||
|
# Backend is either wpa_supplicant or iwd,
|
||||||
|
# we use wpa_supplicant.
|
||||||
|
backend = "wpa_supplicant";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue