From 04783f1580921e143e54aa250dc96799809e7cfc Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 5 Jun 2024 13:39:25 -0500 Subject: [PATCH] deduplicated host configs, defined more things in common.nix files. --- configs/nixos/common.nix | 13 ++++++++++--- hosts/archlaptop-vm/default.nix | 14 +++----------- hosts/workstation-vm/default.nix | 25 +------------------------ hosts/wsl-workstation.nix | 16 ++-------------- packages/proxmox.nix | 13 ++++--------- packages/vm.nix | 13 ++++--------- 6 files changed, 24 insertions(+), 70 deletions(-) diff --git a/configs/nixos/common.nix b/configs/nixos/common.nix index 74baa54..c3ec1ad 100644 --- a/configs/nixos/common.nix +++ b/configs/nixos/common.nix @@ -36,9 +36,16 @@ }; # packages that should be on every system. - environment.systemPackages = with pkgs; [ - neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - ]; + environment.systemPackages = [pkgs.neovim]; + + programs.zsh.enable = lib.mkDefault true; + environment.shells = lib.mkDefault [pkgs.zsh]; + users.users.${config.host.user} = { + isNormalUser = true; + description = config.host.fullName; + shell = pkgs.zsh; + extraGroups = ["wheel"]; + }; imports = [ ../../modules/hostopts.nix diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix index 14b8aca..c5750ec 100644 --- a/hosts/archlaptop-vm/default.nix +++ b/hosts/archlaptop-vm/default.nix @@ -27,25 +27,17 @@ inputs.nixpkgs.lib.nixosSystem { }: { host = { user = "gabe"; + fullName = "Gabe Venberg"; gui.enable = true; isVm = true; }; networking.hostName = "archlaptop-vm"; # Define your hostname. - programs.zsh.enable = true; - environment.shells = with pkgs; [zsh]; users.mutableUsers = false; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.${config.host.user} = { hashedPasswordFile = config.sops.secrets.gv-password.path; - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.zsh; - extraGroups = ["wheel"]; - packages = with pkgs; [ - firefox - # thunderbird - ]; + packages = with pkgs; [firefox]; }; home-manager.sharedModules = [ @@ -60,7 +52,7 @@ inputs.nixpkgs.lib.nixosSystem { user = { git = { profile = { - name = "Gabe Venberg"; + name = config.host.fullName; email = "gabevenberg@gmail.com"; }; workProfile.enable = false; diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index fd4b56e..df5f0f1 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -33,38 +33,17 @@ inputs.nixpkgs.lib.nixosSystem { }: { host = { user = "gabe"; + fullName = "Gabe Venberg"; gui.enable = true; isVm = true; }; networking.hostName = "workstation-vm"; # Define your hostname. - # Set your time zone. - time.timeZone = "America/Chicago"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "us"; - xkb.variant = ""; - }; - - users.users.root.openssh.authorizedKeys.keys = - configLib.dirToStrings "${inputs.nix-secrets}/public-keys"; - - programs.zsh.enable = true; - environment.shells = with pkgs; [zsh]; - # Define a user account. Don't forget to set a password with ‘passwd’. users.mutableUsers = false; users.users.${config.host.user} = { hashedPasswordFile = config.sops.secrets.gv-password.path; - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.zsh; - extraGroups = ["wheel"]; packages = with pkgs; [ firefox - # thunderbird ]; }; @@ -89,8 +68,6 @@ inputs.nixpkgs.lib.nixosSystem { inputs.nixvim.homeManagerModules.nixvim ]; }; - # Enable the OpenSSH daemon. - services.openssh.enable = true; # Bootloader. boot.loader.systemd-boot.enable = true; diff --git a/hosts/wsl-workstation.nix b/hosts/wsl-workstation.nix index 928ebec..60e069e 100644 --- a/hosts/wsl-workstation.nix +++ b/hosts/wsl-workstation.nix @@ -22,20 +22,10 @@ inputs.nixpkgs.lib.nixosSystem { networking.nameservers = ["1.1.1.1" "8.8.8.8"]; host = { user = "nixos"; + fullName = "Gabe Venberg"; }; networking.hostName = "gv-wsl"; # Define your hostname. - # Set your time zone. - time.timeZone = "America/Chicago"; - programs.zsh.enable = true; - environment.shells = with pkgs; [zsh]; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.${config.host.user} = { - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.zsh; - extraGroups = ["wheel"]; - }; home-manager.users.${config.host.user} = { inputs, osConfig, @@ -49,7 +39,7 @@ inputs.nixpkgs.lib.nixosSystem { }; git = { profile = { - name = "Gabe Venberg"; + name = config.host.fullName; email = "gabevenberg@gmail.com"; }; workProfile.enable = false; @@ -62,8 +52,6 @@ inputs.nixpkgs.lib.nixosSystem { ]; }; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; # 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/packages/proxmox.nix b/packages/proxmox.nix index 95536c6..7aa9cc4 100644 --- a/packages/proxmox.nix +++ b/packages/proxmox.nix @@ -22,16 +22,11 @@ inputs.nixos-generators.nixosGenerate { imports = [(modulesPath + "/virtualisation/proxmox-lxc.nix")]; proxmoxLXC.manageHostName = false; host.user = "gabe"; + host.fullName = "Gabe Venberg"; - users.users.root.password="nixos"; - programs.zsh.enable = true; - environment.shells = with pkgs; [zsh]; + users.users.root.password = "nixos"; users.users.${config.host.user} = { - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.zsh; - extraGroups = ["wheel"]; - password="nixos"; + password = "nixos"; }; home-manager.users.${config.host.user} = { @@ -43,7 +38,7 @@ inputs.nixos-generators.nixosGenerate { user = { git = { profile = { - name = "Gabe Venberg"; + name = config.host.fullName; email = "gabevenberg@gmail.com"; }; workProfile.enable = false; diff --git a/packages/vm.nix b/packages/vm.nix index 41621bf..a8f22a9 100644 --- a/packages/vm.nix +++ b/packages/vm.nix @@ -22,16 +22,11 @@ inputs.nixos-generators.nixosGenerate { }: { imports = [(modulesPath + "/profiles/qemu-guest.nix")]; host.user = "gabe"; + host.fullName = "Gabe Venberg"; - users.users.root.password="nixos"; - programs.zsh.enable = true; - environment.shells = with pkgs; [zsh]; + users.users.root.password = "nixos"; users.users.${config.host.user} = { - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.zsh; - extraGroups = ["wheel"]; - password="nixos"; + password = "nixos"; }; home-manager.users.${config.host.user} = { @@ -43,7 +38,7 @@ inputs.nixos-generators.nixosGenerate { user = { git = { profile = { - name = "Gabe Venberg"; + name = config.host.fullName; email = "gabevenberg@gmail.com"; }; workProfile.enable = false;