Migrated from import based to config based

This commit is contained in:
xeovalyte 2024-12-23 17:03:36 +01:00
parent c1b12746f5
commit 5edd8b1e01
Signed by: xeovalyte
SSH Key Fingerprint: SHA256:kSQDrQDmKzljJzfGYcd3m9RqHi4h8rSwkZ3sQ9kBURo
36 changed files with 503 additions and 308 deletions

View File

@ -2,31 +2,39 @@
{
imports = [
# Import hardware configuration
./hardware-configuration.nix
# GUI
../../modules/system/gui/hyprland.nix
../../modules/system/gui/cosmic.nix
../../modules/system/gui/cosmic-greeter.nix
../../modules/system/gui/steam.nix
../../modules/system/gui/thunar.nix
# CLI
../../modules/system/cli/common.nix
../../modules/system/cli/docker.nix
# Hardware
# ../../modules/system/hardware/amd.nix
../../modules/system/hardware/bluetooth.nix
../../modules/system/hardware/firewall.nix
../../modules/system/hardware/garbage-collection.nix
../../modules/system/hardware/laptop.nix
../../modules/system/hardware/locale.nix
../../modules/system/hardware/printing.nix
../../modules/system/hardware/fprint.nix
../../modules/system/hardware/virt.nix
# Import modules
../../modules/system/default.nix
];
settings = {
display-manager = "cosmic-greeter";
desktop-environments = {
cosmic.enable = true;
hyprland.enable = true;
};
applications = {
common.enable = true;
steam.enable = true;
thunar.enable = true;
};
services = {
docker.enable = true;
quickemu.enable = true;
sunshine.enable = false;
garbage-collection.enable = true;
};
hardware = {
fprint.enable = true;
printing.enable = true;
bluetooth.enable = true;
firewall.enable = true;
locale.enable = true;
};
};
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];

View File

@ -0,0 +1,34 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.settings.applications.common;
in {
options = {
settings.applications.common.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable common applications
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
usbutils
tree
fastfetch
btop
git
yazi
just
];
environment.pathsToLink = [ "/share/zsh" ];
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
};
}

View File

@ -0,0 +1,31 @@
{ config, lib, ... }:
with lib;
let
cfg = config.settings.applications.steam;
in {
options = {
settings.applications.steam.enable = lib.mkOption {
type = with lib.types; bool;
description = ''
Enable steam
'';
};
};
config = mkIf cfg.enable {
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"steam"
"steam-original"
"steam-run"
];
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
};
}

View File

@ -0,0 +1,30 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.settings.applications.thunar;
in {
options = {
settings.applications.thunar.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable thunar file manager
'';
};
};
config = mkIf cfg.enable {
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
services.gvfs.enable = true;
services.tumbler.enable = true;
programs.file-roller.enable = true;
};
}

View File

@ -1,19 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
usbutils
tree
fastfetch
btop
git
yazi
just
];
environment.pathsToLink = [ "/share/zsh" ];
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
}

View File

@ -1,22 +0,0 @@
{ pkgs, ... }:
{
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
};
users.users.xeovalyte.extraGroups = [ "docker" ];
security.wrappers = {
docker-rootlesskit = {
owner = "root";
group = "root";
capabilities = "cap_net_bind_service+ep";
source = "${pkgs.rootlesskit}/bin/rootlesskit";
};
};
}

View File

@ -1,19 +0,0 @@
{ pkgs, ... }:
{
virtualisation.containers.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
virtualisation.oci-containers.backend = "podman";
environment.systemPackages = with pkgs; [
dive
podman-tui
podman-compose
];
}

View File

@ -0,0 +1,26 @@
{ ... }:
{
imports = [
./applications/common.nix
./applications/steam.nix
./applications/thunar.nix
./services/docker.nix
./services/quickemu.nix
./services/sunshine.nix
./services/garbage-collection.nix
./hardware/bluetooth.nix
./hardware/fprint.nix
./hardware/locale.nix
# ./hardware/nvidia.nix
./hardware/firewall.nix
./hardware/printing.nix
./desktop-environments/cosmic.nix
./desktop-environments/hyprland.nix
./display-managers/default.nix
];
}

