Add NixOS configs

This commit is contained in:
Medformatik committed 2025-03-18 14:12:54 +01:00
1 parent 75702ae16e
commit 595ef79559
3 files changed
+389

No files matched your search

+231
View File
@@ -0,0 +1,231 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, qitech-control, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
nix = {
package = pkgs.nixVersions.stable;
extraOptions = ''
experimental-features = nix-command flakes
'';
settings = {
sandbox = false;
};
};
# Create a realtime group
users.groups.realtime = {};
# Configure real-time privileges
security.pam.loginLimits = [
{
domain = "@realtime";
type = "-";
item = "rtprio";
value = "99";
}
{
domain = "@realtime";
type = "-";
item = "memlock";
value = "unlimited";
}
{
domain = "@realtime";
type = "-";
item = "nice";
value = "-20";
}
];
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Disable screen locking
services.xserver.displayManager.gdm.autoSuspend = false;
# Disable sleep/suspend
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
# Additional power management settings
powerManagement.enable = false;
# Configure keymap in X11
services.xserver.xkb = {
layout = "de";
variant = "";
};
# Configure console keymap
console.keyMap = "de";
# Enable CUPS to print documents.
services.printing.enable = false;
# Enable sound with pipewire.
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;
};
# Enable graphics acceleration
hardware.graphics.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Enable the QiTech Control server
services.qitech = {
enable = true;
openFirewall = true;
user = "qitech-service";
group = "qitech-service";
port = 3001;
# Specify the correct package
package = qitech-control.packages.${pkgs.system}.server;
};
# Keep the normal qitech user for login
users.users.qitech = {
isNormalUser = true;
description = "QiTech Industries";
extraGroups = [ "networkmanager" "wheel" "realtime" ];
packages = with pkgs; [ ];
};
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "qitech";
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
# Install firefox.
programs.firefox.enable = false;
# 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
gnome-tweaks
gnome-extension-manager
gnomeExtensions.dash-to-dock
git
qitech-control.packages.${pkgs.system}.electron
];
environment.gnome.excludePackages = (with pkgs; [
atomix # puzzle game
baobab # disk usage analyzer
cheese # webcam tool
eog # image viewer
epiphany # web browser
evince # document viewer
geary # email reader
gedit # text editor
simple-scan # document scanner
gnome-characters
gnome-music
gnome-photos
gnome-terminal
gnome-tour
gnome-calculator
gnome-calendar
gnome-contacts
gnome-maps
gnome-weather
hitori # sudoku game
iagno # go game
tali # poker game
totem # video player
seahorse # password manager
]);
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}
+65
View File
@@ -0,0 +1,65 @@
{
description = "NixOS configuration with Home Manager";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# Add the QiTech Control repository
qitech-control = {
url = "github:qitechgmbh/control";
inputs.nixpkgs.follows = "nixpkgs";
};
# Add the Rust overlay as an input
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, qitech-control, rust-overlay, ... }:
let
system = "x86_64-linux";
# Create overlays including qitech packages
overlays = [
rust-overlay.overlays.default
# Add an overlay to make qitech packages available
(final: prev: {
qitech-control-server = qitech-control.packages.${system}.server;
qitech-control-electron = qitech-control.packages.${system}.electron;
})
];
pkgs = import nixpkgs {
inherit system overlays;
};
in {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit qitech-control pkgs; };
modules = [
# Apply the overlay to the system
{ nixpkgs.overlays = overlays; }
./configuration.nix
# QiTech Control module
qitech-control.nixosModules.qitech
# Home Manager module
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.qitech = import ./home.nix;
}
];
};
};
}
+93
View File
@@ -0,0 +1,93 @@
{ config, pkgs, ... }: {
home.stateVersion = "24.11";
# Add autostart entry for the QiTech electron app
xdg.configFile."autostart/de.qitech.control-electron.desktop".text = ''
[Desktop Entry]
Type=Application
Name=QiTech Control
Comment=QiTech Industries Control Software
Exec=qitech-control-electron
Icon=de.qitech.control-electron
Terminal=false
StartupWMClass=de.qitech.control-electron
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Phase=Applications
'';
dconf.settings = {
# Set GNOME wallpaper
"org/gnome/desktop/background" = {
picture-uri = "https://i.postimg.cc/0N61BwSp/qitech-industries-wallpaper.jpg";
picture-uri-dark = "https://i.postimg.cc/0N61BwSp/qitech-industries-wallpaper.jpg";
picture-options = "zoom";
};
# Enable on-screen keyboard
"org/gnome/desktop/a11y/applications" = {
screen-keyboard-enabled = true;
};
# Configure on-screen keyboard (optional)
"org/gnome/desktop/a11y" = {
always-show-universal-access-status = true;
};
# Disable screen blanking/timeout
"org/gnome/desktop/session" = {
idle-delay = 0; # 0 seconds = never
};
# Disable automatic suspend
"org/gnome/settings-daemon/plugins/power" = {
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "nothing";
power-button-action = "nothing";
};
# Disable screen lock
"org/gnome/desktop/screensaver" = {
lock-enabled = false;
idle-activation-enabled = false;
};
# Disable screen dimming
"org/gnome/settings-daemon/plugins/power" = {
idle-dim = false;
};
# Show dock on all monitors and always visible
"org/gnome/shell/extensions/dash-to-dock" = {
dock-position = "BOTTOM";
extend-height = false;
dock-fixed = true;
autohide = false;
intellihide = false;
multi-monitor = true; # Show dock on all monitors
isolate-monitors = false; # Don't isolate workspaces per monitor
isolate-workspaces = false; # Don't isolate dock content per workspace
};
# Configure display settings
"org/gnome/mutter" = {
workspaces-only-on-primary = false; # Show workspaces on all monitors
dynamic-workspaces = false; # Disable dynamic workspaces
};
"org/gnome/desktop/wm/preferences" = {
num-workspaces = 1; # Set a fixed number of workspaces (default: 4)
};
"org/gnome/shell" = {
always-show-log-out = true;
enabled-extensions = [
"dash-to-dock@micxgx.gmail.com"
];
favorite-apps = [
"de.qitech.control-electron.desktop" # The desktop entry from the QiTech app
"org.gnome.Settings.desktop"
"org.gnome.Terminal.desktop"
];
};
};
}