implementing modules for system applications

This commit is contained in:
cnst
2024-08-18 13:49:05 +02:00
parent 38f68c3550
commit a4306380e3
101 changed files with 1105 additions and 452 deletions

View File

@@ -12,22 +12,22 @@
./etc
];
# Define homeImports for each profile, including sharedImports
# Define homeImports for each user, including sharedImports
homeImports = {
"cnst@cnix" =
sharedImports
++ [
./profiles/cnst
./users/cnst
];
"adam@adampad" =
sharedImports
++ [
./profiles/adam
./users/adam
];
"toothpick@toothpc" =
sharedImports
++ [
./profiles/toothpick
./users/toothpick
];
};

View File

@@ -7,6 +7,10 @@
syntaxHighlighting.enable = true;
shellAliases = {
usermodules = "nvim /home/adam/.nix-config/home/users/adam/modules.nix";
umod = "nvim /home/adam/.nix-config/home/users/adam/modules.nix";
systemmodules = "nvim /home/adam/.nix-config/hosts/adampad/modules.nix";
smod = "nvim /home/adam/.nix-config/hosts/adampad/modules.nix";
nixclean = "sudo nix run .#cleanup-boot";
nixdev = "nix develop ~/.nix-config -c $SHELL";
nixconfig = "cd /home/adam/.nix-config/";

View File

@@ -7,7 +7,10 @@
syntaxHighlighting.enable = true;
shellAliases = {
nixmodules = "nvim /home/cnst/.nix-config/home/profiles/cnst/modules.nix";
usermodules = "nvim /home/cnst/.nix-config/home/users/cnst/modules.nix";
umod = "nvim /home/cnst/.nix-config/home/users/cnst/modules.nix";
systemmodules = "nvim /home/cnst/.nix-config/hosts/cnix/modules.nix";
smod = "nvim /home/cnst/.nix-config/hosts/cnix/modules.nix";
nixclean = "sudo nix run .#cleanup-boot";
nixdev = "nix develop ~/.nix-config -c $SHELL";
nixconfig = "cd /home/cnst/.nix-config/";

View File

@@ -22,7 +22,6 @@
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/toothpick/.steam/root/compatibilitytools.d"; # proton and steam compat
XDG_SESSION_TYPE = "wayland";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
MOZ_DISABLE_RDD_SANDBOX = "1";
WLR_DRM_NO_ATOMIC = "1";

View File

@@ -7,6 +7,10 @@
syntaxHighlighting.enable = true;
shellAliases = {
usermodules = "nvim /home/toothpick/.nix-config/home/users/toothpick/modules.nix";
umod = "nvim /home/toothpick/.nix-config/home/users/toothpick/modules.nix";
systemmodules = "nvim /home/toothpick/.nix-config/hosts/toothpc/modules.nix";
smod = "nvim /home/toothpick/.nix-config/hosts/toothpc/modules.nix";
nixclean = "sudo nix run .#cleanup-boot";
nixdev = "nix develop ~/.nix-config -c $SHELL";
nixconfig = "cd /home/toothpick/.nix-config/";

View File

@@ -32,6 +32,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
];
boot = {

66
hosts/adampad/modules.nix Normal file
View File

@@ -0,0 +1,66 @@
{
modules = {
network = {
enable = true;
hostName = "adampad";
interfaces = {
"enp7s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
gaming = {
steam.enable = false;
gamescope.enable = false;
lutris.enable = false;
gamemode = {
enable = false;
optimizeGpu = false;
};
};
gui = {
gnome.enable = false;
hyprland.enable = true;
};
utils = {
android.enable = true;
anyrun.enable = true;
corectrl.enable = false;
microfetch.enable = true;
nix-ld.enable = false;
};
sysd = {
blueman.enable = true;
dbus.enable = true;
fwupd.enable = true;
gnome-keyring.enable = true;
greetd.enable = true;
gvfs.enable = true;
locate.enable = true;
mullvad.enable = true;
pipewire.enable = true;
powerd.enable = true;
samba.enable = false;
sops.enable = false;
ssh.enable = true;
udisks.enable = true;
xserver.amd.enable = true;
};
hardware = {
bluetooth.enable = true;
logitech.enable = false;
graphics = {
amd.enable = true;
nvidia.enable = false;
};
};
studio = {
blender = {
enable = false;
hip = false;
};
gimp.enable = false;
inkscape.enable = false;
};
};
}

View File

@@ -38,6 +38,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
];
boot = {

66
hosts/cnix/modules.nix Normal file
View File

@@ -0,0 +1,66 @@
{
modules = {
network = {
enable = true;
hostName = "cnix";
interfaces = {
"enp7s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
gaming = {
steam.enable = true;
gamescope.enable = true;
lutris.enable = true;
gamemode = {
enable = true;
optimizeGpu = true;
};
};
gui = {
gnome.enable = false;
hyprland.enable = true;
};
utils = {
android.enable = true;
anyrun.enable = true;
corectrl.enable = true;
microfetch.enable = true;
nix-ld.enable = false;
};
sysd = {
blueman.enable = true;
dbus.enable = true;
fwupd.enable = true;
gnome-keyring.enable = true;
greetd.enable = true;
gvfs.enable = true;
locate.enable = true;
mullvad.enable = true;
pipewire.enable = true;
powerd.enable = true;
samba.enable = false;
sops.enable = true;
ssh.enable = true;
udisks.enable = true;
xserver.amd.hhkbse.enable = true;
};
hardware = {
bluetooth.enable = true;
logitech.enable = true;
graphics = {
amd.enable = true;
nvidia.enable = false;
};
};
studio = {
blender = {
enable = false;
hip = false;
};
gimp.enable = true;
inkscape.enable = true;
};
};
}

View File

@@ -11,9 +11,9 @@
systemConfig = "${self}/system";
hostConfig = "${self}/hosts";
cnstConfig = "${self}/home/profiles/cnst";
toothpickConfig = "${self}/home/profiles/toothpick";
adamConfig = "${self}/home/profiles/adam";
cnstConfig = "${self}/home/users/cnst";
toothpickConfig = "${self}/home/users/toothpick";
adamConfig = "${self}/home/users/adam";
userModules = "${self}/home/modules";
systemModules = "${self}/system/modules";
@@ -23,7 +23,7 @@
mod = "${systemConfig}";
# get the basic config to build on top of
inherit (import "${systemConfig}") adampad cnix toothpc;
inherit (import "${systemConfig}") shared;
# get these into the module system
specialArgs = {inherit inputs self userConfig systemConfig hostConfig cnstConfig toothpickConfig adamConfig userModules systemModules;};
@@ -31,15 +31,10 @@
cnix = nixosSystem {
inherit specialArgs;
modules =
cnix
shared
++ [
./cnix
"${mod}/boot/lanzaboote"
"${mod}/etc/bluetooth"
"${mod}/etc/graphics/amd"
"${mod}/etc/logitech"
"${mod}/etc/network/cnix"
"${mod}/etc/xserver/amd/hhkbse"
"${mod}/nix/nh/cnix"
{
home-manager = {
@@ -54,14 +49,10 @@
toothpc = nixosSystem {
inherit specialArgs;
modules =
toothpc
shared
++ [
./toothpc
"${mod}/boot/lanzaboote"
"${mod}/etc/graphics/nvidia"
"${mod}/etc/logitech"
"${mod}/etc/network/toothpc"
"${mod}/etc/xserver/nvidia"
"${mod}/nix/nh/toothpc"
{
home-manager = {
@@ -77,14 +68,10 @@
adampad = nixosSystem {
inherit specialArgs;
modules =
adampad
shared
++ [
./adampad
"${mod}/boot"
"${mod}/etc/bluetooth"
"${mod}/etc/graphics/amd"
"${mod}/etc/network/adampad"
"${mod}/etc/xserver/amd"
"${mod}/nix/nh/adampad"
{
home-manager = {

View File

@@ -32,6 +32,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
];
boot = {

66
hosts/toothpc/modules.nix Normal file
View File

@@ -0,0 +1,66 @@
{
modules = {
network = {
enable = true;
hostName = "toothpc";
interfaces = {
"enp4s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
gaming = {
steam.enable = true;
gamescope.enable = true;
lutris.enable = true;
gamemode = {
enable = true;
optimizeGpu = false;
};
};
gui = {
gnome.enable = false;
hyprland.enable = true;
};
utils = {
android.enable = false;
anyrun.enable = true;
corectrl.enable = true;
microfetch.enable = true;
nix-ld.enable = false;
};
sysd = {
blueman.enable = false;
dbus.enable = true;
fwupd.enable = true;
gnome-keyring.enable = true;
greetd.enable = true;
gvfs.enable = true;
locate.enable = true;
mullvad.enable = true;
pipewire.enable = true;
powerd.enable = true;
samba.enable = false;
sops.enable = false;
ssh.enable = true;
udisks.enable = true;
xserver.nvidia.enable = true;
};
hardware = {
bluetooth.enable = false;
logitech.enable = true;
graphics = {
amd.enable = false;
nvidia.enable = true;
};
};
studio = {
blender = {
enable = false;
hip = false;
};
gimp.enable = true;
inkscape.enable = true;
};
};
}

View File

@@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = [
pkgs.anyrun
];
}

View File

@@ -1,6 +0,0 @@
{
imports = [
./anyrun
./hyprland
];
}

View File

@@ -1,10 +0,0 @@
{
services = {
xserver = {
desktopManager.gnome = {
enable = true;
};
};
gnome.games.enable = true;
};
}

View File

@@ -1,12 +0,0 @@
{
inputs,
pkgs,
...
}: {
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
environment.variables.NIXOS_OZONE_WL = "1";
}

View File

@@ -1,35 +1,9 @@
# yes, this is also yanked from, you guessed it, fufexan.
let
shared = [
./bin
./etc
./nix
./srv
./usr/share
./opt/microfetch
./modules
];
adampad =
shared
++ [
./opt/android
./srv/blueman
];
cnix =
shared
++ [
./opt/gaming.nix
./opt/android
./opt/gimp
./opt/inkscape
./opt/sops
./srv/blueman
];
toothpc =
shared
++ [
./opt/gaming.nix
];
in {
inherit shared adampad cnix toothpc;
inherit shared;
}

View File

@@ -1,8 +0,0 @@
{
hardware = {
bluetooth = {
enable = true;
powerOnBoot = false;
};
};
}

View File

@@ -2,7 +2,8 @@
imports = [
# shared imports
./dconf
./fuse
./locale
./fonts
./security
./xdg
./zram

View File

@@ -1,5 +0,0 @@
{
programs.fuse = {
userAllowOther = true;
};
}

View File

@@ -1,27 +0,0 @@
{pkgs, ...}: {
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
amdvlk
# mesa
mesa
# vulkan
# vulkan-tools
# vulkan-loader
# vulkan-validation-layers
# vulkan-extension-layer
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
};
};
}

View File

@@ -1,30 +0,0 @@
{
pkgs,
config,
...
}: {
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
intel-media-driver
nvidia-vaapi-driver
];
};
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
# package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
powerManagement = {
enable = false;
finegrained = false;
};
open = false;
nvidiaSettings = true;
};
};
}

View File

@@ -1,8 +0,0 @@
{
hardware = {
logitech.wireless = {
enable = true;
enableGraphical = true;
};
};
}

View File

@@ -1,15 +0,0 @@
{
networking = {
networkmanager.enable = true;
hostName = "adampad";
nftables.enable = true;
firewall = {
enable = true;
interfaces = {
"enp7s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
};
}

View File

@@ -1,15 +0,0 @@
{
networking = {
networkmanager.enable = true;
hostName = "cnix";
nftables.enable = true;
firewall = {
enable = true;
interfaces = {
"enp7s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
};
}

View File

@@ -1,15 +0,0 @@
{
networking = {
networkmanager.enable = true;
hostName = "toothpc";
nftables.enable = true;
firewall = {
enable = true;
interfaces = {
"enp4s0" = {
allowedTCPPorts = [22 80 443];
};
};
};
};
}

View File

@@ -0,0 +1,40 @@
{systemModules, ...}: {
imports = [
"${systemModules}/network"
"${systemModules}/gaming/gamemode"
"${systemModules}/gaming/gamescope"
"${systemModules}/gaming/steam"
"${systemModules}/gaming/lutris"
"${systemModules}/gui/gnome"
"${systemModules}/gui/hyprland"
"${systemModules}/utils/android"
"${systemModules}/utils/anyrun"
"${systemModules}/utils/corectrl"
"${systemModules}/utils/microfetch"
"${systemModules}/utils/nix-ld"
"${systemModules}/sysd/blueman"
"${systemModules}/sysd/dbus"
"${systemModules}/sysd/fwupd"
"${systemModules}/sysd/gnome-keyring"
"${systemModules}/sysd/greetd"
"${systemModules}/sysd/gvfs"
"${systemModules}/sysd/locate"
"${systemModules}/sysd/mullvad"
"${systemModules}/sysd/pipewire"
"${systemModules}/sysd/powerd"
"${systemModules}/sysd/samba"
"${systemModules}/sysd/sops"
"${systemModules}/sysd/ssh"
"${systemModules}/sysd/udisks"
"${systemModules}/sysd/xserver/amd"
"${systemModules}/sysd/xserver/amd/hhkbse"
"${systemModules}/sysd/xserver/nvidia"
"${systemModules}/hardware/graphics/amd"
"${systemModules}/hardware/graphics/nvidia"
"${systemModules}/hardware/bluetooth"
"${systemModules}/hardware/logitech"
"${systemModules}/studio/gimp"
"${systemModules}/studio/inkscape"
"${systemModules}/studio/blender"
];
}

View File

@@ -0,0 +1,48 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.modules.gaming.gamemode;
pipewireLowLatencyModule = inputs.nix-gaming.nixosModules.pipewireLowLatency;
in {
imports = [
pipewireLowLatencyModule
];
options = {
modules.gaming.gamemode = {
enable = mkEnableOption "Enables gamemode";
optimizeGpu = mkOption {
type = lib.types.bool;
default = false;
description = "Whether to apply GPU optimizations.";
};
};
};
config = mkIf cfg.enable {
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver = 1;
softrealtime = "auto";
renice = 15;
};
gpu = mkIf cfg.optimizeGpu {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 0;
amd_performance_level = "high";
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
services.pipewire.lowLatency.enable = true;
};
}

View File

@@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.gaming.gamescope;
in {
options = {
modules.gaming.gamescope.enable = mkEnableOption "Enables gamescope";
};
config = mkIf cfg.enable {
programs.gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.gaming.lutris;
in {
options = {
modules.gaming.lutris.enable = mkEnableOption "Enables lutris";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
lutris
];
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.gaming.steam;
in {
options = {
modules.gaming.steam.enable = mkEnableOption "Enables steam";
};
config = mkIf cfg.enable {
programs = {
steam = {
enable = true;
gamescopeSession.enable = true;
};
};
};
}

View File

@@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.gui.gnome;
in {
options = {
modules.gui.gnome.enable = mkEnableOption "Enables gnome";
};
config = mkIf cfg.enable {
services = {
xserver = {
desktopManager.gnome = {
enable = true;
};
};
gnome.games.enable = true;
};
};
}

View File

@@ -0,0 +1,22 @@
{
pkgs,
inputs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.gui.hyprland;
in {
options = {
modules.gui.hyprland.enable = mkEnableOption "Enables hyprland";
};
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
environment.variables.NIXOS_OZONE_WL = "1";
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.hardware.bluetooth;
in {
options = {
modules.hardware.bluetooth.enable = mkEnableOption "Enables bluetooth";
};
config = mkIf cfg.enable {
hardware = {
bluetooth = {
enable = true;
powerOnBoot = false;
};
};
};
}

View File

@@ -0,0 +1,40 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.hardware.graphics.amd;
in {
options = {
modules.hardware.graphics.amd.enable = mkEnableOption "Enables AMD graphics";
};
config = mkIf cfg.enable {
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
amdvlk
# mesa
mesa
# vulkan
# vulkan-tools
# vulkan-loader
# vulkan-validation-layers
# vulkan-extension-layer
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
};
};
};
}

View File

@@ -0,0 +1,39 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.hardware.graphics.nvidia;
in {
options = {
modules.hardware.graphics.nvidia.enable = mkEnableOption "Enables NVidia graphics";
};
config = mkIf cfg.enable {
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
intel-media-driver
nvidia-vaapi-driver
];
};
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
# package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
powerManagement = {
enable = false;
finegrained = false;
};
open = false;
nvidiaSettings = true;
};
};
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.hardware.logitech;
in {
options = {
modules.hardware.logitech.enable = mkEnableOption "Enables logitech";
};
config = mkIf cfg.enable {
hardware = {
logitech.wireless = {
enable = true;
enableGraphical = true;
};
};
};
}

View File

@@ -0,0 +1,48 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.modules.network;
in {
options = {
modules = {
network = {
enable = mkEnableOption "Enable the custom networking module";
hostName = mkOption {
type = types.str;
default = "default-hostname";
description = "Hostname for the system.";
};
interfaces = mkOption {
type = types.attrsOf (types.submodule {
options = {
allowedTCPPorts = mkOption {
type = types.listOf types.int;
default = [];
description = "List of allowed TCP ports for this interface.";
};
};
});
default = {};
description = "Network interface configurations.";
};
};
};
};
config = mkIf cfg.enable {
networking = {
networkmanager.enable = true;
inherit (cfg) hostName;
nftables.enable = true;
firewall = {
enable = true;
inherit (cfg) interfaces;
};
};
};
}

View File

@@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.modules.studio.blender;
in {
options = {
modules.studio.blender = {
enable = mkEnableOption "Enables Blender";
hip = mkOption {
type = lib.types.bool;
default = false;
description = "Use the HIP-enabled version of Blender (for AMD GPUs).";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [
(
if cfg.hip
then pkgs.blender-hip
else pkgs.blender
)
];
};
}

View File

@@ -0,0 +1,18 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.studio.gimp;
in {
options = {
modules.studio.gimp.enable = mkEnableOption "Enables gimp";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.gimp-with-plugins
];
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.studio.inkscape;
in {
options = {
modules.studio.inkscape.enable = mkEnableOption "Enables inkscape";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
inkscape-with-extensions
];
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.blueman;
in {
options = {
modules.sysd.blueman.enable = mkEnableOption "Enables blueman";
};
config = mkIf cfg.enable {
services.blueman.enable = true;
};
}

View File

@@ -0,0 +1,21 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.dbus;
in {
options = {
modules.sysd.dbus.enable = mkEnableOption "Enables dbus";
};
config = mkIf cfg.enable {
services.dbus = {
enable = true;
packages = with pkgs; [
gcr
];
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.fwupd;
in {
options = {
modules.sysd.fwupd.enable = mkEnableOption "Enables fwupd";
};
config = mkIf cfg.enable {
services.fwupd.enable = true;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.gnome-keyring;
in {
options = {
modules.sysd.gnome-keyring.enable = mkEnableOption "Enables gnome-keyring";
};
config = mkIf cfg.enable {
services.gnome.gnome-keyring.enable = true;
};
}

View File

@@ -0,0 +1,30 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.greetd;
in {
options = {
modules.sysd.greetd.enable = mkEnableOption "Enables greetd";
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings = {
# AUTOLOGIN
# initial_session = {
# command = "${pkgs.hyprland}/bin/Hyprland";
# user = "cnst"; # <- select which user to auto-login
# };
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet -r --remember-session --asterisks";
user = "greeter";
};
};
};
security.pam.services.greetd.enableGnomeKeyring = true;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.gvfs;
in {
options = {
modules.sysd.gvfs.enable = mkEnableOption "Enables gvfs";
};
config = mkIf cfg.enable {
services.gvfs.enable = true;
};
}

View File

@@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.locate;
in {
options = {
modules.sysd.locate.enable = mkEnableOption "Enables plocate";
};
config = mkIf cfg.enable {
services.locate = {
enable = true;
package = pkgs.plocate;
localuser = null;
};
};
}

View File

@@ -0,0 +1,19 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.mullvad;
in {
options = {
modules.sysd.mullvad.enable = mkEnableOption "Enables mullvad";
};
config = mkIf cfg.enable {
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
};
}

View File

@@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.pipewire;
in {
options = {
modules.sysd.pipewire.enable = mkEnableOption "Enables pipewire";
};
config = mkIf cfg.enable {
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
};
}

View File

@@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.powerd;
in {
options = {
modules.sysd.powerd.enable = mkEnableOption "Enables power-profiles-daemon";
};
config = mkIf cfg.enable {
services = {
power-profiles-daemon.enable = true;
upower.enable = true;
};
};
}

View File

@@ -0,0 +1,32 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.samba;
in {
options = {
modules.sysd.samba.enable = mkEnableOption "Enables samba";
};
config = mkIf cfg.enable {
services = {
samba = {
enable = true;
package = pkgs.samba4Full;
openFirewall = true;
};
avahi = {
publish.enable = true;
publish.userServices = true;
enable = true;
openFirewall = true;
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
};
}

View File

@@ -47,20 +47,27 @@
};
})
];
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.sops;
in {
sops = lib.mkMerge [
{
age = {sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];};
gnupg = {
home = "~/.gnupg";
sshKeyPaths = [];
};
}
defaultConfig
hostSpecificConfig
];
environment.systemPackages = [
pkgs.sops
pkgs.age
];
options = {
modules.sysd.sops.enable = mkEnableOption "Enables sops";
};
config = mkIf cfg.enable {
sops = lib.mkMerge [
{
age = {sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];};
gnupg = {
home = "~/.gnupg";
sshKeyPaths = [];
};
}
defaultConfig
hostSpecificConfig
];
environment.systemPackages = [
pkgs.sops
pkgs.age
];
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.ssh;
in {
options = {
modules.sysd.ssh.enable = mkEnableOption "Enables ssh";
};
config = mkIf cfg.enable {
services.openssh = {
enable = true;
};
programs.ssh = {
startAgent = true;
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.udisks;
in {
options = {
modules.sysd.udisks.enable = mkEnableOption "Enables udisks";
};
config = mkIf cfg.enable {
services.udisks2.enable = true;
};
}

View File

@@ -0,0 +1,29 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.xserver.amd;
in {
options = {
modules.sysd.xserver.amd.enable = mkEnableOption "Enables xserver with amdgpu";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
videoDrivers = ["amdgpu"];
# xkb = {
# extraLayouts.hhkbse = {
# description = "HHKBse by cnst";
# languages = ["se"];
# symbolsFile = /home/cnst/.nix-config/nixos/hosts/cnix/xkb/symbols/hhkbse;
# };
# layout = "hhkbse";
# # dir = "/home/cnst/.nix-config/nixos/xkb";
# variant = "";
# options = "lv3:rwin_switch";
# };
};
};
}

View File

@@ -0,0 +1,30 @@
{
config,
lib,
hostConfig,
...
}: let
path = "${hostConfig}/cnix/xkb/symbols";
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.xserver.amd.hhkbse;
in {
options = {
modules.sysd.xserver.amd.hhkbse.enable = mkEnableOption "Enables xserver for amdgpu with HHKBSE";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
videoDrivers = ["amdgpu"];
xkb = {
extraLayouts.hhkbse = {
description = "HHKBse by cnst";
languages = ["se"];
symbolsFile = "${path}/hhkbse";
};
layout = "hhkbse";
variant = "";
options = "lv3:rwin_switch";
};
};
};
}

View File

@@ -0,0 +1,19 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.sysd.xserver.nvidia;
in {
options = {
modules.sysd.xserver.nvidia.enable = mkEnableOption "Enables xserver with nvidia";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
videoDrivers = ["nvidia"];
xkb.layout = "se";
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.android;
in {
options = {
modules.utils.android.enable = mkEnableOption "Enables android tools";
};
config = mkIf cfg.enable {
programs.adb.enable = true;
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.anyrun;
in {
options = {
modules.utils.anyrun.enable = mkEnableOption "Enables anyrun";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.anyrun
];
};
}

View File

@@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.corectrl;
in {
options = {
modules.utils.corectrl.enable = mkEnableOption "Enables CoreCtrl";
};
config = mkIf cfg.enable {
programs.corectrl = {
enable = true;
gpuOverclock = {
enable = true;
ppfeaturemask = "0xffffffff";
};
};
};
}

View File

@@ -0,0 +1,16 @@
{
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.microfetch;
in {
options = {
modules.utils.microfetch.enable = mkEnableOption "Enables microfetch";
};
config = mkIf cfg.enable {
environment.systemPackages = [inputs.microfetch.packages.x86_64-linux.default];
};
}

View File

@@ -1,8 +1,19 @@
{pkgs, ...}:
{
programs.nix-ld = {
enable = true;
# Sets up all the libraries to load
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.nix-ld;
in {
options = {
modules.utils.nix-ld.enable = mkEnableOption "Enables nix-ld";
};
config = mkIf cfg.enable {
programs.nix-ld = {
enable = true;
# Sets up all the libraries to load
libraries = with pkgs; [
stdenv.cc.cc
openssl
@@ -86,6 +97,7 @@
libdrm
mesa
libxkbcommon
];
};
];
};
};
}

View File

@@ -12,10 +12,12 @@
];
environment = {
systemPackages = [
pkgs.git
pkgs.scx
pkgs.stow
systemPackages = with pkgs; [
git
scx
stow
winetricks
protonup
];
localBinInPath = true;
};

View File

@@ -1,10 +0,0 @@
{
inputs,
pkgs,
...
}: {
environment.systemPackages = [
inputs.agenix.packages.x86_64-linux.default
pkgs.age
];
}

View File

@@ -1 +0,0 @@
{ programs.adb.enable = true; }

View File

@@ -1,3 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = [pkgs.bottles-unwrapped];
}

View File

@@ -1,9 +0,0 @@
{
programs.corectrl = {
enable = true;
gpuOverclock = {
enable = true;
ppfeaturemask = "0xffffffff";
};
};
}

View File

@@ -1,29 +0,0 @@
{
pkgs,
inputs,
...
}: {
programs.gamemode = {
enable = true;
settings = {
general = {
softrealtime = "auto";
renice = 15;
};
# gpu = {
# apply_gpu_optimisations = "accept-responsibility";
# gpu_device = 1;
# amd_performance_level = "high";
# };
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
services.pipewire.lowLatency.enable = true;
imports = [
inputs.nix-gaming.nixosModules.pipewireLowLatency
];
}

View File

@@ -1,10 +0,0 @@
{
programs.gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
}

View File

@@ -1,17 +0,0 @@
{pkgs, ...}: {
imports = [
./steam
./lutris
# ./bottles
./gamemode
./gamescope
./corectrl
];
environment = {
systemPackages = with pkgs; [
# Misc
protonup
winetricks
];
};
}

View File

@@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
gimp-with-plugins
];
}

View File

@@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
inkscape-with-extensions
];
}

View File

@@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
lutris
];
}

View File

@@ -1,3 +0,0 @@
{inputs, ...}: {
environment.systemPackages = [inputs.microfetch.packages.x86_64-linux.default];
}

View File

@@ -1,8 +0,0 @@
{
programs = {
steam = {
enable = true;
gamescopeSession.enable = true;
};
};
}

View File

@@ -1,10 +0,0 @@
{
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
}

View File

@@ -1 +0,0 @@
{services.blueman.enable = true;}

View File

@@ -1,8 +0,0 @@
{pkgs, ...}: {
services.dbus = {
enable = true;
packages = with pkgs; [
gcr
];
};
}

View File

@@ -1,16 +0,0 @@
{
imports = [
./audio
./dbus
./fwupd
./gnome-keyring
./greetd
./gvfs
./locate
./mullvad
./openssh
./power
# ./samba
./udisks
];
}

View File

@@ -1,3 +0,0 @@
{
services.fwupd.enable = true;
}

View File

@@ -1 +0,0 @@
{services.gnome.gnome-keyring.enable = true;}

View File

@@ -1,17 +0,0 @@
{pkgs, ...}: {
services.greetd = {
enable = true;
settings = {
# AUTOLOGIN
# initial_session = {
# command = "${pkgs.hyprland}/bin/Hyprland";
# user = "cnst"; # <- select which user to auto-login
# };
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet -r --remember-session --asterisks";
user = "greeter";
};
};
};
security.pam.services.greetd.enableGnomeKeyring = true;
}

View File

@@ -1 +0,0 @@
{services.gvfs.enable = true;}

View File

@@ -1,7 +0,0 @@
{pkgs, ...}: {
services.locate = {
enable = true;
package = pkgs.plocate;
localuser = null;
};
}

View File

@@ -1,6 +0,0 @@
{pkgs, ...}: {
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
}

View File

@@ -1,8 +0,0 @@
{
services.openssh = {
enable = true;
};
programs.ssh = {
startAgent = true;
};
}

View File

@@ -1,6 +0,0 @@
{
services = {
power-profiles-daemon.enable = true;
upower.enable = true;
};
}

View File

@@ -1,19 +0,0 @@
{pkgs, ...}: {
services = {
samba = {
enable = true;
package = pkgs.samba4Full;
openFirewall = true;
};
avahi = {
publish.enable = true;
publish.userServices = true;
enable = true;
openFirewall = true;
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
}

View File

@@ -1 +0,0 @@
{services.udisks2.enable = true;}

Some files were not shown because too many files have changed in this diff Show More