View File

@ -0,0 +1,24 @@
{ lib, config, ... }:
with lib;
let
cfg = config.settings.desktop-environments.cosmic;
in {
options = {
settings.desktop-environments.cosmic.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable cosmic desktop environment
'';
};
};
config = mkIf cfg.enable {
services.desktopManager.cosmic.enable = true;
environment.sessionVariables = {
COSMIC_DISABLE_DIRECT_SCANOUT = "true";
};
};
}

View File

@ -0,0 +1,44 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.settings.desktop-environments.hyprland;
in {
options = {
settings.desktop-environments.hyprland.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable hyprland window manager
'';
};
};
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
xwayland.enable = true;
};
# Sound configuration
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Keyring configuration
security.polkit.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
programs.ssh.startAgent = true;
# Configure networking
networking.networkmanager.enable = true;
networking.wireless.iwd.enable = true;
};
}

View File

@ -0,0 +1,11 @@
{ lib, config, ... }:
with lib;
let
cfg = config.settings.display-manager;
in {
config = mkIf (cfg == "cosmic-greeter") {
services.displayManager.cosmic-greeter.enable = true;
};
}

View File

@ -0,0 +1,21 @@
{ lib, ... }:
with lib;
let
cfg = config.settings.display-manager;
in {
options = {
settings.display-manager = lib.mkOption {
type = lib.types.enum ["sddm" "cosmic-greeter"];
description = ''
Specify which display manager to use
'';
};
};
imports = [
./sddm.nix
./cosmic-greeter.nix
];
}

View File

@ -0,0 +1,20 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.settings.display-manager;
in {
config = mkIf (cfg == "sddm") {
environment.systemPackages = with pkgs; [
libsForQt5.qt5.qtquickcontrols2
libsForQt5.qt5.qtgraphicaleffects
];
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "${import ./sddm-theme.nix { inherit pkgs; }}";
};
};
}

View File

@ -1,5 +0,0 @@
{ ... }:
{
services.displayManager.cosmic-greeter.enable = true;
}

View File

@ -1,9 +0,0 @@
{ ... }:
{
services.desktopManager.cosmic.enable = true;
environment.sessionVariables = {
COSMIC_DISABLE_DIRECT_SCANOUT = "true";
};
}

View File

@ -1,29 +0,0 @@
{ config, pkgs, ... }:
{
programs.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
xwayland.enable = true;
};
# Sound configuration
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Keyring configuration
security.polkit.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
programs.ssh.startAgent = true;
# Configure networking
networking.networkmanager.enable = true;
networking.wireless.iwd.enable = true;
}

View File

@ -1,5 +0,0 @@
{ ... }:
{
programs.noisetorch.enable = true;
}

View File

@ -1,18 +0,0 @@
{ pkgs, ... }:
{
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

View File

@ -1,14 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
libsForQt5.qt5.qtquickcontrols2
libsForQt5.qt5.qtgraphicaleffects
];
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "${import ./sddm-theme.nix { inherit pkgs; }}";
};
}

View File

@ -1,16 +0,0 @@
{ config, lib, nixpkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"steam"
"steam-original"
"steam-run"
];
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
}

View File

@ -1,11 +0,0 @@
{ pkgs, ... }:
{
services.sunshine = {
enable = true;
package = pkgs.unstable.sunshine.override { cudaSupport = true; };
autoStart = true;
capSysAdmin = true;
openFirewall = true;
};
}

View File

@ -1,15 +0,0 @@
{ pkgs, ... }:
{
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
services.gvfs.enable = true;
services.tumbler.enable = true;
programs.file-roller.enable = true;
}

View File

@ -1,16 +0,0 @@
{ pkgs, ... }:
{
hardware.graphics = {
enable = true;
enable32Bit = true;
};
hardware.graphics.extraPackages = with pkgs; [
amdvlk
];
hardware.graphics.extraPackages32 = with pkgs; [
driversi686Linux.amdvlk
];
}

View File

