From acb8519f43b34202a30c80d28b20731d74b494ca Mon Sep 17 00:00:00 2001 From: Tyler Starr Date: Fri, 27 Sep 2024 13:57:17 -0700 Subject: [PATCH] refactor for defaults in default and physical machine --- provision/hosts/bulwark/default.nix | 5 +-- provision/hosts/default/default.nix | 34 +++++++++++++++++++ provision/hosts/default/home-default.nix | 20 +++++++++++ .../hosts/default/physical/configuration.nix | 34 ------------------- .../default/physical/home-configuration.nix | 16 --------- provision/hosts/kestrel/default.nix | 5 +-- provision/hosts/shivan/default.nix | 5 +-- provision/hosts/torus/default.nix | 5 +-- 8 files changed, 66 insertions(+), 58 deletions(-) create mode 100644 provision/hosts/default/default.nix create mode 100644 provision/hosts/default/home-default.nix diff --git a/provision/hosts/bulwark/default.nix b/provision/hosts/bulwark/default.nix index d98308c3..e94cc543 100644 --- a/provision/hosts/bulwark/default.nix +++ b/provision/hosts/bulwark/default.nix @@ -3,8 +3,9 @@ inherit system; specialArgs = { inherit user inputs; }; modules = [ - ../default/physical/configuration.nix - ./configuration.nix + ../default # shared by all configs + ../default/physical/configuration.nix # shared by physical machines + ./configuration.nix # bulwark specific ./hardware.nix ../../modules agenix.nixosModules.default diff --git a/provision/hosts/default/default.nix b/provision/hosts/default/default.nix new file mode 100644 index 00000000..b1a0e579 --- /dev/null +++ b/provision/hosts/default/default.nix @@ -0,0 +1,34 @@ +{ config, pkgs, user, lib, inputs, ... }: +{ + imports = [ + ./git.nix + ./backup.nix + ./home-default.nix + ]; + + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + settings.auto-optimise-store = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + # Add non-free packages + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = import ../../lib/overlays.nix; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + + environment.systemPackages = with pkgs; [ + inputs.agenix.packages.x86_64-linux.default + ]; + + # Did you read the comment? + system.stateVersion = "23.11"; +} diff --git a/provision/hosts/default/home-default.nix b/provision/hosts/default/home-default.nix new file mode 100644 index 00000000..2d605666 --- /dev/null +++ b/provision/hosts/default/home-default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, user, ... }: +{ + home-manager.users.${user} = { + home.username = "${user}"; + home.homeDirectory = "/home/${user}"; + programs.home-manager.enable = true; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + home.packages = with pkgs; [ + ]; + + # Did you read the comment? + home.stateVersion = "23.11"; + }; +} diff --git a/provision/hosts/default/physical/configuration.nix b/provision/hosts/default/physical/configuration.nix index 451c2e15..4f5676bc 100644 --- a/provision/hosts/default/physical/configuration.nix +++ b/provision/hosts/default/physical/configuration.nix @@ -1,53 +1,19 @@ { config, pkgs, user, lib, inputs, ... }: { imports = [ - ../git.nix - ../backup.nix ./home-configuration.nix ]; - nix = { - package = pkgs.nixFlakes; - extraOptions = "experimental-features = nix-command flakes"; - settings.auto-optimise-store = true; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - # Add non-free packages - nixpkgs.config.allowUnfree = true; nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" "openssl-1.1.1w" ]; - nixpkgs.overlays = import ../../../lib/overlays.nix; - - # Hardware options - #hardware.bluetooth.enable = true; - #hardware.bluetooth.package = pkgs.bluez; - #hardware.sensor.iio.enable = true; - #hardware.graphics.enable = true; - #hardware.graphics.enable32Bit = true; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Set your time zone. - time.timeZone = "America/Los_Angeles"; - i18n.defaultLocale = "en_US.UTF-8"; - # Define user account. users.users.${user} = { isNormalUser = true; extraGroups = [ "dialout" "wheel" "docker" "libvirtd" ]; shell = pkgs.bash; }; - - environment.systemPackages = with pkgs; [ - inputs.agenix.packages.x86_64-linux.default - ]; - - # Did you read the comment? - system.stateVersion = "23.11"; } diff --git a/provision/hosts/default/physical/home-configuration.nix b/provision/hosts/default/physical/home-configuration.nix index 8aa754ee..881431d1 100644 --- a/provision/hosts/default/physical/home-configuration.nix +++ b/provision/hosts/default/physical/home-configuration.nix @@ -1,25 +1,9 @@ { config, pkgs, user, ... }: { home-manager.users.${user} = { - home.username = "${user}"; - home.homeDirectory = "/home/${user}"; - programs.home-manager.enable = true; - - programs.direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; - }; - programs.vscode = { enable = true; package = pkgs.vscode.fhs; }; - - home.packages = with pkgs; [ - ]; - - # Did you read the comment? - home.stateVersion = "23.11"; }; } diff --git a/provision/hosts/kestrel/default.nix b/provision/hosts/kestrel/default.nix index 27a8f63e..5e1505e4 100644 --- a/provision/hosts/kestrel/default.nix +++ b/provision/hosts/kestrel/default.nix @@ -3,8 +3,9 @@ inherit system; specialArgs = { inherit user inputs; }; modules = [ - ../default/physical/configuration.nix - ./configuration.nix + ../default # shared by all configs + ../default/physical/configuration.nix # shared by physical machines + ./configuration.nix # kestrel specific ./hardware.nix ../../modules agenix.nixosModules.default diff --git a/provision/hosts/shivan/default.nix b/provision/hosts/shivan/default.nix index 27a8f63e..adad5bb3 100644 --- a/provision/hosts/shivan/default.nix +++ b/provision/hosts/shivan/default.nix @@ -3,8 +3,9 @@ inherit system; specialArgs = { inherit user inputs; }; modules = [ - ../default/physical/configuration.nix - ./configuration.nix + ../default # shared by all configs + ../default/physical/configuration.nix # shared by physical machines + ./configuration.nix # shivan specific ./hardware.nix ../../modules agenix.nixosModules.default diff --git a/provision/hosts/torus/default.nix b/provision/hosts/torus/default.nix index 27a8f63e..95474614 100644 --- a/provision/hosts/torus/default.nix +++ b/provision/hosts/torus/default.nix @@ -3,8 +3,9 @@ inherit system; specialArgs = { inherit user inputs; }; modules = [ - ../default/physical/configuration.nix - ./configuration.nix + ../default # shared by all configs + ../default/physical/configuration.nix # shared by physical machines + ./configuration.nix # torus specific ./hardware.nix ../../modules agenix.nixosModules.default