testing the new config before pushing to main

This commit is contained in:
ooks-io 2024-01-19 20:28:53 +13:00
parent a545953c2d
commit c53123d2c5
38 changed files with 370 additions and 198 deletions

View file

@ -0,0 +1,88 @@
{ inputs, pkgs, ... }:
{
imports = [
inputs.hardware.nixosModule.common-cpu-intel
inputs.hardware.nixosModule.common-pc-ssd
./hardware-configuration.nix # Hardware configuration generated by nix-generate-config
../common/user/ooks # Add and configure the user "ooks"
../common/base # Default system programs
../common/features/vm.nix # Adds VM support
../common/features/greetd.nix # Adds login-manager greetd
];
networking = {
hostName = "ooksdesk"; # Define hostname
networkmanager.enable = true; # Networking tool
};
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen; # Kernel version
supportedFilesystems = ["ntfs"]; # Add ntfs support
};
programs = {
dconf.enable = true; # Low level configuration system
kdeconnect.enable = true; # Adds android connectivity over local network
gnupg.agent = { # Daemon to request and cache passwords for the keychain
enable = true;
enableSSHSupport = true;
};
};
xdg.portal = { # Allows cross-desktop communication
enable = true;
wlr.enable = true; # Adds Wayland support
};
hardware = {
opengl = { # Used for rendering 2D and 3D graphics
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [nvidia-vaapi-driver]; # Adds nvidia VAAPI driver for hardware-accelerated video decoding
};
nvidia = {
open = true; # Use Nvidia's open source kernel module
modesetting.enable = true; # Enables kernel modesettings
nvidiaSettings = true; # Nvidia's settings GUI
};
};
services = {
dbus = { # Allows communication between applications
enable = true;
packages = [ pkgs.gcr ]; # GNOME cryptographic services, used for managing cryptographic keys
};
xserver.videoDrivers = ["nvidia"]; # Required for Nvidia to work
udisks2 = { # Used to manage mounting of temp storage
enable = true;
mountOnMedia = true; # Auto mounts device to /media
};
};
environment = {
variables = { # Environment variables for nvidia
GBM_BACKEND = "nvidia-drm";
LIBVA_DRIVER_NAME = "nvidia";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
systemPackages = with pkgs; [ # Vulkan packages
vulkan-loader
vulkan-validation-layers
vulkan-tools
];
};
system = {
stateVersion = "22.05";
};
}

View file

@ -0,0 +1,116 @@
{ config, inputs, pkgs, ... }:
# Imports
# -------------------------------------------------------------------------------------------------
{
imports = [
inputs.hardware.nixosModules.gpd-micropc
./hardware-configuration.nix
../common/user/ooks
../common/base
../common/features/bluetooth.nix
../common/features/vm.nix
../common/features/greetd.nix
];
# Hostname and networking
# -------------------------------------------------------------------------------------------------
networking = {
hostName = "ooksmicro";
networkmanager.enable = true;
};
# Printing
# -------------------------------------------------------------------------------------------------
services.printing.enable = true;
# Kernel
# ------------------------------------------------------------------------------------------------
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
kernelParams = [ "fbcon=rotate:1" ];
};
# Laptop Programs
# -------------------------------------------------------------------------------------------------
powerManagement.powertop.enable = true;
programs = {
light.enable = true;
dconf.enable = true;
kdeconnect.enable = true;
};
# XDG Portal
# ------------------------------------------------------------------------------------------------
xdg.portal = {
enable = true;
wlr.enable = true;
};
hardware = {
opengl = {
enable = true;
};
};
# gnupg
# -------------------------------------------------------------------------------------------------
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Services
# -------------------------------------------------------------------------------------------------
services = {
thermald = {
enable = true;
};
logind = {
lidSwitch = "suspend";
};
dbus = {
enable = true;
packages = [ pkgs.gcr ];
};
auto-cpufreq = {
enable = true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};
# System Version
# -------------------------------------------------------------------------------------------------
system = {
stateVersion = "22.05";
};
}

View file

@ -0,0 +1,53 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/fe7ea7fd-b531-4c00-8123-99f7ea855800";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/57C5-11E7";
fsType = "vfat";
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,24 @@
{ config, inputs, pkgs, ... }:
{
imports = [
inputs.hardware.nixosModules.lenovo-thinkpad-t480s
./hardware-configuration.nix
../../profiles
# ../../modules
];
activeProfiles = ["base" "laptop"];
systemModules.user = {
ooks.enable = true;
shell.fish.enable = true;
};
networking = {
hostName = "ooks-t480";
};
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
};
}

View file

