move more stuff

This commit is contained in:
mjallen18
2024-02-28 21:15:55 -06:00
parent 33c0b054d6
commit 31dd4950b1
16 changed files with 287 additions and 203 deletions

View File

@@ -32,7 +32,7 @@
# kde.nixosModules.plasma6
nix-flatpak.nixosModules.nix-flatpak
./hosts/desktop/configuration.nix
./hosts/desktop/impermanence.nix
./share/impermanence
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;

View File

@@ -6,6 +6,7 @@ in
imports =
[
../modules
../share
];
# Enable nix flakes and nix-command tools

View File

@@ -26,6 +26,12 @@ in
../default.nix
];
share.hardware.amd = {
enable = true;
corectrl.enable = true;
corectrl.enablePolkit = true;
};
# Configure bootloader with lanzaboot and secureboot
boot = {
loader = {
@@ -54,7 +60,7 @@ in
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [
"quiet" "amdgpu.ppfeaturemask=0xffffffff"
"quiet"
];
consoleLogLevel = 3;
@@ -72,9 +78,9 @@ in
# Steam udev rules for remote play
steam-hardware.enable = true;
opengl.enable = true;
# Enables support for 32bit libs that steam uses
opengl.driSupport32Bit = true;
# opengl.enable = true;
# # Enables support for 32bit libs that steam uses
# opengl.driSupport32Bit = true;
};
# Services configs
@@ -112,25 +118,25 @@ in
];
};
systemd.services.fix-wifi = {
path = [ pkgs.bash ];
script = ''
sleep 5
if ping -q -c1 10.0.1.1 &>/dev/null; then
echo "No need to fix wifi"
else
echo 1 | tee /sys/bus/pci/devices/0000\:09\:00.0/reset
rmmod iwlwifi
modprobe iwlwifi
fi
'';
wantedBy = [ "multi-user.target" ];
after = [ "NetworkManager.target" ];
serviceConfig = {
Type="oneshot";
RemainAfterExit=true;
};
};
# systemd.services.fix-wifi = {
# path = [ pkgs.bash ];
# script = ''
# sleep 5
# if ping -q -c1 10.0.1.1 &>/dev/null; then
# echo "No need to fix wifi"
# else
# echo 1 | tee /sys/bus/pci/devices/0000\:09\:00.0/reset
# rmmod iwlwifi
# modprobe iwlwifi
# fi
# '';
# wantedBy = [ "multi-user.target" ];
# after = [ "NetworkManager.target" ];
# serviceConfig = {
# Type="oneshot";
# RemainAfterExit=true;
# };
# };
# Networking configs
networking = {
@@ -177,22 +183,6 @@ in
groups = [ "wheel" ];
}];
};
# Configure polkit
polkit = {
enable = true;
extraConfig = ''
polkit.addRule(function(action, subject) {
if ((action.id == "org.corectrl.helper.init" ||
action.id == "org.corectrl.helperkiller.init") &&
subject.local == true &&
subject.active == true &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
'';
};
};
# Configure environment
@@ -205,7 +195,6 @@ in
nano
os-prober
efibootmgr
git
sbctl
gparted
discover-wrapped
@@ -218,26 +207,13 @@ in
aspellDicts.en-science
aha
clinfo
neofetch
gamescope
gamescope-wsi
mangohud
goverlay
heroic
python3
virt-manager
orca-slicer
];
# Force radv
# variables.AMD_VULKAN_ICD = "RADV";
};
# Configure programs
programs = {
fish.enable = true;
java.enable = true;
# corectrl.enable = true;
# Steam
steam = {
@@ -282,14 +258,6 @@ in
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ]; # Enable sudo for the user.
shell = pkgs.fish;
packages = with pkgs; [
firefox
tree
lm_sensors
vmware-horizon-client
etcher
freerdp
];
};
# This option defines the first version of NixOS you have installed on this particular machine,

View File

@@ -16,10 +16,40 @@ in
enable = true;
userName = "mjallen18";
userEmail = "matt.l.jallen@gmail.com";
aliases = {
co = "checkout";
ci = "commit";
cia = "commit --amend";
s = "status";
st = "status";
b = "branch";
# p = "pull --rebase";
pu = "push";
};
};
home.packages = [
programs.command-not-found.enable = true;
home.packages = with pkgs; [
firefox
tree
lm_sensors
vmware-horizon-client
etcher
freerdp
neofetch
gamescope
gamescope-wsi
mangohud
goverlay
heroic
python3
virt-manager
orca-slicer
# Other packages
vulkan-hdr-layer
];
# Garbage collect automatically every week
nix.gc.automatic = true;
}

