Initial commit
This commit is contained in:
21
nixos/audio.nix
Normal file
21
nixos/audio.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
# Audio configuration for NixOS using PipeWire
|
||||
{
|
||||
security.rtkit.enable = true;
|
||||
services.pulseaudio.enable = false;
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
wireplumber = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
"10-disable-camera" = {
|
||||
"wireplumber.profiles" = {main."monitor.libcamera" = "disabled";};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
9
nixos/bluetooth.nix
Normal file
9
nixos/bluetooth.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Bluetooth configuration for NixOS
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [blueman];
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
services.blueman.enable = true;
|
||||
}
|
||||
6
nixos/docker.nix
Normal file
6
nixos/docker.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
# Docker is a containerization platform that allows you to run applications in isolated environments called containers.
|
||||
{ config, ... }:
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
users.users."${config.var.username}".extraGroups = [ "docker" ];
|
||||
}
|
||||
27
nixos/fonts.nix
Normal file
27
nixos/fonts.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
# Fonts configuration for NixOS
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
fonts = {
|
||||
packages = with pkgs; [
|
||||
roboto
|
||||
work-sans
|
||||
comic-neue
|
||||
source-sans
|
||||
comfortaa
|
||||
inter
|
||||
lato
|
||||
lexend
|
||||
jost
|
||||
dejavu_fonts
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-color-emoji
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.meslo-lg
|
||||
openmoji-color
|
||||
twemoji-color-font
|
||||
];
|
||||
|
||||
enableDefaultPackages = false;
|
||||
};
|
||||
}
|
||||
9
nixos/home-manager.nix
Normal file
9
nixos/home-manager.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Home-manager configuration for NixOS
|
||||
{inputs, ...}: {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
backupFileExtension = "hm-backup";
|
||||
extraSpecialArgs = {inherit inputs;};
|
||||
};
|
||||
}
|
||||
15
nixos/hyprland.nix
Normal file
15
nixos/hyprland.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
# Hyprland is a dynamic tiling Wayland compositor.
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
package = inputs.hyprland.packages."${pkgs.stdenv.hostPlatform.system}".hyprland;
|
||||
portalPackage =
|
||||
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
}
|
||||
58
nixos/nix.nix
Normal file
58
nixos/nix.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
# Nix configuration for NixOS
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
autoGarbageCollector = config.var.autoGarbageCollector;
|
||||
in
|
||||
{
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
users = [ config.var.username ];
|
||||
commands = [
|
||||
{
|
||||
command = "/run/current-system/sw/bin/nixos-rebuild";
|
||||
options = [ "NOPASSWD" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||
channel.enable = false;
|
||||
extraOptions = ''
|
||||
warn-dirty = false
|
||||
'';
|
||||
settings = {
|
||||
download-buffer-size = 262144000; # 250 MB (250 * 1024 * 1024)
|
||||
auto-optimise-store = true;
|
||||
trusted-users = [ config.var.username ]; # Allows remote nixos-rebuild to vps
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
substituters = [
|
||||
# high priority since it's almost always used
|
||||
"https://cache.nixos.org?priority=10"
|
||||
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://numtide.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
|
||||
];
|
||||
};
|
||||
gc = {
|
||||
automatic = autoGarbageCollector;
|
||||
persistent = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
};
|
||||
}
|
||||
63
nixos/omen.nix
Normal file
63
nixos/omen.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
# Omen laptop configuration for NixOS
|
||||
# Import this only if you have an HP Omen laptop
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
hp-omen-linux-module =
|
||||
pkgs.callPackage
|
||||
({
|
||||
kernel ? config.boot.kernelPackages.kernel,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hp-omen-linux-module";
|
||||
version = "rebase-6.14";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ranisalt";
|
||||
repo = "hp-omen-linux-module";
|
||||
rev = finalAttrs.version;
|
||||
sha256 = "sha256-2zCm29bdboSjRm/caMjBPGNc0tZXPUnIIYlHxxfhAok=";
|
||||
};
|
||||
setSourceRoot = ''
|
||||
export sourceRoot=$(pwd)/${finalAttrs.src.name}/src
|
||||
'';
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
makeFlags = [
|
||||
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install hp-wmi.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86/hp/
|
||||
runHook postInstall
|
||||
'';
|
||||
})) {kernel = config.boot.kernelPackages.kernel;};
|
||||
in {
|
||||
boot.extraModulePackages = [hp-omen-linux-module];
|
||||
boot.kernelModules = ["hp-wmi"];
|
||||
|
||||
users.groups.omen-rgb = {};
|
||||
users.users.${config.var.username}.extraGroups = ["omen-rgb"];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"w /sys/devices/platform/hp-wmi/rgb_zones/zone00 0660 root omen-rgb -"
|
||||
"w /sys/devices/platform/hp-wmi/rgb_zones/zone01 0660 root omen-rgb -"
|
||||
"w /sys/devices/platform/hp-wmi/rgb_zones/zone02 0660 root omen-rgb -"
|
||||
"w /sys/devices/platform/hp-wmi/rgb_zones/zone03 0660 root omen-rgb -"
|
||||
];
|
||||
|
||||
services.udev.extraRules = ''
|
||||
SUBSYSTEM=="platform", KERNEL=="hp-wmi", ACTION=="add", \
|
||||
RUN+="${pkgs.coreutils-full}/bin/sleep 2", \
|
||||
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone00", \
|
||||
RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone00", \
|
||||
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone01", \
|
||||
RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone01", \
|
||||
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone02", \
|
||||
RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone02", \
|
||||
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone03", \
|
||||
RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone03"
|
||||
'';
|
||||
}
|
||||
47
nixos/sddm.nix
Normal file
47
nixos/sddm.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
# SDDM is a display manager for X11 and Wayland
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
foreground = config.theme.textColorOnWallpaper;
|
||||
sddm-astronaut = pkgs.sddm-astronaut.override {
|
||||
embeddedTheme = "purple_leaves";
|
||||
themeConfig = {
|
||||
HeaderTextColor = "#${foreground}";
|
||||
DateTextColor = "#${foreground}";
|
||||
TimeTextColor = "#${foreground}";
|
||||
LoginFieldTextColor = "#${foreground}";
|
||||
PasswordFieldTextColor = "#${foreground}";
|
||||
UserIconColor = "#${foreground}";
|
||||
PasswordIconColor = "#${foreground}";
|
||||
WarningColor = "#${foreground}";
|
||||
LoginButtonBackgroundColor = "#${foreground}";
|
||||
SystemButtonsIconsColor = "#${foreground}";
|
||||
SessionButtonTextColor = "#${foreground}";
|
||||
VirtualKeyboardButtonTextColor = "#${foreground}";
|
||||
DropdownBackgroundColor = "#${foreground}";
|
||||
HighlightBackgroundColor = "#${foreground}";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
services.displayManager = {
|
||||
sddm = {
|
||||
package = pkgs.kdePackages.sddm;
|
||||
extraPackages = [ sddm-astronaut ];
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
theme = "sddm-astronaut-theme";
|
||||
settings = {
|
||||
Wayland.SessionDir = "${
|
||||
inputs.hyprland.packages."${pkgs.stdenv.hostPlatform.system}".hyprland
|
||||
}/share/wayland-sessions";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ sddm-astronaut ];
|
||||
}
|
||||
34
nixos/systemd-boot.nix
Normal file
34
nixos/systemd-boot.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
# Systemd-boot configuration for NixOS
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
bootspec.enable = true;
|
||||
loader = {
|
||||
efi.canTouchEfiVariables = true;
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
consoleMode = "auto";
|
||||
configurationLimit = 5;
|
||||
};
|
||||
};
|
||||
tmp.cleanOnBoot = true;
|
||||
kernelPackages = pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc.
|
||||
|
||||
# Silent boot
|
||||
kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"rd.systemd.show_status=false"
|
||||
"rd.udev.log_level=3"
|
||||
"udev.log_priority=3"
|
||||
"boot.shell_on_fail"
|
||||
];
|
||||
consoleLogLevel = 0;
|
||||
initrd.verbose = false;
|
||||
};
|
||||
|
||||
# To avoid systemd services hanging on shutdown
|
||||
systemd.settings.Manager = {
|
||||
DefaultTimeoutStopSec = "10s";
|
||||
};
|
||||
}
|
||||
19
nixos/users.nix
Normal file
19
nixos/users.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
# Users configuration for NixOS
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
username = config.var.username;
|
||||
in {
|
||||
programs.zsh.enable = true;
|
||||
users = {
|
||||
defaultUserShell = pkgs.zsh;
|
||||
|
||||
users.${username} = {
|
||||
isNormalUser = true;
|
||||
description = "${username} account";
|
||||
extraGroups = ["networkmanager" "wheel"];
|
||||
};
|
||||
};
|
||||
}
|
||||
134
nixos/utils.nix
Normal file
134
nixos/utils.nix
Normal file
@@ -0,0 +1,134 @@
|
||||
# Misc
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hostname = config.var.hostname;
|
||||
keyboardLayout = config.var.keyboardLayout;
|
||||
configDir = config.var.configDirectory;
|
||||
timeZone = config.var.timeZone;
|
||||
defaultLocale = config.var.defaultLocale;
|
||||
otherLocale = config.var.otherLocale;
|
||||
numericLocale = config.var.numericLocale;
|
||||
timeLocale = config.var.timeLocale;
|
||||
autoUpgrade = config.var.autoUpgrade;
|
||||
in
|
||||
{
|
||||
networking.hostName = hostname;
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
systemd.services.NetworkManager-wait-online.enable = false;
|
||||
|
||||
# system.autoUpgrade = {
|
||||
# enable = autoUpgrade;
|
||||
# dates = "04:00";
|
||||
# flake = "${configDir}";
|
||||
# flags = [
|
||||
# "--update-input"
|
||||
# "nixpkgs"
|
||||
# "--commit-lock-file"
|
||||
# ];
|
||||
# allowReboot = false;
|
||||
# };
|
||||
|
||||
time = {
|
||||
timeZone = timeZone;
|
||||
};
|
||||
i18n.defaultLocale = defaultLocale;
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = otherLocale;
|
||||
LC_IDENTIFICATION = otherLocale;
|
||||
LC_MEASUREMENT = otherLocale;
|
||||
LC_MONETARY = numericLocale;
|
||||
LC_NAME = otherLocale;
|
||||
LC_NUMERIC = numericLocale;
|
||||
LC_PAPER = otherLocale;
|
||||
LC_TELEPHONE = otherLocale;
|
||||
LC_TIME = timeLocale;
|
||||
};
|
||||
|
||||
services = {
|
||||
xserver = {
|
||||
enable = true;
|
||||
xkb.layout = keyboardLayout;
|
||||
xkb.variant = "";
|
||||
};
|
||||
# gnome.gnome-keyring.enable = true;
|
||||
# psd = {
|
||||
# enable = true;
|
||||
# resyncTimer = "10m";
|
||||
# };
|
||||
};
|
||||
console.keyMap = keyboardLayout;
|
||||
|
||||
environment.variables = {
|
||||
XDG_DATA_HOME = "$HOME/.local/share";
|
||||
PASSWORD_STORE_DIR = "$HOME/.local/share/password-store";
|
||||
EDITOR = "nvim";
|
||||
TERMINAL = "kitty";
|
||||
TERM = "kitty";
|
||||
BROWSER = "brave";
|
||||
};
|
||||
|
||||
services.libinput.enable = true;
|
||||
programs.dconf.enable = true;
|
||||
services = {
|
||||
dbus = {
|
||||
enable = true;
|
||||
implementation = "broker";
|
||||
packages = with pkgs; [
|
||||
gcr
|
||||
gnome-settings-daemon
|
||||
];
|
||||
};
|
||||
gvfs.enable = true;
|
||||
upower.enable = true;
|
||||
power-profiles-daemon.enable = true;
|
||||
udisks2.enable = true;
|
||||
};
|
||||
|
||||
# enable zsh autocompletion for system packages (systemd, etc)
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
|
||||
# Faster rebuilding
|
||||
documentation = {
|
||||
enable = true;
|
||||
doc.enable = true;
|
||||
man.enable = true;
|
||||
dev.enable = true;
|
||||
info.enable = true;
|
||||
nixos.enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
hyprland-qtutils
|
||||
xdg-utils
|
||||
];
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
xdgOpenUsePortal = true;
|
||||
config = {
|
||||
common.default = [ "gtk" ];
|
||||
hyprland.default = [
|
||||
"gtk"
|
||||
"hyprland"
|
||||
];
|
||||
};
|
||||
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||
};
|
||||
|
||||
security = {
|
||||
# allow wayland lockers to unlock the screen
|
||||
pam.services.hyprlock.text = "auth include login";
|
||||
|
||||
# userland niceness
|
||||
rtkit.enable = true;
|
||||
|
||||
# don't ask for password for wheel group
|
||||
sudo.wheelNeedsPassword = false;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user