@ -0,0 +1,61 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptnix".device = "/dev/disk/by-uuid/014d725c-bf13-40a2-a9ab-0dd6185a95f6";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/F356-6F9C";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp61s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wwan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,128 @@
{ config, inputs, pkgs, ... }:
# Imports
# -------------------------------------------------------------------------------------------------
{
imports = [
inputs.hardware.nixosModules.common-pc-ssd
inputs.hardware.nixosModules.common-cpu-intel
inputs.hardware.nixosModules.common-gpu-intel
./hardware-configuration.nix
../common/user/ooks
../common/base
../common/features/bluetooth.nix
../common/features/greetd.nix
];
# Hostname and networking
# -------------------------------------------------------------------------------------------------
networking = {
hostName = "ooksx1";
networkmanager.enable = true;
};
# Printing
# -------------------------------------------------------------------------------------------------
services.printing.enable = true;
# Kernel
# ------------------------------------------------------------------------------------------------
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
};
# Laptop Programs
# -------------------------------------------------------------------------------------------------
powerManagement.powertop.enable = true;
programs = {
light.enable = true;
dconf.enable = true;
kdeconnect.enable = true;
};
hardware = {
opengl = {
enable = true;
};
};
# gnupg
# -------------------------------------------------------------------------------------------------
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Services
# -------------------------------------------------------------------------------------------------
services = {
logind = {
lidSwitch = "suspend";
};
dbus = {
enable = true;
packages = [ pkgs.gcr ];
};
auto-cpufreq = {
enable = true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};
systemd = {
user.services.polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
# Firewall
# -------------------------------------------------------------------------------------------------
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# System Version
# -------------------------------------------------------------------------------------------------
system = {
stateVersion = "22.05";
};
}

View file

@ -0,0 +1,62 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/3ea21f10-f705-457c-8366-a8268f658ba6";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/45D8-8DC3";
fsType = "vfat";
};
swapDevices = [{
device = "/swap/swapfile";
size = 8196;
}];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wwp0s20f0u2c2.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,17 +1,13 @@
{ lib, config, ... }:
let
cfg = config.systemModules.bootloader;
in
{ lib, ... }:
{
config = lib.mkIf cfg.enable {
boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "max";
imports = [ ./systemd ];
options.systemModules = {
bootloader = {
systemd = {
enable = lib.mkEnableOption "Enable systemd bootloader module";
};
efi.canTouchEfiVariables = true;
};
};
}

View file

@ -0,0 +1 @@
## to be implemented

View file

@ -0,0 +1,17 @@
{ lib, config, ... }:
let
cfg = config.systemModules.bootloader.systemd;
in
{
config = lib.mkIf cfg.enable {
boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
};
};
}

View file

@ -3,10 +3,16 @@
{
imports = [
./hardware
./networking
./bootloader
./nix
./programs
./user
./displayManager
./networking.nix
./locale.nix
./virtualisation.nix
./pipewire.nix
./security.nix
];
@ -14,9 +20,6 @@
security = {
enable = lib.mkEnableOption "Enable security module";
};
bootloader = {
enable = lib.mkEnableOption "Enable systemd bootloader module";
};
pipewire = {
enable = lib.mkEnableOption "Enable pipewire module";
};

View file

@ -0,0 +1,13 @@
{ lib, ... }:
{
imports = [
./tuigreet
];
options.systemModules.displayManager = {
tuigreet = {
enable = lib.mkEnableOption "Enable tuigreet display manager module";
};
};
}

View file

@ -1,26 +0,0 @@
{ pkgs, ... }:
let
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
in
{
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${tuigreet} --time --remember --cmd Hyprland";
user = "greeter";
};
};
};
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
}

View file

@ -0,0 +1,29 @@
{ pkgs, lib, config, ... }:
let
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
cfg = config.systemModules.displayManager.tuigreet;
in
{
config = lib.mkIf cfg.enable {
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${tuigreet} --time --remember --cmd Hyprland";
user = "greeter";
};
};
};
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
};
}

View file

@ -0,0 +1,22 @@
{ lib, config, ... }:
let
cfg = config.systemModules.hardware.backlight;
in
{
config = lib.mkIf cfg.enable {
hardware.brillo.enable = true;
services.clight = {
enable = true;
settings = {
verbose = true;
backlight.disabled = true;
dpms.timeouts = [900 300];
dimmer.timeouts = [870 270];
gamma.long_transition = true;
screen.disabled = true;
};
};
};
}

View file

@ -1,14 +0,0 @@
{
hardware.brillo.enable = true;
services.clight = {
enable = true;
settings = {
verbose = true;
backlight.disabled = true;
dpms.timeouts = [900 300];
dimmer.timeouts = [870 270];
gamma.long_transition = true;
screen.disabled = true;
};
};
}

View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
cfg = config.systemModules.hardware.bluetooth;
in
{
config = lib.mkIf cfg.enable {
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
environment.systemPackages = with pkgs; [
galaxy-buds-client
live-buds-cli
bluetuith
];
# https://github.com/NixOS/nixpkgs/issues/114222
systemd.user.services.telephony_client.enable = false;
};
}

View file

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
{
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
environment.systemPackages = with pkgs; [
galaxy-buds-client
live-buds-cli
bluetuith
];
# https://github.com/NixOS/nixpkgs/issues/114222
systemd.user.services.telephony_client.enable = false;
}

View file

