nix-greynix/configuration.nix

274 lines
7.8 KiB
Nix
Raw Permalink Normal View History

2025-05-18 21:41:41 +08:00
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/programs.nix
./modules/fonts.nix
./modules/gnome.nix
./modules/intel-gpu.nix
2025-06-19 13:54:49 +08:00
./modules/windows-support.nix
2025-05-18 21:41:41 +08:00
];
2025-06-19 11:08:40 +08:00
# Bootloader
2025-05-18 21:41:41 +08:00
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.configurationLimit = 10;
2025-06-19 08:12:06 +08:00
boot.initrd.luks.devices."luks-886090f3-1ba1-4134-9734-5b922106820d".device = "/dev/disk/by-uuid/886090f3-1ba1-4134-9734-5b922106820d";
# Let the system detect and handle plugged-in hardware
services.udev.enable = true;
2025-05-18 21:41:41 +08:00
# Clear /tmp during boot
boot.tmp.cleanOnBoot = true;
# Housekeeping: Garbage collection
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
nix.settings.auto-optimise-store = true;
# Increase buffer size
nix.settings.download-buffer-size = "4G";
2025-05-19 17:33:24 +08:00
# Adding features but not flakes
nix.settings = {
experimental-features = "nix-command";
};
2025-05-18 21:41:41 +08:00
# Networking
networking.hostName = "greynix"; # Define your hostname.
networking.networkmanager.enable = true;
2025-06-19 11:08:40 +08:00
#Recommended if you plan to use networked printers, scanners, or file shares.
services.avahi = {
enable = true; # Start the Avahi daemon.
ipv4 = true; # Enable mDNS for IPv4.
ipv6 = true; # Enable mDNS for IPv6.
nssmdns4 = true; # Enable mDNS resolution for IPv4.
nssmdns6 = true; # Enable mDNS resolution for IPv6.
publish = {
enable = true; # Allow publishing services.
addresses = true; # Broadcast local IP addresses.
workstation = true; # Advertise as a "workstation" on the network.
hinfo = true; # Share hardware info (e.g. CPU/OS).
userServices = true; # Allow user-level services to be advertised.
};
};
environment.etc."nsswitch.conf".text = ''
passwd: files systemd
group: files systemd
shadow: files systemd
hosts: files mdns4_minimal mdns6_minimal [NOTFOUND=return] dns mdns4 mdns6 wins
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
'';
2025-06-19 11:00:54 +08:00
# Sudo options
2025-05-18 21:41:41 +08:00
# Disable sudo password for the wheel group
security.sudo.wheelNeedsPassword = false;
2025-06-19 11:00:54 +08:00
# Enable sudo-rs for better security (memory safe, written in Rust).
security.sudo-rs.enable = true;
2025-05-18 21:41:41 +08:00
2025-06-20 09:38:46 +08:00
# Localization & Time Zones
services.timesyncd = {
enable = true;
# NTP servers from around the world
servers = [
# Canada - Canadian government (CDN NTP Project)
"ntp1.ca"
"ntp2.ca"
"ntp3.ca"
# Iceland - RHnet (Icelandic University Research Network)
"ntp1.is"
# Netherlands - SURFnet (Research & Education Network)
"time1.surfnet.nl"
"time2.surfnet.nl"
# France - Paris Observatory (Observatoire de Paris)
"ntp.obspm.fr"
# Germany - Physikalisch-Technische Bundesanstalt (PTB)
"ptbtime1.ptb.de"
# Japan - NICT (National Institute of Information and Communications Technology)
"ntp.nict.jp"
# South Korea - KRISS (Korea Research Institute of Standards and Science)
"time.kriss.re.kr"
"time.bora.net"
"time.nuri.net"
# New Zealand - NIWA (National Institute of Water and Atmospheric Research)
"ntp1.niwa.co.nz"
# Australia - NMI (National Measurement Institute)
"ntp1.nmi.gov.au"
"ntp2.nmi.gov.au"
"ntp3.nmi.gov.au"
];
};
2025-05-18 21:41:41 +08:00
# Set your time zone.
time.timeZone = "Asia/Taipei";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "zh_TW.UTF-8";
LC_IDENTIFICATION = "zh_TW.UTF-8";
LC_MEASUREMENT = "zh_TW.UTF-8";
LC_MONETARY = "zh_TW.UTF-8";
LC_NAME = "zh_TW.UTF-8";
LC_NUMERIC = "zh_TW.UTF-8";
LC_PAPER = "zh_TW.UTF-8";
LC_TELEPHONE = "zh_TW.UTF-8";
LC_TIME = "zh_TW.UTF-8";
};
# Traditional Chinese input
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-chewing
fcitx5-chinese-addons
fcitx5-table-extra
];
};
2025-06-19 11:17:59 +08:00
# Xserver Options
2025-05-18 21:41:41 +08:00
# Enable the X11 windowing system.
services.xserver.enable = true;
2025-06-19 11:17:59 +08:00
services.xserver.videoDrivers = [ "amdgpu" "intel" ];
2025-06-20 09:43:23 +08:00
# GNOME Settings
2025-05-18 21:41:41 +08:00
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Remove Xterm program
services.xserver.excludePackages = [ pkgs.xterm ];
services.xserver.desktopManager.xterm.enable = false;
2025-06-20 09:43:23 +08:00
services.gnome.gnome-user-share.enable = true;
2025-05-18 21:41:41 +08:00
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = false;
# Enable sound with pipewire.
2025-06-06 12:40:26 +08:00
services.pulseaudio.enable = false;
2025-05-18 21:41:41 +08:00
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.elias = {
isNormalUser = true;
2025-06-06 12:40:26 +08:00
description = "elias";
2025-06-20 09:38:46 +08:00
#ADDED AUDIO GROUP FOR MICROPHONE, DIDN"T HELP
2025-06-06 12:40:26 +08:00
extraGroups = [ "networkmanager" "wheel" "audio"];
2025-05-18 21:41:41 +08:00
packages = with pkgs; [
# thunderbird
];
};
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "elias";
# 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;
2025-06-20 09:48:43 +08:00
# XDG Portals for Flatpak compatibility
# Portals help sandboxed Flatpak apps talk to your desktop (file picker, notifications, etc).
xdg.portal.enable = true;
# Enable both KDE and GTK backends for compatibility.
xdg.portal.extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
2025-05-18 21:41:41 +08:00
# Programs
# =====================
# Most programs installed in modules/programs.nix
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Services
# =====================
# List services that you want to enable:
# Enable OpenSSH daemon
services.openssh.enable = false;
# Enable Flatpak
services.flatpak.enable = true;
# Enable Tailscale
services.tailscale.enable = true;
# Enable Podman
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
# Enable Firmware Updater
services.fwupd.enable = true;
# fwupdmgr refresh
# fwupdmgr get-updates
# 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. Its 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?
}