diff --git a/hosts/ooknode/default.nix b/hosts/ooknode/default.nix deleted file mode 100644 index 45572ef..0000000 --- a/hosts/ooknode/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - ooknet.host = { - admin = { - name = "ooks"; - shell = "fish"; - homeManager = true; - }; - }; -} diff --git a/hosts/ooksmedia/default.nix b/hosts/ooksmedia/default.nix new file mode 100644 index 0000000..2af78cf --- /dev/null +++ b/hosts/ooksmedia/default.nix @@ -0,0 +1,28 @@ +{ + pkgs, + lib, + ... +}: { + imports = [ + ./file-system.nix + ./hardware.nix + ]; + + ooknet = { + host = { + admin = { + name = "ooks"; + shell = "fish"; + homeManager = true; + }; + }; + console = { + profile = "standard"; + editor = "nvim"; + multiplexer = "zellij"; + }; + }; + boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; + + system.stateVersion = lib.mkDefault "24.11"; +} diff --git a/hosts/ooksmedia/file-system.nix b/hosts/ooksmedia/file-system.nix new file mode 100644 index 0000000..64bb4a1 --- /dev/null +++ b/hosts/ooksmedia/file-system.nix @@ -0,0 +1,29 @@ +{ + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550"; + fsType = "btrfs"; + options = ["subvol=root"]; + }; + "/nix" = { + device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550"; + fsType = "btrfs"; + options = ["subvol=nix"]; + }; + "/persist" = { + device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550"; + fsType = "btrfs"; + options = ["subvol=persist"]; + }; + "/swap" = { + device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550"; + fsType = "btrfs"; + options = ["subvol=swap"]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/B511-09E2"; + fsType = "vfat"; + }; + }; + swapDevices = []; +} diff --git a/modules/nixos/base/options.nix b/modules/nixos/base/options.nix index 1eb9acf..6683e48 100644 --- a/modules/nixos/base/options.nix +++ b/modules/nixos/base/options.nix @@ -12,7 +12,7 @@ in { default = "ooks-generic"; }; type = mkOption { - type = enum ["desktop" "laptop"]; + type = enum ["vm" "desktop" "laptop"]; }; role = mkOption { type = enum ["workstation" "server"]; diff --git a/modules/nixos/server/services/forgejo/options.nix b/modules/nixos/server/services/forgejo/options.nix new file mode 100644 index 0000000..ce2fcd6 --- /dev/null +++ b/modules/nixos/server/services/forgejo/options.nix @@ -0,0 +1,22 @@ +{ + lib, + config, + ... +}: let + inherit (config.services) forgejo; + inherit (lib) mkEnableOption mkOption; + inherit (lib.types) str; + mkColorOption = description: + mkOption { + type = str; + default = ""; + inherit description; + }; +in { + options.ooknet.server.forgejo.customTheme = { + enable = mkEnableOption; + light = { + primary = mkColorOption; + }; + }; +} diff --git a/outputs/hosts/servers.nix b/outputs/hosts/servers.nix index 70af570..a05b3cf 100644 --- a/outputs/hosts/servers.nix +++ b/outputs/hosts/servers.nix @@ -15,5 +15,12 @@ in { profile = "linode"; services = ["website" "forgejo"]; }; + ookmedia = mkServer { + inherit withSystem; + system = "x86_64-linux"; + hostname = "ooksmedia"; + type = "desktop"; + services = []; + }; }; } diff --git a/outputs/lib/builders.nix b/outputs/lib/builders.nix index cd7822e..4c954a3 100644 --- a/outputs/lib/builders.nix +++ b/outputs/lib/builders.nix @@ -87,27 +87,33 @@ hostname, system, type, - profile, services, + profile ? null, domain ? "", additionalModules ? [], specialArgs ? {}, }: - mkBaseSystem { - inherit withSystem hostname system type specialArgs; - role = "server"; - additionalModules = concatLists [ - (singleton { - ooknet.server = { - inherit domain services; - }; - }) - core - [(serverModules + "/profiles/${profile}")] - [serverModules] - additionalModules - ]; - }; + assert lib.assertMsg (!(type == "vm" && profile == null)) + "Profile must be specified for VM servers"; + mkBaseSystem { + inherit withSystem hostname system type specialArgs; + role = "server"; + additionalModules = concatLists [ + (singleton { + ooknet.server = { + inherit domain services; + }; + }) + core + ( + if type == "vm" + then [(serverModules + "/profiles/${profile}")] + else [(hostModules + "/${hostname}")] + ) + [serverModules] + additionalModules + ]; + }; mkImage = { profile, diff --git a/outputs/lib/icon/mkLogo.nix b/outputs/lib/icon/mkLogo.nix new file mode 100644 index 0000000..2fb7303 --- /dev/null +++ b/outputs/lib/icon/mkLogo.nix @@ -0,0 +1,122 @@ +{ + lib, + pkgs, + hozen, + ... +}: let + inherit (lib) makeExtensible; + inherit (hozen) color; +in + makeExtensible (self: { + # Base logo derivation + mkLogo = { + name ? "ooknet-logo", + width ? 512, + height ? 512, + dark ? color.neutrals."800", + mid ? color.neutrals."650", + light ? color.neutrals."550", + shadow ? color.neutrals."700", + highlight ? color.neutrals."300", + }: + pkgs.stdenv.mkDerivation { + inherit name width height; + + # Use your SVG content here + src = pkgs.writeTextFile { + name = "logo.svg"; + text = + /* + html + */ + '' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ''; + }; + + nativeBuildInputs = [pkgs.inkscape]; + + # Proper build phases + buildPhase = '' + # Ensure output directory exists + mkdir -p $out/share/icons + + # Convert SVG to PNG + inkscape --export-type="png" \ + --export-filename="$out/share/icons/${name}.png" \ + --export-width=${toString width} \ + --export-height=${toString height} \ + $src + + # Also keep the SVG + cp $src "$out/share/icons/${name}.svg" + ''; + + # Meta information is always good practice + meta = { + description = "OokNet Logo"; + mainProgram = name; + }; + }; + + # Wallpaper derivation that uses the logo + mkWallpaper = { + width, + height, + logo ? self.mkLogo {}, + backgroundColor ? "282828", + }: + pkgs.stdenv.mkDerivation { + name = "ooknet-wallpaper"; + + buildInputs = [pkgs.imagemagick]; + + buildPhase = '' + # Create background + convert -size ${toString width}x${toString height} \ + xc:#${backgroundColor} \ + background.png + + # Composite logo onto center of background + composite -gravity center \ + ${logo}/share/icons/*.png \ + background.png \ + $out + ''; + }; + }) diff --git a/outputs/pkgs/wallpapers/generated-wallpaper.nix b/outputs/pkgs/wallpapers/generated-wallpaper.nix new file mode 100644 index 0000000..b8c994b --- /dev/null +++ b/outputs/pkgs/wallpapers/generated-wallpaper.nix @@ -0,0 +1,69 @@ +{ + pkgs, + config, +}: let + inherit (config.ooknet.hardware) monitors; + inherit (config.ooknet.appearance) colorscheme; + largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs)); + largestWidth = largest (x: x.width) monitors; + largestHeight = largest (x: x.height) monitors; +in + { + width ? largestWidth, + height ? largestHeight, + logoScale ? 4, + backgroundColor ? colorscheme.palette.mantle, + logoColor1 ? colorscheme.palette.yellow, + logoColor2 ? colorscheme.palette.green, + }: + pkgs.stdenv.mkDerivation { + name = "generated-nix-wallpaper-${colorscheme.slug}.png"; + src = pkgs.writeTextFile { + name = "template.svg"; + text = '' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ''; + }; + buildInputs = [pkgs.inkscape]; + unpackPhase = "true"; + buildPhase = '' + inkscape --export-type="png" $src -w ${toString width} -h ${toString height} -o wallpaper.png + ''; + installPhase = "install -Dm0644 wallpaper.png $out"; + } diff --git a/outputs/pkgs/website/src/templates/home.html b/outputs/pkgs/website/src/templates/home.html index 0a192dd..704127e 100644 --- a/outputs/pkgs/website/src/templates/home.html +++ b/outputs/pkgs/website/src/templates/home.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% block home %} @@ -35,6 +36,5 @@ -{% block home %} {{ section.content | safe }} {% endblock home %}