From bd5039992ca8f48a6783faed549c6796f4526e41 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 26 Jun 2023 15:08:44 +0100 Subject: [PATCH] Move things into abstacted sections to maximuse reuse --- flake.nix | 67 ++++++++++++++------------------ hosts/Legion/configuration.nix | 46 +--------------------- hosts/N0245/configuration.nix | 28 ++----------- hosts/N0245/default.nix | 1 + hosts/N0245/users/elitherl.nix | 48 ----------------------- hosts/Vanguard/configuration.nix | 20 +--------- hosts/Vanguard/default.nix | 1 + hosts/Vanguard/users/xenia.nix | 6 --- hosts/common.nix | 8 +++- users/elitherl/N0245.nix | 46 ++++++++++++++++++++++ users/elitherl/default.nix | 16 ++++++++ users/root/default.nix | 7 ++++ users/xenia/default.nix | 17 ++++++++ 13 files changed, 133 insertions(+), 178 deletions(-) create mode 100644 hosts/N0245/default.nix delete mode 100644 hosts/N0245/users/elitherl.nix create mode 100644 hosts/Vanguard/default.nix delete mode 100644 hosts/Vanguard/users/xenia.nix create mode 100644 users/elitherl/N0245.nix create mode 100644 users/elitherl/default.nix create mode 100644 users/root/default.nix create mode 100644 users/xenia/default.nix diff --git a/flake.nix b/flake.nix index 1a0a97ab..421b3e2c 100644 --- a/flake.nix +++ b/flake.nix @@ -22,14 +22,32 @@ ... }: let home-config = { - imports = [home-manager.nixosModules.home-manager]; + imports = [home-manager.nixosModules.home-manager ./users/root]; home-manager = { useGlobalPkgs = true; useUserPackages = false; + users.root.imports = [./home/env/bash.nix ./home/env/starship.nix]; }; }; hyprland-config = { - imports = [hyprland.homeManagerModules.default]; + imports = [hyprland.nixosModules.default]; + security.pam.services.swaylock = {}; + programs.hyprland.enable = true; + services.greetd = { + enable = true; + settings = rec { + initial_session.command = "Hyprland"; + default_session = initial_session; + }; + }; + }; + hyprland-home-config = {pkgs, ...}: { + imports = [ + hyprland.homeManagerModules.default + ./home/desktop/hyprland.nix + ./home/gui + ]; + programs.firefox.package = pkgs.firefox-wayland; xdg.configFile."hypr/hyprpaper.conf".text = '' preload = ${wallpapers.outputs.default} wallpaper = ,${wallpapers.outputs.default} @@ -45,8 +63,8 @@ }; modules = [ home-config - ./hosts/common.nix - ./hosts/Legion/configuration.nix + ./hosts/Legion + ./users/xenia ./services/Legion.nix ]; }; @@ -58,23 +76,11 @@ }; modules = [ home-config - hyprland.nixosModules.default - ./hosts/common.nix - ./hosts/Vanguard/configuration.nix + hyprland-config + ./hosts/Vanguard + ./users/xenia ./services/sshd - { - security.pam.services.swaylock = {}; - programs.hyprland.enable = true; - home-manager.users.xenia = { - imports = [ - hyprland-config - ./hosts/Vanguard/users/xenia.nix - ./home/personal.nix - ./home/gui - ./home/desktop/hyprland.nix - ]; - }; - } + {home-manager.users.xenia.imports = [hyprland-home-config];} ]; }; N0245 = nixpkgs.lib.nixosSystem { @@ -85,24 +91,11 @@ }; modules = [ home-config - hyprland.nixosModules.default - ./hosts/common.nix - ./hosts/N0245/configuration.nix + hyprland-config + ./hosts/N0245 + ./users/elitherl/N0245.nix ./services/syncthing/N0245.nix - { - hardware.bluetooth.enable = true; - security.pam.services.swaylock = {}; - programs.hyprland.enable = true; - home-manager.users.elitherl = { - imports = [ - hyprland-config - ./hosts/N0245/users/elitherl.nix - ./home/work.nix - ./home/gui - ./home/desktop/hyprland.nix - ]; - }; - } + {home-manager.users.elitherl.imports = [hyprland-home-config];} ]; }; }; diff --git a/hosts/Legion/configuration.nix b/hosts/Legion/configuration.nix index 29dba241..e0add021 100644 --- a/hosts/Legion/configuration.nix +++ b/hosts/Legion/configuration.nix @@ -1,40 +1,17 @@ # 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`). -{pkgs, ...}: { +{...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../common.nix ]; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - services.xserver = { - layout = "gb"; - xkbVariant = ""; - }; - console.keyMap = "uk"; - - # 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"; - }; - networking = { hostName = "Legion"; # Define your hostname. nameservers = ["192.168.1.230" "127.0.0.1" "9.9.9.9"]; @@ -49,25 +26,6 @@ upper = "05:00"; }; }; - users.users.xenia = { - isNormalUser = true; - description = "Evie Litherland-Smith"; - extraGroups = ["networkmanager" "wheel"]; - shell = pkgs.fish; - openssh.authorizedKeys.keys = import ../../auth/authorized_keys.nix; - }; - home-manager.users.xenia = { - imports = [../../home/personal.nix]; - home.username = "xenia"; - home.homeDirectory = "/home/xenia"; - home.stateVersion = "22.11"; - }; - home-manager.users.root = { - imports = [../../home/env/bash.nix ../../home/env/starship.nix]; - home.username = "root"; - home.homeDirectory = "/root"; - home.stateVersion = "22.11"; - }; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/hosts/N0245/configuration.nix b/hosts/N0245/configuration.nix index ede2224e..ccbaedda 100644 --- a/hosts/N0245/configuration.nix +++ b/hosts/N0245/configuration.nix @@ -1,17 +1,12 @@ # 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’). -{pkgs, ...}: { +{...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../common.nix ]; - - nix.package = pkgs.nixUnstable; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -26,26 +21,11 @@ boot.initrd.luks.devices."luks-761eeb11-3091-4142-9232-4fb33165eccd".keyFile = "/crypto_keyfile.bin"; networking.hostName = "N0245"; # Define your hostname. + hardware.bluetooth.enable = true; environment.etc."ppp/options".text = '' ipcp-accept-remote ''; - users.users.elitherl = { - isNormalUser = true; - description = "Evie Litherland-Smith"; - extraGroups = ["networkmanager" "wheel"]; - shell = pkgs.fish; - }; - - services.greetd = { - enable = true; - settings = rec { - initial_session = { - command = "Hyprland"; - user = "elitherl"; - }; - default_session = initial_session; - }; - }; + services.greetd.settings.user = "elitherl"; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/hosts/N0245/default.nix b/hosts/N0245/default.nix new file mode 100644 index 00000000..e5cd8b02 --- /dev/null +++ b/hosts/N0245/default.nix @@ -0,0 +1 @@ +{...}: {imports = [./configuration.nix];} diff --git a/hosts/N0245/users/elitherl.nix b/hosts/N0245/users/elitherl.nix deleted file mode 100644 index 2a957ed6..00000000 --- a/hosts/N0245/users/elitherl.nix +++ /dev/null @@ -1,48 +0,0 @@ -{pkgs, ...}: { - home.username = "elitherl"; - home.homeDirectory = "/home/elitherl"; - home.stateVersion = "22.11"; - home.packages = with pkgs; [ - zotero - openfortivpn - nomachine-client - teams-for-linux - zoom-us - ]; - programs.firefox.package = pkgs.firefox-wayland; - - wayland.windowManager.hyprland.extraConfig = '' - source=./common.conf - - monitor = eDP-1,preferred,auto,1.0 - monitor = DP-3,preferred,auto,auto - monitor = DP-4,preferred,auto,auto,transform,1 - - workspace = DP-3,1 - workspace = DP-3,2 - workspace = DP-3,3 - workspace = DP-3,4 - - windowrule = float, title:^([Zz]oom).*$ - windowrule = center, title:^([Zz]oom).*$ - windowrule = workspace 3 silent, ^(teams-for-linux)$ - windowrule = workspace 3, title:^([Zz]oom).*$ - windowrule = workspace 4 silent, ^(Nxplayer.bin)$ - - exec-once = firefox - exec-once = teams-for-linux - ''; - programs.waybar.settings = { - main."output" = "!DP-4"; - alt = { - "include" = [ - "~/.config/waybar/modules.json" - "~/.config/waybar/layout.json" - ]; - "output" = "DP-4"; - "modules-left" = ["wlr/workspaces"]; - "modules-center" = ["clock#compact"]; - "modules-right" = ["tray"]; - }; - }; -} diff --git a/hosts/Vanguard/configuration.nix b/hosts/Vanguard/configuration.nix index 99116e05..24661ec9 100644 --- a/hosts/Vanguard/configuration.nix +++ b/hosts/Vanguard/configuration.nix @@ -5,6 +5,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../common.nix ]; # Bootloader. @@ -30,24 +31,7 @@ hardware.steam-hardware.enable = true; hardware.opengl.driSupport32Bit = true; - users.users.xenia = { - isNormalUser = true; - description = "Evie Litherland-Smith"; - extraGroups = ["networkmanager" "wheel"]; - shell = pkgs.fish; - openssh.authorizedKeys.keys = import ../../auth/authorized_keys.nix; - }; - - services.greetd = { - enable = true; - settings = rec { - initial_session = { - command = "Hyprland"; - user = "xenia"; - }; - default_session = initial_session; - }; - }; + services.greetd.settings.user = "xenia"; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/hosts/Vanguard/default.nix b/hosts/Vanguard/default.nix new file mode 100644 index 00000000..e5cd8b02 --- /dev/null +++ b/hosts/Vanguard/default.nix @@ -0,0 +1 @@ +{...}: {imports = [./configuration.nix];} diff --git a/hosts/Vanguard/users/xenia.nix b/hosts/Vanguard/users/xenia.nix deleted file mode 100644 index bc9bf6e0..00000000 --- a/hosts/Vanguard/users/xenia.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - home.username = "xenia"; - home.homeDirectory = "/home/xenia"; - home.stateVersion = "22.11"; - programs.firefox.package = pkgs.firefox-wayland; -} diff --git a/hosts/common.nix b/hosts/common.nix index 899a3714..ff21735d 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -21,7 +21,13 @@ zsh.enable = true; }; fonts.fontconfig.enable = true; - environment.localBinInPath = true; + environment = { + localBinInPath = true; + shellAliases = { + ll = "ls -l"; + update = "sudo nixos-rebuild switch --flake 'git+https://git.xenia.me.uk/xenia/nixos.git?ref=main'"; + }; + }; services.xserver = { layout = "gb"; diff --git a/users/elitherl/N0245.nix b/users/elitherl/N0245.nix new file mode 100644 index 00000000..508a772e --- /dev/null +++ b/users/elitherl/N0245.nix @@ -0,0 +1,46 @@ +{pkgs, ...}: { + imports = [./default.nix]; + home-manager.users.elitherl = { + home.packages = with pkgs; [ + zotero + openfortivpn + nomachine-client + teams-for-linux + zoom-us + ]; + wayland.windowManager.hyprland.extraConfig = '' + source=./common.conf + + monitor = eDP-1,preferred,auto,1.0 + monitor = DP-3,preferred,auto,auto + monitor = DP-4,preferred,auto,auto,transform,1 + + workspace = DP-3,1 + workspace = DP-3,2 + workspace = DP-3,3 + workspace = DP-3,4 + + windowrule = float, title:^([Zz]oom).*$ + windowrule = center, title:^([Zz]oom).*$ + windowrule = workspace 3 silent, ^(teams-for-linux)$ + windowrule = workspace 3, title:^([Zz]oom).*$ + windowrule = workspace 4 silent, ^(Nxplayer.bin)$ + + exec-once = firefox + exec-once = teams-for-linux + ''; + programs.waybar.settings = { + main."output" = "!DP-4"; + alt = { + "include" = [ + "~/.config/waybar/modules.json" + "~/.config/waybar/layout.json" + ]; + "output" = "DP-4"; + "modules-left" = ["wlr/workspaces"]; + "modules-center" = ["clock#compact"]; + "modules-right" = ["tray"]; + }; + }; + }; +} diff --git a/users/elitherl/default.nix b/users/elitherl/default.nix new file mode 100644 index 00000000..5f6053c6 --- /dev/null +++ b/users/elitherl/default.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: { + users.users.elitherl = { + isNormalUser = true; + description = "Evie Litherland-Smith"; + extraGroups = ["networkmanager" "wheel"]; + shell = pkgs.fish; + }; + home-manager.users.elitherl = { + imports = [../../home/work.nix]; + home = { + username = "elitherl"; + homeDirectory = "/home/elitherl"; + stateVersion = "22.11"; + }; + }; +} diff --git a/users/root/default.nix b/users/root/default.nix new file mode 100644 index 00000000..1f4a832b --- /dev/null +++ b/users/root/default.nix @@ -0,0 +1,7 @@ +{...}: { + home-manager.users.root = { + home.username = "root"; + home.homeDirectory = "/root"; + home.stateVersion = "22.11"; + }; +} diff --git a/users/xenia/default.nix b/users/xenia/default.nix new file mode 100644 index 00000000..48e1dc3e --- /dev/null +++ b/users/xenia/default.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + users.users.xenia = { + isNormalUser = true; + description = "Evie Litherland-Smith"; + extraGroups = ["networkmanager" "wheel"]; + shell = pkgs.fish; + openssh.authorizedKeys.keys = import ../../auth/authorized_keys.nix; + }; + home-manager.users.xenia = { + imports = [../../home/personal.nix]; + home = { + username = "xenia"; + homeDirectory = "/home/xenia"; + stateVersion = "22.11"; + }; + }; +}