@ -0,0 +1,21 @@
{ lib, ... }:
{
imports = [
./bluetooth.nix
./backlight.nix
./power.nix
];
options.systemModules.hardware = {
bluetooth = {
enable = lib.mkEnableOption "Enable bluetooth module";
};
backlight= {
enable = lib.mkEnableOption "Enable backlight module";
};
power = {
enable = lib.mkEnableOption "Enable power module";
};
};
}

View file

@ -0,0 +1,32 @@
{ lib, config, ... }:
let
cfg = config.systemModules.hardware.power;
in
{
config = lib.mkIf cfg.enable {
services.system76-scheduler.settings.cfsProfiles.enable = true;
services.tlp = {
enable = true;
settings = {
cpu_boost_on_ac = 1;
cpu_boost_on_bat = 0;
cpu_scaling_governor_on_ac = "performance";
cpu_scaling_governor_on_bat = "powersave";
};
};
services = {
upower.enable = true;
thermald.enable = true;
power-profiles-daemon.enable = false;
logind = {
lidSwitch = "suspend";
};
};
powerManagement.powertop.enable = true;
};
}

View file

@ -13,6 +13,7 @@ in
];
};
time.timeZone = lib.mkDefault "Pacific/Auckland";
location.provider = "geoclue2";
services.geoclue2.enable = true;
};
}

View file

@ -4,7 +4,7 @@
imports = [
./nh.nix
./nix.nix
./nixpkgs
./nixpkgs.nix
./subs.nix
];

View file

@ -0,0 +1,13 @@
{ lib, ... }:
{
imports = [
./gnomeServices.nix
];
options.systemModules.programs = {
gnomeServices = {
enable = lib.mkEnableOption "Enable gnome services module";
};
};
}

View file

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
let
cfg = config.systemModules.programs.gnomeServices;
in
{
config = lib.mkIf cfg.enable {
services = {
dbus.packages = with pkgs; [
gcr
gnome.gnome-settings-daemon
];
gnome.gnome-keyring.enable = true;
gvfs.enable = true;
};
};
}

View file

@ -33,8 +33,8 @@ in
enable = true;
wheelNeedsPassword = false;
};
rtkit.enable = true;
};
rtkit.enable = true;
# security tweaks borrowed from @hlissner
boot.kernel.sysctl = {

View file

@ -2,7 +2,7 @@
let
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
cfg = config.systemModule.user.ooks;
cfg = config.systemModules.user.ooks;
in
{
@ -22,7 +22,6 @@ in
packages = [ pkgs.home-manager ];
};
home-manager.users.ooks = import ../../../../home/user/ooks/${config.networking.hostName};
home-manager.users.ooks = import ../../../home/user/ooks/${config.networking.hostName};
};
}

View file

@ -7,22 +7,48 @@ in
{
imports = [
../modules
../../modules
inputs.home-manager.nixosModules.home-manager
];
config = lib.mkIf cfg.enable {
environment.systemPackages = [pkgs.git];
environment.enableAllTerminfo = true;
systemModules = {
security.enable = true;
nixOptions.enable = true;
pipewire.enable = true;
networking.enable = true;
locale.enable = true;
bootloader.systemd.enable = true;
programs.gnomeServices.enable = true;
displayManager.tuigreet.enable = true;
};
environment.systemPackages = [pkgs.git];
environment.enableAllTerminfo = true;
services = {
dbus.enable = true; # Need this for gtk
printing.enable = true; # Do I even print?
udisks2 = { # Used to manage mount of temp storage
enable = true;
mountOnMedia = true; # Auto mounts device to /media
};
};
boot.supportedFilesystems = ["ntfs"]; # For when someone hands me a usb
programs = {
dconf.enable = true;
kdeconnect.enable = true;
};
home-manager.extraSpecialArgs = { inherit inputs outputs; };
hardware.enableAllFirmware = true;
hardware = {
enableAllFirmware = true;
opengl.enable = true;
};
system.stateVersion = lib.mkDefault "23.11";
};
}

View file

@ -10,8 +10,8 @@ in
imports = [
./base
./nvidia
#./gaming
#./laptop
./gaming
./laptop
];
options = {
@ -20,7 +20,7 @@ in
default = [];
};
systemProfiles = {
systemProfile = {
base = {
enable = lib.mkEnableOption "Enable the base profile";
};
@ -36,5 +36,5 @@ in
};
};
config.profiles = profileEnabler;
config.systemProfile = profileEnabler;
}

View file

@ -15,7 +15,7 @@ in
steam.enable = true;
gamescope = {
enable = true;
capsSysNice = true;
capSysNice = true;
};
gamemode = {
enable = true;

View file

@ -1,16 +1,17 @@
{ config, lib, ... }:
let
cfg = config.system.profile.laptop;
cfg = config.systemProfile.laptop;
in
{
imports = [
../modules
../../modules
];
config = cfg.enable {
system = {
config = lib.mkIf cfg.enable {
systemModules = {
hardware = {
bluetooth.enable = true;
powerSettings.enable = true
power.enable = true;
backlight.enable = true;
};
};

View file

@ -7,7 +7,7 @@ in
{
config = lib.mkIf cfg.enable {
harware.nvidia = {
hardware.nvidia = {
open = true;
package = production;
modesetting.enable = true;