From bdab858be21516d184328e1855876919ef9036b4 Mon Sep 17 00:00:00 2001 From: lsoriano-mcm Date: Sat, 28 Jun 2025 21:15:22 -0500 Subject: [PATCH] nixos: system revamp --- hosts/desktop/configuration.nix | 4 +++- hosts/macos/darwin.nix | 2 +- modules/linuxDev.nix | 7 +++++++ modules/{dev.nix => macosDev.nix} | 0 modules/system.nix | 8 ++++++++ system/firewall.nix | 9 +++++++++ system/hardware.nix | 9 +++++++++ system/locale.nix | 4 ++++ system/network.nix | 4 ++++ system/programs.nix | 16 ++++++++++++++++ system/services.nix | 8 ++++++++ system/tty.nix | 6 ++++++ 12 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 modules/linuxDev.nix rename modules/{dev.nix => macosDev.nix} (100%) create mode 100644 system/firewall.nix create mode 100644 system/hardware.nix create mode 100644 system/locale.nix create mode 100644 system/network.nix create mode 100644 system/programs.nix create mode 100644 system/services.nix create mode 100644 system/tty.nix diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 2854a5c..049f67f 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -7,7 +7,9 @@ }: { imports = [ inputs.sops-nix.nixosModules.sops - # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../modules/linuxDev.nix + ../../modules/system.nix ]; environment.systemPackages = with pkgs; []; diff --git a/hosts/macos/darwin.nix b/hosts/macos/darwin.nix index 4400954..f5a93ac 100644 --- a/hosts/macos/darwin.nix +++ b/hosts/macos/darwin.nix @@ -5,7 +5,7 @@ ... }: { imports = [ - ../../modules/dev.nix + ../../modules/macosDev.nix inputs.sops-nix.darwinModules.sops ]; # List packages installed in system profile. To search by name, run: diff --git a/modules/linuxDev.nix b/modules/linuxDev.nix new file mode 100644 index 0000000..489e015 --- /dev/null +++ b/modules/linuxDev.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ../system/dev/tools.nix + ../system/dev/python.nix + ../system/dev/linux.nix + ]; +} diff --git a/modules/dev.nix b/modules/macosDev.nix similarity index 100% rename from modules/dev.nix rename to modules/macosDev.nix diff --git a/modules/system.nix b/modules/system.nix index 65740a9..a521fc7 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -1,4 +1,12 @@ {...}: { imports = [ + ../system/users.nix + ../system/hardware.nix + ../system/locale.nix + ../system/network.nix + ../system/programs.nix + ../system/services.nix + ../system/tty.nix + ../system/firewall.nix ]; } diff --git a/system/firewall.nix b/system/firewall.nix new file mode 100644 index 0000000..965dcf6 --- /dev/null +++ b/system/firewall.nix @@ -0,0 +1,9 @@ +{...}: { + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; +} diff --git a/system/hardware.nix b/system/hardware.nix new file mode 100644 index 0000000..1b10cc7 --- /dev/null +++ b/system/hardware.nix @@ -0,0 +1,9 @@ +{myConfig, ...}: { + hardware = { + logitech.wireless.enable = myConfig.linux.logitech-hardware.enable; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + }; +} diff --git a/system/locale.nix b/system/locale.nix new file mode 100644 index 0000000..0e33602 --- /dev/null +++ b/system/locale.nix @@ -0,0 +1,4 @@ +{myConfig, ...}: { + i18n.defaultLocale = "en_US.UTF-8"; + time.timeZone = "${myConfig.general.Timezone}"; +} diff --git a/system/network.nix b/system/network.nix new file mode 100644 index 0000000..aaf56d8 --- /dev/null +++ b/system/network.nix @@ -0,0 +1,4 @@ +{myConfig, ...}: { + networking.hostName = "${myConfig.general.Hostname}"; + networking.networkmanager.enable = true; +} diff --git a/system/programs.nix b/system/programs.nix new file mode 100644 index 0000000..62cdae2 --- /dev/null +++ b/system/programs.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: { + programs.bash = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + + programs = { + zsh.enable = true; + fish.enable = true; + }; +} diff --git a/system/services.nix b/system/services.nix new file mode 100644 index 0000000..f846a55 --- /dev/null +++ b/system/services.nix @@ -0,0 +1,8 @@ +{...}: { + services = { + openssh.enable = true; + libinput.enable = true; + blueman.enable = true; + printing.enable = true; + }; +} diff --git a/system/tty.nix b/system/tty.nix new file mode 100644 index 0000000..24c3239 --- /dev/null +++ b/system/tty.nix @@ -0,0 +1,6 @@ +{...}: { + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; +}