From f1de2014dcd426e015a2638222160d9d349ea4e5 Mon Sep 17 00:00:00 2001 From: beeb5k Date: Fri, 6 Mar 2026 18:33:36 +0530 Subject: Init --- hosts/common.nix | 185 ++++++++++++++++++++++++++++++++ hosts/nixios/default.nix | 124 +++++++++++++++++++++ hosts/nixios/hardware-configuration.nix | 49 +++++++++ 3 files changed, 358 insertions(+) create mode 100644 hosts/common.nix create mode 100644 hosts/nixios/default.nix create mode 100644 hosts/nixios/hardware-configuration.nix (limited to 'hosts') diff --git a/hosts/common.nix b/hosts/common.nix new file mode 100644 index 0000000..e6bc71d --- /dev/null +++ b/hosts/common.nix @@ -0,0 +1,185 @@ +{ user }: +{ + pkgs, + inputs, + lib, + config, + ... +}: +{ + nix.settings = { + trusted-users = [ "@wheel" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + }; + + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 2"; + flake = "/home/${user}/beeSystems"; + }; + + boot.loader = { + efi.canTouchEfiVariables = true; + timeout = 50; + grub = { + enable = true; + device = "nodev"; + efiSupport = true; + useOSProber = true; + configurationLimit = 4; + theme = pkgs.fetchFromGitHub { + owner = "shvchk"; + repo = "fallout-grub-theme"; + rev = "80734103d0b48d724f0928e8082b6755bd3b2078"; + sha256 = "sha256-7kvLfD6Nz4cEMrmCA9yq4enyqVyqiTkVZV5y4RyUatU="; + }; + }; + }; + + services.kanata = { + enable = true; + keyboards.default = { + extraDefCfg = "process-unmapped-keys yes"; + + config = '' + ;; Define the physical keys on your keyboard that we want to modify + (defsrc + esc caps rctrl f1 + ) + + ;; Define custom actions (Aliases) + (defalias + ;; The smart key: + ;; - Tap: Sends Esc + ;; - Hold: Sends Left Control + ;; - "press": If you press another key while holding this, it triggers + ;; Left Control IMMEDIATELY (no lag). Perfect for Vim. + capesc (tap-hold-press 200 200 esc lctrl) + + ;; Switches to toggle between layers + game (layer-switch gaming) + base (layer-switch base) + ) + + ;; 3. Base Layer (Typing Mode) + ;; - Physical Esc -> Caps Lock (Standard swap) + ;; - Physical Caps -> Esc (tap) / Ctrl (hold) + ;; - Physical RCtrl -> Switch to "Gaming Mode" + ;; - Physical F1 -> Normal F1 behavior + (deflayer base + caps @capesc @game f1 + ) + + ;; 4. Gaming Layer (Gaming Mode) + ;; - Physical Esc -> Caps Lock (keeps light toggle working) + ;; - Physical Caps -> Left Ctrl (Pure Ctrl! Safe for crouching) + ;; - Physical RCtrl -> Switch back to "Typing Mode" + ;; - Physical F1 -> Escape (Your dedicated Pause button) + (deflayer gaming + caps lctrl @base esc + ) + ''; + }; + }; + + time.timeZone = "Asia/Kolkata"; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_IN"; + LC_IDENTIFICATION = "en_IN"; + LC_MEASUREMENT = "en_IN"; + LC_MONETARY = "en_IN"; + LC_NAME = "en_IN"; + LC_NUMERIC = "en_IN"; + LC_PAPER = "en_IN"; + LC_TELEPHONE = "en_IN"; + LC_TIME = "en_IN"; + }; + + services.displayManager.ly = { + enable = true; + settings = { + load = true; + save = true; + }; + }; + + security.pam.services.ly.enableGnomeKeyring = true; + security.pam.services.login.enableGnomeKeyring = true; + + nixpkgs.config.allowUnfree = true; + nix.registry.${user}.flake = inputs.self; + nix.registry.nixpkgs.flake = inputs.nixpkgs; + + networking.networkmanager.wifi.powersave = false; + networking.networkmanager.enable = true; + + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = false; + services.blueman.enable = false; + + hardware.enableRedistributableFirmware = true; + + services.libinput.enable = true; + services.libinput.touchpad = { + naturalScrolling = true; + disableWhileTyping = true; + }; + + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + jack.enable = true; + }; + + security.rtkit.enable = true; + security.polkit.enable = true; + + fonts.fontDir.enable = true; + fonts.packages = with pkgs; [ + # maple-mono.NF + nerd-fonts.jetbrains-mono + ]; + fonts.fontconfig.defaultFonts.monospace = [ + "Ioskeley Mono" + "JetBrainsMono Nerd Fonts" + "Symbols Nerd Font" + ]; + programs.fish.enable = true; + programs.nano.enable = false; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + services.upower.enable = true; + services.earlyoom.enable = false; + services.fwupd.enable = false; + services.gnome.gnome-keyring.enable = true; + services.power-profiles-daemon.enable = true; + services.printing.enable = false; + services.openssh.enable = true; + services.dbus.enable = true; + + services.gvfs.enable = true; + services.udisks2.enable = true; + + environment.systemPackages = with pkgs; [ + android-tools + ]; + + users.defaultUserShell = pkgs.fish; +} diff --git a/hosts/nixios/default.nix b/hosts/nixios/default.nix new file mode 100644 index 0000000..2f39cc5 --- /dev/null +++ b/hosts/nixios/default.nix @@ -0,0 +1,124 @@ +{ + systemState, + user, + hostname, +}: +{ + pkgs, + config, + inputs, + lib, + ... +}: +{ + imports = [ + ./hardware-configuration.nix + (import ../common.nix { inherit user; }) + ]; + + # REMOVE LATER + virtualisation.vmVariant = { + users.users.${user}.password = "1"; + users.users.root.password = "1"; + + virtualisation.memorySize = 4096; + virtualisation.cores = 4; + services.displayManager.ly.enable = lib.mkForce false; + + services.getty.helpLine = ">> WELCOME <<"; + services.getty.autologinUser = user; + }; + # REMOVE LATER + + boot.kernelPackages = pkgs.linuxPackages_zen; + + programs.dconf.enable = true; + security.pam.services.swaylock = { }; + + xdg.portal = lib.mkForce { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-wlr + ]; + config = { + common = { + default = [ "gtk" ]; + "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; + }; + mango = { + "org.freedesktop.impl.portal.ScreenCast" = [ "wlr" ]; + "org.freedesktop.impl.portal.Screenshot" = [ "wlr" ]; + }; + }; + }; + + programs.gamemode.enable = config.programs.steam.enable; + programs.gamescope = { + enable = config.programs.steam.enable; + capSysNice = true; + }; + programs.steam = { + enable = false; + gamescopeSession.enable = false; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; + + users.users.${user} = { + isNormalUser = true; + shell = pkgs.fish; + extraGroups = [ + "networkmanager" + "wheel" + ]; + }; + + environment.sessionVariables = { }; + + networking.hostName = hostname; + networking.firewall.allowedTCPPorts = [ ]; + networking.firewall.allowedUDPPorts = [ ]; + networking.firewall.enable = true; + + environment.systemPackages = with pkgs; [ + libva-utils + vulkan-tools + pciutils + direnv + mangohud + ]; + + services.xserver.videoDrivers = [ "nvidia" ]; + hardware = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + libvdpau-va-gl + nvidia-vaapi-driver + ]; + }; + + nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = true; + open = false; + nvidiaSettings = false; + + prime = { + offload.enable = true; + offload.enableOffloadCmd = true; + offload.offloadCmdMainProgram = "prime-run"; + nvidiaBusId = "PCI:1:0:0"; + amdgpuBusId = "PCI:5:0:0"; + }; + + package = config.boot.kernelPackages.nvidiaPackages.latest; # or stable + }; + }; + + system.stateVersion = systemState; # check flake.nix +} diff --git a/hosts/nixios/hardware-configuration.nix b/hosts/nixios/hardware-configuration.nix new file mode 100644 index 0000000..7e2a1c3 --- /dev/null +++ b/hosts/nixios/hardware-configuration.nix @@ -0,0 +1,49 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. + +# yes i did modify it. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usb_storage" + "usbhid" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-label/NIXSWAP"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} -- cgit v1.3.1