From 041ea0528faf6e96a5dd13fd364e340fa851b92a Mon Sep 17 00:00:00 2001 From: Grey Jones Date: Thu, 2 Jul 2026 19:57:24 +0100 Subject: [PATCH] Initial commit --- .gitattributes | 2 + flake.lock | 114 ++++++++++++++++++++++ flake.nix | 52 ++++++++++ flakes/home-manager.nix | 12 +++ flakes/nh.nix | 15 +++ flakes/plasma-desktop-modified.nix | 30 ++++++ flakes/plasma-desktop.nix | 27 +++++ flakes/zen-browser.nix | 56 +++++++++++ hosts/nixos-vm/default.nix | 110 +++++++++++++++++++++ hosts/nixos-vm/hardware-configuration.nix | 29 ++++++ hosts/nixos-vm/home.nix | 52 ++++++++++ hosts/takamaki/default.nix | 104 ++++++++++++++++++++ 12 files changed, 603 insertions(+) create mode 100644 .gitattributes create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 flakes/home-manager.nix create mode 100644 flakes/nh.nix create mode 100644 flakes/plasma-desktop-modified.nix create mode 100644 flakes/plasma-desktop.nix create mode 100644 flakes/zen-browser.nix create mode 100644 hosts/nixos-vm/default.nix create mode 100644 hosts/nixos-vm/hardware-configuration.nix create mode 100644 hosts/nixos-vm/home.nix create mode 100644 hosts/takamaki/default.nix diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..46a6094 --- /dev/null +++ b/flake.lock @@ -0,0 +1,114 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1783005591, + "narHash": "sha256-NcLHV5uBAeggDUE2wPbKszjfyaSLsoqaYt7izOphkZw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f469c79b955609d6a8fdd9e689be76a93b1621d7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nh": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782982440, + "narHash": "sha256-Zc5cC0WfiicPKtmJbUi8XlZJ1alXN9HLiCJONNtJfhQ=", + "owner": "nix-community", + "repo": "nh", + "rev": "813e006f41e4e463e6858e5d8dcdc8d38ecda83d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nh", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1782723713, + "narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "plasma-manager": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775856943, + "narHash": "sha256-b7Mp7P+q2Md5AGt4rjHfMcBykzMumFTen10ST++AuTU=", + "owner": "nix-community", + "repo": "plasma-manager", + "rev": "a524a6160e6df89f7673ba293cf7d78b559eb1a5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "plasma-manager", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nh": "nh", + "nixpkgs": "nixpkgs", + "plasma-manager": "plasma-manager", + "zen-browser": "zen-browser" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782624757, + "narHash": "sha256-pqFaCAV+g8H+p0kE4vYn9ZgcEFvt644zGy7SyCdf9c8=", + "owner": "youwen5", + "repo": "zen-browser-flake", + "rev": "907465791e7064d86d37964dd95e23280dfb68da", + "type": "github" + }, + "original": { + "owner": "youwen5", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..680ac27 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "grey's custom NixOS config"; + + inputs = { + nixpkgs = { + url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nh = { + url = "github:nix-community/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zen-browser = { + url = "github:youwen5/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + plasma-manager = { + url = "github:nix-community/plasma-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + }; + + outputs = {self,nixpkgs,home-manager,plasma-manager,...}@inputs: { + nixosConfigurations = builtins.listToAttrs (map (name: { + inherit name; + value = nixpkgs.lib.nixosSystem { + modules = [ + ./hosts/${name} + home-manager.nixosModules.default { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.grey = ./hosts/${name}/home.nix; + }; + } + ]; + specialArgs = { + inherit inputs; + system = "x86-64-linux"; + }; + }; + }) ["takamaki" "kitagawa" "nixos-vm"]); + }; +} diff --git a/flakes/home-manager.nix b/flakes/home-manager.nix new file mode 100644 index 0000000..797cac2 --- /dev/null +++ b/flakes/home-manager.nix @@ -0,0 +1,12 @@ +{ + inputs, + pkgs, + ... +}: { + environment.systemPackages = with pkgs; [ + inputs.home-manager.packages.${system}.default + ]; + + users.users.grey.isNormalUser = true; + home-manager.sharedModules = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; +} diff --git a/flakes/nh.nix b/flakes/nh.nix new file mode 100644 index 0000000..bd69bcd --- /dev/null +++ b/flakes/nh.nix @@ -0,0 +1,15 @@ +{ + inputs, + pkgs, + ... +}: { + environment.systemPackages = with pkgs; [ + inputs.nh.packages.${system}.default + ]; + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 3d --keep 3"; + flake = "/home/grey/nixos"; + }; +} diff --git a/flakes/plasma-desktop-modified.nix b/flakes/plasma-desktop-modified.nix new file mode 100644 index 0000000..e24f98a --- /dev/null +++ b/flakes/plasma-desktop-modified.nix @@ -0,0 +1,30 @@ +{ + config, + pkgs, + ... +}: { + services.desktopManager.plasma6 = { + enable = true; + enableQt5Integration = true; + }; + + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + konsole + qrca + ]; + + services.displayManager.defaultSession = "plasma"; + + services.displayManager.sddm = { + enable = true; + theme = "breeze"; + wayland.enable = true; + enableHidpi = true; + settings = { + Autologin = { + Session = "plasma.desktop"; + User = "grey"; + }; + }; + }; +} diff --git a/flakes/plasma-desktop.nix b/flakes/plasma-desktop.nix new file mode 100644 index 0000000..7548332 --- /dev/null +++ b/flakes/plasma-desktop.nix @@ -0,0 +1,27 @@ +{ + config, + pkgs, + ... +}: { + services.desktopManager.plasma6 = { + enable = true; + enableQt5Integration = true; + }; + + environment.plasma6.excludePackages = with pkgs; [ + # kdepackages. + ]; + + services.displayManager.sddm = { + enable = true; + theme = "breeze"; + wayland.enable = true; + enableHidpi = true; + settings = { + Autologin = { + Session = "plasma.desktop"; + User = "grey"; + }; + }; + }; +} diff --git a/flakes/zen-browser.nix b/flakes/zen-browser.nix new file mode 100644 index 0000000..1035573 --- /dev/null +++ b/flakes/zen-browser.nix @@ -0,0 +1,56 @@ +{ + inputs, + pkgs, + lib, + ... +}: +let + extension = shortId: guid: { + name = guid; + value = { + install_url = "https://addons.mozilla.org/en-GB/firefox/downloads/latest/${shortId}/latest.xpi"; + installation_mode = "normal_installed"; + }; + }; + + prefs = { + # about:config + "extensions.autoDisableScopes" = 0; + "extensions.pocket.enabled" = false; + }; + + extensions = [ + (extension "ublock-origin" "uBlock0@raymonhill.net") + ]; +in +{ + environment.systemPackages = with pkgs; [ + (pkgs.wrapFirefox + inputs.zen-browser.packages.${system}.zen-browser-unwrapped + { + extraPrefs = lib.concatLines ( + lib.mapAttrsToList ( + name: value: ''lockPref(${lib.strings.toJSON name}, ${lib.strings.toJSON value});'' + ) prefs + ); + + extraPolicies = { + DisableTelemetry = true; + ExtensionSettings = builtins.listToAttrs extensions; + + SearchEngines = { + Defeault = "ddg"; + Add = [ + { + Name = "nixpkgs packages"; + URLTemplate = "https://search.nixos.org/packages?query={searchTerms}"; + IconURL = "https://wiki.nixos.org/favicon.ico"; + Alias = "@np"; + } + ]; + }; + }; + } + ) + ]; +} diff --git a/hosts/nixos-vm/default.nix b/hosts/nixos-vm/default.nix new file mode 100644 index 0000000..0f98762 --- /dev/null +++ b/hosts/nixos-vm/default.nix @@ -0,0 +1,110 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ + config, + pkgs, + ... +}: let name = "nixos-vm"; in { + imports = [ + ./hardware-configuration.nix + ../../flakes/nh.nix + ../../flakes/plasma-desktop-modified.nix + ../../flakes/home-manager.nix + ../../flakes/zen-browser.nix + ]; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + virtualisation.virtualbox.guest.enable = true; + + # 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. + + # Configure network proxy if necessary + # 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; []; + }; + + # 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 + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # 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/hardware-configuration.nix b/hosts/nixos-vm/hardware-configuration.nix new file mode 100644 index 0000000..26ff2f5 --- /dev/null +++ b/hosts/nixos-vm/hardware-configuration.nix @@ -0,0 +1,29 @@ +# 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. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9f7f7f45-eb12-4b9a-a751-8d675d8bb592"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4D2B-B3CD"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + virtualisation.virtualbox.guest.enable = true; +} diff --git a/hosts/nixos-vm/home.nix b/hosts/nixos-vm/home.nix new file mode 100644 index 0000000..88fd980 --- /dev/null +++ b/hosts/nixos-vm/home.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + ... +}: { + home.username = "grey"; + home.homeDirectory = "/home/grey"; + + home.stateVersion = "26.05"; + + home.packages = [ + pkgs.kitty + pkgs.bibata-cursors + pkgs.papirus-icon-theme + pkgs.steam + pkgs.equibop + pkgs.prismlauncher + pkgs.obsidian + pkgs.github-desktop + pkgs.vscode + ]; + + programs.git.settings = { + enable = true; + user.name = "Grey Jones"; + user.email = "grey@greyweather.dev"; + }; + + programs.plasma = { + enable = true; + overrideConfig = true; + + workspace = { + clickItemTo = "select"; + lookAndFeel = "org.kde.breezedark.desktop"; + cursor.theme = "Bibata-Modern-Ice"; + iconTheme = "Papirus-Dark"; + }; + + shortcuts = { + plasmashell = { + "Show Activity Switcher" = "none"; + }; + + kwin = { + "Close Window" = "Meta+Q"; + }; + + "services/kitty.desktop"."_launch" = "Meta+Return"; + }; + }; +} diff --git a/hosts/takamaki/default.nix b/hosts/takamaki/default.nix new file mode 100644 index 0000000..3b128e5 --- /dev/null +++ b/hosts/takamaki/default.nix @@ -0,0 +1,104 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../flakes/nh.nix + ]; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos-vm"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # 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; []; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # 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? +}