From 79bf183c6c0472a0997d44b4428289a69f010a58 Mon Sep 17 00:00:00 2001 From: azikx Date: Sat, 26 Oct 2024 22:44:55 +0900 Subject: [PATCH] =?UTF-8?q?update=20=EF=8C=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.lock | 31 ++++++++-- flake.nix | 9 ++- home/programs/gui/pkgs.nix | 2 +- home/programs/misc/xdg.nix | 31 +++++----- modules/host/default.nix | 5 ++ modules/host/hardware/bluetooth/default.nix | 20 +++++++ modules/host/hardware/boot/default.nix | 65 +++++++++++++++++++++ modules/host/hardware/cpu/default.nix | 16 +++++ modules/host/hardware/default.nix | 5 ++ modules/host/hardware/gpu/default.nix | 25 ++++++++ modules/host/hardware/network/default.nix | 40 +++++++++++++ modules/host/hardware/security/default.nix | 42 +++++++++++++ modules/host/hardware/sound/default.nix | 27 +++++++++ modules/host/misc/default.nix | 5 ++ modules/host/misc/locales/default.nix | 18 ++++++ modules/host/misc/minimal/default.nix | 21 +++++++ modules/host/misc/power/default.nix | 16 +++++ modules/host/misc/system76/default.nix | 25 ++++++++ modules/host/misc/torrserver/default.nix | 27 +++++++++ modules/host/misc/torrserver/package.nix | 27 +++++++++ modules/host/misc/users/default.nix | 40 +++++++++++++ modules/host/misc/variables/default.nix | 32 ++++++++++ modules/host/misc/zapret/default.nix | 57 ++++++++++++++++++ modules/host/programs/default.nix | 5 ++ modules/host/programs/fish/default.nix | 11 ++++ modules/host/programs/git/default.nix | 16 +++++ modules/host/programs/hm/default.nix | 17 ++++++ modules/host/programs/hyprland/default.nix | 19 ++++++ modules/host/programs/light/default.nix | 11 ++++ modules/host/programs/nh/default.nix | 22 +++++++ modules/host/programs/packages/default.nix | 13 +++++ modules/host/programs/steam/default.nix | 28 +++++++++ modules/host/services/autocpu/default.nix | 28 +++++++++ modules/host/services/dbus/default.nix | 11 ++++ modules/host/services/default.nix | 6 ++ modules/host/services/getty/default.nix | 18 ++++++ modules/host/services/gvfs/default.nix | 11 ++++ modules/host/services/laptop/default.nix | 63 ++++++++++++++++++++ modules/host/services/polkit/default.nix | 11 ++++ modules/host/services/printing/default.nix | 11 ++++ modules/host/services/tailscale/default.nix | 18 ++++++ modules/host/services/xserver/default.nix | 23 ++++++++ modules/host/services/zram/default.nix | 27 +++++++++ 43 files changed, 933 insertions(+), 22 deletions(-) create mode 100644 modules/host/default.nix create mode 100644 modules/host/hardware/bluetooth/default.nix create mode 100644 modules/host/hardware/boot/default.nix create mode 100644 modules/host/hardware/cpu/default.nix create mode 100644 modules/host/hardware/default.nix create mode 100644 modules/host/hardware/gpu/default.nix create mode 100644 modules/host/hardware/network/default.nix create mode 100644 modules/host/hardware/security/default.nix create mode 100644 modules/host/hardware/sound/default.nix create mode 100644 modules/host/misc/default.nix create mode 100644 modules/host/misc/locales/default.nix create mode 100644 modules/host/misc/minimal/default.nix create mode 100644 modules/host/misc/power/default.nix create mode 100644 modules/host/misc/system76/default.nix create mode 100644 modules/host/misc/torrserver/default.nix create mode 100644 modules/host/misc/torrserver/package.nix create mode 100644 modules/host/misc/users/default.nix create mode 100644 modules/host/misc/variables/default.nix create mode 100644 modules/host/misc/zapret/default.nix create mode 100644 modules/host/programs/default.nix create mode 100644 modules/host/programs/fish/default.nix create mode 100644 modules/host/programs/git/default.nix create mode 100644 modules/host/programs/hm/default.nix create mode 100644 modules/host/programs/hyprland/default.nix create mode 100644 modules/host/programs/light/default.nix create mode 100644 modules/host/programs/nh/default.nix create mode 100644 modules/host/programs/packages/default.nix create mode 100644 modules/host/programs/steam/default.nix create mode 100644 modules/host/services/autocpu/default.nix create mode 100644 modules/host/services/dbus/default.nix create mode 100644 modules/host/services/default.nix create mode 100644 modules/host/services/getty/default.nix create mode 100644 modules/host/services/gvfs/default.nix create mode 100644 modules/host/services/laptop/default.nix create mode 100644 modules/host/services/polkit/default.nix create mode 100644 modules/host/services/printing/default.nix create mode 100644 modules/host/services/tailscale/default.nix create mode 100644 modules/host/services/xserver/default.nix create mode 100644 modules/host/services/zram/default.nix diff --git a/flake.lock b/flake.lock index 7f5022a..c9412bd 100644 --- a/flake.lock +++ b/flake.lock @@ -765,6 +765,26 @@ "type": "github" } }, + "nypkgs": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726657437, + "narHash": "sha256-eBeVOFceQkYfWHAwdQ+aM8vLAbsuuWUgek2f6dFBTl0=", + "owner": "yunfachi", + "repo": "nypkgs", + "rev": "698ab4159dc38affee2fc5886468af139de8d95e", + "type": "github" + }, + "original": { + "owner": "yunfachi", + "repo": "nypkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -802,6 +822,7 @@ "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable_2", "nur": "nur", + "nypkgs": "nypkgs", "spicetify-nix": "spicetify-nix", "stylix": "stylix", "walls": "walls", @@ -1074,15 +1095,15 @@ "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1729404148, - "narHash": "sha256-OxLb5uMhJI65zQXY+Altq1mI4mDgYkc/ZeQwwRBMsxY=", - "owner": "axax-loll", + "lastModified": 1729457884, + "narHash": "sha256-oNuY6kQDfqpe1K6dEP7IIoegnSZvvv/WKD/6xcefncc=", + "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "8062a16083cda535819698aebf08f68f89f607b4", + "rev": "8146e6a761f9d51f1a93528709733685ff046e2c", "type": "github" }, "original": { - "owner": "axax-loll", + "owner": "0xc000022070", "repo": "zen-browser-flake", "type": "github" } diff --git a/flake.nix b/flake.nix index 1a1d43e..03b8dcf 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,9 @@ modules = [ ./home ]; }; }; + + hostModules = import ./modules/host; + homeModules = import ./modules/home; }; inputs = { @@ -30,7 +33,7 @@ ayugram-desktop.url = "github:kaeeraa/ayugram-desktop/release?submodules=1"; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - zen-browser.url = "github:axax-loll/zen-browser-flake"; + zen-browser.url = "github:0xc000022070/zen-browser-flake"; stylix.url = "github:danth/stylix"; yazi.url = "github:sxyazi/yazi"; @@ -47,6 +50,10 @@ url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; + nypkgs = { + url = "github:yunfachi/nypkgs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; auto-cpufreq = { url = "github:AdnanHodzic/auto-cpufreq"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/home/programs/gui/pkgs.nix b/home/programs/gui/pkgs.nix index 4a53475..8ce009a 100644 --- a/home/programs/gui/pkgs.nix +++ b/home/programs/gui/pkgs.nix @@ -41,7 +41,7 @@ config.nur.repos.abszero.palgen config.nur.repos.rycee.mozilla-addons-to-nix - inputs.ayugram-desktop.packages.${pkgs.system}.default + inputs.ayugram-desktop.packages.${pkgs.system}.ayugram-desktop inputs.zen-browser.packages."${pkgs.system}".specific ]; } diff --git a/home/programs/misc/xdg.nix b/home/programs/misc/xdg.nix index a433975..4b64bf5 100644 --- a/home/programs/misc/xdg.nix +++ b/home/programs/misc/xdg.nix @@ -34,21 +34,22 @@ in { videos = "${hmdir}/Videos"; }; desktopEntries = { - zen = { - name = "Zen Browser"; - exec = "appimage-run ${hmdir}/.local/share/zen-specific.AppImage"; - terminal = false; - icon = "firefox"; - mimeType = [ - "text/html" - "text/xml" - "application/xhtml+xml" - "application/vnd.mozilla.xul+xml" - "x-scheme-handler/http" - "x-scheme-handler/https" - ]; - type = "Application"; - }; + /* zen = { + name = "Zen Browser"; + exec = "appimage-run ${hmdir}/.local/share/zen-specific.AppImage"; + terminal = false; + icon = "firefox"; + mimeType = [ + "text/html" + "text/xml" + "application/xhtml+xml" + "application/vnd.mozilla.xul+xml" + "x-scheme-handler/http" + "x-scheme-handler/https" + ]; + type = "Application"; + }; + */ }; }; } diff --git a/modules/host/default.nix b/modules/host/default.nix new file mode 100644 index 0000000..def3b81 --- /dev/null +++ b/modules/host/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + imports = lib.fileset.toList ( + # All default.nix files in ./. + lib.fileset.fileFilter (file: file.name == "default.nix") ./.); +} diff --git a/modules/host/hardware/bluetooth/default.nix b/modules/host/hardware/bluetooth/default.nix new file mode 100644 index 0000000..48bd5c7 --- /dev/null +++ b/modules/host/hardware/bluetooth/default.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.bluetooth; +in { + options = { module.hardware.bluetooth = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + hardware.bluetooth = { # BLUETOOTH LOL + enable = true; + powerOnBoot = true; + }; + environment.systemPackages = with pkgs; [ # TUI FOR BLUETOOTH + bluetuith + bluetooth_battery + ]; + }; +} + diff --git a/modules/host/hardware/boot/default.nix b/modules/host/hardware/boot/default.nix new file mode 100644 index 0000000..7c53095 --- /dev/null +++ b/modules/host/hardware/boot/default.nix @@ -0,0 +1,65 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.boot; +in { + options = { module.hardware.boot = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + boot = { # ITSELF LOL + kernelPackages = pkgs.linuxPackages_zen; + kernelModules = [ "kvm-amd" ]; + consoleLogLevel = 0; + kernelParams = [ + "quiet" + "loglevel=3" + "nowatchdog" + "page_alloc.shuffle=1" + "threadirqs" + "split_lock_detect=off" + "pci=pcie_bus_perf" + "psmouse.synaptics_intertouch=0" + "rd.systemd.show_status=false" + ]; + + loader = { # SYSTEMD BOOT AS DEFAULT + systemd-boot = { + enable = true; + configurationLimit = 4; + }; + efi.canTouchEfiVariables = true; + timeout = 0; # TIMEOUT FOR LAUNCH + }; + + initrd = { # IDK + availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "ohci_pci" + "ehci_pci" + "pata_atiixp" + "ums_realtek" + "sd_mod" + "sr_mod" + "sdhci_pci" + "usb_storage" + ]; + systemd.enable = true; + compressor = "zstd"; + compressorArgs = [ "-9" ]; + verbose = false; + }; + + plymouth = { # PLYMOUTH WITH NIXOS LOGO + enable = true; + logo = + "${pkgs.nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png"; + }; + + tmp.cleanOnBoot = true; + }; + }; +} + diff --git a/modules/host/hardware/cpu/default.nix b/modules/host/hardware/cpu/default.nix new file mode 100644 index 0000000..c01335c --- /dev/null +++ b/modules/host/hardware/cpu/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.cpu; +in { + options = { module.hardware.cpu = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + hardware.cpu.amd = { # OPTIMIZATION FOR CPU + updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + ryzen-smu.enable = true; + }; + }; +} diff --git a/modules/host/hardware/default.nix b/modules/host/hardware/default.nix new file mode 100644 index 0000000..def3b81 --- /dev/null +++ b/modules/host/hardware/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + imports = lib.fileset.toList ( + # All default.nix files in ./. + lib.fileset.fileFilter (file: file.name == "default.nix") ./.); +} diff --git a/modules/host/hardware/gpu/default.nix b/modules/host/hardware/gpu/default.nix new file mode 100644 index 0000000..2785f75 --- /dev/null +++ b/modules/host/hardware/gpu/default.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.gpu; +in { + options = { module.hardware.gpu = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + hardware = { + graphics = { # GPU + enable = true; + enable32Bit = true; + extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ]; + }; + amdgpu = { + amdvlk = { + enable = true; + support32Bit.enable = true; + supportExperimental.enable = true; + }; + }; + }; + }; +} diff --git a/modules/host/hardware/network/default.nix b/modules/host/hardware/network/default.nix new file mode 100644 index 0000000..03fe4d6 --- /dev/null +++ b/modules/host/hardware/network/default.nix @@ -0,0 +1,40 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.network; +in { + options = { + module.hardware.network = { + enable = mkEnableOption ""; + host = mkOption { + type = types.str; + default = null; + }; + }; + }; + + config = mkIf cfg.enable { + networking = { # FOR NETWORK + hostName = cfg.host; + networkmanager = { + enable = true; + insertNameservers = [ "1.1.1.1" "1.0.0.1" ]; + dns = "systemd-resolved"; + wifi = { + powersave = true; + macAddress = "random"; + backend = "iwd"; + }; + }; + useDHCP = mkDefault true; + nftables.enable = true; + }; + services.resolved.enable = true; + systemd.services = { # IDK + NetworkManager-wait-online.enable = false; + systemd-networkd-wait-online.enable = mkForce false; + }; + }; +} + diff --git a/modules/host/hardware/security/default.nix b/modules/host/hardware/security/default.nix new file mode 100644 index 0000000..9f40605 --- /dev/null +++ b/modules/host/hardware/security/default.nix @@ -0,0 +1,42 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.security; +in { + options = { + module.hardware.security = { + enable = mkEnableOption ""; + username = mkOption { + default = null; + type = types.str; + }; + }; + }; + + config = mkIf cfg.enable { + security = { + sudo.enable = false; + sudo-rs = { + enable = true; + execWheelOnly = true; + wheelNeedsPassword = true; + }; + doas = { # VERY TOP + enable = true; + wheelNeedsPassword = true; + extraRules = [{ + users = [ cfg.username ]; + keepEnv = true; + persist = true; + }]; + }; + pam.services = { + gtklock = { }; + swaylock = { }; + hyprlock = { }; + }; + }; + }; +} + diff --git a/modules/host/hardware/sound/default.nix b/modules/host/hardware/sound/default.nix new file mode 100644 index 0000000..dff725e --- /dev/null +++ b/modules/host/hardware/sound/default.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.hardware.sound; +in { + options = { module.hardware.sound = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + wireplumber.enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + lowLatency = { + enable = true; + quantum = 64; + rate = 48000; + }; + }; + }; +} + diff --git a/modules/host/misc/default.nix b/modules/host/misc/default.nix new file mode 100644 index 0000000..def3b81 --- /dev/null +++ b/modules/host/misc/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + imports = lib.fileset.toList ( + # All default.nix files in ./. + lib.fileset.fileFilter (file: file.name == "default.nix") ./.); +} diff --git a/modules/host/misc/locales/default.nix b/modules/host/misc/locales/default.nix new file mode 100644 index 0000000..2933385 --- /dev/null +++ b/modules/host/misc/locales/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.misc.locales; +in { + options = { module.misc.locales = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + time.timeZone = "Asia/Chita"; # TIME + services.chrony.enable = true; # SYNC TIME + i18n = { # LOCALE LANG + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ "all" ]; + }; + }; +} + diff --git a/modules/host/misc/minimal/default.nix b/modules/host/misc/minimal/default.nix new file mode 100644 index 0000000..ead956c --- /dev/null +++ b/modules/host/misc/minimal/default.nix @@ -0,0 +1,21 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.misc.minimal; +in { + options = { module.misc.minimal = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + programs.command-not-found.enable = mkDefault false; + documentation = { # DISABLE MAN AND GUIDES + enable = mkDefault false; + doc.enable = mkDefault false; + info.enable = mkDefault false; + man.enable = mkDefault false; + nixos.enable = mkDefault false; + }; + + }; +} + diff --git a/modules/host/misc/power/default.nix b/modules/host/misc/power/default.nix new file mode 100644 index 0000000..d0fc175 --- /dev/null +++ b/modules/host/misc/power/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.misc.power; +in { + options = { module.misc.power = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + powerManagement = { # POWER OPTIMIZATION + enable = true; + powertop.enable = true; + }; + }; +} + diff --git a/modules/host/misc/system76/default.nix b/modules/host/misc/system76/default.nix new file mode 100644 index 0000000..41f1769 --- /dev/null +++ b/modules/host/misc/system76/default.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.misc.system76; +in { + options = { module.misc.system76 = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + hardware.system76 = { # OPTIMIZATIONS + enableAll = true; + power-daemon.enable = true; + firmware-daemon.enable = true; + kernel-modules.enable = true; + }; + services.system76-scheduler = { # SCHEDULER + enable = true; + settings = { + cfsProfiles.enable = true; + processScheduler.pipewireBoost.enable = true; + }; + }; + }; +} + diff --git a/modules/host/misc/torrserver/default.nix b/modules/host/misc/torrserver/default.nix new file mode 100644 index 0000000..16b022b --- /dev/null +++ b/modules/host/misc/torrserver/default.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.module.misc.torrserver; + torr = pkgs.callPackage ./package.nix { }; +in { + options = { module.misc.torrserver = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + systemd.services = { + torrserver = { # TORRSERVER + enable = true; + after = [ "multi-user.target" "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${torr}/bin/torrserver"; + Restart = "on-failure"; + Type = "simple"; + TimeoutSec = 30; + }; + }; + }; + }; +} + diff --git a/modules/host/misc/torrserver/package.nix b/modules/host/misc/torrserver/package.nix new file mode 100644 index 0000000..d1a29d0 --- /dev/null +++ b/modules/host/misc/torrserver/package.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchurl, autoPatchelfHook }: +let + version = "134"; + hash = "sha256-WDygG9aGnD20nGxtG0t+T2KEwbJ+fZ0uRaCndirrsXI="; +in stdenv.mkDerivation { + name = "torrserver"; + dontUnpack = true; + + src = fetchurl { + url = + "https://github.com/YouROK/TorrServer/releases/download/MatriX.${version}/TorrServer-linux-amd64"; + sha256 = "${hash}"; + }; + + nativeBuildInputs = [ autoPatchelfHook ]; + + installPhase = + " mkdir -p $out/bin\n cp $src $out/bin/torrserver\n chmod +x $out/bin/torrserver\n"; + + meta = with lib; { + description = "Torrserver"; + homepage = "https://github.com/YouROK/TorrServer"; + license = licenses.unlicense; + meta.platforms = platforms.all; + mainProgram = "torrserver"; + }; +} diff --git a/modules/host/misc/users/default.nix b/modules/host/misc/users/default.nix new file mode 100644 index 0000000..d3a0ab8 --- /dev/null +++ b/modules/host/misc/users/default.nix @@ -0,0 +1,40 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.misc.users; +in { + options = { + module.misc.users = { + enable = mkEnableOption ""; + shell = mkOption { + type = types.str; + default = null; + }; + user = mkOption { + type = types.str; + default = null; + }; + }; + }; + + config = mkIf cfg.enable { + users = { + mutableUsers = false; + defaultUserShell = cfg.shell; + users = { + root.useDefaultShell = true; + ${cfg.user} = { + uid = 1000; + home = "/home/${cfg.user}"; + useDefaultShell = true; + createHome = true; + isSystemUser = true; + extraGroups = + [ "video" "audio" "networkmanager" "wheel" "docker" "libvirtd" ]; + }; + }; + }; + }; +} + diff --git a/modules/host/misc/variables/default.nix b/modules/host/misc/variables/default.nix new file mode 100644 index 0000000..73b31b6 --- /dev/null +++ b/modules/host/misc/variables/default.nix @@ -0,0 +1,32 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.module.misc.variables; + usr = config.module.misc.users; +in { + options = { module.misc.variables = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + environment.variables = { + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + GDK_BACKEND = "wayland"; + NIXPKGS_ALLOW_UNFREE = "1"; + NIXPKGS_ALLOW_INSECURE = "1"; + MOZ_ENABLE_WAYLAND = "1"; + XDG_SESSION_TYPE = "wayland"; + NIXOS_OZONE_WL = "1"; + }; + + environment.sessionVariables = { + MOZ_LEGACY_PROFILES = "1"; + FLAKE = "/home/${usr.user}/.flake"; + QT_QPA_PLATFORMTHEME = "gtk3"; + TDESKTOP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY = "1"; + }; + }; +} + diff --git a/modules/host/misc/zapret/default.nix b/modules/host/misc/zapret/default.nix new file mode 100644 index 0000000..8b3834a --- /dev/null +++ b/modules/host/misc/zapret/default.nix @@ -0,0 +1,57 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.module.misc.zapret; +in { + options = { module.misc.zapret = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + systemd = { + services = { + zapret = { + wantedBy = [ "multi-user.target" ]; + requires = [ "network.target" ]; + path = with pkgs; [ iptables nftables zapret ipset curl gawk ]; + serviceConfig = { + Type = "forking"; + Restart = "no"; + TimeoutSec = "30sec"; + IgnoreSIGPIPE = "no"; + KillMode = "none"; + GuessMainPID = "no"; + ExecStart = "${pkgs.zapret}/bin/zapret start"; + ExecStop = "${pkgs.zapret}/bin/zapret stop"; + EnvironmentFile = pkgs.writeText "zapret-environment" '' + FWTYPE="iptables" + SET_MAXELEM=522288 + IPSET_OPT="hashsize 262144 maxelem $SET_MAXELEM" + AUTOHOSTLIST_RETRANS_THRESHOLD=3 + AUTOHOSTLIST_FAIL_THRESHOLD=3 + AUTOHOSTLIST_FAIL_TIME=60 + AUTOHOSTLIST_DEBUGLOG=0 + MDIG_THREADS=30 + GZIP_LISTS=1 + + MODE=nfqws + MODE_HTTP=1 + MODE_HTTP_KEEPALIVE=0 + MODE_HTTPS=1 + MODE_QUIC=0 + MODE_FILTER=none + + DESYNC_MARK=0x40000000 + DESYNC_MARK_POSTNAT=0x20000000 + NFQWS_OPT_DESYNC="--dpi-desync=fake,split2 --dpi-desync-ttl=3" + TPWS_OPT="--hostspell=HOST --split-http-req=method --split-pos=3 --oob" + FLOWOFFLOAD=donttouch + INIT_APPLY_FW=1 + DISABLE_IPV6=0 + ''; + }; + }; + }; + }; + }; +} + diff --git a/modules/host/programs/default.nix b/modules/host/programs/default.nix new file mode 100644 index 0000000..def3b81 --- /dev/null +++ b/modules/host/programs/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + imports = lib.fileset.toList ( + # All default.nix files in ./. + lib.fileset.fileFilter (file: file.name == "default.nix") ./.); +} diff --git a/modules/host/programs/fish/default.nix b/modules/host/programs/fish/default.nix new file mode 100644 index 0000000..655be43 --- /dev/null +++ b/modules/host/programs/fish/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.programs.fish; +in { + options = { module.programs.fish.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { programs.fish.enable = true; }; +} + diff --git a/modules/host/programs/git/default.nix b/modules/host/programs/git/default.nix new file mode 100644 index 0000000..c9582c5 --- /dev/null +++ b/modules/host/programs/git/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.programs.git; +in { + options = { module.programs.git.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + programs.git = { + enable = true; + package = pkgs.gitMinimal; + }; + }; +} + diff --git a/modules/host/programs/hm/default.nix b/modules/host/programs/hm/default.nix new file mode 100644 index 0000000..05ff5cf --- /dev/null +++ b/modules/host/programs/hm/default.nix @@ -0,0 +1,17 @@ +{ inputs, lib, config, ... }: + +with lib; + +let cfg = config.module.programs.hm; +in { + options = { module.programs.hm.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + }; + }; +} + diff --git a/modules/host/programs/hyprland/default.nix b/modules/host/programs/hyprland/default.nix new file mode 100644 index 0000000..69e81e5 --- /dev/null +++ b/modules/host/programs/hyprland/default.nix @@ -0,0 +1,19 @@ +{ inputs, pkgs, lib, config, ... }: + +with lib; + +let + cfg = config.module.programs.hyprland; + hpkg = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}; +in { + options = { module.programs.hyprland.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + programs.hyprland = { + enable = true; + package = hpkg.hyprland; + portalPackage = hpkg.xdg-desktop-portal-hyprland; + }; + }; +} + diff --git a/modules/host/programs/light/default.nix b/modules/host/programs/light/default.nix new file mode 100644 index 0000000..410719c --- /dev/null +++ b/modules/host/programs/light/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.programs.light; +in { + options = { module.programs.light.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { programs.light.enable = true; }; +} + diff --git a/modules/host/programs/nh/default.nix b/modules/host/programs/nh/default.nix new file mode 100644 index 0000000..41103eb --- /dev/null +++ b/modules/host/programs/nh/default.nix @@ -0,0 +1,22 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.module.programs.nh; + usr = config.module.misc.users; +in { + options = { module.programs.nh.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + programs.nh = { + enable = true; + flake = "/home/${usr.user}/.flake"; + clean = { + enable = true; + extraArgs = "--keep-since 3d --keep 3"; + }; + }; + }; +} + diff --git a/modules/host/programs/packages/default.nix b/modules/host/programs/packages/default.nix new file mode 100644 index 0000000..92ffd77 --- /dev/null +++ b/modules/host/programs/packages/default.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let cfg = config.module.programs.packages; +in { + options = { module.programs.packages.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ helix killall ]; + }; +} + diff --git a/modules/host/programs/steam/default.nix b/modules/host/programs/steam/default.nix new file mode 100644 index 0000000..1d6784a --- /dev/null +++ b/modules/host/programs/steam/default.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let cfg = config.module.programs.steam; +in { + options = { module.programs.steam.enable = mkEnableOption ""; }; + + config = mkIf cfg.enable { + hardware.xone.enable = true; + programs = { + gamescope.enable = true; + steam = { # GAMING + enable = true; + package = pkgs.steam.override { + extraEnv = { + MANGOHUD = true; + OBS_VKCAPTURE = true; + RADV_TEX_ANISO = 16; + }; + }; + extraCompatPackages = with pkgs; [ proton-ge-bin ]; + protontricks.enable = true; + }; + }; + }; +} + diff --git a/modules/host/services/autocpu/default.nix b/modules/host/services/autocpu/default.nix new file mode 100644 index 0000000..f281828 --- /dev/null +++ b/modules/host/services/autocpu/default.nix @@ -0,0 +1,28 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.autocpu; +in { + options = { module.services.autocpu = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + services.auto-cpufreq = { + enable = true; + settings = { + charger = { # AC MODE + governor = "performance"; + turbo = "auto"; + }; + battery = { # BAT MODE + governor = "powersave"; + turbo = "auto"; + energy_perf_bias = "balance_power"; + platform_profile = "low-power"; + enable_thresholds = true; + }; + }; + }; + }; +} + diff --git a/modules/host/services/dbus/default.nix b/modules/host/services/dbus/default.nix new file mode 100644 index 0000000..25e07e9 --- /dev/null +++ b/modules/host/services/dbus/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.dbus; +in { + options = { module.services.dbus = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { services.dbus.implementation = "broker"; }; +} + diff --git a/modules/host/services/default.nix b/modules/host/services/default.nix new file mode 100644 index 0000000..2f7d474 --- /dev/null +++ b/modules/host/services/default.nix @@ -0,0 +1,6 @@ +{ lib, ... }: { + imports = lib.fileset.toList ( + # All default.nix files in ./. + lib.fileset.fileFilter (file: file.name == "default.nix") ./.); +} + diff --git a/modules/host/services/getty/default.nix b/modules/host/services/getty/default.nix new file mode 100644 index 0000000..d5e1553 --- /dev/null +++ b/modules/host/services/getty/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.module.services.getty; + usr = config.module.misc.users; +in { + options = { module.services.getty = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + services.getty = { + autologinUser = usr.user; + greetingLine = "Good day my lord ahhhh"; + }; + }; +} + diff --git a/modules/host/services/gvfs/default.nix b/modules/host/services/gvfs/default.nix new file mode 100644 index 0000000..6406202 --- /dev/null +++ b/modules/host/services/gvfs/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.gvfs; +in { + options = { module.services.gvfs = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { services.gvfs.enable = true; }; +} + diff --git a/modules/host/services/laptop/default.nix b/modules/host/services/laptop/default.nix new file mode 100644 index 0000000..3b70cb8 --- /dev/null +++ b/modules/host/services/laptop/default.nix @@ -0,0 +1,63 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.tlp; +in { + options = { module.services.tlp = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + services = { + thermald.enable = true; + upower.enable = true; + fprintd = { # FINGER PRINT + enable = true; + package = pkgs.fprintd-tod; + tod = { + enable = true; + driver = pkgs.libfprint-2-tod1-vfs0090; + }; + }; + tlp = { + enable = true; + + settings = { + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "balanced"; + + # CPU + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_performance"; + + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 40; + + # NETWORKING + WIFI_PWR_ON_AC = "off"; + WIFI_PWR_ON_BAT = "on"; + + # GRAPHICS + RADEON_DPM_STATE_ON_AC = "performance"; + RADEON_DPM_STATE_ON_BAT = "battery"; + RADEON_POWER_PROFILE_ON_AC = "default"; + RADEON_POWER_PROFILE_ON_BAT = "default"; + + # IDK + TLP_DEFAULT_MODE = "BAT"; + RUNTIME_PM_ON_AC = "auto"; + RUNTIME_PM_ON_BAT = "auto"; + USB_AUTOSUSPEND = 0; + }; + }; + }; + }; +} + diff --git a/modules/host/services/polkit/default.nix b/modules/host/services/polkit/default.nix new file mode 100644 index 0000000..bb6d336 --- /dev/null +++ b/modules/host/services/polkit/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.polkit; +in { + options = { module.services.polkit = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { security.polkit.enable = true; }; +} + diff --git a/modules/host/services/printing/default.nix b/modules/host/services/printing/default.nix new file mode 100644 index 0000000..ebf7397 --- /dev/null +++ b/modules/host/services/printing/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.printing; +in { + options = { module.services.printing = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { services.printing.enable = true; }; +} + diff --git a/modules/host/services/tailscale/default.nix b/modules/host/services/tailscale/default.nix new file mode 100644 index 0000000..eb8fb24 --- /dev/null +++ b/modules/host/services/tailscale/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.tailscale; +in { + options = { module.services.tailscale = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + services = { + tailscale = { # OWN VPN NETWORK + enable = true; + useRoutingFeatures = "both"; + }; + }; + }; +} + diff --git a/modules/host/services/xserver/default.nix b/modules/host/services/xserver/default.nix new file mode 100644 index 0000000..1f9fb89 --- /dev/null +++ b/modules/host/services/xserver/default.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.xserver; +in { + options = { module.services.xserver = { enable = mkEnableOption ""; }; }; + + config = mkIf cfg.enable { + services = { + xserver = { + enable = true; + libinput.enable = true; + xkb = { + layout = "us"; + variant = "qwerty"; + options = "grp:caps_toggle"; + }; + }; + }; + }; +} + diff --git a/modules/host/services/zram/default.nix b/modules/host/services/zram/default.nix new file mode 100644 index 0000000..f4d9fa6 --- /dev/null +++ b/modules/host/services/zram/default.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: + +with lib; + +let cfg = config.module.services.zram; +in { + options = { + module.services.zram = { + enable = mkEnableOption ""; + algo = mkOption { + type = types.str; + default = null; + }; + }; + }; + + config = mkIf cfg.enable { + zramSwap = { + enable = true; + priority = 1000; + algorithm = cfg.algo; + swapDevices = 1; + memoryPercent = 100; + }; + }; +} +