1
0
forked from extern/nix-config

nix: Continue modularization of system modules

This commit is contained in:
Donovan Glover 2023-06-18 15:51:52 -04:00
parent e60f7000b0
commit 07bbb996e5
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
8 changed files with 108 additions and 97 deletions

14
modules/boot.nix Normal file
View File

@ -0,0 +1,14 @@
{
boot.loader = {
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
timeout = 0;
efi.canTouchEfiVariables = true;
};
boot.tmp.useTmpfs = true;
}

View File

@ -1,10 +1,15 @@
{ {
imports = [ imports = [
./boot.nix
./dual-function-keys.nix ./dual-function-keys.nix
./fish.nix ./fish.nix
./fonts.nix ./fonts.nix
./gamemode.nix
./greetd.nix ./greetd.nix
./home-manager.nix
./hyprland.nix ./hyprland.nix
./networking.nix
./nix.nix
./piper.nix ./piper.nix
./pipewire.nix ./pipewire.nix
./starship.nix ./starship.nix
@ -12,5 +17,6 @@
./thunar.nix ./thunar.nix
./user.nix ./user.nix
./virtualization.nix ./virtualization.nix
./vmware.nix
]; ];
} }

18
modules/gamemode.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs, ... }:
{
programs.gamemode = {
enable = true;
settings = {
general = {
renice = 10;
igpu_power_threshold = -1;
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'Note' 'gamemode started from host.'";
end = "${pkgs.libnotify}/bin/notify-send 'Note' 'gamemode ended from host.";
};
};
};
}

17
modules/home-manager.nix Normal file
View File

@ -0,0 +1,17 @@
let VARIABLES = import ../src/variables.nix; in {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [{
home.stateVersion = VARIABLES.stateVersion;
}];
users = {
user = {
home.username = VARIABLES.username;
home.homeDirectory = "/home/${VARIABLES.username}";
};
};
};
}

28
modules/networking.nix Normal file
View File

@ -0,0 +1,28 @@
let VARIABLES = import ../src/variables.nix; in {
networking = {
hostName = VARIABLES.hostname;
networkmanager = {
enable = true;
wifi.macAddress = "random";
ethernet.macAddress = "random";
unmanaged = [ "interface-name:ve-*" ];
};
useHostResolvConf = true;
nat = {
enable = true;
internalInterfaces = [ "ve-+" ];
externalInterface = "wg-mullvad";
forwardPorts = [
{
destination = "192.168.100.11:80";
sourcePort = 11918;
}
];
};
};
}

15
modules/nix.nix Normal file
View File

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
nix = {
package = pkgs.nixFlakes;
settings = {
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
auto-optimise-store = true;
substituters = ["https://nix-gaming.cachix.org"];
trusted-public-keys = ["nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="];
};
};
}

10
modules/vmware.nix Normal file
View File

@ -0,0 +1,10 @@
{
virtualisation.vmware.host = {
enable = true;
extraConfig = /* config */ ''
# Enable 3D acceleration on the host
mks.gl.allowUnsupportedDrivers = "TRUE"
mks.vk.allowUnsupportedDevices = "TRUE"
'';
};
}

View File

@ -26,49 +26,11 @@ let VARIABLES = import ./variables.nix; in {
i18n.defaultLocale = VARIABLES.defaultLocale; i18n.defaultLocale = VARIABLES.defaultLocale;
i18n.supportedLocales = VARIABLES.supportedLocales; i18n.supportedLocales = VARIABLES.supportedLocales;
# nix
nix.package = pkgs.nixFlakes;
nix.settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
nix.settings.auto-optimise-store = true;
nix.settings = {
substituters = ["https://nix-gaming.cachix.org"];
trusted-public-keys = ["nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="];
};
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
boot.loader = {
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
timeout = 0;
efi.canTouchEfiVariables = true;
};
boot.tmp.useTmpfs = true;
programs.neovim.enable = true; programs.neovim.enable = true;
programs.npm.enable = true; programs.npm.enable = true;
programs.gamemode = {
enable = true;
settings = {
general = {
renice = 10;
igpu_power_threshold = -1;
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'Note' 'gamemode started from host.'";
end = "${pkgs.libnotify}/bin/notify-send 'Note' 'gamemode ended from host.";
};
};
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
hypr-contrib.packages."${VARIABLES.system}".grimblast hypr-contrib.packages."${VARIABLES.system}".grimblast
nix-gaming.packages."${VARIABLES.system}".osu-stable nix-gaming.packages."${VARIABLES.system}".osu-stable
@ -177,18 +139,6 @@ let VARIABLES = import ./variables.nix; in {
environment.defaultPackages = [ ]; environment.defaultPackages = [ ];
system.stateVersion = VARIABLES.stateVersion; system.stateVersion = VARIABLES.stateVersion;
# home-manager
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [
{
home.stateVersion = VARIABLES.stateVersion;
}
];
};
systemd.extraConfig = "DefaultTimeoutStopSec=10s"; # Prevent hanging on shutdown systemd.extraConfig = "DefaultTimeoutStopSec=10s"; # Prevent hanging on shutdown
services.logind.lidSwitch = "ignore"; # Don't suspend on lid close services.logind.lidSwitch = "ignore"; # Don't suspend on lid close
@ -197,28 +147,6 @@ let VARIABLES = import ./variables.nix; in {
time.timeZone = "${VARIABLES.timezone}"; # Timezone time.timeZone = "${VARIABLES.timezone}"; # Timezone
# user
home-manager.users.user = {
home.username = VARIABLES.username;
home.homeDirectory = "/home/${VARIABLES.username}";
};
# networking
networking = {
hostName = VARIABLES.hostname;
networkmanager = {
enable = true;
wifi.macAddress = "random";
ethernet.macAddress = "random";
unmanaged = [ "interface-name:ve-*" ];
};
useHostResolvConf = true;
};
services.resolved.llmnr = "false"; services.resolved.llmnr = "false";
systemd.services.NetworkManager-wait-online.enable = false; systemd.services.NetworkManager-wait-online.enable = false;
@ -231,30 +159,5 @@ let VARIABLES = import ./variables.nix; in {
networking.firewall.allowedTCPPorts = [ 11918 ]; networking.firewall.allowedTCPPorts = [ 11918 ];
networking = {
nat = {
enable = true;
internalInterfaces = [ "ve-+" ];
externalInterface = "wg-mullvad";
forwardPorts = [
{
destination = "192.168.100.11:80";
sourcePort = 11918;
}
];
};
};
virtualisation.vmware.host = {
enable = true;
extraConfig = /* config */ ''
# Enable 3D acceleration on the host
mks.gl.allowUnsupportedDrivers = "TRUE"
mks.vk.allowUnsupportedDevices = "TRUE"
'';
};
zramSwap.enable = true; # Swap zramSwap.enable = true; # Swap
} }