From 276756d998f02574abaa75758aedacb9e531087e Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 4 Mar 2025 20:58:20 +0100 Subject: [PATCH] refactor variables & theme --- hosts/laptop/configuration.nix | 13 +++---------- hosts/laptop/home.nix | 9 +-------- hosts/laptop/variables.nix | 16 ++++++++++++---- nixos/auto-upgrade.nix | 11 ----------- nixos/bluetooth.nix | 1 - nixos/fonts.nix | 12 +----------- nixos/network-manager.nix | 4 ---- nixos/nix.nix | 7 ++++++- nixos/nvidia.nix | 17 +++++++++++++++++ nixos/pia.nix | 10 ---------- nixos/prime.nix | 17 ----------------- nixos/timezone.nix | 15 --------------- nixos/utils.nix | 26 ++++++++++++++++++++++++++ nixos/variables-config.nix | 8 -------- nixos/virtualbox.nix | 9 --------- nixos/xdg-portal.nix | 14 -------------- themes/yoru.nix | 4 ++-- 17 files changed, 68 insertions(+), 125 deletions(-) delete mode 100644 nixos/auto-upgrade.nix delete mode 100644 nixos/network-manager.nix delete mode 100644 nixos/pia.nix delete mode 100644 nixos/prime.nix delete mode 100644 nixos/timezone.nix delete mode 100644 nixos/variables-config.nix delete mode 100644 nixos/virtualbox.nix delete mode 100644 nixos/xdg-portal.nix diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 4932fe3..9b805c8 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -1,26 +1,19 @@ { config, ... }: { imports = [ + # Mostly system related configuration ../../nixos/nvidia.nix # CHANGEME: Remove this line if you don't have an Nvidia GPU - ../../nixos/prime.nix # CHANGEME: Remove this line if you don't have an Nvidia GPU - ../../nixos/audio.nix ../../nixos/bluetooth.nix ../../nixos/fonts.nix ../../nixos/home-manager.nix - ../../nixos/network-manager.nix ../../nixos/nix.nix ../../nixos/systemd-boot.nix - ../../nixos/timezone.nix ../../nixos/tuigreet.nix ../../nixos/users.nix ../../nixos/utils.nix - ../../nixos/xdg-portal.nix - ../../nixos/docker.nix - ../../nixos/variables-config.nix - - # Choose your theme here - # ../../themes/stylix/yoru.nix + # ../../nixos/docker.nix + # You should let those lines as is ./hardware-configuration.nix ./variables.nix ]; diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 1b02aec..699fa61 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -1,13 +1,12 @@ { pkgs, config, ... }: { imports = [ + # Mostly user-specific configuration ./variables.nix # Programs ../../home/programs/kitty ../../home/programs/nvim - # ../../home/programs/nvf - # ../../home/programs/qutebrowser ../../home/programs/shell ../../home/programs/fetch ../../home/programs/git @@ -17,7 +16,6 @@ ../../home/programs/lazygit ../../home/programs/zen ../../home/programs/duckduckgo-colorscheme - ../../home/programs/superfile ../../home/programs/discord # Scripts @@ -36,8 +34,6 @@ ../../home/system/udiskie ../../home/system/clipman - # ../../themes/stylix/yoru.nix - ./secrets # CHANGEME: You should probably remove this line, this is where I store my secrets ]; @@ -62,17 +58,14 @@ nodejs python3 jq - figlet just pnpm - lazydocker # Utils zip unzip optipng pfetch - pandoc btop fastfetch diff --git a/hosts/laptop/variables.nix b/hosts/laptop/variables.nix index 7f48638..bc1da67 100644 --- a/hosts/laptop/variables.nix +++ b/hosts/laptop/variables.nix @@ -1,5 +1,8 @@ -{ config, ... }: { - imports = [ ../../nixos/variables-config.nix ../../themes/yoru.nix ]; +{ config, lib, ... }: { + imports = [ + # Choose your theme here: + ../../themes/yoru.nix + ]; config.var = { hostname = "nixy"; @@ -21,8 +24,13 @@ autoUpgrade = false; autoGarbageCollector = true; + }; - # Choose your theme variables here - # theme = import ../../themes/var/2025.nix; + # Let this here + options = { + var = lib.mkOption { + type = lib.types.attrs; + default = { }; + }; }; } diff --git a/nixos/auto-upgrade.nix b/nixos/auto-upgrade.nix deleted file mode 100644 index c2a4f83..0000000 --- a/nixos/auto-upgrade.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, ... }: -let configDir = config.var.configDirectory; -in { - system.autoUpgrade = { - enable = config.var.autoUpgrade; - dates = "04:00"; - flake = "${configDir}"; - flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; - allowReboot = false; - }; -} diff --git a/nixos/bluetooth.nix b/nixos/bluetooth.nix index 30d05ef..f5c7856 100644 --- a/nixos/bluetooth.nix +++ b/nixos/bluetooth.nix @@ -4,6 +4,5 @@ enable = true; powerOnBoot = true; }; - services.blueman.enable = true; } diff --git a/nixos/fonts.nix b/nixos/fonts.nix index 9127fd0..1cd59c9 100644 --- a/nixos/fonts.nix +++ b/nixos/fonts.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: { +{ pkgs, ... }: { fonts = { packages = with pkgs; [ @@ -19,18 +19,8 @@ nerd-fonts.meslo-lg openmoji-color twemoji-color-font - inputs.apple-fonts.packages.${pkgs.system}.sf-pro-nerd ]; enableDefaultPackages = false; - - fontconfig = { - defaultFonts = { - monospace = [ "FiraCode Nerd Font Mono" "Noto Color Emoji" ]; - sansSerif = [ "SFProDisplay Nerd Font" "Noto Color Emoji" ]; - serif = [ "SFProDisplay Nerd Font" "Noto Color Emoji" ]; - emoji = [ "Noto Color Emoji" ]; - }; - }; }; } diff --git a/nixos/network-manager.nix b/nixos/network-manager.nix deleted file mode 100644 index 99446d3..0000000 --- a/nixos/network-manager.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - networking.networkmanager.enable = true; - systemd.services.NetworkManager-wait-online.enable = false; -} diff --git a/nixos/nix.nix b/nixos/nix.nix index db44cb0..62b526f 100644 --- a/nixos/nix.nix +++ b/nixos/nix.nix @@ -14,9 +14,14 @@ in { settings = { auto-optimise-store = true; experimental-features = [ "nix-command" "flakes" ]; - substituters = [ "https://hyprland.cachix.org" ]; + substituters = [ + "https://cache.nixos.org/" + "https://hyprland.cachix.org" + "https://nix-community.cachix.org" + ]; trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; gc = { diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix index 1bafec8..f3c5e48 100644 --- a/nixos/nvidia.nix +++ b/nixos/nvidia.nix @@ -41,6 +41,22 @@ in { true; # This can cause sleep/suspend to fail and saves entire VRAM to /tmp/ modesetting.enable = true; package = nvidiaDriverChannel; + + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + + # sync.enable = true; + + # CHANGEME: Change those values to match your hardware (if prime is imported) + amdgpuBusId = + "PCI:5:0:0"; # Set this to the bus ID of your AMD GPU if you have one + # intelBusId = "PCI:0:2:0"; # Set this to the bus ID of your Intel GPU if you have one + nvidiaBusId = + "PCI:1:0:0"; # Set this to the bus ID of your Nvidia GPU if you have one + }; }; graphics = { enable = true; @@ -55,4 +71,5 @@ in { ]; }; }; + } diff --git a/nixos/pia.nix b/nixos/pia.nix deleted file mode 100644 index b1d118c..0000000 --- a/nixos/pia.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, ... }: { - services.pia.enable = true; - - # Alternatively, you can use the `authUserPassFile` attribute if you are using - # a Nix secrets manager. Here's an example using sops-nix. - # - # The secret you provide to `authUserPassFile` should be a multiline string with - # a single username on the first line a single password on the second line. - services.pia.authUserPassFile = "/home/hadi/.config/pia/pia.ovpn"; -} diff --git a/nixos/prime.nix b/nixos/prime.nix deleted file mode 100644 index d7ef6d4..0000000 --- a/nixos/prime.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - hardware.nvidia.prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - - # sync.enable = true; - - # CHANGEME: Change those values to match your hardware (if prime is imported) - amdgpuBusId = - "PCI:5:0:0"; # Set this to the bus ID of your AMD GPU if you have one - # intelBusId = "PCI:0:2:0"; # Set this to the bus ID of your Intel GPU if you have one - nvidiaBusId = - "PCI:1:0:0"; # Set this to the bus ID of your Nvidia GPU if you have one - }; -} diff --git a/nixos/timezone.nix b/nixos/timezone.nix deleted file mode 100644 index a157add..0000000 --- a/nixos/timezone.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, ... }: { - time.timeZone = config.var.timeZone; - i18n.defaultLocale = config.var.defaultLocale; - i18n.extraLocaleSettings = { - LC_ADDRESS = config.var.extraLocale; - LC_IDENTIFICATION = config.var.extraLocale; - LC_MEASUREMENT = config.var.extraLocale; - LC_MONETARY = config.var.extraLocale; - LC_NAME = config.var.extraLocale; - LC_NUMERIC = config.var.extraLocale; - LC_PAPER = config.var.extraLocale; - LC_TELEPHONE = config.var.extraLocale; - LC_TIME = config.var.extraLocale; - }; -} diff --git a/nixos/utils.nix b/nixos/utils.nix index 45779b9..6ec1c21 100644 --- a/nixos/utils.nix +++ b/nixos/utils.nix @@ -2,10 +2,36 @@ let hostname = config.var.hostname; keyboardLayout = config.var.keyboardLayout; + configDir = config.var.configDirectory; in { networking.hostName = hostname; + networking.networkmanager.enable = true; + systemd.services.NetworkManager-wait-online.enable = false; + + system.autoUpgrade = { + enable = config.var.autoUpgrade; + dates = "04:00"; + flake = "${configDir}"; + flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; + allowReboot = false; + }; + + time.timeZone = config.var.timeZone; + i18n.defaultLocale = config.var.defaultLocale; + i18n.extraLocaleSettings = { + LC_ADDRESS = config.var.extraLocale; + LC_IDENTIFICATION = config.var.extraLocale; + LC_MEASUREMENT = config.var.extraLocale; + LC_MONETARY = config.var.extraLocale; + LC_NAME = config.var.extraLocale; + LC_NUMERIC = config.var.extraLocale; + LC_PAPER = config.var.extraLocale; + LC_TELEPHONE = config.var.extraLocale; + LC_TIME = config.var.extraLocale; + }; + services = { xserver = { enable = true; diff --git a/nixos/variables-config.nix b/nixos/variables-config.nix deleted file mode 100644 index 7a54f2e..0000000 --- a/nixos/variables-config.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ lib, ... }: { - options = { - var = lib.mkOption { - type = lib.types.attrs; - default = { }; - }; - }; -} diff --git a/nixos/virtualbox.nix b/nixos/virtualbox.nix deleted file mode 100644 index 12dab01..0000000 --- a/nixos/virtualbox.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, ... }: -let username = config.var.username; -in { - virtualisation.virtualbox.host = { - enable = true; - enableExtensionPack = true; - }; - users.extraGroups.vboxusers.members = [ username ]; -} diff --git a/nixos/xdg-portal.nix b/nixos/xdg-portal.nix deleted file mode 100644 index 9aae13b..0000000 --- a/nixos/xdg-portal.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: { - xdg.portal = { - enable = true; - config.common.default = "*"; - wlr.enable = true; - xdgOpenUsePortal = true; - extraPortals = [ - pkgs.xdg-desktop-portal-hyprland - pkgs.xdg-desktop-portal-gtk - pkgs.libsForQt5.xdg-desktop-portal-kde - ]; - config.hyprland = { default = [ "hyprland" "gtk" ]; }; - }; -} diff --git a/themes/yoru.nix b/themes/yoru.nix index 977ae46..60e0687 100644 --- a/themes/yoru.nix +++ b/themes/yoru.nix @@ -56,8 +56,8 @@ }; cursor = { - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Ice"; + # package = pkgs.bibata-cursors; + # name = "Bibata-Modern-Ice"; size = 24; };