diff options
33 files changed, 544 insertions, 434 deletions
@@ -55,22 +55,25 @@ } ) systems); - mkSystem = file: system: - nixpkgs.lib.nixosSystem { + mkSystem = hostDir: system: let + lib = nixpkgs.lib.extend (_: _: self.lib); + in + lib.nixosSystem { inherit system; - specialArgs = {inherit inputs system;}; + specialArgs = {inherit inputs system hostDir lib;}; modules = [ ./system ./options.nix - file + hostDir ]; }; - mkHome = file: system: let - hostModule = mkSystem file system; + mkHome = hostDir: system: let + hostModule = mkSystem hostDir system; + lib = nixpkgs.lib.extend (_: _: self.lib); in home-manager.lib.homeManagerConfiguration { inherit (hostModule) pkgs; - extraSpecialArgs = {inherit inputs system;}; + extraSpecialArgs = {inherit inputs system hostDir lib;}; modules = [ ./home ./options.nix @@ -97,7 +100,6 @@ }; lib = import ./lib { - inherit inputs; inherit (nixpkgs) lib; }; diff --git a/home/apps/caelestia/scheme.nix b/home/apps/caelestia/scheme.nix index 06991d9..ac4042c 100644 --- a/home/apps/caelestia/scheme.nix +++ b/home/apps/caelestia/scheme.nix @@ -1,11 +1,10 @@ { lib, config, - inputs, ... -}: -with inputs.self.lib; let +}: let inherit (lib) mkIf; + inherit (lib.colors) mixColor; cfg = config.apps.caelestia; theme = config.theme.colors; in { diff --git a/home/desktops/hyprland/hyprland.lua b/home/desktops/hyprland/hyprland.lua index c9596ca..8079bbc 100644 --- a/home/desktops/hyprland/hyprland.lua +++ b/home/desktops/hyprland/hyprland.lua @@ -1,7 +1,7 @@ --[[ - Hyprland Configuration - Copyright (c) Freya Murphy 2026 + Hyprland Configuration + Copyright (c) Freya Murphy 2026 ]]-- @@ -12,68 +12,66 @@ local hy3 = hl.plugin.hy3 --[[ LIB ]]-- local function exec(cmd) - return hl.dsp.exec_cmd(cmd) + return hl.dsp.exec_cmd(cmd) end local function bind(keys, cb, opts) - hl.bind(table.concat(keys, " + "), cb, opts or {}) + hl.bind(table.concat(keys, " + "), cb, opts or {}) end local function rgb(color) - return "rgb(" .. color .. ")" + return "rgb(" .. color .. ")" end local function animation(leaf, speed, bezier, style) - hl.animation({ - leaf = leaf, - enabled = true, - speed = speed, - bezier = bezier, - style = style, - }) + hl.animation({ + leaf = leaf, + enabled = true, + speed = speed, + bezier = bezier, + style = style, + }) end --[[ GENERAL ]]-- hl.config({ - general = { - layout = "hy3", - resize_on_border = true, - extend_border_grab_area = 20, - }, + general = { + resize_on_border = true, + extend_border_grab_area = 20, + }, }) - --[[ MONITORS ]]-- for _,monitor in pairs(config.monitors) do - local opts = { - scale = monitor.scale, - bitdepth = monitor.bitdepth, - } + local opts = { + scale = monitor.scale, + bitdepth = monitor.bitdepth, + } - -- output - if monitor.desc == "" then - opts.output = monitor.port - else - opts.output = "desc:" .. monitor.desc - end + -- output + if monitor.desc == "" then + opts.output = monitor.port + else + opts.output = "desc:" .. monitor.desc + end - -- mode - if monitor.size.enabled then - opts.mode = monitor.size.x .. "x" .. monitor.size.y - else - opts.mode = "preferred" - end + -- mode + if monitor.size.enabled then + opts.mode = monitor.size.x .. "x" .. monitor.size.y + else + opts.mode = "preferred" + end - -- position - if monitor.position.enabled then - opts.position = monitor.position.x .. "x" .. monitor.position.y - else - opts.position = "auto" - end + -- position + if monitor.position.enabled then + opts.position = monitor.position.x .. "x" .. monitor.position.y + else + opts.position = "auto" + end - hl.monitor(opts) + hl.monitor(opts) end --[[ ENVIRONMENT ]]-- @@ -81,8 +79,6 @@ end hl.env("XDG_CURRENT_DESKTOP", "Hyprland") hl.env("XDG_SESSION_TYPE", "wayland") hl.env("XDG_SESSION_DESKTOP", "Hyprland") -hl.env("MOZ_ENABLE_WAYLAND", "1") -hl.env("NIXOS_OZONE_WL", "1") hl.env("HYPRCURSOR_THEME", "rose-pine-hyprcursor") hl.env("HYPRCURSOR_SIZE", "24") @@ -110,18 +106,18 @@ bind({mod, "J"}, hl.dsp.layout("togglesplit")) -- Move focus with mod + arrow keys -- Move window across workspace with mod + arrow keys for _,direction in pairs({"left", "right", "up", "down"}) do - bind({mod, direction}, hl.dsp.focus({ direction = direction })) - bind({mod, "SHIFT", direction}, hy3.move_focus(direction)) + bind({mod, direction}, hy3.move_focus(direction)) + bind({mod, "SHIFT", direction}, hy3.move_window(direction)) end -- Switch workspaces with mod + [0-9] -- Move active window to a workspace with mod + SHIFT + [0-9] -- Move to tab in tab group for i = 1, 10 do - local key = i % 10 - bind({mod, key}, hl.dsp.focus({ workspace = i })) - bind({mod, "SHIFT", key}, hl.dsp.window.move({ workspace = i })) - bind({"ALT", key}, hy3.focus_tab({ index = i })) + local key = i % 10 + bind({mod, key}, hl.dsp.focus({ workspace = i })) + bind({mod, "SHIFT", key}, hl.dsp.window.move({ workspace = i, follow = false })) + bind({"ALT", key}, hy3.focus_tab({ index = i })) end -- Hy3 groups and tab groups @@ -159,75 +155,70 @@ bind({"XF86MonBrightnessUp"}, exec("brightnessctl set 5%+")) --[[ THEME ]]-- hl.config({ - general = { - gaps_in = config.theme.innerGap, - gaps_out = config.theme.outerGap, - border_size = config.theme.borderWidth, - - col = { - active_border = rgb(config.theme.colors.primary), - inactive_border = rgb(config.theme.colors.surface), - }, - }, - - decoration = { - rounding = config.theme.outerRadius, - shadow = { - enabled = true, - }, - blur = { - enabled = config.theme.blur, - size = 4, - passes = 2, - noise = 0.008, - contrast = 0.8916, - brightness = 0.8, - }, - }, + general = { + gaps_in = config.theme.innerGap, + gaps_out = config.theme.outerGap, + border_size = config.theme.borderWidth, + col = { + active_border = rgb(config.theme.colors.primary), + inactive_border = rgb(config.theme.colors.surface), + }, + }, + decoration = { + rounding = config.theme.outerRadius, + shadow = { + enabled = true, + }, + blur = { + enabled = config.theme.blur, + size = 4, + passes = 2, + noise = 0.008, + contrast = 0.8916, + brightness = 0.8, + }, + }, }) --[[ INPUT ]]-- hl.config({ - input = { - kb_layout = "us", - kb_variant = "", - kb_model = "", - kb_options = "gtp:alt_shift_toggle, compose:ralt", - kb_rules = "", - - follow_mouse = 1, - - sensitivity = 0, - - touchpad = { - natural_scroll = true, - }, - }, + input = { + kb_layout = "us", + kb_variant = "", + kb_model = "", + kb_options = "gtp:alt_shift_toggle, compose:ralt", + kb_rules = "", + follow_mouse = 1, + sensitivity = 0, + touchpad = { + natural_scroll = true, + }, + }, }) --[[ GESTURES ]]-- -- Allow 3 finger swipe on trackpad to seek workspaces hl.gesture({ - fingers = 3, - direction = "horizontal", - action = "workspace", + fingers = 3, + direction = "horizontal", + action = "workspace", }) --[[ ANIMATIONS ]]-- hl.config({ - animations = { - enabled = true, - }, + animations = { + enabled = true, + }, }) hl.curve("default", { type = "bezier", points = {{0.12, 0.92}, {0.08, 1.00}} }) hl.curve("overshot", { type = "bezier", points = {{0.18, 0.95}, {0.22, 1.03}} }) hl.curve("linear", { type = "bezier", points = {{1.00, 1.00}, {1.00, 1.00}} }) -animation("windows", 5, "default", "popin 60%") +animation("windows", 5, "default", "popin 60%") animation("windowsIn", 6, "overshot", "popin 60%") animation("windowsOut", 4, "overshot", "popin 60%") animation("windowsMove", 4, "overshot", "slide") @@ -242,12 +233,12 @@ animation("workspaces", 5, "overshot", "slide") animation("border", 1, "linear", nil) animation("borderangle", 24, "linear", "loop") --- [[ LAYER RULES ]]-- +--[[ LAYER RULES ]]-- -- Fix wierd borders for _,namespace in pairs({"wofi", "notification"}) do - hl.layer_rule({ blur = true, match = { namespace = namespace } }) - hl.layer_rule({ ignore_alpha = 0, match = { namespace = namespace } }) + hl.layer_rule({ blur = true, match = { namespace = namespace } }) + hl.layer_rule({ ignore_alpha = 0, match = { namespace = namespace } }) end hl.layer_rule({ no_anim = true, match = { namespace = "selection" } }) @@ -255,67 +246,66 @@ hl.layer_rule({ no_anim = true, match = { namespace = "selection" } }) --[[ XWAYLAND ]]-- hl.config({ - xwayland = { - force_zero_scaling = true, - use_nearest_neighbor = false, - }, + xwayland = { + force_zero_scaling = true, + use_nearest_neighbor = false, + }, }) --[[ HY3 ]]-- hl.config({ - plugin = { - hy3 = { - - -- Tabs - tabs = { - height = 24, - text_height = 9, - text_padding = 10, - padding = 2, - render_text = true, - text_font = "monospace", - radius = config.theme.outerRadius, - border_width = config.theme.borderWidth, - colors = { - active = rgb(config.theme.colors.base), - active_border = rgb(config.theme.colors.primary), - active_text = rgb(config.theme.colors.text), - inactive = rgb(config.theme.colors.base), - inactive_border = rgb(config.theme.colors.surface), - inactive_text = rgb(config.theme.colors.text), - } - }, - - autotile = { - enable = true, - }, - } - } + general = { + layout = "hy3", + }, + plugin = { + hy3 = { + tabs = { + height = 24, + text_height = 9, + text_padding = 10, + padding = 2, + render_text = true, + text_font = "monospace", + radius = config.theme.outerRadius, + border_width = config.theme.borderWidth, + colors = { + active = rgb(config.theme.colors.base), + active_border = rgb(config.theme.colors.primary), + active_text = rgb(config.theme.colors.text), + inactive = rgb(config.theme.colors.base), + inactive_border = rgb(config.theme.colors.surface), + inactive_text = rgb(config.theme.colors.text), + } + }, + autotile = { + enable = true, + }, + } + } }) --[[ MISC ]]-- hl.config({ - misc = { - disable_hyprland_logo = true, - disable_splash_rendering = true, - key_press_enables_dpms = true, - mouse_move_enables_dpms = true, - enable_anr_dialog = false, - vrr = 1, - }, - - ecosystem = { - no_update_news = true, - no_donation_nag = true, - }, + misc = { + disable_hyprland_logo = true, + disable_splash_rendering = true, + key_press_enables_dpms = true, + mouse_move_enables_dpms = true, + enable_anr_dialog = false, + vrr = 1, + }, + ecosystem = { + no_update_news = true, + no_donation_nag = true, + }, }) --[[ AUTOSTART ]]-- hl.on("hyprland.start", function() - for _,app in config.autoRun do - hl.exec_cmd(app) - end + for _,app in pairs(config.autoRun) do + hl.exec_cmd(app) + end end) diff --git a/home/gpg.nix b/home/gpg.nix index ae2614c..bbfbbeb 100644 --- a/home/gpg.nix +++ b/home/gpg.nix @@ -14,7 +14,7 @@ # source = path; # trust = 5; # }) - # inputs.self.lib.gpgKeys; + # lib.files.gpgKeys; }; # global gpg agent diff --git a/home/ssh/default.nix b/home/ssh/default.nix index 19909c9..2ad9220 100644 --- a/home/ssh/default.nix +++ b/home/ssh/default.nix @@ -3,7 +3,7 @@ programs.ssh = { enable = true; enableDefaultConfig = false; - matchBlocks."*" = {}; + settings."*" = {}; extraConfig = lib.fileContents ./config; }; } diff --git a/hosts/kaworu/default.nix b/hosts/kaworu/default.nix index 940f3fc..25c16c7 100644 --- a/hosts/kaworu/default.nix +++ b/hosts/kaworu/default.nix @@ -1,24 +1,23 @@ # Kaworu # System configuration for my desktop -_: { +{lib, ...}: { imports = [ ./hardware.nix ]; # options hostName = "kaworu"; - monitors = [ - { - name = "HDMI-A-1"; - scale = 1.0; - } + monitors = with lib.monitors; [ + asus + acer ]; # modules apps = { - astal.enable = true; + caelestia.enable = true; hyprlock.enable = true; kitty.enable = true; + obs.enable = true; }; browsers = { firefox.enable = true; @@ -28,18 +27,19 @@ _: { hyprland.enable = true; ly.enable = true; }; - development = { - c.enable = true; - rust.enable = true; - web.enable = true; - }; gaming = { + enable = true; + openrgb.enable = true; homestuck.enable = true; minecraft.enable = true; steam.enable = true; }; + bootloader = { + limine.enable = true; + }; # modules - bluetooth = true; - network = true; + amdgpu.enable = true; + bluetooth.enable = true; + network.enable = true; } diff --git a/hosts/kaworu/hardware.nix b/hosts/kaworu/hardware.nix index c3c9a57..0f2d277 100644 --- a/hosts/kaworu/hardware.nix +++ b/hosts/kaworu/hardware.nix @@ -1,11 +1,4 @@ _: { - # bootloader - boot.loader.systemd-boot.enable = true; - boot.loader.efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; - # kernel modules boot.initrd.availableKernelModules = [ "xhci_pci" diff --git a/hosts/shinji/default.nix b/hosts/shinji/default.nix index 0750d29..e22ee91 100644 --- a/hosts/shinji/default.nix +++ b/hosts/shinji/default.nix @@ -1,16 +1,17 @@ # Shinji # System configuration for my laptop -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: { imports = [ ./hardware.nix - ./sops.nix - ./wireguard.nix ]; # options hostName = "shinji"; - cores = 16; - monitors = [ + monitors = with lib.monitors; [ { port = "eDP-1"; laptop = true; @@ -18,22 +19,8 @@ bitdepth = 10; } # desktop when docked - { - desc = "ASUSTek COMPUTER INC ASUS VA24E LALMTF215939"; - position = { - enabled = true; - x = 2048; - y = 240; - }; - } - { - desc = "Acer Technologies EB321HQU 0x00000698"; - position = { - enabled = true; - x = 3968; - y = 0; - }; - } + asus + acer ]; # set power btn to suspend @@ -92,8 +79,20 @@ docker.enable = true; qemu.enable = true; }; + vpn = { + enable = true; + ip = "10.3.0.3/32"; + }; + bootloader = { + limine = { + enable = true; + secureBoot.enable = true; + }; + plymouth.enable = true; + }; # modules + amdgpu.enable = true; battery.enable = true; bluetooth.enable = true; network.enable = true; diff --git a/hosts/shinji/hardware.nix b/hosts/shinji/hardware.nix index b0933f0..1edae37 100644 --- a/hosts/shinji/hardware.nix +++ b/hosts/shinji/hardware.nix @@ -8,24 +8,6 @@ inputs.nixos-hardware.nixosModules.lenovo-yoga-7-slim-gen8 ]; - # bootloader - boot.loader = { - efi.canTouchEfiVariables = true; - limine = { - enable = true; - efiSupport = true; - secureBoot.enable = true; - maxGenerations = 10; - style = { - backdrop = config.theme.colors.base; - wallpapers = [config.theme.wallpaper]; - }; - }; - - grub.enable = false; - systemd-boot.enable = false; - }; - # kernel modules boot.initrd.availableKernelModules = [ "nvme" diff --git a/hosts/shinji/sops.nix b/hosts/shinji/sops.nix deleted file mode 100644 index 9169bbc..0000000 --- a/hosts/shinji/sops.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ]; - - environment.systemPackages = with pkgs; [ - sops - ]; - - sops = { - defaultSopsFile = ./secrets.yaml; - - gnupg.home = config.homePath + "/.local/share/gnupg"; - gnupg.sshKeyPaths = []; - - secrets = { - freyanetWg = {}; - }; - }; -} diff --git a/hosts/shinji/wireguard.nix b/hosts/shinji/wireguard.nix deleted file mode 100644 index 8e42f9d..0000000 --- a/hosts/shinji/wireguard.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - pkgs, - ... -}: { - environment.systemPackages = with pkgs; [ - wireguard-tools - ]; - - networking.wg-quick.interfaces = { - freyanet = { - address = ["10.3.0.3/32"]; - dns = ["10.2.0.1"]; - privateKeyFile = config.sops.secrets.freyanetWg.path; - autostart = false; - - peers = [ - { - publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk="; - allowedIPs = ["10.0.0.0/8"]; - endpoint = "freya.cat:3000"; - persistentKeepalive = 25; - } - ]; - }; - }; -} diff --git a/hosts/thinkpad/default.nix b/hosts/thinkpad/default.nix index 11b5bcb..e57214d 100644 --- a/hosts/thinkpad/default.nix +++ b/hosts/thinkpad/default.nix @@ -3,8 +3,6 @@ _: { imports = [ ./hardware.nix - ./sops.nix - ./wireguard.nix ]; # options @@ -35,6 +33,13 @@ _: { homestuck.enable = true; minecraft.enable = true; }; + vpn = { + enable = true; + ip = "10.3.0.5/32"; + }; + bootloader = { + grub.enable = true; + }; # modules battery.enable = true; diff --git a/hosts/thinkpad/hardware.nix b/hosts/thinkpad/hardware.nix index a012cbc..9d58333 100644 --- a/hosts/thinkpad/hardware.nix +++ b/hosts/thinkpad/hardware.nix @@ -1,24 +1,9 @@ -{ - config, - inputs, - ... -}: { +{inputs, ...}: { # external defaults imports = [ inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-7th-gen ]; - # bootloader - boot.loader = { - efi.canTouchEfiVariables = true; - grub = { - enable = true; - efiSupport = true; - device = "nodev"; - splashImage = config.theme.wallpaper; - }; - }; - # kernel modules boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; boot.initrd.kernelModules = []; diff --git a/hosts/thinkpad/sops.nix b/hosts/thinkpad/sops.nix deleted file mode 100644 index 9169bbc..0000000 --- a/hosts/thinkpad/sops.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ]; - - environment.systemPackages = with pkgs; [ - sops - ]; - - sops = { - defaultSopsFile = ./secrets.yaml; - - gnupg.home = config.homePath + "/.local/share/gnupg"; - gnupg.sshKeyPaths = []; - - secrets = { - freyanetWg = {}; - }; - }; -} diff --git a/hosts/thinkpad/wireguard.nix b/hosts/thinkpad/wireguard.nix deleted file mode 100644 index 72eb113..0000000 --- a/hosts/thinkpad/wireguard.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - pkgs, - ... -}: { - environment.systemPackages = with pkgs; [ - wireguard-tools - ]; - - networking.wg-quick.interfaces = { - freyanet = { - address = ["10.3.0.5/32"]; - dns = ["10.2.0.1"]; - privateKeyFile = config.sops.secrets.freyanetWg.path; - autostart = false; - - peers = [ - { - publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk="; - allowedIPs = ["10.0.0.0/8"]; - endpoint = "freya.cat:3000"; - persistentKeepalive = 25; - } - ]; - }; - }; -} diff --git a/lib/colors.nix b/lib/colors.nix index a653f11..27f29bb 100644 --- a/lib/colors.nix +++ b/lib/colors.nix @@ -1,4 +1,4 @@ -{lib, ...}: let +{lib}: let colorToInt = hex: let table = { "0" = 0; diff --git a/lib/default.nix b/lib/default.nix index 21031c8..2842af4 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,73 +1,8 @@ -{lib, ...} @ inputs: let - callLibs = file: import file inputs; - files = callLibs ./files.nix; - colors = callLibs ./colors.nix; +{lib}: let + callLibs = file: import file {inherit lib;}; in { - inherit (files) getFiles certs sshKeys gpgKeys; - inherit (colors) colorToInt colorToHex darkenColor lightenColor mixColor; - - # set of options we want to copy from a system - # config to home manager - homeConfig = config: - { - inherit - (config) - # System Information - hostName - timeZone - stateVersion - # System Modules - battery - bluetooth - fingerprint - network - tpm - nvidia - minimal - # Primary User - user - fullName - email - homePath - dotfilesPath - # Monitors - monitors - # Theme - theme - # Programs - apps - browsers - desktops - gaming - development - virt - autoRun - # Packages - extraPackages - ; - # fix xdg - xdg.portal = { - inherit - (config.xdg.portal) - enable - xdgOpenUsePortal - extraPortals - config - ; - }; - # bring over nix options - nix = lib.mkForce { - inherit - (config.nix) - buildMachines - checkConfig - distributedBuilds - gc - package - registry - settings - ; - }; - } - // config.extraHome; + colors = callLibs ./colors.nix; + files = callLibs ./files.nix; + home = callLibs ./home.nix; + monitors = callLibs ./monitors.nix; } diff --git a/lib/files.nix b/lib/files.nix index 960d1d0..c75508c 100644 --- a/lib/files.nix +++ b/lib/files.nix @@ -1,8 +1,8 @@ -{lib, ...}: let +{lib}: let # gets list of files from a directory getFiles = folder: lib.attrsets.mapAttrsToList (name: _: "${folder}/${name}") (builtins.readDir folder); - +in { # gets custom set of root certs certs = getFiles ../files/certs; @@ -15,9 +15,4 @@ gpgKeys = builtins.filter (filePath: lib.strings.hasSuffix "asc" filePath) (getFiles ../files/keys); -in { - inherit getFiles; - inherit certs; - inherit sshKeys; - inherit gpgKeys; } diff --git a/lib/home.nix b/lib/home.nix new file mode 100644 index 0000000..4b4ec02 --- /dev/null +++ b/lib/home.nix @@ -0,0 +1,66 @@ +{lib}: { + # set of options we want to copy from a system + # config to home manager + mkConfig = config: + { + inherit + (config) + # System Information + hostName + timeZone + stateVersion + # System Modules + battery + bluetooth + fingerprint + network + tpm + nvidia + minimal + # Primary User + user + fullName + email + homePath + dotfilesPath + # Monitors + monitors + # Theme + theme + # Programs + apps + browsers + desktops + gaming + development + virt + autoRun + # Packages + extraPackages + ; + # fix xdg + xdg.portal = { + inherit + (config.xdg.portal) + enable + xdgOpenUsePortal + extraPortals + config + ; + }; + # bring over nix options + nix = lib.mkForce { + inherit + (config.nix) + buildMachines + checkConfig + distributedBuilds + gc + package + registry + settings + ; + }; + } + // config.extraHome; +} diff --git a/lib/monitors.nix b/lib/monitors.nix new file mode 100644 index 0000000..4cb2977 --- /dev/null +++ b/lib/monitors.nix @@ -0,0 +1,21 @@ +_: { + # 1080p small ASUS monitor + asus = { + desc = "ASUSTek COMPUTER INC ASUS VA24E LALMTF215939"; + position = { + enabled = true; + x = 2048; + y = 240; + }; + }; + + # 1440p 32in acer + acer = { + desc = "Acer Technologies EB321HQU 0x00000698"; + position = { + enabled = true; + x = 3968; + y = 0; + }; + }; +} diff --git a/options.nix b/options.nix index e3ab592..e1208d7 100644 --- a/options.nix +++ b/options.nix @@ -252,11 +252,6 @@ in { description = "NixOS State Version"; default = "26.05"; }; - cores = mkOption { - type = types.int; - description = "Number of logical cores on the system"; - default = 8; - }; # # Packages @@ -270,6 +265,7 @@ in { # # System modules # + amdgpu.enable = mkEnableOption "Enable amdgpu optimizations"; battery.enable = mkEnableOption "Install battery and power system services and programs."; bluetooth.enable = mkEnableOption "Install bluetooth system services and programs."; fingerprint.enable = mkEnableOption "Install fingerprint system services and programs."; @@ -512,6 +508,7 @@ in { # gaming = { enable = mkEnableOption "Enable gaming optimizations"; + openrgb.enable = mkEnableOption "Enable OpenRGB support"; homestuck.enable = mkEnableOption "Install the unofficial homestuck collection."; minecraft.enable = mkEnableOption "Install the minecraft block game."; steam.enable = mkEnableOption "Install the steam game launcher."; @@ -531,6 +528,18 @@ in { }; # + # Different bootloaders to choose from (system only) + # + bootloader = { + grub.enable = mkEnableOption "Enable the grub boot loader"; + limine = { + enable = mkEnableOption "Enable the limine boot loader"; + secureBoot.enable = mkEnableOption "Enable secure boot for limine"; + }; + plymouth.enable = mkEnableOption "Enable the plymouth splash screen"; + }; + + # # Virt/VM programs to enable # virt = { @@ -540,6 +549,24 @@ in { }; # + # FreyaNET Wireguard VPN + # + vpn = { + enable = mkEnableOption "Enable freyanet wireguard vpn"; + ip = mkOption { + type = types.str; + description = "Wireguard local address"; + }; + }; + + # + # Enable sops module + # + sops = { + enable = mkEnableOption "Enable sops module"; + }; + + # # Programs to auto start on launch # autoRun = mkOption { diff --git a/system/amdgpu.nix b/system/amdgpu.nix new file mode 100644 index 0000000..5bb0f02 --- /dev/null +++ b/system/amdgpu.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.amdgpu; +in { + config = mkIf cfg.enable { + # kernel modules + boot = { + initrd.kernelModules = ["amdgpu"]; + kernelModules = ["kvm-amd"]; + }; + + # AMD Anti-Lag + hardware.graphics.extraPackages = with pkgs; [ + low-latency-layer + ]; + + # Configuration + environment.variables = { + AMD_VULKAN_ICD = "RADV"; + RADV_ANTILAG = "1"; + LOW_LATENCY_LAYER = "1"; + }; + }; +} diff --git a/system/bootloader/default.nix b/system/bootloader/default.nix new file mode 100644 index 0000000..29fa61d --- /dev/null +++ b/system/bootloader/default.nix @@ -0,0 +1,7 @@ +_: { + imports = [ + ./grub.nix + ./limine.nix + ./plymouth.nix + ]; +} diff --git a/system/bootloader/grub.nix b/system/bootloader/grub.nix new file mode 100644 index 0000000..167e779 --- /dev/null +++ b/system/bootloader/grub.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf; + cfg = config.bootloader.grub; +in { + config = mkIf cfg.enable { + boot.loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + splashImage = config.theme.wallpaper; + }; + }; + }; +} diff --git a/system/bootloader/limine.nix b/system/bootloader/limine.nix new file mode 100644 index 0000000..3487809 --- /dev/null +++ b/system/bootloader/limine.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf; + cfg = config.bootloader.limine; +in { + config = mkIf cfg.enable { + boot.loader = { + efi.canTouchEfiVariables = true; + limine = { + enable = true; + efiSupport = true; + secureBoot.enable = cfg.secureBoot.enable; + maxGenerations = 10; + style = { + backdrop = config.theme.colors.base; + wallpapers = [config.theme.wallpaper]; + }; + }; + }; + }; +} diff --git a/system/bootloader/plymouth.nix b/system/bootloader/plymouth.nix new file mode 100644 index 0000000..9338a84 --- /dev/null +++ b/system/bootloader/plymouth.nix @@ -0,0 +1,25 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf; + cfg = config.bootloader.plymouth; +in { + config = mkIf cfg.enable { + boot = { + kernelParams = [ + "quiet" + "splash" + "rd.udev.log_level=3" + "systemd.show_status=auto" + "udev.log_priority=3" + "vt.global_cursor_default=0" + ]; + plymouth = { + enable = true; + theme = "bgrt"; + }; + }; + }; +} diff --git a/system/default.nix b/system/default.nix index 4bb2809..f8101c8 100644 --- a/system/default.nix +++ b/system/default.nix @@ -13,18 +13,22 @@ in { inputs.nix-gaming.nixosModules.platformOptimizations inputs.nix-gaming.nixosModules.pipewireLowLatency inputs.nix-gaming.nixosModules.wine + ./bootloader ./desktops ./gaming ./virt + ./amdgpu.nix ./battery.nix ./bluetooth.nix ./desktop.nix ./fingerprint.nix ./networking.nix ./nvidia.nix + ./sops.nix ./sshd.nix ./tpm.nix ./unfree.nix + ./vpn.nix ]; # allow flakes @@ -38,9 +42,11 @@ in { experimental-features = ["nix-command" "flakes"]; use-xdg-base-directories = true; trusted-users = ["root" "@wheel"]; - max-jobs = config.cores / 4; - cores = (config.cores - 2) / config.nix.settings.max-jobs; }; + # make nice + daemonCPUSchedPolicy = "idle"; + daemonIOSchedClass = "idle"; + daemonIOSchedPriority = 7; }; # allow defined unfree packages @@ -87,7 +93,7 @@ in { imports = [ ../home ../options.nix - (inputs.self.lib.homeConfig config) + (lib.home.mkConfig config) ]; }; @@ -175,7 +181,7 @@ in { }; # certs - security.pki.certificateFiles = inputs.self.lib.certs; + security.pki.certificateFiles = lib.files.certs; # sudo security.sudo.enable = false; diff --git a/system/desktops/wayland.nix b/system/desktops/wayland.nix index 2f43fb3..382d6a1 100644 --- a/system/desktops/wayland.nix +++ b/system/desktops/wayland.nix @@ -23,6 +23,13 @@ in { }; }; + environment.variables = { + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + SDL_VIDEODRIVER = "wayland,x11"; + SDL_VIDEO_DRIVER = "wayland,x11"; + }; + programs.xwayland.enable = true; }; } diff --git a/system/gaming/default.nix b/system/gaming/default.nix index ac04c6f..606f565 100644 --- a/system/gaming/default.nix +++ b/system/gaming/default.nix @@ -12,6 +12,16 @@ in { ]; config = mkIf cfg.enable { + boot.kernelParams = [ + # lower latency + "tsc=reliable" + "clocksource=tsc" + "preempt=full" + # no watchdog + "nmi_watchdog=0" + "nowatchdog" + ]; + programs.wine = { enable = true; package = pkgs.wineWow64Packages.staging; @@ -19,6 +29,23 @@ in { ntsync = true; }; + services.ananicy = { + enable = true; + package = pkgs.ananicy-cpp; + rulesProvider = pkgs.ananicy-rules-cachyos; + }; + + services.hardware.openrgb = { + enable = cfg.openrgb.enable; + package = pkgs.openrgb-with-all-plugins; + }; + + services.scx = { + enable = true; + package = pkgs.scx.rustscheds; + scheduler = "scx_pandemonium"; + }; + environment.systemPackages = with pkgs; [ winetricks ]; diff --git a/system/nvidia.nix b/system/nvidia.nix index d9818e0..feb2edd 100644 --- a/system/nvidia.nix +++ b/system/nvidia.nix @@ -9,7 +9,13 @@ in { config = mkIf cfg.enable { # kernel modules - boot.blacklistedKernelModules = ["nouveau"]; + boot = { + blacklistedKernelModules = ["nouveau"]; + kernelParams = [ + "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + "nvidia.NVreg_TemporaryFilePath=/var/tmp" + ]; + }; services.xserver.videoDrivers = ["modesetting" "nvidia"]; # nvidia driver @@ -17,7 +23,7 @@ in { modesetting.enable = true; powerManagement = { enable = true; - finegrained = true; + finegrained = false; }; prime = cfg.primeBusIds diff --git a/system/sops.nix b/system/sops.nix new file mode 100644 index 0000000..17f6f13 --- /dev/null +++ b/system/sops.nix @@ -0,0 +1,27 @@ +{ + config, + pkgs, + lib, + inputs, + hostDir, + ... +}: let + inherit (lib) mkIf; + cfg = config.sops; +in { + imports = [ + inputs.sops-nix.nixosModules.sops + ]; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + sops + ]; + + sops = { + defaultSopsFile = hostDir + "/secrets.yaml"; + gnupg.home = config.homePath + "/.local/share/gnupg"; + gnupg.sshKeyPaths = []; + }; + }; +} diff --git a/system/sshd.nix b/system/sshd.nix index e60da43..088b6e1 100644 --- a/system/sshd.nix +++ b/system/sshd.nix @@ -1,7 +1,6 @@ { lib, config, - inputs, ... }: let inherit (lib) mkIf; @@ -35,7 +34,7 @@ in { # add authorized keys users.users.${config.user} = { - openssh.authorizedKeys.keyFiles = inputs.self.lib.sshKeys; + openssh.authorizedKeys.keyFiles = lib.files.sshKeys; }; }; } diff --git a/system/vpn.nix b/system/vpn.nix new file mode 100644 index 0000000..c336f32 --- /dev/null +++ b/system/vpn.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.vpn; +in { + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + wireguard-tools + ]; + + networking.wg-quick.interfaces = { + freyanet = { + address = [cfg.ip]; + dns = ["10.2.0.1"]; + privateKeyFile = config.sops.secrets.freyanetWg.path; + autostart = false; + + peers = [ + { + publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk="; + allowedIPs = ["10.0.0.0/8"]; + endpoint = "freya.cat:3000"; + persistentKeepalive = 25; + } + ]; + }; + }; + + sops = { + enable = true; + secrets.freyanetWg = {}; + }; + }; +} |