init config

This commit is contained in:
2025-07-04 00:32:17 +02:00
commit 1a20402712
35 changed files with 2383 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
{ ... }:
{
imports = [
hardware/intel-cpu.nix
hardware/no-mitigations.nix
system/roles.nix
system/nixpkgs.nix
system/location.nix
system/shell.nix
system/users.nix
system/ssh.nix
desktop/plasma.nix
desktop/pulseaudio.nix
];
}
+37
View File
@@ -0,0 +1,37 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.enableGnome = lib.mkEnableOption "Enable Gnome desktop";
config = lib.mkIf config.lumpiasty.enableGnome {
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "pl";
variant = "";
};
# Configure console keymap
console.keyMap = "pl2";
# Enable external monitor brightness control
hardware.i2c.enable = true;
# Network
networking.useDHCP = lib.mkDefault false;
networking.networkmanager.enable = lib.mkDefault true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Use wayland in electron apps
environment.sessionVariables.NIXOS_OZONE_WL = "1";
};
}
+37
View File
@@ -0,0 +1,37 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.enablePlasma = lib.mkEnableOption "Enable Plasma6 desktop";
config = lib.mkIf config.lumpiasty.enablePlasma {
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "pl";
variant = "";
};
# Configure console keymap
console.keyMap = "pl2";
# Enable external monitor brightness control
hardware.i2c.enable = true;
# Network
networking.useDHCP = lib.mkDefault false;
networking.networkmanager.enable = lib.mkDefault true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Use wayland in electron apps
environment.sessionVariables.NIXOS_OZONE_WL = "1";
};
}
+60
View File
@@ -0,0 +1,60 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.enablePulseaudio = lib.mkEnableOption "Enable Plasma6 desktop";
config = lib.mkIf config.lumpiasty.enablePulseaudio {
# Enable sound with pipewire. Dont forget after 24.05
services.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;
wireplumber.configPackages = [
(pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-alsa-nova-3.conf" ''
monitor.alsa.rules = [
{
matches = [
{
node.name = "alsa_output.usb-SteelSeries_Arctis_Nova_3-00.analog-stereo"
}
]
actions = {
update-props = {
audio.format = "S24LE"
audio.rate = 96000
api.alsa.period-size = 1024
api.alsa.period-num = 4
api.alsa.disable-batch = false
}
}
}
]
'')
];
};
# hardware.pulseaudio = {
# enable = true;
# support32Bit = true;
# extraConfig = ''
# unload-module module-role-cork
# '';
# };
# hardware.alsa.enablePersistence = true; # not implemented in 24.05
# Remove me after 24.05
# sound.enable = true;
};
}
+195
View File
@@ -0,0 +1,195 @@
{ config, lib, pkgs, modulesPath, ... }:
{
# Enable system76-scheduler
# Config basically rewrite of stock, a bit tuned
services.system76-scheduler = {
enable = true;
useStockConfig = false;
settings = {
processScheduler = {
pipewireBoost = {
enable = true;
profile = {
nice = -6;
ioClass = "best-effort";
ioPrio = 0;
};
};
foregroundBoost = {
enable = true;
foreground = {
nice = 0;
ioClass = "best-effort";
ioPrio = 0;
};
background = {
nice = 6;
ioClass = "idle";
};
};
};
};
assignments = {
sound-server = {
nice = -15;
ioClass = "realtime";
ioPrio = 0;
matchers = [
# original config matches on /usr/bin/..., but this is NixOS
"pipewire"
"pipewire-pulse"
"jackd"
];
};
recording = {
nice = -9;
ioClass = "best-effort";
ioPrio = 0;
matchers = [
"amsynth"
"jamesdsp"
"jitsi"
"mumble"
"obs"
"teams"
"wireplumber"
"zoom"
"bitwig-studio"
"include name=\"Bitwig*\""
];
};
games = {
nice = -5;
ioClass = "best-effort";
ioPrio = 0;
matchers = [
"lutris"
"steam"
"heroic"
"itch"
"vrcompositor"
"vrdashboard"
"vrmonitor"
"vrserver"
"include descends=\"steam\""
"include descends=\"lutris\""
"include descends=\"heroic\""
"include descends=\"itch\""
];
};
desktop-environment = {
nice = -3;
ioClass = "best-effort";
ioPrio = 0;
matchers = [
"cosmic-comp"
"gnome-shell"
"i3wm"
"kwin"
"kwin_wayland"
"Xwayland"
"sway"
"Hyprland"
"gamescope"
"Xorg"
];
};
session-services = {
nice = 9;
ioClass = "idle";
matchers = [
"include parent=\"gnome-session-binary\""
"include parent=\"gvfsd\""
"include cgroup=\"/user.slice/*.service\" parent=\"systemd\""
"include cgroup=\"/user.slice/*/session.slice/*\" parent=\"systemd\""
"exclude cgroup=\"/user.slice/*/app.slice/*\""
"exclude cgroup=\"/user.slice/*/session.slice/*\""
"exclude cgroup=\"/user.slice/*app-dbus*\""
];
};
system-services = {
nice = 12;
ioClass = "idle";
matchers = [
"include cgroup=\"/system.slice/*\""
];
};
package-manager = {
nice = 15;
class = "batch";
ioClass = "idle";
matchers = [
"include name=\"apt-*\""
"include name=\"dpkg-*\""
"apt"
"dpkg"
"flatpak"
"fwupd"
"packagekitd"
"update-initramfs"
"nix"
];
};
batch = {
nice = 19;
class = "idle";
ioClass = "idle";
matchers = [
"include name=\"sbuild-*\""
"\"7z\""
"\"7za\""
"\"7zr\""
"ar"
"boinc"
"c++"
"cargo"
"clang"
"cmake"
"cpp"
"FAHClient"
"FAHCoreWrapper"
"fossilize-replay"
"g++"
"gcc"
"gradle"
"javac"
"ld"
"lld"
"make"
"mold"
"mvn"
"ninja"
"rust-analyzer"
"rustc"
"sbuild"
"tar"
"tracker-miner-fs-3"
"unrar"
"zip"
];
};
};
exceptions = [
"include descends=\"chrt\""
"include descends=\"gamemoderun\""
"include descends=\"ionice\""
"include descends=\"nice\""
"include descends=\"taskset\""
"include descends=\"schedtool\""
"chrt"
"dbus"
"dbus-broker"
"gamemoderun"
"ionice"
"nice"
"rtkit-daemon"
"systemd"
"taskset"
"schedtool"
"/etc/profiles/per-user/user/bin/easyeffects*"
];
};
# Add https://github.com/maxiberta/kwin-system76-scheduler-integration kwin script
}
+11
View File
@@ -0,0 +1,11 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.intelCpu = lib.mkEnableOption "Enable intel CPU";
config = lib.mkIf config.lumpiasty.intelCpu {
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# hardware.cpu.intel.updateMicrocode = true;
boot.kernelModules = [ "kvm-intel" ];
};
}
+11
View File
@@ -0,0 +1,11 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.noMitigations = lib.mkEnableOption "Disable mitigations";
config = lib.mkIf config.lumpiasty.noMitigations {
boot.kernelParams = [
"mitigations=off"
];
};
}
+18
View File
@@ -0,0 +1,18 @@
{ config, lib, pkgs, modulesPath, ... }:
{
# Time zone / Internalisation
time.timeZone = "Europe/Warsaw";
i18n.defaultLocale = "pl_PL.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "pl_PL.UTF-8";
LC_IDENTIFICATION = "pl_PL.UTF-8";
LC_MEASUREMENT = "pl_PL.UTF-8";
LC_MONETARY = "pl_PL.UTF-8";
LC_NAME = "pl_PL.UTF-8";
LC_NUMERIC = "pl_PL.UTF-8";
LC_PAPER = "pl_PL.UTF-8";
LC_TELEPHONE = "pl_PL.UTF-8";
LC_TIME = "pl_PL.UTF-8";
};
}
+11
View File
@@ -0,0 +1,11 @@
{ config, lib, pkgs, modulesPath, ... }:
{
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Overlay different packages on top of nixpkgs
nixpkgs.overlays = [
(import ../../overlays/pkgs.nix)
];
}
+5
View File
@@ -0,0 +1,5 @@
{config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.pc = lib.mkEnableOption "Enable options specific to personal computers";
}
+15
View File
@@ -0,0 +1,15 @@
{ config, lib, pkgs, modulesPath, ... }:
{
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
htop
tree
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}
+15
View File
@@ -0,0 +1,15 @@
{ config, lib, pkgs, modulesPath, ... }:
{
options.lumpiasty.sshd = lib.mkEnableOption "Enable intel CPU";
config = lib.mkIf config.lumpiasty.sshd {
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
AllowUsers = [ "user" ];
};
};
};
}
+40
View File
@@ -0,0 +1,40 @@
{ config, lib, pkgs, modulesPath, nix-flatpak, ... }:
let
cfg = config.lumpiasty.users;
mkHome = import ../../lib/mkHome.nix { lib = lib; nix-flatpak = nix-flatpak; };
mkUser = import ../../lib/mkUser.nix { lib = lib; };
in
{
options.lumpiasty.users = {
user = lib.mkEnableOption "Create user \"user\"";
drugi = lib.mkEnableOption "Create user \"drugi\"";
};
config = {
# Docker rootless user service, only if pc
# Unfortunately, not implemented in home-manager yet
virtualisation.docker.rootless = {
enable = config.lumpiasty.pc;
setSocketVariable = true;
};
# Flatpak
services.flatpak.enable = true;
# Users
users.mutableUsers = false;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# User user
users.users.user = mkUser cfg.user ../../users/user/config.nix;
home-manager.users.user = mkHome cfg.user ../../users/user/home.nix;
# User drugi
users.users.drugi = mkUser cfg.drugi ../../users/drugi/config.nix;
home-manager.users.drugi = mkHome cfg.drugi ../../users/drugi/home.nix;
};
}