feat: add nixos and hm config

This commit is contained in:
js0ny 2025-10-11 11:26:21 +01:00
parent 8db7f8a1e9
commit ffafb4a329
54 changed files with 1282 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
chromium
nil
nixd
];
}

View file

@ -0,0 +1,8 @@
{pkgs, ...}: {
programs.chromium = {
extraOpts = {
"BrowserSignin" = 0;
"PasswordManagerEnabled" = false;
};
};
}

View file

@ -0,0 +1,105 @@
{
config,
pkgs,
...
}: {
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
security.pam.services.login.enableGnomeKeyring = true;
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/London";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_GB.UTF-8";
# extraLocales = [
# "en_GB.UTF-8/UTF-8"
# ];
extraLocaleSettings = {
# LC_CTYPE = "en_GB.UTF-8";
LC_ALL = "en_GB.UTF-8";
};
};
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Configure keymap in X11
services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
services.pipewire = {
enable = true;
pulse.enable = true;
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
environment.shellAliases = {
nrs = "sudo nixos-rebuild switch --flake ~/.dotfiles/nixcfgs";
};
# 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;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
nix.settings.experimental-features = ["nix-command" "flakes"];
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.js0ny = {
isNormalUser = true;
extraGroups = ["wheel" "docker" "libvirtd" "dialout"]; # Enable sudo for the user.
packages = with pkgs; [
tree
];
};
services.flatpak.enable = true;
}

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
imports = [
./configuration.nix
./packages.nix
./fonts.nix
];
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
services.desktopManager.gnome.enable = true;
}

View file

@ -0,0 +1,7 @@
{...}: {
programs.hyprland = {
enable = true;
withUWSM = false;
xwayland.enable = true;
};
}

View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
services.desktopManager.plasma6.enable = true;
}

View file

@ -0,0 +1,26 @@
{ pkgs, ... }:
{
boot.extraModprobeConfig = ''
blacklist nouveau
options nouveau modeset=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
'';
services.xserver.videoDrivers = [ "modesetting" ];
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
hardware.nvidia = {
# enable = false;
modesetting.enable = false;
powerManagement.enable = false;
};
}

View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
services.displayManager.gdm = {
enable = true;
wayland = true;
};
}

View file

@ -0,0 +1,3 @@
{...}: {
services.displayManager.ly.enable = true;
}

View file

@ -0,0 +1,6 @@
{...}: {
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
}

View file

@ -0,0 +1,16 @@
{pkgs, ...}: {
virtualisation = {
docker.enable = true;
podman.enable = true;
};
# systemd.services.docker = {
# serviceConfig = {
# Environment = [
# "HTTP_PROXY=127.0.0.1:7897"
# "HTTPS_PROXY=127.0.0.1:7897"
# "NO_PROXY=localhost,127.0.0.1,.example.com"
# ];
# };
# };
}

View file

@ -0,0 +1,33 @@
{
pkgs,
config,
...
}: {
programs.firefox = {
enable = true;
languagePacks = ["zh-CN"];
preferences = {
"widget.use-xdg-desktop-portal.file-picker" = 1;
};
policies = {
DisableTelemetry = true;
BlockAboutConfig = false;
DontCheckDefaultBrowser = true;
ExtensionSettings = let
moz = short: "https://addons.mozilla.org/firefox/downloads/latest/${short}/latest.xpi";
in {
"*".installation_mode = "blocked";
"uBlock0@raymondhill.net" = {
install_url = moz "ublock-origin";
installation_mode = "force_installed";
updates_disabled = true;
};
};
};
};
}

View file

@ -0,0 +1,55 @@
{
pkgs,
config,
...
}: {
environment.systemPackages = with pkgs; [
maple-mono.NF
sarasa-gothic
lxgw-wenkai
lxgw-neoxihei
noto-fonts-cjk-sans
noto-fonts
noto-fonts-emoji
nerd-fonts.jetbrains-mono
];
fonts = {
enableDefaultPackages = true;
fontconfig = {
enable = true;
defaultFonts = {
monospace = ["Maple Mono NF" "JetBrainsMono Nerd Font"];
serif = ["LXGW WenKai"];
sansSerif = ["LXGW Neo XiHei"];
};
};
fontDir.enable = true;
};
system.fsPackages = [pkgs.bindfs];
fileSystems = let
mkRoSymBind = path: {
device = path;
fsType = "fuse.bindfs";
options = ["ro" "resolve-symlinks" "x-gvfs-hide"];
};
aggregated = pkgs.buildEnv {
name = "system-fonts-and-icons";
paths = with pkgs; [
libsForQt5.breeze-qt5
noto-fonts
noto-fonts-emoji
noto-fonts-cjk-sans
noto-fonts-cjk-serif
];
pathsToLink = ["/share/fonts" "/share/icons"];
};
in {
# Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind "${aggregated}/share/icons";
"/usr/share/fonts" = mkRoSymBind "${aggregated}/share/fonts";
};
}

View file

@ -0,0 +1,11 @@
# ~/.config/nix-config/common/packages-headless.nix
{ pkgs, ... }:
{
# nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
powertop
];
}

View file

@ -0,0 +1,22 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
virt-manager
];
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
ovmf = {
enable = true;
packages = [
(pkgs.OVMF.override {
secureBoot = true;
tpmSupport = true;
}).fd
];
};
};
};
}

View file

@ -0,0 +1,11 @@
{
hardware.nvidia = {
open = false;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
}

View file

@ -0,0 +1,18 @@
# ~/.config/nix-config/common/packages-headless.nix
{pkgs, ...}: {
# nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
vim
wget
curl
git
tmux
pciutils
usbutils
smartmontools
wl-clipboard
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
];
}

View file

@ -0,0 +1,8 @@
# https://nixos.wiki/wiki/Wine
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
wineWowPackages.stable
winetricks
wineWowPackages.waylandFull
];
}