nixos/common.nix

108 lines
2.6 KiB
Nix
Raw Normal View History

2025-12-03 09:55:43 +00:00
# Common.nix
2025-12-02 21:44:07 +00:00
{ config, pkgs, lib, ... }:
{
2025-12-03 09:55:43 +00:00
# Use latest kernel
2025-12-02 21:44:07 +00:00
boot.kernelPackages = pkgs.linuxPackages_latest;
2025-12-03 10:02:45 +00:00
2025-12-03 10:07:54 +00:00
# Shell aliases
environment.shellAliases = {
2025-12-03 10:10:21 +00:00
update = "sudo nixos-rebuild switch --upgrade --option tarball-ttl 0";
clean = "sudo nix-collect-garbage -d"; # Clean old generations
ll = "ls -alh";
2025-12-03 10:07:54 +00:00
};
2025-12-03 10:02:45 +00:00
# Add packages
environment.systemPackages = [
pkgs.git
];
2025-12-02 21:44:07 +00:00
2025-12-03 09:55:43 +00:00
# GNOME + Keybinds
2025-12-02 21:44:07 +00:00
# Enable the X11 windowing system.
services.xserver.enable = true;
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
2025-12-03 09:55:43 +00:00
2025-12-03 10:43:45 +00:00
# Apply GNOME settings on login
2025-12-03 11:01:51 +00:00
systemd.user.services.gnomeSettings = {
description = "Apply GNOME custom settings";
wantedBy = [ "default.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "apply-gnome-settings" ''
echo "Running GNOME settings script..." >> /home/fred/gnome-settings.log
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
gsettings set org.gnome.desktop.wm.keybindings close "['<Super>q']"
gsettings set org.gnome.settings-daemon.plugins.media-keys home "['<Super>e']"
gsettings set org.gnome.settings-daemon.plugins.media-keys control-center "['<Super>i']"
'';
};
};
2025-12-03 10:40:34 +00:00
2025-12-02 21:44:07 +00:00
# Define a user account. Don't forget to set a password with passwd.
users.users.fred = {
isNormalUser = true;
description = "fred";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
bazaar
fastfetch
vesktop
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Services
services.flatpak.enable = true;
2025-12-03 10:07:54 +00:00
######################
##BORING STUFF BELOW##
######################
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# 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;
};
# Configure keymap in X11
services.xserver.xkb = {
layout = "gb";
variant = "";
};
# Configure console keymap
console.keyMap = "uk";
2025-12-02 21:44:07 +00:00
}