start to split nix into modules

This commit is contained in:
Noah Masur 2022-04-25 21:54:53 -04:00
parent 55577615e2
commit 3989a16015
8 changed files with 93 additions and 53 deletions

View File

@ -0,0 +1,6 @@
{ config, ... }: {
config = {
services.keybase.enable = true;
services.kbfs.enable = true;
};
}

View File

@ -0,0 +1,9 @@
{ config, ... }: {
config = {
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
};
}

View File

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ./lutris.nix ];
config = {
# League of Legends anti-cheat
boot.kernel.sysctl = { "abi.vsyscall32" = 0; };
environment.systemPackages = with pkgs; [ openssl dconf ];
};
}

View File

@ -0,0 +1,9 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
config = { environment.systemPackages = with pkgs; [ lutris amdvlk wine ]; };
}

10
modules/gaming/steam.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ... }: {
imports = [ ./common.nix ];
config = {
hardware.steam-hardware.enable = true;
environment.systemPackages = with pkgs; [ steam ];
};
}

28
modules/system/doas.nix Normal file
View File

@ -0,0 +1,28 @@
# Replace sudo with doas
{ config, ... }: {
config = {
security = {
# Remove sudo
sudo.enable = false;
# Add doas
doas = {
enable = true;
# No password required
wheelNeedsPassword = false;
# Pass environment variables from user to root
# Also requires removing password here
extraRules = [{
groups = [ "wheel" ];
noPass = true;
keepEnv = true;
}];
};
};
};
}

View File

@ -0,0 +1,14 @@
{ config, ... }:
{
config = {
# Service to determine location for time zone
services.geoclue2.enable = true;
location = { provider = "geoclue2"; };
# Enable local time based on time zone
services.localtime.enable = true;
};
}

View File

@ -7,6 +7,9 @@
{
imports = [ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
../modules/system/timezone.nix
../modules/system/doas.nix
../modules/gaming/steam.nix
];
nixpkgs.config.allowUnfree = true;
@ -19,12 +22,6 @@
# networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone, also used by redshift
services.localtime.enable = true;
services.avahi.enable = true;
services.geoclue2.enable = true;
location = { provider = "geoclue2"; };
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
@ -83,8 +80,6 @@
};
hardware.acpilight.enable = true;
# Required for setting GTK theme (for preferred-color-scheme in browser)
services.dbus.packages = with pkgs; [ pkgs.dconf ];
@ -104,37 +99,6 @@
];
fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ];
# Gaming
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
hardware.steam-hardware.enable = true;
boot.kernel.sysctl = { "abi.vsyscall32" = 0; }; # League of Legends anti-cheat
# Replace sudo with doas
security = {
# Remove sudo
sudo.enable = false;
# Add doas
doas = {
enable = true;
# No password required
wheelNeedsPassword = false;
# Pass environment variables from user to root
# Also requires removing password here
extraRules = [{
groups = [ "wheel" ];
noPass = true;
keepEnv = true;
}];
};
};
# Define a user account. Don't forget to set a password with passwd.
users.users.noah = {
@ -173,18 +137,8 @@
# Mouse config
libratbag # Mouse adjustments
piper # Mouse adjustments GUI
# Gaming
steam
lutris
amdvlk
wine
openssl # Required for League of Legends
dconf
];
# environment.variables = { NIX_SKIP_KEYBASE_CHECKS = "1"; };
# Reduce blue light at night
services.redshift = {
enable = true;
@ -197,10 +151,6 @@
# Detect monitors (brightness)
hardware.i2c.enable = true;
# Login to Keybase in the background
services.keybase.enable = true;
services.kbfs.enable = true;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;