From 7364e01d077fcc96980d210297ec7c67a8c586a3 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 28 Jun 2023 19:37:23 +0100 Subject: [PATCH] Remove users directory and hosts for non-NixOS machines Move user account definitions into machine configuration.nix Move per-host user settings into flake.nix directly --- flake.nix | 140 +++++++++++++++++++++++++++++-- home/work.nix | 9 +- hosts/Legion/configuration.nix | 10 ++- hosts/Monarch/home.nix | 17 ---- hosts/Northstar/home.nix | 17 ---- hosts/Ronin/configuration.nix | 9 +- hosts/Vanguard/configuration.nix | 7 ++ users/elitherl/Ronin.nix | 44 ---------- users/elitherl/default.nix | 23 ----- users/root/default.nix | 7 -- users/xenia/Vanguard.nix | 19 ----- users/xenia/default.nix | 17 ---- 12 files changed, 163 insertions(+), 156 deletions(-) delete mode 100644 hosts/Monarch/home.nix delete mode 100644 hosts/Northstar/home.nix delete mode 100644 users/elitherl/Ronin.nix delete mode 100644 users/elitherl/default.nix delete mode 100644 users/root/default.nix delete mode 100644 users/xenia/Vanguard.nix delete mode 100644 users/xenia/default.nix diff --git a/flake.nix b/flake.nix index 080a675e..34180974 100644 --- a/flake.nix +++ b/flake.nix @@ -26,11 +26,18 @@ ... }: let home-config = { - imports = [home-manager.nixosModules.home-manager ./users/root]; + imports = [home-manager.nixosModules.home-manager]; home-manager = { useGlobalPkgs = true; useUserPackages = false; - users.root.imports = [./home/env/bash.nix ./home/env/starship.nix]; + users.root = { + imports = [./home/env/bash.nix ./home/env/starship.nix]; + home = { + username = "root"; + homeDirectory = "/root"; + stateVersion = "22.11"; + }; + }; }; }; hyprland-config = {pkgs, ...}: { @@ -90,8 +97,17 @@ modules = [ home-config ./hosts/Legion - ./users/xenia ./services/Legion.nix + { + home-manager.users.xenia = { + imports = [./home/personal.nix]; + home = { + username = "xenia"; + homeDirectory = "/home/xenia"; + stateVersion = "22.11"; + }; + }; + } ]; }; Vanguard = nixpkgs.lib.nixosSystem { @@ -104,10 +120,32 @@ home-config hyprland-config ./hosts/Vanguard - ./users/xenia/Vanguard.nix ./services/sshd ./services/syncthing/Vanguard.nix - {home-manager.users.xenia.imports = [hyprland-home-config];} + { + home-manager.users.xenia = { + imports = [hyprland-home-config ./home/personal.nix]; + home = { + username = "xenia"; + homeDirectory = "/home/xenia"; + stateVersion = "22.11"; + }; + wayland.windowManager.hyprland.extraConfig = '' + source=./common.conf + monitor=DP-2,highrr,auto,auto + + workspace = name:steam + windowrule = workspace name:steam, [Ss]team.* + bind = ALT, S, moveworkspacetomonitor, name:steam current + bind = ALT, S, workspace, name:steam + bind = ALT SHIFT, S, moveworkspacetomonitor, name:steam current + bind = ALT SHIFT, S, movetoworkspace, name:steam + ''; + programs.waybar.settings = { + main."wlr/workspaces"."format-icons"."steam" = "󰓓"; + }; + }; + } ]; }; Ronin = nixpkgs.lib.nixosSystem { @@ -120,20 +158,104 @@ home-config hyprland-config ./hosts/Ronin - ./users/elitherl/Ronin.nix ./services/syncthing/Ronin.nix - {home-manager.users.elitherl.imports = [hyprland-home-config];} + ({pkgs, ...}: let + laptop-state = pkgs.writeShellScriptBin "check-laptop-lid-state" '' + grep closed /proc/acpi/button/lid/LID0/state &&\ + hyprctl keyword monitor "eDP-1,disable" ||\ + hyprctl keyword monitor "eDP-1,1920x1080,0x0,1.0" + ''; + in { + home-manager.users.elitherl = { + imports = [hyprland-home-config ./home/work.nix]; + home = { + username = "elitherl"; + homeDirectory = "/home/elitherl"; + stateVersion = "22.11"; + packages = [laptop-state]; + }; + wayland.windowManager.hyprland.extraConfig = '' + source=./common.conf + bindl=,switch:Lid Switch,exec,check-laptop-lid-state + exec = ${laptop-state}/bin/check-laptop-lid-state + monitor = DP-3,1920x1200,1920x0,1.0 + monitor = DP-4,1920x1080,3840x0,1.0,transform,1 + + workspace = name:remote + windowrule = workspace name:chat, teams-for-linux + windowrule = workspace name:remote, Nxplayer.* + bind = ALT, R, moveworkspacetomonitor, name:remote current + bind = ALT, R, workspace, name:remote + bind = ALT SHIFT, R, moveworkspacetomonitor, name:remote current + bind = ALT SHIFT, R, movetoworkspace, name:remote + ''; + programs.waybar.settings = { + main = { + "output" = "!DP-4"; + "wlr/workspaces"."format-icons"."remote" = "󰢹"; + }; + alt = { + "include" = [ + "~/.config/waybar/modules.json" + "~/.config/waybar/layout.json" + ]; + "output" = "DP-4"; + "wlr/workspaces"."format-icons"."remote" = "󰢹"; + "modules-left" = []; + "modules-center" = ["wlr/workspaces"]; + "modules-right" = []; + }; + }; + }; + }) ]; }; }; homeConfigurations = { "tux@Monarch" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."aarch64-darwin"; - modules = [./hosts/Monarch/home.nix]; + modules = [ + ({pkgs, ...}: { + imports = [./home/personal.nix ./home/gui/wezterm.nix]; + home = { + username = "tux"; + homeDirectory = "/Users/tux"; + stateVersion = "23.05"; + packages = [pkgs.gcc]; + }; + programs = { + home-manager.enable = true; + zsh = { + sessionVariables.CC = "${pkgs.gcc}/bin/gcc"; + envExtra = '' + eval "$(/opt/homebrew/bin/brew shellenv)" + ''; + }; + }; + services.syncthing.enable = true; + }) + ]; }; "xenia@Northstar" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."aarch64-linux"; - modules = [./hosts/Northstar/home.nix]; + modules = [ + { + imports = [./home/personal.nix]; + home = { + username = "xenia"; + homeDirectory = "/home/xenia"; + stateVersion = "22.11"; + }; + programs = { + home-manager.enable = true; + bash.bashrcExtra = '' + source $HOME/.nix-profile/etc/profile.d/nix.sh + ''; + }; + services.syncthing.enable = true; + fonts.fontconfig.enable = true; + } + ]; }; }; }; diff --git a/home/work.nix b/home/work.nix index 0bddcdab..89930e74 100644 --- a/home/work.nix +++ b/home/work.nix @@ -1,5 +1,12 @@ -{...}: { +{pkgs, ...}: { imports = [./default.nix ./git/work.nix ./ssh/work.nix]; + home.packages = with pkgs; [ + zotero + openfortivpn + nomachine-client + teams-for-linux + zoom-us + ]; programs.fish.functions.fsync = '' rsync -avz --copy-links --filter=':- .gitignore' --exclude='.git*'\ --delete-during --delete-excluded\ diff --git a/hosts/Legion/configuration.nix b/hosts/Legion/configuration.nix index e0add021..de6a57dd 100644 --- a/hosts/Legion/configuration.nix +++ b/hosts/Legion/configuration.nix @@ -1,7 +1,7 @@ # 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 @@ -27,6 +27,14 @@ }; }; + users.users.xenia = { + isNormalUser = true; + description = "Evie Litherland-Smith"; + extraGroups = ["networkmanager" "wheel"]; + shell = pkgs.fish; + openssh.authorizedKeys.keys = import ../../auth/authorized_keys.nix; + }; + # 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 diff --git a/hosts/Monarch/home.nix b/hosts/Monarch/home.nix deleted file mode 100644 index d272abe6..00000000 --- a/hosts/Monarch/home.nix +++ /dev/null @@ -1,17 +0,0 @@ -{pkgs, ...}: { - imports = [../../home/personal.nix ../../home/gui/wezterm.nix]; - # Home Manager needs a bit of information about you and the - # paths it should manage. - home.username = "tux"; - home.homeDirectory = "/Users/tux"; - home.stateVersion = "23.05"; - home.packages = [pkgs.gcc]; - programs.home-manager.enable = true; - programs.zsh = { - sessionVariables.CC = "${pkgs.gcc}/bin/gcc"; - envExtra = '' - eval "$(/opt/homebrew/bin/brew shellenv)" - ''; - }; - services.syncthing.enable = true; -} diff --git a/hosts/Northstar/home.nix b/hosts/Northstar/home.nix deleted file mode 100644 index 53157aab..00000000 --- a/hosts/Northstar/home.nix +++ /dev/null @@ -1,17 +0,0 @@ -{pkgs, ...}: { - imports = [ - ../../home/personal.nix - ../../home/gui/firefox.nix - ]; - home.username = "xenia"; - home.homeDirectory = "/home/xenia"; - home.stateVersion = "22.11"; - programs.home-manager.enable = true; - programs.bash.bashrcExtra = '' - source $HOME/.nix-profile/etc/profile.d/nix.sh - ''; - programs.firefox.package = pkgs.firefox-wayland; - - services.syncthing.enable = true; - fonts.fontconfig.enable = true; -} diff --git a/hosts/Ronin/configuration.nix b/hosts/Ronin/configuration.nix index f62971fd..15fb6134 100644 --- a/hosts/Ronin/configuration.nix +++ b/hosts/Ronin/configuration.nix @@ -1,7 +1,7 @@ # 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 @@ -25,6 +25,13 @@ 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.settings.initial_session.user = "elitherl"; # This value determines the NixOS release from which the default diff --git a/hosts/Vanguard/configuration.nix b/hosts/Vanguard/configuration.nix index a2f4d6cf..0de3103a 100644 --- a/hosts/Vanguard/configuration.nix +++ b/hosts/Vanguard/configuration.nix @@ -32,6 +32,13 @@ 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.settings.initial_session.user = "xenia"; # This value determines the NixOS release from which the default diff --git a/users/elitherl/Ronin.nix b/users/elitherl/Ronin.nix deleted file mode 100644 index 3e96c6a4..00000000 --- a/users/elitherl/Ronin.nix +++ /dev/null @@ -1,44 +0,0 @@ -{pkgs, ...}: let - laptop-state = pkgs.writeShellScriptBin "check-laptop-lid-state" '' - grep closed /proc/acpi/button/lid/LID0/state &&\ - hyprctl keyword monitor "eDP-1,disable" ||\ - hyprctl keyword monitor "eDP-1,1920x1080,0x0,1.0" - ''; -in { - imports = [./default.nix]; - home-manager.users.elitherl = { - home.packages = [laptop-state]; - wayland.windowManager.hyprland.extraConfig = '' - source=./common.conf - bindl=,switch:Lid Switch,exec,check-laptop-lid-state - exec = ${laptop-state}/bin/check-laptop-lid-state - monitor = DP-3,1920x1200,1920x0,1.0 - monitor = DP-4,1920x1080,3840x0,1.0,transform,1 - - workspace = name:remote - windowrule = workspace name:chat, teams-for-linux - windowrule = workspace name:remote, Nxplayer.* - bind = ALT, R, moveworkspacetomonitor, name:remote current - bind = ALT, R, workspace, name:remote - bind = ALT SHIFT, R, moveworkspacetomonitor, name:remote current - bind = ALT SHIFT, R, movetoworkspace, name:remote - ''; - programs.waybar.settings = { - main = { - "output" = "!DP-4"; - "wlr/workspaces"."format-icons"."remote" = "󰢹"; - }; - alt = { - "include" = [ - "~/.config/waybar/modules.json" - "~/.config/waybar/layout.json" - ]; - "output" = "DP-4"; - "wlr/workspaces"."format-icons"."remote" = "󰢹"; - "modules-left" = []; - "modules-center" = ["wlr/workspaces"]; - "modules-right" = []; - }; - }; - }; -} diff --git a/users/elitherl/default.nix b/users/elitherl/default.nix deleted file mode 100644 index 7814bafa..00000000 --- a/users/elitherl/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{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"; - packages = with pkgs; [ - zotero - openfortivpn - nomachine-client - teams-for-linux - zoom-us - ]; - }; - }; -} diff --git a/users/root/default.nix b/users/root/default.nix deleted file mode 100644 index 1f4a832b..00000000 --- a/users/root/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{...}: { - home-manager.users.root = { - home.username = "root"; - home.homeDirectory = "/root"; - home.stateVersion = "22.11"; - }; -} diff --git a/users/xenia/Vanguard.nix b/users/xenia/Vanguard.nix deleted file mode 100644 index 2d07457b..00000000 --- a/users/xenia/Vanguard.nix +++ /dev/null @@ -1,19 +0,0 @@ -{...}: { - imports = [./default.nix]; - home-manager.users.xenia = { - wayland.windowManager.hyprland.extraConfig = '' - source=./common.conf - monitor=DP-2,highrr,auto,auto - - workspace = name:steam - windowrule = workspace name:steam, [Ss]team.* - bind = ALT, S, moveworkspacetomonitor, name:steam current - bind = ALT, S, workspace, name:steam - bind = ALT SHIFT, S, moveworkspacetomonitor, name:steam current - bind = ALT SHIFT, S, movetoworkspace, name:steam - ''; - programs.waybar.settings = { - main."wlr/workspaces"."format-icons"."steam" = "󰓓"; - }; - }; -} diff --git a/users/xenia/default.nix b/users/xenia/default.nix deleted file mode 100644 index 48e1dc3e..00000000 --- a/users/xenia/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{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"; - }; - }; -}