View File

@@ -1,21 +0,0 @@
{ pkgs, lib, LT, config, utils, inputs, ... }@args:
{
# Set up impernance configuration for things like bluetooth
# In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints.
environment.persistence."/nix/persist/system" = {
hideMounts = true;
directories = [
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
"/etc/secureboot"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
];
files = [
{ file = "/etc/nix/id_rsa"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
];
};
}

View File

@@ -110,7 +110,12 @@ in
];
};
share.hardware.nvidia = {
enable = true;
enableBeta = true;
nvidiaSettings = true;
enableNvidiaDocker = true;
}
# Configure bootloader with lanzaboot and secureboot
boot = {
@@ -142,43 +147,43 @@ in
zfs.requestEncryptionCredentials = false;
};
# Hardware configs
hardware = {
# Nvidia
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
# # Hardware configs
# hardware = {
# # Nvidia
# nvidia = {
# package = config.boot.kernelPackages.nvidiaPackages.beta;
# Modesetting is required.
modesetting.enable = true;
# # Modesetting is required.
# modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# # Fine-grained power management. Turns off GPU when not in use.
# # Experimental and only works on modern Nvidia GPUs (Turing or newer).
# powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# # Use the NVidia open source kernel module (not to be confused with the
# # independent third-party "nouveau" open source driver).
# # Support is limited to the Turing and later architectures. Full list of
# # supported GPUs is at:
# # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# # Only available from driver 515.43.04+
# # Currently alpha-quality/buggy, so false is currently the recommended setting.
# open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
};
# # Enable the Nvidia settings menu,
# # accessible via `nvidia-settings`.
# nvidiaSettings = true;
# };
# Enable OpenGL
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
# # Enable OpenGL
# opengl = {
# enable = true;
# driSupport = true;
# driSupport32Bit = true;
# };
# };
# Services configs
services = {
@@ -186,8 +191,8 @@ in
xserver = {
enable = true;
# Load nvidia driver for Xorg and Wayland
videoDrivers = ["nvidia"];
# # Load nvidia driver for Xorg and Wayland
# videoDrivers = ["nvidia"];
# Enable the Plasma 6 Desktop Environment.
displayManager = {
@@ -338,6 +343,8 @@ in
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCw9zq8DLGByI5v2gAn95hKNyOsm3g61a2buxu2BBMFysQJgmZPCCLUqRJKhSM5Vm/JOgsAmdpRBRZQoHD+6S844CJHb4v4VIbjkyQgYCuM7Rst2IOZ5QybvsA2/D0nwytZ+HXQqDj2AagUYDbz0gyyIHkDQ5YGBMkvkWz/h1Vci6aoBM7VihEDM4KlWoTVuPeASGM8r5IZ2FS83Djbqo4ov6AYvLMrKB9Z7hmFgH6R3LE0gxOkzbGVXtSuvJyrjvgytoT22UhATjjxSQ9D+YJXXkQoB3lUdg8OoIquUPjMZpl4mR8ffvseWPfcvD1XlD5t+TOHFqKpESO547tlOBYhdpew+NSgAXpamCU6oyV8tDCywLQu2ucxHRn78u6WXzWHkDtffdhzmk6TZaPhWqVHuTGjR4higBgGqUfSaKOMszt+FDRZAr3HtuQ2+zJ8bowK9fW5OqilTtK2HtQqroD9ApegDNbqOz6kGy5IycSXvqPURy/M4lxZxbtBPuemcJs= mattjallen@MacBook-Pro.local"
# desktop windows
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZ2PYPjZddOzR8OJj16G88KcUhCDLkvrEmpUQP0wKHDUuA27HQQ2ORo66asadwGHY3k1VDZ1ei9l9H++SIIeKOaaUr5yZdktvj4POUNtbd9ZhcS7sZU7BSF+NMDM+h3tImh6z0S7mWvRQOUv3ZM+ZER+5xTWJVG1OOJEpb1drxJk6Qz0wbZKSR7TPNFBLLXlVy7hkNYf07RtDyhCCxNB3hJfa8c+oztnWumwDhDQWLqiUXWIU2QH6iRLGl/WYnujtNvVVaV/Hn3JJkS6MM9dnV3cpoIO0+J7+WfsN9rZ0wXt5yY3GhiGXwmcO5eYVli8lHlLWtK7aYSETyry6CBsLbojzOQO5rSqhpwfF2njAAFAQU0UjLc8PahisIuFKCwHH4iyXXOagiv5K1Mc/0Ak+WhhMPee6vV2p7NTyNpXRvouDbWy5cSRH31WgQ9fK5mIGe5v8nGGqtEhUubUkiOgP+H3UbT2V/nTv/TFKdJcKw+WmizvTrxBmaMjWALlkYl+s= mattl@Jallen-PC"
# desktop nixos
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTBMydhOc6SnOdB5WrEd7X07DrboAtagCUgXiOJjLov matt@matt-nixos"
];
packages = with pkgs; [
neofetch
@@ -367,7 +374,7 @@ in
virtualisation = {
docker = {
enable = true;
enableNvidia = true;
# enableNvidia = true;
enableOnBoot = true;
};

View File

@@ -1,25 +0,0 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.hardware.gpu.amd;
in {
kernelParams = [ "amdgpu.ppfeaturemask=0xffffffff" ];
# Configure programs
programs = { corectrl.enable };
# Configure environment
environment = {
# Force radv
variables.AMD_VULKAN_ICD = "RADV";
};
# Hardware configs
hardware = {
# Enable OpenGL
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}

View File

@@ -1,9 +0,0 @@
{ lib, ... }:
with lib;
{
options.hardware.gpu.amd = {
enable = mkEnableOption "amd hardware config";
};
}

View File

@@ -1,42 +0,0 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.hardware.gpu.nvidia;
in {
hardware = {
# Nvidia
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
};
# Enable OpenGL
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}

View File

@@ -1,8 +0,0 @@
{ lib, ... }:
with lib;
{
options.hardware.gpu.nvidia = {
enable = mkEnableOption "nvidia hardware config";
};
}

48
share/amd/default.nix Normal file
View File

@@ -0,0 +1,48 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.share.hardware.amd;
in {
imports = [
./options.nix
];
config = mkIf cfg.enable {
boot.kernelParams = [ (if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "") ];
# Configure programs
programs.corectrl.enable = cfg.corectrl.enable;
# Configure environment
environment = {
# Force radv
variables.AMD_VULKAN_ICD = "RADV";
};
# Hardware configs
hardware = {
# Enable OpenGL
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
# Configure polkit
security.polkit = {
enable = cfg.corectrl.enablePolkit;
extraConfig = ''
polkit.addRule(function(action, subject) {
if ((action.id == "org.corectrl.helper.init" ||
action.id == "org.corectrl.helperkiller.init") &&
subject.local == true &&
subject.active == true &&
subject.isInGroup("${cfg.corectrl.polkitGroup}")) {
return polkit.Result.YES;
}
});
'';
};
};
}

22
share/amd/options.nix Normal file
View File

@@ -0,0 +1,22 @@
{ lib, ... }:
with lib;
{
options.share.hardware.amd = {
enable = mkEnableOption "amd hardware config";
corectrl.enable = mkOption {
type = types.bool;
default = false;
};
corectrl.enablePolkit = mkOption {
type = types.bool;
default = false;
};
corectrl.polkitGroup = mkOption {
type = types.str;
default = "wheel";
};
};
}

7
share/default.nix Normal file
View File

@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./amd
./nvidia
];
}

View File

@@ -0,0 +1,20 @@
{ pkgs, lib, LT, config, utils, inputs, ... }@args:
{
# Set up impernance configuration for things like bluetooth
# In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints.
environment.persistence."/nix/persist/system" = {
hideMounts = true;
directories = [
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
"/etc/secureboot"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
];
files = [
{ file = "/etc/nix/id_rsa"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
];
};
}

59
share/nvidia/default.nix Normal file
View File

@@ -0,0 +1,59 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.share.hardware.nvidia;
in {
imports = [
./options.nix
];
config = mkIf cfg.enable {
hardware = {
# Nvidia
nvidia = {
package = if cfg.enableBeta then config.boot.kernelPackages.nvidiaPackages.beta else config.boot.kernelPackages.nvidiaPackages.latest;
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = cfg.enableOpen;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = cfg.nvidiaSettings;
};
# Enable OpenGL
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
# Services configs
services.xserver = {
# Load nvidia driver for Xorg and Wayland
videoDrivers = ["nvidia"];
};
# Virtualisation
virtualisation.docker.enableNvidia = cfg.enableNvidiaDocker;
};
}

27
share/nvidia/options.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib, ... }:
with lib;
{
options.share.hardware.nvidia = {
enable = mkEnableOption "nvidia hardware config";
enableOpen = mkOption {
type = types.bool;
default = false;
};
nvidiaSettings = mkOption {
type = types.bool;
default = false;
};
enableBeta = mkOption {
type = types.bool;
default = false;
};
enableNvidiaDocker = mkOption {
type = types.bool;
default = false;
};
};
}