Big refactor (#1)
All checks were successful
check / check (push) Successful in 34s

Reviewed-on: https://gitea.mrdev023.fr/florian.richer/nixos/pulls/1
Co-authored-by: Florian RICHER <florian.richer@protonmail.com>
Co-committed-by: Florian RICHER <florian.richer@protonmail.com>
This commit is contained in:
Florian RICHER 2024-05-28 10:12:33 +02:00 committed by florian.richer
parent e9329e63dc
commit b7f82f87e8
84 changed files with 1100 additions and 1247 deletions

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.bluetooth;
in
{
options.modules.system.hardware.bluetooth = {
enable = mkEnableOption ''
Enable pipewire with my custom configurations
'';
};
config = mkIf cfg.enable {
hardware.bluetooth.enable = true;
};
}

View file

@ -0,0 +1,14 @@
{ ... }:
{
imports = [
./bluetooth
./gamingKernel
./keymaps
./nvidia
./pipewire
./plymouth
./printing
./waydroid
];
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.gamingKernel;
in
{
options.modules.system.hardware.gamingKernel = {
enable = mkEnableOption ''
Enable gaming kernel with my custom configurations
'';
};
config = mkIf cfg.enable {
boot.kernelPackages = pkgs.linuxPackages_zen;
};
}

View file

@ -0,0 +1,23 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.keymaps;
in
{
options.modules.system.hardware.keymaps = {
layout = mkOption {
default = "fr";
example = "fr";
description = ''
Set key layout (fr, us)
'';
type = types.str;
};
};
config = mkMerge [
(mkIf (cfg.layout == "fr") (import ./fr.nix {}))
(mkIf (cfg.layout == "us") (import ./us.nix {}))
];
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
# Configure keymap in X11
services.xserver = {
xkb = {
layout = "fr";
variant = "";
};
};
# Configure console keymap
console.keyMap = "fr";
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
# Configure keymap in X11
services.xserver = {
xkb = {
layout = "us";
variant = "altgr-intl";
};
};
# Configure console keymap
console.keyMap = "us";
}

View file

@ -0,0 +1,51 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.nvidia;
in
{
options.modules.system.hardware.nvidia = {
enable = mkEnableOption ''
Enable nvidia with my custom configurations
'';
};
config = mkIf cfg.enable {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
# 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;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
};
}

View file

@ -0,0 +1,31 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.pipewire;
in
{
options.modules.system.hardware.pipewire = {
enable = mkEnableOption ''
Enable pipewire with my custom configurations
'';
};
config = mkIf cfg.enable {
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.plymouth;
in
{
options.modules.system.hardware.plymouth = {
enable = mkEnableOption ''
Enable plymouth with my custom configurations
'';
};
config = mkIf cfg.enable {
boot.plymouth.enable = true;
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.printing;
in
{
options.modules.system.hardware.printing = {
enable = mkEnableOption ''
Enable printing with my custom configurations
'';
};
config = mkIf cfg.enable {
services.printing.enable = true;
};
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.hardware.waydroid;
in
{
options.modules.system.hardware.waydroid = {
enable = mkEnableOption ''
Enable waydroid with my custom configurations
'';
};
config = mkIf cfg.enable {
virtualisation.waydroid.enable = true;
};
}