@ -1,6 +1,20 @@
{ pkgs, ... }:
{ config, lib, ... }:
{
with lib;
let
cfg = config.settings.hardware.bluetooth;
in {
options = {
settings.hardware.bluetooth.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable bluetooth
'';
};
};
config = mkIf cfg.enable {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
@ -12,4 +26,5 @@
};
services.blueman.enable = true;
};
}

View File

@ -1,9 +1,24 @@
{ ... }:
{ config, lib, ... }:
{
with lib;
let
cfg = config.settings.hardware.firewall;
in {
options = {
settings.hardware.firewall.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable firewall
'';
};
};
config = mkIf cfg.enable {
networking.firewall = {
enable = true;
allowedTCPPorts = [ ];
allowedUDPPorts = [ ];
};
};
}

View File

@ -1,8 +1,23 @@
{ lib, pkgs, ... }:
{ config, lib, ... }:
{
with lib;
let
cfg = config.settings.hardware.fprint;
in {
options = {
settings.hardware.fprint.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable fingerprint
'';
};
};
config = mkIf cfg.enable {
services.fprintd.enable = true;
security.pam.services.login.fprintAuth = false;
security.pam.services.cosmic-greeter.fprintAuth = false;
};
}

View File

@ -1,11 +0,0 @@
{ ... }:
{
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
nix.settings.auto-optimise-store = true;
}

View File

@ -1,24 +0,0 @@
{ ... }:
{
# services.auto-cpufreq.enable = true;
# services.auto-cpufreq.settings = {
# battery = {
# governor = "powersave";
# turbo = "never";
# };
# charger = {
# governor = "performance";
# turbo = "auto";
# };
# };
services.power-profiles-daemon.enable = true;
boot.extraModprobeConfig = ''
options snd_hda_intel power_save=0
'';
# powerManagement.powertop.enable = true;
}

View File

@ -1,6 +1,20 @@
{ ... }:
{ config, lib, ... }:
{
with lib;
let
cfg = config.settings.hardware.locale;
in {
options = {
settings.hardware.locale.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable locale configuration
'';
};
};
config = mkIf cfg.enable {
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
@ -18,4 +32,5 @@
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
};
};
}

View File

@ -1,8 +1,23 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
with lib;
let
cfg = config.settings.hardware.printing;
in {
options = {
settings.hardware.printing.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable printer configuration
'';
};
};
config = mkIf cfg.enable {
services.printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
};
}

View File

@ -1,12 +0,0 @@
{ pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
users.users.xeovalyte.extraGroups = [ "libvirtd" ];
environment.systemPackages = with pkgs; [
quickemu
];
}

View File

@ -0,0 +1,37 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.settings.services.docker;
in {
options = {
settings.services.docker.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable docker configuration
'';
};
};
config = mkIf cfg.enable {
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
};
users.users.xeovalyte.extraGroups = [ "docker" ];
security.wrappers = {
docker-rootlesskit = {
owner = "root";
group = "root";
capabilities = "cap_net_bind_service+ep";
source = "${pkgs.rootlesskit}/bin/rootlesskit";
};
};
};
}

View File

@ -0,0 +1,26 @@
{ config, lib, ... }:
with lib;
let
cfg = config.settings.services.garbage-collection;
in {
options = {
settings.services.garbage-collection.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable garbage collection of nix store
'';
};
};
config = mkIf cfg.enable {
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
nix.settings.auto-optimise-store = true;
};
}

View File

@ -0,0 +1,27 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.settings.services.quickemu;
in {
options = {
settings.services.quickemu.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable quickemu virtualisation
'';
};
};
config = mkIf cfg.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
users.users.xeovalyte.extraGroups = [ "libvirtd" ];
environment.systemPackages = with pkgs; [
quickemu
];
};
}

View File

@ -0,0 +1,26 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.settings.services.sunshine;
in {
options = {
settings.services.sunshine.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable sunshine service
'';
};
};
config = mkIf cfg.enable {
services.sunshine = {
enable = true;
package = pkgs.unstable.sunshine.override { cudaSupport = true; };
autoStart = true;
capSysAdmin = true;
openFirewall = true;
};
};
}