From 1cb62df487f20687d4f2e80a7397f4bed4bcc1b6 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 1 Jan 2026 16:02:35 -0500 Subject: [PATCH] latest --- .vscode/settings.json | 11 +- bin/skyg | 3 +- configs/niri/waybar/top-bar.jsonc | 343 ++++++++---------- flake.nix | 236 ++++-------- modules/core/nix-substituters.nix | 2 + .../hosts}/fwbook.hardware-configuration.nix | 0 {hosts => modules/hosts}/fwbook.nix | 16 +- .../hl-bigbox1.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-bigbox1.nix | 2 - .../hl-fwdesk.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-fwdesk.nix | 9 +- .../hosts}/hl-fws1.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-fws1.nix | 6 - .../hl-minipc1.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-minipc1.nix | 3 - .../hl-minipc2.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-minipc2.nix | 7 +- .../hl-minipc3.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-minipc3.nix | 6 +- .../hl-terra1.hardware-configuration.nix | 0 {hosts => modules/hosts}/hl-terra1.nix | 3 - {hosts => modules/hosts}/scripts/fw1/gs.sh | 0 .../hosts}/scripts/fwbook/functions.nu | 0 .../hosts}/scripts/fwbook/functions.sh | 0 modules/lib.nix | 193 +++++----- modules/main.nix | 8 - modules/nixos/common/containers/default.nix | 1 + modules/nixos/desktop/tiler/niri.nix | 3 - 28 files changed, 348 insertions(+), 504 deletions(-) rename {hosts => modules/hosts}/fwbook.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/fwbook.nix (97%) rename {hosts => modules/hosts}/hl-bigbox1.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-bigbox1.nix (98%) rename {hosts => modules/hosts}/hl-fwdesk.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-fwdesk.nix (96%) rename {hosts => modules/hosts}/hl-fws1.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-fws1.nix (78%) rename {hosts => modules/hosts}/hl-minipc1.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-minipc1.nix (97%) rename {hosts => modules/hosts}/hl-minipc2.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-minipc2.nix (91%) rename {hosts => modules/hosts}/hl-minipc3.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-minipc3.nix (85%) rename {hosts => modules/hosts}/hl-terra1.hardware-configuration.nix (100%) rename {hosts => modules/hosts}/hl-terra1.nix (93%) rename {hosts => modules/hosts}/scripts/fw1/gs.sh (100%) rename {hosts => modules/hosts}/scripts/fwbook/functions.nu (100%) rename {hosts => modules/hosts}/scripts/fwbook/functions.sh (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index e2749aa..6c0540a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,13 +2,8 @@ "nix.enableLanguageServer": true, "nix.serverPath": "nixd", "nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix", - "cSpell.words": [ - "nixd", - "nixos", - "nixpkgs", - "pkgs" - ], + "cSpell.words": ["nixd", "nixos", "nixpkgs", "pkgs"], "search.exclude": { - "system-special-links": true, + "system-special-links": true } -} \ No newline at end of file +} diff --git a/bin/skyg b/bin/skyg index 73252a3..1957ff1 100755 --- a/bin/skyg +++ b/bin/skyg @@ -1,7 +1,7 @@ #!/usr/bin/env nu # Ensure we are located at the bin folder -const current_folder = path self | path dirname +const current_folder = path self | path dirname | path dirname cd $current_folder def valid_profiles [] { @@ -16,6 +16,7 @@ def is-valid-profile [name: string] { } def main [] { + print $current_folder help main } diff --git a/configs/niri/waybar/top-bar.jsonc b/configs/niri/waybar/top-bar.jsonc index 34fa3be..5f441f4 100644 --- a/configs/niri/waybar/top-bar.jsonc +++ b/configs/niri/waybar/top-bar.jsonc @@ -1,190 +1,155 @@ { - "reload_style_on_change": true, - "layer": "top", // Waybar at top layer - "height": 32, // Waybar height (to be removed for auto height) - "margin-top": 4, - "margin-left": 4, - "margin-right": 4, - "spacing": 0, // Gaps between modules (4px) - "modules-left": [ - "niri/window" - ], - "modules-center": [ - "privacy", - "clock", - ], - "modules-right": [ - "group/controls", - "battery", - "group/sound", - "group/backlight", - "tray", - "mpd", - // "jack", - // "wireplumber", - "custom/logout" - ], - // Modules configuration - "group/sound": { - "click-to-reveal": true, - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": true - }, - "modules": [ - "pulseaudio", - "pulseaudio/slider" - ] - }, - "group/backlight": { - "click-to-reveal": true, - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": true - }, - "modules": [ - "backlight", - "backlight/slider" - ] - }, - "pulseaudio/slider": { - "min": 0, - "max": 100, - "orientation": "horizontal", - }, - "custom/logout": { - "format": "⏻", - "tooltip": true, - "on-click": "nwg-bar" - }, - "keyboard-state": { - "numlock": true, - "capslock": true, - "format-icons": { - "locked": "", - "unlocked": "" - }, - "format": { - "numlock": "N {icon}", - "capslock": "C {icon}" - } - }, - "niri/window": { - "icon": true, - "format": "{app_id}/{title}" - }, - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - "tray": { - "spacing": 10 - }, - "custom/controls": { - "format": "🎛️", - "tooltip": true - }, - "group/controls": { - "click-to-reveal": true, - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": false - }, - "modules": [ - "custom/controls", - "network", - "cpu", - "memory", - "temperature", - "idle_inhibitor", - "keyboard-state" - ] - }, - "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format": "{:%e %B %H:%M}", - "on-click": "gnome-calendar" - }, - "cpu": { - "format": "{usage}% ", - "tooltip": false - }, - "memory": { - "format": "{}% " - }, - "temperature": { - "critical-threshold": 80, - "format": "{temperatureC}°C {icon}", - "format-icons": [ - "", - "", - "" - ] - }, - "backlight": { - "format": "{icon}", - "format-icons": [ - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - "battery": { - "states": { - "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{capacity}% {icon}", - "format-charging": "{capacity}% ", - "format-plugged": "{capacity}% ", - "format-alt": "{time} {icon}", - "format-icons": [ - "", - "", - "", - "", - "" - ] - }, - "network": { - "format": "{ifname} {essid}", - "tooltip-format": "{ifname} {ipaddr}/{cidr} {essid} {icon} {frequency} {signaldBm}", - "on-click": "nmcli device wifi rescan && ghostty -e nmtui" - }, - "pulseaudio": { - "format": "{icon}", - "format-bluetooth": "{volume}% {icon}", - "format-bluetooth-muted": " {icon}", - "format-muted": "", - "format-source": "{volume}% ", - "format-source-muted": "", - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": [ - "", - "", - "" - ] - }, - "on-click": "/run/current-system/sw/bin/flatpak run org.pipewire.Helvum" - // "on-click": "/run/current-system/sw/bin/pavucontrol" - } -} \ No newline at end of file + "reload_style_on_change": true, + "layer": "top", // Waybar at top layer + "height": 32, // Waybar height (to be removed for auto height) + "margin-top": 4, + "margin-left": 4, + "margin-right": 4, + "spacing": 0, // Gaps between modules (4px) + "modules-left": ["niri/window"], + "modules-center": ["privacy", "clock"], + "modules-right": [ + "group/controls", + "battery", + "group/sound", + "group/backlight", + "tray", + "mpd", + // "jack", + // "wireplumber", + "custom/logout", + ], + // Modules configuration + "group/sound": { + "click-to-reveal": true, + "orientation": "horizontal", + "drawer": { + "transition-duration": 500, + "transition-left-to-right": true, + }, + "modules": ["pulseaudio", "pulseaudio/slider"], + }, + "group/backlight": { + "click-to-reveal": true, + "orientation": "horizontal", + "drawer": { + "transition-duration": 500, + "transition-left-to-right": true, + }, + "modules": ["backlight", "backlight/slider"], + }, + "pulseaudio/slider": { + "min": 0, + "max": 100, + "orientation": "horizontal", + }, + "custom/logout": { + "format": "⏻", + "tooltip": true, + "on-click": "nwg-bar", + }, + "keyboard-state": { + "numlock": true, + "capslock": true, + "format-icons": { + "locked": "", + "unlocked": "", + }, + "format": { + "numlock": "N {icon}", + "capslock": "C {icon}", + }, + }, + "niri/window": { + "icon": true, + "format": "{app_id}/{title}", + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "", + }, + }, + "tray": { + "spacing": 10, + }, + "custom/controls": { + "format": "🎛️", + "tooltip": true, + }, + "group/controls": { + "click-to-reveal": true, + "orientation": "horizontal", + "drawer": { + "transition-duration": 500, + "transition-left-to-right": false, + }, + "modules": [ + "custom/controls", + "network", + "cpu", + "memory", + "temperature", + "idle_inhibitor", + "keyboard-state", + ], + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format": "{:%e %B %H:%M}", + "on-click": "gnome-calendar", + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false, + }, + "memory": { + "format": "{}% ", + }, + "temperature": { + "critical-threshold": 80, + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""], + }, + "backlight": { + "format": "{icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""], + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15, + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""], + }, + "network": { + "format": "{ifname} {essid}", + "tooltip-format": "{ifname} {ipaddr}/{cidr} {essid} {icon} {frequency} {signaldBm}", + "on-click": "nmcli device wifi rescan && ghostty -e nmtui", + }, + "pulseaudio": { + "format": "{icon}", + "format-bluetooth": "{volume}% {icon}", + "format-bluetooth-muted": " {icon}", + "format-muted": "", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""], + }, + "on-click": "/run/current-system/sw/bin/flatpak run org.pipewire.Helvum", + // "on-click": "/run/current-system/sw/bin/pavucontrol" + }, +} diff --git a/flake.nix b/flake.nix index fe8c700..be11322 100644 --- a/flake.nix +++ b/flake.nix @@ -34,98 +34,51 @@ }; outputs = - { - self, - nixpkgs-unstable, - determinate, - nixos-hardware, - nixpkgs, - systems, - home-manager, - nix-darwin, - nix-flatpak, - stylix, - hyprlauncher, - dms, + { self + , nixpkgs-unstable + , determinate + , nixos-hardware + , nixpkgs + , systems + , home-manager + , nix-darwin + , nix-flatpak + , stylix + , hyprlauncher + , dms + , }: let - user = { - name = "ari"; - fullName = "Ari Sosnovsky"; - email = "ariel@sosnovsky.ca"; - }; - homeManagerVersion = "24.11"; - # Local Services - localNixCaches = { - urls = [ - "http://minipc1.lab.internal:5000" - ]; - keys = [ - "minipc1.lab.internal:buUlsyg+xRqkUk0MWACmIyRUtHIOPQQzg7nc4qZCc4E=" - ]; - }; - localDockerRegistries = [ "minipc1.lab.internal:5001" ]; - hlCommonSettings = { - system = "x86_64-linux"; - user = user; - localNixCaches = localNixCaches; - homeManagerVersion = homeManagerVersion; - os = { - enable = true; - firewall = { - enable = false; - }; - enableFonts = true; - hardware = { - enable = false; - }; - enablePrometheusExporters = true; - containers = { - runtime = "docker"; - localDockerRegistries = localDockerRegistries; - }; - }; - }; - # Lib Config - libConfig = { - inherit - determinate - nix-darwin - hlCommonSettings - systems - nix-flatpak - stylix - ; - specialArgs = { - inherit - hyprlauncher - nixpkgs-unstable - dms - ; - }; - }; # Libs - lib = ( - import modules/lib.nix ( + lib = + import modules/lib.nix { - nixpkgs = nixpkgs; - home-manager = home-manager; + hostFolder = builtins.toString ./hosts; + user = { + name = "ari"; + fullName = "Ari Sosnovsky"; + email = "ariel@sosnovsky.ca"; + }; + inherit + nixpkgs + nixpkgs-unstable + home-manager + determinate + nix-darwin + systems + nix-flatpak + stylix + ; + + specialArgs = { + inherit + hyprlauncher + nixpkgs-unstable + dms + ; + }; } - // libConfig - ) - ); - homelabServices = ( - (lib.makeHLServices { - user = user; - nodeNames = [ - "hl-minipc1" - "hl-minipc2" - "hl-minipc3" - "hl-terra1" - "hl-bigbox1" - ]; - }) - ); + ; in { # Dev Setups @@ -154,80 +107,51 @@ # None-NIXOS LINUX Setups # ------------- - homeConfigurations."${user.name}" = lib.makeHomeManagerUsers { - inherit user homeManagerVersion; - }; + # homeConfigurations."${user.name}" = lib.makeHomeManagerUsers { + # inherit user homeManagerVersion; + # }; # NIXOS LINUX Setups # ------------- - nixosConfigurations = { - # NIXOS Framework Setups - # ------------- - fwbook = lib.makeNixOsModule { - system = "x86_64-linux"; - user = user; - systemStateVersion = "23.11"; + nixosConfigurations = (lib.makeNixosConfigurations [ + { hostName = "fwbook"; - # localNixCaches = localNixCaches; - localDockerRegistries = localDockerRegistries; - homeManagerVersion = homeManagerVersion; - os = { - enable = true; - firewall = { - enable = false; - }; - enableFonts = true; - enableNetworking = true; - enableSSH = false; - hardware = { - enable = true; - }; - containers = { - localDockerRegistries = localDockerRegistries; - runtime = "docker"; - }; - enablePrometheusExporters = true; - }; - configuration = - { ... }: - { - imports = [ - nixos-hardware.nixosModules.framework-13-7040-amd - (import ./hosts/fwbook.nix { - user = user; - }) - ]; - }; - }; - # NIXOS Framework Homelab - # ------------- - hl-fws1 = lib.makeHLService { - hostName = "hl-fws1"; - configuration = - { ... }: - { - imports = [ - nixos-hardware.nixosModules.framework-11th-gen-intel - (import (./hosts/hl-fws1.nix) { user = user; }) - ]; - }; - systemStateVersion = "24.05"; - }; - # NIXOS Framework Desktop - # ------------- - hl-fwdesk = lib.makeHLService { + systemStateVersion = "23.11"; + configuration = [ + nixos-hardware.nixosModules.framework-13-7040-amd + ]; + } + { hostName = "hl-minipc1"; } + { hostName = "hl-minipc2"; } + { hostName = "hl-minipc3"; } + { hostName = "hl-terra1"; } + { hostName = "hl-bigbox1"; } + { hostName = "hl-fwdesk"; - configuration = - { ... }: - { - imports = [ - nixos-hardware.nixosModules.framework-desktop-amd-ai-max-300-series - (import (./hosts/hl-fwdesk.nix) { user = user; }) - ]; - }; systemStateVersion = "25.05"; - }; - } - // homelabServices; + configuration = [ + nixos-hardware.nixosModules.framework-desktop-amd-ai-max-300-series + ]; + } + { + hostName = "hl-fws1"; + configuration = [ + nixos-hardware.nixosModules.framework-11th-gen-intel + ]; + } + ]); + # // { + # fwbook = lib.makeNixOs { + # hostName = "fwbook"; + # systemStateVersion = "23.11"; + # configuration = [ + # ./hosts/fwbook.nix + # ./hosts/fwbook.hardware-configuration.nix + + # nixos-hardware.nixosModules.framework-13-7040-amd + # ]; + # }; + # } + random = ./hosts; }; } diff --git a/modules/core/nix-substituters.nix b/modules/core/nix-substituters.nix index 7de321a..fd9b4f8 100644 --- a/modules/core/nix-substituters.nix +++ b/modules/core/nix-substituters.nix @@ -22,6 +22,7 @@ in config = { nix.settings.substituters = [ + "http://minipc1.lab.internal:5000" "https://cache.nixos.org" "https://cache.flox.dev" "https://devenv.cachix.org" @@ -36,6 +37,7 @@ in "ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc=" ] ++ cfg.urls; nix.settings.trusted-public-keys = [ + "minipc1.lab.internal:buUlsyg+xRqkUk0MWACmIyRUtHIOPQQzg7nc4qZCc4E=" "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" diff --git a/hosts/fwbook.hardware-configuration.nix b/modules/hosts/fwbook.hardware-configuration.nix similarity index 100% rename from hosts/fwbook.hardware-configuration.nix rename to modules/hosts/fwbook.hardware-configuration.nix diff --git a/hosts/fwbook.nix b/modules/hosts/fwbook.nix similarity index 97% rename from hosts/fwbook.nix rename to modules/hosts/fwbook.nix index bded37a..6202dc0 100644 --- a/hosts/fwbook.nix +++ b/modules/hosts/fwbook.nix @@ -1,10 +1,8 @@ -{ user }: -{ - pkgs, - hyprlauncher, - system, - nixpkgs-unstable, - ... +{ pkgs +, system +, unstablePkgs +, user +, ... }: let zshFWBook = builtins.filterSource (p: t: true) ./scripts/fwbook; @@ -13,10 +11,8 @@ let 8000 8001 ]; - unstable = nixpkgs-unstable.legacyPackages.${system}; in { - imports = [ ./fwbook.hardware-configuration.nix ]; # Skyg environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = 1; environment.sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1; @@ -265,7 +261,7 @@ in port = 11434; acceleration = "rocm"; rocmOverrideGfx = "11.0.2"; - package = unstable.ollama-rocm; + package = unstablePkgs.ollama-rocm; }; # # Brother Printer hardware.sane.brscan5.enable = true; diff --git a/hosts/hl-bigbox1.hardware-configuration.nix b/modules/hosts/hl-bigbox1.hardware-configuration.nix similarity index 100% rename from hosts/hl-bigbox1.hardware-configuration.nix rename to modules/hosts/hl-bigbox1.hardware-configuration.nix diff --git a/hosts/hl-bigbox1.nix b/modules/hosts/hl-bigbox1.nix similarity index 98% rename from hosts/hl-bigbox1.nix rename to modules/hosts/hl-bigbox1.nix index 94ea4b4..c18614a 100644 --- a/hosts/hl-bigbox1.nix +++ b/modules/hosts/hl-bigbox1.nix @@ -1,7 +1,5 @@ -{ ... }: { pkgs, config, ... }: { - imports = [ ./hl-bigbox1.hardware-configuration.nix ]; skyg = { user.enable = true; server.admin.enable = true; diff --git a/hosts/hl-fwdesk.hardware-configuration.nix b/modules/hosts/hl-fwdesk.hardware-configuration.nix similarity index 100% rename from hosts/hl-fwdesk.hardware-configuration.nix rename to modules/hosts/hl-fwdesk.hardware-configuration.nix diff --git a/hosts/hl-fwdesk.nix b/modules/hosts/hl-fwdesk.nix similarity index 96% rename from hosts/hl-fwdesk.nix rename to modules/hosts/hl-fwdesk.nix index df268f4..2e53f6a 100644 --- a/hosts/hl-fwdesk.nix +++ b/modules/hosts/hl-fwdesk.nix @@ -1,5 +1,7 @@ -{ ... }: -{ pkgs, ... }: +{ pkgs +, unstablePkgs +, ... +}: let ports = { tabby = 11029; @@ -21,7 +23,7 @@ in amdgpu.enable = true; }; desktop = { - stylix.enable = true; + stylix.enable = true; enable = true; tiler = { enable = true; @@ -107,6 +109,7 @@ in host = "0.0.0.0"; port = ports.ollama; acceleration = "rocm"; + package = unstablePkgs.ollama-rocm; }; # Tabby services.tabby = { diff --git a/hosts/hl-fws1.hardware-configuration.nix b/modules/hosts/hl-fws1.hardware-configuration.nix similarity index 100% rename from hosts/hl-fws1.hardware-configuration.nix rename to modules/hosts/hl-fws1.hardware-configuration.nix diff --git a/hosts/hl-fws1.nix b/modules/hosts/hl-fws1.nix similarity index 78% rename from hosts/hl-fws1.nix rename to modules/hosts/hl-fws1.nix index 24221b7..6e4365a 100644 --- a/hosts/hl-fws1.nix +++ b/modules/hosts/hl-fws1.nix @@ -1,10 +1,5 @@ -{ user }: { pkgs, ... }: -let - scriptsFolder = builtins.filterSource (p: t: true) ./scripts/fw1; -in { - imports = [ ./hl-fws1.hardware-configuration.nix ]; skyg.user.enable = true; skyg.nixos.common.ssh-server.enable = true; skyg.nixos.server.k3s.enable = true; @@ -24,4 +19,3 @@ in # Kernel boot.kernelPackages = pkgs.linuxPackages_zen; } - diff --git a/hosts/hl-minipc1.hardware-configuration.nix b/modules/hosts/hl-minipc1.hardware-configuration.nix similarity index 100% rename from hosts/hl-minipc1.hardware-configuration.nix rename to modules/hosts/hl-minipc1.hardware-configuration.nix diff --git a/hosts/hl-minipc1.nix b/modules/hosts/hl-minipc1.nix similarity index 97% rename from hosts/hl-minipc1.nix rename to modules/hosts/hl-minipc1.nix index a850d73..915ed64 100644 --- a/hosts/hl-minipc1.nix +++ b/modules/hosts/hl-minipc1.nix @@ -1,4 +1,3 @@ -{ user }: { ... }: let ports = { @@ -24,7 +23,6 @@ let ]; in { - imports = [ ./hl-minipc1.hardware-configuration.nix ]; skyg.user.enable = true; skyg.nixos.common.ssh-server.enable = true; skyg.nixos.common.containers.openMetricsPort = true; @@ -89,4 +87,3 @@ in networking.firewall.allowedUDPPorts = openPorts; networking.firewall.allowedTCPPorts = openPorts; } - diff --git a/hosts/hl-minipc2.hardware-configuration.nix b/modules/hosts/hl-minipc2.hardware-configuration.nix similarity index 100% rename from hosts/hl-minipc2.hardware-configuration.nix rename to modules/hosts/hl-minipc2.hardware-configuration.nix diff --git a/hosts/hl-minipc2.nix b/modules/hosts/hl-minipc2.nix similarity index 91% rename from hosts/hl-minipc2.nix rename to modules/hosts/hl-minipc2.nix index 7012700..f90c28e 100644 --- a/hosts/hl-minipc2.nix +++ b/modules/hosts/hl-minipc2.nix @@ -1,9 +1,5 @@ -{ user }: -{ pkgs -, ... -}: +{ ... }: { - imports = [ ./hl-minipc2.hardware-configuration.nix ]; skyg.user.enable = true; skyg.nixos.common.ssh-server.enable = true; skyg.nixos.common.containers.openMetricsPort = true; @@ -39,4 +35,3 @@ }; }; } - diff --git a/hosts/hl-minipc3.hardware-configuration.nix b/modules/hosts/hl-minipc3.hardware-configuration.nix similarity index 100% rename from hosts/hl-minipc3.hardware-configuration.nix rename to modules/hosts/hl-minipc3.hardware-configuration.nix diff --git a/hosts/hl-minipc3.nix b/modules/hosts/hl-minipc3.nix similarity index 85% rename from hosts/hl-minipc3.nix rename to modules/hosts/hl-minipc3.nix index 1fb1d14..41b6465 100644 --- a/hosts/hl-minipc3.nix +++ b/modules/hosts/hl-minipc3.nix @@ -1,9 +1,6 @@ -{ user }: -{ pkgs -, ... +{ ... }: { - imports = [ ./hl-minipc3.hardware-configuration.nix ]; skyg.user.enable = true; skyg.nixos.common.ssh-server.enable = true; skyg.nixos.common.containers.openMetricsPort = true; @@ -20,4 +17,3 @@ # Disable firewall networking.firewall.enable = false; } - diff --git a/hosts/hl-terra1.hardware-configuration.nix b/modules/hosts/hl-terra1.hardware-configuration.nix similarity index 100% rename from hosts/hl-terra1.hardware-configuration.nix rename to modules/hosts/hl-terra1.hardware-configuration.nix diff --git a/hosts/hl-terra1.nix b/modules/hosts/hl-terra1.nix similarity index 93% rename from hosts/hl-terra1.nix rename to modules/hosts/hl-terra1.nix index 3adc84a..96eb890 100644 --- a/hosts/hl-terra1.nix +++ b/modules/hosts/hl-terra1.nix @@ -1,4 +1,3 @@ -{ user }: { pkgs, ... }: let openPorts = [ @@ -16,7 +15,6 @@ let ]; in { - imports = [ ./hl-terra1.hardware-configuration.nix ]; skyg.user.enable = true; skyg.nixos.common.ssh-server.enable = true; skyg.nixos.desktop.enable = false; @@ -46,4 +44,3 @@ in ''; }; } - diff --git a/hosts/scripts/fw1/gs.sh b/modules/hosts/scripts/fw1/gs.sh similarity index 100% rename from hosts/scripts/fw1/gs.sh rename to modules/hosts/scripts/fw1/gs.sh diff --git a/hosts/scripts/fwbook/functions.nu b/modules/hosts/scripts/fwbook/functions.nu similarity index 100% rename from hosts/scripts/fwbook/functions.nu rename to modules/hosts/scripts/fwbook/functions.nu diff --git a/hosts/scripts/fwbook/functions.sh b/modules/hosts/scripts/fwbook/functions.sh similarity index 100% rename from hosts/scripts/fwbook/functions.sh rename to modules/hosts/scripts/fwbook/functions.sh diff --git a/modules/lib.nix b/modules/lib.nix index 3c44875..0625821 100644 --- a/modules/lib.nix +++ b/modules/lib.nix @@ -1,26 +1,44 @@ { nixpkgs +, nixpkgs-unstable +, user , determinate , home-manager , nix-darwin , systems -, hlCommonSettings , nix-flatpak -, specialArgs , stylix -, +, specialArgs +, hostFolder }: let skygUtils = import ./skyg-utils.nix; - makeImports = - { attrs - , extraConfiguration ? [ ] - , - }: - (if (isNull attrs.configuration) then [ ] else [ attrs.configuration ]) - ++ [ - (import ./main.nix attrs) - ] - ++ extraConfiguration; + makeNixOs = + { system ? "x86_64-linux" + , hostName + , homeManagerVersion ? "24.11" + , systemStateVersion ? "24.05" + , configuration ? [ ] + }: nixpkgs.lib.nixosSystem { + specialArgs = specialArgs // { + inherit system skygUtils user; + unstablePkgs = nixpkgs-unstable.legacyPackages.${system}; + }; + inherit system; + modules = [ + determinate.nixosModules.default + stylix.nixosModules.stylix + home-manager.nixosModules.default + nix-flatpak.nixosModules.nix-flatpak + specialArgs.dms.nixosModules.dankMaterialShell + (import ./main.nix { + inherit + user + homeManagerVersion + hostName + systemStateVersion; + }) + ] ++ configuration; + }; eachSystem = nixpkgs.lib.genAttrs (import systems); allPkgs = eachSystem ( system: @@ -31,101 +49,74 @@ let }; } ); - makeNixOsModuleMaker = - masterAttrs: - { system ? masterAttrs.system ? "x86_64-linux" - , ... - }@attrs: - let - joinedttrs = masterAttrs // attrs; - in - nixpkgs.lib.nixosSystem { - specialArgs = specialArgs // { - inherit system skygUtils; - }; - inherit system; - modules = [ - determinate.nixosModules.default - stylix.nixosModules.stylix - ] - ++ (makeImports { - attrs = joinedttrs; - extraConfiguration = [ - home-manager.nixosModules.default - nix-flatpak.nixosModules.nix-flatpak - specialArgs.dms.nixosModules.dankMaterialShell - ]; - }); - }; - makeNixOsModule = makeNixOsModuleMaker { }; - makeHLService = makeNixOsModuleMaker hlCommonSettings; - makeDarwinModule = - { system ? "x86_64-darwin" - , user - , ... - }@attrs: - nix-darwin.lib.darwinSystem { - modules = - (makeImports { - attrs = attrs; - extraConfiguration = [ - home-manager.darwinModules.home-manager - stylix.darwinModules.stylix - ]; - }) - ++ [ - (import ./macos.nix { - user = user; - system = system; - }) - ]; - }; - makeHomeManagerUsers = - { modules ? [ ] - , homeManagerVersion - , user - , system ? "x86_64-linux" - , - }: - let - hm = ( - import ./home { - stateVersion = homeManagerVersion; - } - ); - pkgs = allPkgs."${system}"; - in - home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - (hm.makeCommonUser user) - ] - ++ modules; - }; + # makeDarwinModule = + # { system ? "x86_64-darwin" + # , user + # , ... + # }@attrs: + # nix-darwin.lib.darwinSystem { + # modules = + # (makeImports { + # attrs = attrs; + # extraConfiguration = [ + # home-manager.darwinModules.home-manager + # stylix.darwinModules.stylix + # ]; + # }) + # ++ [ + # (import ./macos.nix { + # user = user; + # system = system; + # }) + # ]; + # }; + # makeHomeManagerUsers = + # { modules ? [ ] + # , homeManagerVersion + # , user + # , system ? "x86_64-linux" + # , + # }: + # let + # hm = ( + # import ./home { + # stateVersion = homeManagerVersion; + # }makeHLServices + # ); + # pkgs = allPkgs."${system}"; + # in + # home-manager.lib.homeManagerConfiguration { + # inherit pkgs; + # modules = [ + # (hm.makeCommonUser user) + # ] + # ++ modules; + # }; in { eachSystem = eachSystem; pkgs = allPkgs; - makeNixOsModule = makeNixOsModule; - makeHLService = makeHLService; - makeDarwinModule = makeDarwinModule; - makeHomeManagerUsers = makeHomeManagerUsers; - makeHLServices = - { nodeNames ? [ ] - , systemStateVersion ? "24.05" - , user - , - }: + makeNixOs = makeNixOs; + makeNixosConfigurations = + nodes: builtins.listToAttrs ( builtins.map - (name: { - name = name; - value = makeHLService { - hostName = name; - configuration = (import (../hosts + "/${name}.nix") { user = user; }); - systemStateVersion = systemStateVersion; + ({ hostName + , ... + }@attrs: { + name = hostName; + value = makeNixOs + { + inherit hostName; + } // attrs // { + configuration = [ + import + (./hosts + "/${hostName}.nix") + import + (./hosts + "/${hostName}.hardware-configuration.nix") + ] ++ (if attrs.configuration then attrs.configuration else [ ]); }; }) - nodeNames + nodes ); } diff --git a/modules/main.nix b/modules/main.nix index fd7f5a9..24c149e 100644 --- a/modules/main.nix +++ b/modules/main.nix @@ -2,12 +2,6 @@ , homeManagerVersion , systemStateVersion , hostName - # Desktop Module - # os -, os ? { - enable = false; - } -, localNixCaches ? { keys = [ ]; urls = [ ]; } , ... }: { ... }: { @@ -20,7 +14,5 @@ skyg.user = user; skyg.core.hostName = hostName; skyg.home-manager.version = homeManagerVersion; - skyg.core.substituters = localNixCaches; - skyg.nixos.common.containers = (if os.enable then os.containers else { }); system.stateVersion = systemStateVersion; } diff --git a/modules/nixos/common/containers/default.nix b/modules/nixos/common/containers/default.nix index 1748c0f..047a7d9 100644 --- a/modules/nixos/common/containers/default.nix +++ b/modules/nixos/common/containers/default.nix @@ -18,6 +18,7 @@ }; localDockerRegistries = lib.mkOption { type = lib.types.listOf lib.types.str; + default = [ "minipc1.lab.internal:5001" ]; }; metricsPort = lib.mkOption { type = lib.types.number; diff --git a/modules/nixos/desktop/tiler/niri.nix b/modules/nixos/desktop/tiler/niri.nix index 6558a78..a81112f 100644 --- a/modules/nixos/desktop/tiler/niri.nix +++ b/modules/nixos/desktop/tiler/niri.nix @@ -2,13 +2,10 @@ , lib , pkgs , skygUtils -, system -, nixpkgs-unstable , ... }: let cfg = config.skyg.nixos.desktop.tiler.niri; - unstable = nixpkgs-unstable.legacyPackages.${system}; in { options = {