mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat: add nixos and hm config
This commit is contained in:
parent
8db7f8a1e9
commit
ffafb4a329
54 changed files with 1282 additions and 0 deletions
7
nixcfgs/modules/nixos/additional-packages.nix
Normal file
7
nixcfgs/modules/nixos/additional-packages.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
chromium
|
||||
nil
|
||||
nixd
|
||||
];
|
||||
}
|
||||
8
nixcfgs/modules/nixos/chromium.nix
Normal file
8
nixcfgs/modules/nixos/chromium.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{pkgs, ...}: {
|
||||
programs.chromium = {
|
||||
extraOpts = {
|
||||
"BrowserSignin" = 0;
|
||||
"PasswordManagerEnabled" = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
105
nixcfgs/modules/nixos/configuration.nix
Normal file
105
nixcfgs/modules/nixos/configuration.nix
Normal 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;
|
||||
}
|
||||
7
nixcfgs/modules/nixos/default.nix
Normal file
7
nixcfgs/modules/nixos/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./packages.nix
|
||||
./fonts.nix
|
||||
];
|
||||
}
|
||||
5
nixcfgs/modules/nixos/desktop/gnome.nix
Normal file
5
nixcfgs/modules/nixos/desktop/gnome.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.desktopManager.gnome.enable = true;
|
||||
}
|
||||
7
nixcfgs/modules/nixos/desktop/hyprland.nix
Normal file
7
nixcfgs/modules/nixos/desktop/hyprland.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{...}: {
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = false;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
}
|
||||
6
nixcfgs/modules/nixos/desktop/kde.nix
Normal file
6
nixcfgs/modules/nixos/desktop/kde.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.desktopManager.plasma6.enable = true;
|
||||
}
|
||||
|
||||
26
nixcfgs/modules/nixos/disable-nvidia.nix
Normal file
26
nixcfgs/modules/nixos/disable-nvidia.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
8
nixcfgs/modules/nixos/display-manager/gdm.nix
Normal file
8
nixcfgs/modules/nixos/display-manager/gdm.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.displayManager.gdm = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
};
|
||||
}
|
||||
3
nixcfgs/modules/nixos/display-manager/ly.nix
Normal file
3
nixcfgs/modules/nixos/display-manager/ly.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{...}: {
|
||||
services.displayManager.ly.enable = true;
|
||||
}
|
||||
6
nixcfgs/modules/nixos/display-manager/sddm.nix
Normal file
6
nixcfgs/modules/nixos/display-manager/sddm.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{...}: {
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
};
|
||||
}
|
||||
16
nixcfgs/modules/nixos/docker.nix
Normal file
16
nixcfgs/modules/nixos/docker.nix
Normal 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"
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
}
|
||||
33
nixcfgs/modules/nixos/firefox.nix
Normal file
33
nixcfgs/modules/nixos/firefox.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
55
nixcfgs/modules/nixos/fonts.nix
Normal file
55
nixcfgs/modules/nixos/fonts.nix
Normal 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";
|
||||
};
|
||||
}
|
||||
11
nixcfgs/modules/nixos/laptop.nix
Normal file
11
nixcfgs/modules/nixos/laptop.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# ~/.config/nix-config/common/packages-headless.nix
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# nixpkgs.config.allowUnfree = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
22
nixcfgs/modules/nixos/libvirt.nix
Normal file
22
nixcfgs/modules/nixos/libvirt.nix
Normal 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
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
11
nixcfgs/modules/nixos/nvidia.nix
Normal file
11
nixcfgs/modules/nixos/nvidia.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
hardware.nvidia = {
|
||||
open = false;
|
||||
};
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
}
|
||||
|
||||
18
nixcfgs/modules/nixos/packages.nix
Normal file
18
nixcfgs/modules/nixos/packages.nix
Normal 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
|
||||
];
|
||||
}
|
||||
8
nixcfgs/modules/nixos/wine.nix
Normal file
8
nixcfgs/modules/nixos/wine.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# https://nixos.wiki/wiki/Wine
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
wineWowPackages.stable
|
||||
winetricks
|
||||
wineWowPackages.waylandFull
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue