nix-greynix/configuration.nix
2025-06-20 09:48:43 +08:00

273 lines
7.8 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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
./modules/windows-support.nix
];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.configurationLimit = 10;
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;
# 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";
# Adding features but not flakes
nix.settings = {
experimental-features = "nix-command";
};
# Networking
networking.hostName = "greynix"; # Define your hostname.
networking.networkmanager.enable = true;
#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
'';
# Sudo options
# Disable sudo password for the wheel group
security.sudo.wheelNeedsPassword = false;
# Enable sudo-rs for better security (memory safe, written in Rust).
security.sudo-rs.enable = true;
# 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"
];
};
# 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
];
};
# Xserver Options
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" "intel" ];
# GNOME Settings
# 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;
services.gnome.gnome-user-share.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = false;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
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;
description = "elias";
#ADDED AUDIO GROUP FOR MICROPHONE, DIDN"T HELP
extraGroups = [ "networkmanager" "wheel" "audio"];
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;
# 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
];
# 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?
}