From be100cfe97dfbc897ea81a45867c7d67aba8a004 Mon Sep 17 00:00:00 2001 From: Grey Jones Date: Sat, 4 Jul 2026 20:36:27 +0100 Subject: [PATCH] organisation + move config for all devices to 'global' counterparts --- .../configs => global-configs}/fastfetch.nix | 0 .../configs => global-configs}/plasma.nix | 0 global-configs/zen-browser.nix | 105 ++++++++++++++++++ global-default.nix | 72 ++++++++++++ global-home.nix | 52 +++++++++ hosts/nixos-vm/default.nix | 79 ++----------- hosts/nixos-vm/home.nix | 51 ++------- {flakes => modules}/home-manager.nix | 0 {flakes => modules}/nh.nix | 0 {flakes => modules}/plasma-desktop.nix | 0 10 files changed, 245 insertions(+), 114 deletions(-) rename {hosts/nixos-vm/configs => global-configs}/fastfetch.nix (100%) rename {hosts/nixos-vm/configs => global-configs}/plasma.nix (100%) create mode 100644 global-configs/zen-browser.nix create mode 100644 global-default.nix create mode 100644 global-home.nix rename {flakes => modules}/home-manager.nix (100%) rename {flakes => modules}/nh.nix (100%) rename {flakes => modules}/plasma-desktop.nix (100%) diff --git a/hosts/nixos-vm/configs/fastfetch.nix b/global-configs/fastfetch.nix similarity index 100% rename from hosts/nixos-vm/configs/fastfetch.nix rename to global-configs/fastfetch.nix diff --git a/hosts/nixos-vm/configs/plasma.nix b/global-configs/plasma.nix similarity index 100% rename from hosts/nixos-vm/configs/plasma.nix rename to global-configs/plasma.nix diff --git a/global-configs/zen-browser.nix b/global-configs/zen-browser.nix new file mode 100644 index 0000000..1a30609 --- /dev/null +++ b/global-configs/zen-browser.nix @@ -0,0 +1,105 @@ +{ + pkgs, + inputs, + ... +}: let + firefox-addons = with pkgs; inputs.firefox-addons.packages.${system}; +in { + programs.zen-browser = { + enable = true; + setAsDefaultBrowser = true; + nativeMessagingHosts = [ + pkgs.firefoxpwa + ]; + policies = { + AutofillAddressEnabled = false; + AutofillCreditCardEnabled = false; + DisableAppUpdate = true; + DisableFeedbackCommands = true; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + Preferences = { + "browser.startup.homepage" = { + Value = "about:blank"; + Status = "locked"; + }; + }; + }; + profiles.default = { + settings = { + "zen.urlbar.behavior" = "float"; + "zen.welcome-screen.seen" = true; + }; + extensions.packages = with firefox-addons; [ + adnauseam + bitwarden + indie-wiki-buddy + pwas-for-firefox + ]; + search = { + force = true; + default = "ddg"; + engines = { + nixpkgs = { + name = "nixpkgs packages"; + urls = [ + { + template = "https://search.nixos.org/packages?query={searchTerms}"; + } + ]; + icon = "https://wiki.nixos.org/favicon.ico"; + definedAliases = ["@np"]; + }; + nixos-options = { + name = "NixOS options"; + urls = [ + { + template = "https://search.nixos.org/options?query={searchTerms}"; + } + ]; + icon = "https://wiki.nixos.org/favicon.ico"; + definedAliases = ["@no"]; + }; + nixos-wiki = { + name = "NixOS Wiki"; + urls = [ + { + template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; + } + ]; + icon = "https://wiki.nixos.org/favicon.ico"; + definedAliases = ["@nw"]; + }; + }; + }; + keyboardShortcuts = [ + { + id = "key_close"; + key = "q"; + modifiers = { + control = false; + alt = true; + }; + } + { + id = "key_newNavigatorTab"; + keycode = "VK_RETURN"; + modifiers = { + control = false; + alt = true; + }; + } + ]; + keyboardShortcutsVersion = 19; + }; + }; +} diff --git a/global-default.nix b/global-default.nix new file mode 100644 index 0000000..dee7b3b --- /dev/null +++ b/global-default.nix @@ -0,0 +1,72 @@ +{ + config, + pkgs, + ... +}: { + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/London"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "gb"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "uk"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users."grey" = { + isNormalUser = true; + description = "grey"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + pkgs.pipewire + pkgs.git + pkgs.fzf + pkgs.jq + ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "26.05"; # Did you read the comment? +} \ No newline at end of file diff --git a/global-home.nix b/global-home.nix new file mode 100644 index 0000000..1884b7d --- /dev/null +++ b/global-home.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + ... +}: { + home.username = "grey"; + home.homeDirectory = "/home/grey"; + + home.stateVersion = system.stateVersion; + + programs.git = { + enable = true; + + lfs.enable = true; + + settings = { + user.name = "Grey Jones"; + user.email = "grey@greyweather.dev"; + }; + + signing = { + format = "openpgp"; + key = "CC7388DF8E1890729921BCFF7C67C51C2FF524D9"; + signByDefault = true; + }; + }; + + programs.gpg = { + enable = true; + }; + + programs.ssh = { + enable = true; + enableDefaultConfig = false; + settings = { + "git.greyweather.dev" = { + HostName = "git.greyweather.dev"; + Port = "222"; + User = "git"; + IdentityFile = "~/.ssh/id_gitea"; + }; + "github.com" = { + HostName = "github.com"; + Port = 22; + User = "git"; + IdentityFile = "~/.ssh/id_github"; + } + }; + }; + + home.shell.enableBashIntegration = true; +} \ No newline at end of file diff --git a/hosts/nixos-vm/default.nix b/hosts/nixos-vm/default.nix index 87d3373..b645979 100644 --- a/hosts/nixos-vm/default.nix +++ b/hosts/nixos-vm/default.nix @@ -6,23 +6,18 @@ config, pkgs, ... -}: let name = "nixos-vm"; in { +}: let +name = "nixos-vm"; +modules-dir = ../../modules; +in { imports = [ ./hardware-configuration.nix - ../../flakes/nh.nix - ../../flakes/plasma-desktop.nix - ../../flakes/home-manager.nix + ../../global-default.nix + ${modules-dir}/nh.nix + ${modules-dir}/plasma-desktop.nix + ${modules-dir}/home-manager.nix ]; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = name; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -30,59 +25,9 @@ # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "gb"; - variant = ""; - }; - - # Configure console keymap - console.keyMap = "uk"; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users."grey" = { - isNormalUser = true; - description = "grey"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - }; - virtualisation.virtualbox.guest.enable = true; virtualisation.virtualbox.guest.dragAndDrop = true; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - pkgs.pipewire - pkgs.git - pkgs.fzf - pkgs.jq - ]; - programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; users.users."grey".shell = pkgs.zsh; @@ -104,12 +49,4 @@ # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "26.05"; # Did you read the comment? } diff --git a/hosts/nixos-vm/home.nix b/hosts/nixos-vm/home.nix index f40d0ae..e863337 100644 --- a/hosts/nixos-vm/home.nix +++ b/hosts/nixos-vm/home.nix @@ -4,18 +4,16 @@ inputs, lib, ... -}: { +}: let +global-configs-dir = ../../global-configs; +in { imports = [ - ./configs/plasma.nix - ./configs/fastfetch.nix - ./configs/zen-browser.nix + ../../global-home.nix + ${global-configs-dir}/plasma.nix + ${global-configs-dir}/fastfetch.nix + ${global-configs-dir}/zen-browser.nix ]; - home.username = "grey"; - home.homeDirectory = "/home/grey"; - - home.stateVersion = "26.05"; - home.packages = with pkgs; [ pkgs.steam pkgs.equibop @@ -35,40 +33,6 @@ pkgs.lact ]; - programs.git = { - enable = true; - - lfs.enable = true; - - settings = { - user.name = "Grey Jones"; - user.email = "grey@greyweather.dev"; - }; - - signing = { - format = "openpgp"; - key = "CC7388DF8E1890729921BCFF7C67C51C2FF524D9"; - signByDefault = true; - }; - }; - - programs.gpg = { - enable = true; - }; - - programs.ssh = { - enable = true; - enableDefaultConfig = false; - settings = { - "git.greyweather.dev" = { - HostName = "git.greyweather.dev"; - Port = "222"; - User = "git"; - IdentityFile = "~/.ssh/id_gitea"; - }; - }; - }; - home.shell.enableZshIntegration = true; programs.zsh = { @@ -100,6 +64,7 @@ confirm_os_window_close = -1; }; + shellIntegration.enableBashIntegration = true; shellIntegration.enableZshIntegration = true; themeFile = "Arthur"; }; diff --git a/flakes/home-manager.nix b/modules/home-manager.nix similarity index 100% rename from flakes/home-manager.nix rename to modules/home-manager.nix diff --git a/flakes/nh.nix b/modules/nh.nix similarity index 100% rename from flakes/nh.nix rename to modules/nh.nix diff --git a/flakes/plasma-desktop.nix b/modules/plasma-desktop.nix similarity index 100% rename from flakes/plasma-desktop.nix rename to modules/plasma-desktop.nix