Refactor modules style

This commit is contained in:
Julia Lange 2024-04-07 17:08:48 -07:00
parent ed2a7f94cf
commit cc95386f1a
44 changed files with 455 additions and 297 deletions

View file

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
{
import = [
./graphics
./networking
./pipewire
./polkit
./sops-nix
./system
];
}

View file

@ -0,0 +1,9 @@
{ config, pkgs, lib, ... }:
{
imports = [
./display_manager
./nvidia
./wayland_compositors
];
}

View file

@ -0,0 +1,23 @@
{ config, pkgs, lib, ... }:
{
options = {
tuigreet.enable = lib.mkEnableOption "enables tuigreet with greetd";
};
config = lib.mkIf config.tuigreet.enable {
services.greetd = {
enable = true;
package = pkgs.greetd.tuigreet;
settings = {
terminal = {
vt = 2;
};
default_session = lib.mkIf config.hyprland.enable {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
user = config.user.name;
};
};
};
};
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, ... }:
{
options = {
nvidia.enable = lib.mkEnableOption
"Enables nvidia with proprietary drivers";
};
config = lib.mkIf config.nvidia.enable {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
environment.systemPackages = with pkgs; [
nvidia-vaapi-driver
];
};
}

View file

@ -0,0 +1,17 @@
{ inputs, config, pkgs, lib, ... }:
{
options = {
hyprland.enable = lib.mkEnableOption "Enables hyprland";
};
config = lib.mkIf config.hyprland.enable {
imports = [ inputs.hyprland.nixosModules.default ];
programs.hyprland.enable = true;
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
experimental-features = [ "nix-command" "flakes" ];
};
};
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
{
options = {
bluetooth.enable = lib.mkEnableOption "Enables Bluetooth with blueman";
};
config = lib.mkIf config.bluetooth.enable {
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
environment.systemPackages = with pkgs; [
blueman
];
};
}

View file

@ -0,0 +1,8 @@
{ config, pkgs, lib, ... }:
{
import = [
./bluetooth
./wireless
];
}

View file

@ -0,0 +1,33 @@
{ config, pkgs, lib, ... }:
{
options = {
wireless.enable = lib.mkEnableOption "Enables wireless";
};
config = lib.mkIf confi.wireless.enable {
networking.wireless = {
enable = true;
userControlled = {
enable = true;
group = "network";
};
networks = {
"foofoo2" = {
pskRaw = "1269f8db0aec9d9c30bff6de9951f0ab2d18d7cea4dacd8bd253ebc237e73e2d";
priority = 1;
};
"OrbiWanKenobe" = {
pskRaw = "0128447a146d359c1224e558b0f4e3fc0a53b0b4a178334075b50f8d07e179d2";
priority = 1;
};
"Homura" = {
pskRaw = "dd77456e1df3f2c17bccc917a0e609684fa6d2ccb6a2e0fb122d50d243e0c87e";
priority = 0;
};
};
};
networking.enableIPv6 = false;
};
}

View file

@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
{
options = {
pipewire.enable = lib.mkEnableOption "Enables pipewire and pulsemixer";
};
config = lib.mkIf config.pipewire.enable {
security.rtkit.enable = true;
services.pipewire = {
enable = true;
wireplumber.enable = true;
alsa.enable = false;
alsa.support32Bit = false;
pulse.enable = true;
environment.systemPackages = with pkgs; [
pulsemixer
];
};
};
}

View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
{
options = {
polkit.enable = lib.mkEnableOption "Enables polkit with kde handler";
};
config = lib.mkIf config.polkit.enable {
security.polkit.enable = true;
environment.systemPackages = with pkgs; [
polkit-kde-agent
];
}
}

View file

@ -0,0 +1,20 @@
{ inputs, config, pkgs, lib, ... }:
let rootPath = ./.; in
{
options = {
sops-nix.enable = lib.mkEnableOption "Enables nix-sops for secret management";
};
config = lib.mkIf config.sops-nix.enable {
imports = [ inputs.sops-nix.nixosModules.sops ];
sops = {
defaultSopsFile = rootPath + "secrets.yaml";
defaultSopsFormat = "yaml";
age.keyFile = "/home/" + config.user.name + ".config/sops/age/keys.txt";
};
environment.systemPackages = with pkgs; [
sops
];
};
}

View file

@ -0,0 +1,61 @@
{ config, pkgs, lib, ... }:
{
options = {
user.name = lib.mkOption { default = "pan"; };
user.timezone = lib.mkOption { default = "America/Los_Angeles"; };
font.extraFonts = lib.mkOption { default = []; };
};
config = {
# Use the systemd-boot EFI boot loader.
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.timeout = 1;
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = config.user.timezone;
i18n.defaultLocale = "en_US.UTF-8";
# "Essential" Packages
environment.systemPackages = with pkgs; [
git
neovim
nnn
xdg-user-dirs
];
# XDG Compliance
xdg.portal.config.common.default = "*";
environment.sessionVariables = rec {
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_STATE_HOME = "\${HOME}/.local/state";
XDG_DATA_HOME = "\${HOME}/.local/share";
XDG_BIN_HOME = "\${HOME}/.local/bin";
PATH = [
"\${HOME}/prog/scripts"
];
};
users.groups = {
wheel = { };
network = { };
};
users.users.defaultUser = {
name = config.user.name;
isNormalUser = true;
extraGroups = [ "wheel" "network" ];
};
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
cascadia-code
source-han-sans # Pan-CJK font
] ++ config.system.extraFonts;
};
};
}