From 32ef1cf68ca02a0dbaf6377a0dc305aaa551bc1a Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 27 Jan 2023 15:09:19 -0600 Subject: [PATCH] modularizing the configs --- modules/base.nix | 68 ++++++++++++++++++++++ pkgs/base-packages.nix | 29 ++++++++++ system/hoid/configuration.nix | 72 +---------------------- system/shen/configuration.nix | 106 +--------------------------------- 4 files changed, 101 insertions(+), 174 deletions(-) create mode 100644 modules/base.nix create mode 100644 pkgs/base-packages.nix diff --git a/modules/base.nix b/modules/base.nix new file mode 100644 index 0000000..e4f1035 --- /dev/null +++ b/modules/base.nix @@ -0,0 +1,68 @@ +{ config, lib, pkgs, ... }: + +with lib; +{ + + boot.kernelPackages = pkgs.linuxPackages_latest; + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + nix = { + extraOptions = "experimental-features = nix-command flakes"; + package = pkgs.nixFlakes; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 20d"; + }; + settings = { + auto-optimise-store = true; + }; + }; + nixpkgs.config.allowUnFree = true; + + system.autoUpgrade = { + enable = true; + dates = "02:00"; + allowReboot = true; + flake = "${config.users.users.chris.home}/conf"; + flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; + }; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.utf8"; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Enable networking + networking.networkmanager.enable = true; + + services.avahi = { + enable = true; + publish.enable = true; + publish.userServices = true; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.chris = { + isNormalUser = true; + description = "Chris"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + environment.homeBinInPath = true; + programs.fish.enable = true; + + virtualisation.docker.enable = true; + services.openssh.enable = true; + services.fstrim.enable = true; + +} diff --git a/pkgs/base-packages.nix b/pkgs/base-packages.nix new file mode 100644 index 0000000..c3d4664 --- /dev/null +++ b/pkgs/base-packages.nix @@ -0,0 +1,29 @@ +{ pkgs, config, ... }: +{ + environment.systemPackages = with pkgs; [ + vim + wget + yt-dlp + bat + ripgrep + ffmpeg-full + rsync + dutree + tmux + git + samba + exa + jq + fd + bc + sysstat + procs + btop + htop + #nvtop + glxinfo + vulkan-tools + pciutils + blesh + ]; +} diff --git a/system/hoid/configuration.nix b/system/hoid/configuration.nix index e204f1a..1c67a28 100644 --- a/system/hoid/configuration.nix +++ b/system/hoid/configuration.nix @@ -8,81 +8,13 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../../pkgs/base-packages.nix + ../../modules/base.nix ]; - boot.kernelPackages = pkgs.linuxPackages_latest; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.efiSysMountPoint = "/boot/efi"; networking.hostName = "hoid"; # 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 = "America/Chicago"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.utf8"; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = ""; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.chris = { - isNormalUser = true; - description = "Chris"; - 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 - git - rclone - rsync - fd - bat - ripgrep - curl - iputils - btop - htop - yt-dlp - tmux - exa - ]; - - programs.fish.enable = true; - - # 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 = [ ... ]; diff --git a/system/shen/configuration.nix b/system/shen/configuration.nix index d4126d8..301ede0 100644 --- a/system/shen/configuration.nix +++ b/system/shen/configuration.nix @@ -8,50 +8,11 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../../pkgs/base-packages.nix + ../../modules/base.nix ]; - nix = { - extraOptions = "experimental-features = nix-command flakes"; - package = pkgs.nixFlakes; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 20d"; - }; - settings = { - auto-optimise-store = true; - }; - }; - - system.autoUpgrade = { - enable = true; - dates = "02:00"; - allowReboot = true; - flake = "${config.users.users.chris.home}/conf"; - flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; - }; - - - nixpkgs.config.allowUnFree = true; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "shen"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "America/Chicago"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; # Enable CUPS to print documents. services.printing = { @@ -66,12 +27,6 @@ ''; }; - services.avahi = { - enable = true; - publish.enable = true; - publish.userServices = true; - }; - hardware.opengl = { enable = true; extraPackages = with pkgs; [ @@ -91,63 +46,6 @@ }; environment.variables.AMD_VULKAN_ICD = lib.mkDefault "RADV"; - environment.homeBinInPath = true; - - programs.fish.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.chris = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim - wget - yt-dlp - bat - ripgrep - ffmpeg-full - rsync - dutree - tmux - git - samba - exa - jq - fd - bc - sysstat - procs - btop - htop - #nvtop - glxinfo - vulkan-tools - pciutils - blesh - ]; - - virtualisation.docker.enable = true; - - # 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; - services.fstrim.enable = true; # CADDY services.caddy = {