From f6c51505c37b61631655d0e6ec3a0525a6161243 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 1 May 2024 11:11:13 +0900 Subject: [PATCH] Reorg base NixOS configs --- nixos/common/modules/nixos.nix | 26 ++++++++- nixos/common/software/packages.nix | 47 ---------------- nixos/default.nix | 27 +-------- nixos/minimal.nix | 89 ++++++------------------------ nixos/small.nix | 86 ++++++++--------------------- 5 files changed, 65 insertions(+), 210 deletions(-) delete mode 100644 nixos/common/software/packages.nix diff --git a/nixos/common/modules/nixos.nix b/nixos/common/modules/nixos.nix index ee16e3d3..8ee44ca0 100644 --- a/nixos/common/modules/nixos.nix +++ b/nixos/common/modules/nixos.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ pkgs, system, stateVersion, ... }: { nix = { settings = { auto-optimise-store = true; @@ -14,4 +14,28 @@ options = "--delete-older-than 30d"; }; }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # https://github.com/NixOS/nixpkgs/issues/180175#issuecomment-1658731959 + systemd.services.NetworkManager-wait-online = { + serviceConfig = { + ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; + }; + }; + + system.stateVersion = stateVersion; + nixpkgs.hostPlatform = system; } diff --git a/nixos/common/software/packages.nix b/nixos/common/software/packages.nix deleted file mode 100644 index 0a97868f..00000000 --- a/nixos/common/software/packages.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ pkgs, ... }: { - # List packages installed in system profile - environment.systemPackages = with pkgs; [ - tmux # terminal multiplexer - rbw # CLI app for Bitwarden - nfs-utils # nfs network share tools - nixfmt # Formatting nix output - dconf # Required for stylix - ripgrep # Better grep - sbctl # Secureboot Control - wget # WebGet - killall # Killall - curl # Curl - For web requests - neofetch # system information viewer - rsync # copy/sync - git # git! - duf # replacement / prettier UI for df - ncdu # ncurses style browser for du/dust - du-dust # better UI for 'du" - home-manager # manage dotfiles - btop # like htop, but prettier - iftop # interface top - network usage - nload # network load - Network usage graphs - iotop # I/O top viewer - disk r/w, etc - sops # manage secrets - gnupg # GNU Privacy Guard - fx # Pretty print JSON - nodejs # Required by fx - eza # like ls, but prettier - cryptsetup # used to open LUKS devices - parted # Disk partitioner / Formatter - screen # Terminal screen manager - e2fsprogs # disk format utilities, like mkfs.ext4 - bat # Like cat, but with syntax highlighting - openssl # Used to generate certs, random strings, etc - tree # CLI directory display software - nmap # network mapping / discovery software - busybox # General linux commands, nslookup, dig, etc - sshpass # ssh password helper - cbonsai # ncurses bonsai tree - busybox # Linux utilities - ethtool # Ethernet troubleshooting - fd # alternative to "Find" - lazygit # Decent Git TUI - fish # Shell - ]; -} diff --git a/nixos/default.nix b/nixos/default.nix index d68c2d54..2223ec94 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -13,9 +13,8 @@ ./common/services/opensnitch.nix # Software - ./common/software/cli/weechat.nix ./common/software/cli/clean-hm.nix - ./common/software/packages.nix + ./common/software/packages # NixOS Modules ./common/modules/fonts.nix # Font Configs @@ -28,28 +27,4 @@ ] ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop}; programs.fish.enable = true; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # https://github.com/NixOS/nixpkgs/issues/180175#issuecomment-1658731959 - systemd.services.NetworkManager-wait-online = { - serviceConfig = { - ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; - }; - }; - - system.stateVersion = stateVersion; - nixpkgs.hostPlatform = system; } diff --git a/nixos/minimal.nix b/nixos/minimal.nix index 7719e152..323c51d0 100644 --- a/nixos/minimal.nix +++ b/nixos/minimal.nix @@ -1,77 +1,22 @@ -{ lib, inputs, pkgs, hostname, stateVersion, username, desktop, system, ... }: { +{ pkgs, hostname, stateVersion, username, inputs, system, ... }: { imports = [ - # Modules - inputs.disko.nixosModules.disko + # Modules + inputs.disko.nixosModules.disko + + # Services + ./common/services/openssh.nix + ./common/services/fail2ban.nix + + # Software + ./common/software/packages/small.nix - # Services - ./common/services/openssh.nix - ./common/services/fail2ban.nix - - # Software - ./common/software/cli/clean-hm.nix - - # NixOS Modules - ./common/modules/networking.nix # Initial Networking configs - ./common/modules/nixos.nix # NixOS related items - ./common/modules/remote-builders.nix # Add remote builders - - ./users/${username} - ./hosts/${hostname} - ] ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop}; - - # List packages installed in system profile - environment.systemPackages = with pkgs; [ - tmux - dconf - ripgrep - sbctl - wget - killall - curl - rsync - git - bat - duf - ncdu - du-dust - btop - iftop - nload - iotop - sops - gnupg - cryptsetup - parted - screen - sshpass - fd - eza - fish - ]; + # NixOS Modules + ./common/modules/networking.nix # Initial Networking configs + ./common/modules/nixos.nix # Common NixOS Configurations + ./users/${username} + ./hosts/${hostname} + ] ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop}; + programs.fish.enable = true; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # https://github.com/NixOS/nixpkgs/issues/180175#issuecomment-1658731959 - systemd.services.NetworkManager-wait-online = { - serviceConfig = { - ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; - }; - }; - - system.stateVersion = stateVersion; - nixpkgs.hostPlatform = system; } diff --git a/nixos/small.nix b/nixos/small.nix index ba3f634a..15c59888 100644 --- a/nixos/small.nix +++ b/nixos/small.nix @@ -1,70 +1,28 @@ { pkgs, hostname, stateVersion, username, inputs, system, ... }: { imports = [ - # Modules - inputs.disko.nixosModules.disko - - # Services - ./common/services/openssh.nix - ./common/services/fail2ban.nix - ./common/services/tailscale.nix - ./common/services/promtail.nix - ./common/services/telegraf.nix - ./common/services/gnupg-agent.nix - - # Software - ./common/software/cli/clean-hm.nix + # Modules + inputs.disko.nixosModules.disko + + # Services + ./common/services/openssh.nix + ./common/services/fail2ban.nix + ./common/services/tailscale.nix + ./common/services/promtail.nix + ./common/services/telegraf.nix + ./common/services/gnupg-agent.nix + + # Software + ./common/software/cli/clean-hm.nix + ./common/software/packages/small.nix - # NixOS Modules - ./common/modules/networking.nix # Initial Networking configs - ./common/modules/nixos.nix # Common NixOS Configurations - ./common/modules/remote-builders.nix # Add remote builders - - ./users/${username} - ./hosts/${hostname} - ]; - - # List packages installed in system profile - environment.systemPackages = with pkgs; [ - tmux - rbw - dconf - ripgrep - git - bat - eza - duf - gnupg - screen - btop - sshpass - cryptsetup - fd - fish - ]; + # NixOS Modules + ./common/modules/networking.nix # Initial Networking configs + ./common/modules/nixos.nix # Common NixOS Configurations + ./common/modules/remote-builders.nix # Add remote builders + ./users/${username} + ./hosts/${hostname} + ] ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop}; + programs.fish.enable = true; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # https://github.com/NixOS/nixpkgs/issues/180175#issuecomment-1658731959 - systemd.services.NetworkManager-wait-online = { - serviceConfig = { - ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; - }; - }; - - system.stateVersion = stateVersion; - nixpkgs.hostPlatform = system; }