Split up config files to multiple and added imports. Fixed default values for systemConfigs

This commit is contained in:
Martin Berg Alstad 2025-04-15 12:48:27 +02:00
parent 9611b8bb8d
commit 16c4a8f46b
Signed by: martials
GPG Key ID: 706F53DD087A91DE
23 changed files with 149 additions and 163 deletions

View File

@ -23,10 +23,10 @@
# ========= Utilities ========= # ========= Utilities =========
# #
# Secrets management # Secrets management
sops-nix = { # sops-nix = {
url = "github:mic92/sops-nix"; # url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
}; # };
# Catppuccin theming # Catppuccin theming
catppuccin = { catppuccin = {
url = "github:catppuccin/nix"; url = "github:catppuccin/nix";
@ -76,7 +76,7 @@
lib = nixpkgs.lib.extend customLib; lib = nixpkgs.lib.extend customLib;
libHm = home-manager.lib.extend customLib; libHm = home-manager.lib.extend customLib;
systems = [ systems = builtins.map (config: defaultAttrs // config) [
{ {
hostName = "desktop"; hostName = "desktop";
system = "x86_64-linux"; system = "x86_64-linux";
@ -94,6 +94,16 @@
# TODO Homelab config # TODO Homelab config
]; ];
defaultAttrs = {
user = {
name = common.username;
password = "temp";
};
version = common.system.version;
wayland.enable = true;
nvidia.enable = false;
};
in in
{ {
# #
@ -110,18 +120,9 @@
{ {
hostName, hostName,
system, system,
user ? { user,
name = common.username; ...
password = "temp"; }@systemConfig:
},
version ? common.version,
wayland ? {
enable = true;
},
nvidia ? {
enable = false;
},
}@systemConfig: # TODO only pass in systemConfig
{ {
name = hostName; name = hostName;

View File

@ -1,70 +1,11 @@
{ {
pkgs, lib,
inputs,
outputs,
common,
... ...
}: }:
{ {
imports = [ ./modules ]; imports = [
(lib.custom.relativeToRoot "shared/modules")
nixpkgs.overlays = [ outputs.overlays.unstable-packages ]; ./hardware-configuration.nix
# Bootloader.
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.${common.username} = {
isNormalUser = true;
description = common.username;
extraGroups = [
"networkmanager"
"wheel"
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.sessionVariables = {
# Tells Electron apps to use Wayland
NIXOS_OZONE_WL = "1";
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
xdg-utils
xdg-desktop-portal
xdg-desktop-portal-gtk
unstable.protonmail-desktop
stremio
fastfetch
discord
nix-prefetch-github # Cmd to get rev and hash from GitHub
gimp
vlc
vdhcoapp # TODO run "vdhcoapp install" on startup
onlyoffice-desktopeditors
inputs.grayjay.packages.${system}.grayjay
]; ];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
programs.kdeconnect.enable = true;
services = {
flatpak.enable = false;
xserver.enable = true;
};
system.stateVersion = common.system.version;
} }

View File

@ -1,8 +0,0 @@
{ lib, ... }:
{
imports = [
(lib.custom.relativeToRoot "shared/modules")
./hardware-configuration.nix
];
}

View File

@ -1,72 +1,23 @@
{ {
pkgs, pkgs,
outputs, lib,
common,
... ...
}: }:
{ {
imports = [ ./modules ]; imports = [
(lib.custom.relativeToRoot "shared/modules")
./battery.nix
./bluetooth.nix
./hardware-configuration.nix
./security.nix
];
nixpkgs.overlays = [ outputs.overlays.unstable-packages ]; boot.kernelPackages = pkgs.linuxPackages_latest;
# Bootloader.
boot = {
kernelPackages = pkgs.linuxPackages_latest;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.${common.username} = {
isNormalUser = true;
description = common.username;
extraGroups = [
"networkmanager"
"wheel"
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.sessionVariables = {
# Tells Electron apps to use Wayland
NIXOS_OZONE_WL = "1";
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
brightnessctl brightnessctl
wget hyprsunset # Blue light filter
xdg-utils
xdg-desktop-portal
xdg-desktop-portal-gtk
unstable.protonmail-desktop
stremio
fastfetch
discord
nix-prefetch-github # Cmd to get rev and hash from GitHub
gimp
vlc
vdhcoapp
onlyoffice-desktopeditors
]; ];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
programs.kdeconnect.enable = true;
services = {
flatpak.enable = false;
xserver.enable = true;
};
system.stateVersion = common.system.version;
} }

View File

@ -1,15 +0,0 @@
{ pkgs, lib, ... }:
{
imports = [
(lib.custom.relativeToRoot "shared/modules")
./battery.nix
./bluetooth.nix
./hardware-configuration.nix
./security.nix
];
environment.systemPackages = with pkgs; [
hyprsunset # Blue light filter
];
}

6
shared/modules/boot.nix Normal file
View File

@ -0,0 +1,6 @@
{
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
}

View File

@ -1,17 +1,28 @@
{ {
imports = [ imports = [
./boot.nix
./development ./development
./electron.nix
./fonts.nix ./fonts.nix
./gaming ./gaming
./gnome ./gnome
./hardware ./hardware
./kdeconnect.nix
./locale.nix ./locale.nix
./mail.nix
./media.nix
./networking.nix ./networking.nix
./nixos.nix
./nix-helper.nix ./nix-helper.nix
./office.nix
./hyprland ./hyprland
./sddm.nix ./sddm.nix
./security.nix ./security.nix
./shell.nix ./shell.nix
./social.nix
./users.nix
./qt.nix ./qt.nix
./xdg.nix
./xserver.nix
]; ];
} }

View File

@ -0,0 +1,8 @@
{ lib, systemConfig, ... }:
{
environment.sessionVariables = lib.mkIf systemConfig.wayland.enable {
# Tells Electron apps to use Wayland
NIXOS_OZONE_WL = "1";
};
}

View File

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

7
shared/modules/mail.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
unstable.protonmail-desktop
];
}

11
shared/modules/media.nix Normal file
View File

@ -0,0 +1,11 @@
{ pkgs, inputs, ... }:
{
environment.systemPackages = with pkgs; [
stremio
gimp
vlc
vdhcoapp
inputs.grayjay.packages.${system}.grayjay
];
}

View File

@ -1,6 +1,10 @@
{ systemConfig, ... }: { pkgs, systemConfig, ... }:
{ {
environment.systemPackages = with pkgs; [
wget
];
networking = { networking = {
networkmanager.enable = true; networkmanager.enable = true;
hostName = systemConfig.hostName; hostName = systemConfig.hostName;

25
shared/modules/nixos.nix Normal file
View File

@ -0,0 +1,25 @@
{
pkgs,
outputs,
systemConfig,
...
}:
{
environment.systemPackages = with pkgs; [
nix-prefetch-github # Cmd to get rev and hash from GitHub
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs = {
# Allow unfree packages
config.allowUnfree = true;
overlays = [ outputs.overlays.unstable-packages ];
};
system.stateVersion = systemConfig.version;
}

View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
onlyoffice-desktopeditors
];
}

View File

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

15
shared/modules/users.nix Normal file
View File

@ -0,0 +1,15 @@
{ systemConfig, ... }:
let
username = systemConfig.user.name;
in
{
# Define a user without a password, TODO pass in user.password
users.users.${username} = {
isNormalUser = true;
description = username;
extraGroups = [
"networkmanager"
"wheel"
];
};
}

9
shared/modules/xdg.nix Normal file
View File

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
xdg-utils
xdg-desktop-portal
xdg-desktop-portal-gtk
];
}

View File

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