diff --git a/modules/kubernetes.nix b/modules/kubernetes.nix new file mode 100644 index 0000000..fe269a0 --- /dev/null +++ b/modules/kubernetes.nix @@ -0,0 +1,78 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + options = { + services.kubernetes = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Whether to enable Kubernetes services"; + }; + + version = lib.mkOption { + type = lib.types.str; + default = "1.28.0"; + description = "Kubernetes version to use"; + }; + + clusterName = lib.mkOption { + type = lib.types.str; + default = "palatine-hill-cluster"; + description = "Name of the Kubernetes cluster"; + }; + + controlPlaneEndpoint = lib.mkOption { + type = lib.types.str; + default = "localhost:6443"; + description = "Control plane endpoint"; + }; + + networking = lib.mkOption { + type = lib.types.attrs; + default = { }; + description = "Kubernetes networking configuration"; + }; + }; + }; + + config = lib.mkIf config.services.kubernetes.enable { + environment.systemPackages = with pkgs; [ + kubectl + kubernetes + ]; + + # Enable containerd for Kubernetes + virtualisation.containerd.enable = true; + + # Enable kubelet + services.kubelet = { + enable = true; + extraFlags = { + "pod-infra-container-image" = "registry.k8s.io/pause:3.9"; + }; + }; + + # Enable kubeadm for cluster initialization + environment.etc."kubeadm.yaml".text = '' + apiVersion: kubeadm.k8s.io/v1beta3 + kind: InitConfiguration + localAPIEndpoint: + advertiseAddress: 127.0.0.1 + bindPort: 6443 + --- + apiVersion: kubeadm.k8s.io/v1beta3 + kind: ClusterConfiguration + clusterName: ${config.services.kubernetes.clusterName} + controlPlaneEndpoint: ${config.services.kubernetes.controlPlaneEndpoint} + networking: + serviceSubnet: 10.96.0.0/12 + podSubnet: 10.244.0.0/16 + dnsDomain: cluster.local + ''; + }; +} diff --git a/systems/artemision/configuration.nix b/systems/artemision/configuration.nix index 607f7ee..2edc4b9 100644 --- a/systems/artemision/configuration.nix +++ b/systems/artemision/configuration.nix @@ -1,5 +1,4 @@ { - config, lib, pkgs, ... @@ -58,23 +57,6 @@ }; gvfs.enable = true; - ollama = { - enable = true; - package = pkgs.ollama-rocm; - loadModels = [ - "dolphin3" - "gemma3" - "gemma3:27b" - "deepseek-r1:latest" - "deepseek-r1:1.5b" - "qwen3" - "qwen2.5-coder" - ]; - }; - open-webui = { - enable = true; - port = 21212; - }; fwupd = { enable = true; @@ -95,7 +77,10 @@ }; }; - users.users.alice.extraGroups = [ "calibre-web" ]; + users.users = { + alice.extraGroups = [ "calibre-web" ]; + }; + users.groups.ollama = { }; system.stateVersion = "24.05"; diff --git a/systems/artemision/programs.nix b/systems/artemision/programs.nix index 2cb7c63..8a21067 100644 --- a/systems/artemision/programs.nix +++ b/systems/artemision/programs.nix @@ -16,6 +16,7 @@ candy-icons chromium chromedriver + claude-code croc deadnix direnv diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 950c782..bb726bc 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -17,6 +17,7 @@ ./minio.nix ./networking.nix ./nextcloud.nix + ./ollama.nix #./plex ./postgresql.nix ./samba.nix @@ -99,6 +100,13 @@ smartd.enable = true; calibre-server.enable = false; + # Kubernetes example configuration + # To enable Kubernetes, uncomment the following: + # kubernetes = { + # enable = true; + # clusterName = "palatine-hill-cluster"; + # controlPlaneEndpoint = "localhost:6443"; + # }; }; nix.gc.options = "--delete-older-than 150d"; diff --git a/systems/palatine-hill/ollama.nix b/systems/palatine-hill/ollama.nix new file mode 100644 index 0000000..8ee64db --- /dev/null +++ b/systems/palatine-hill/ollama.nix @@ -0,0 +1,53 @@ +{ + pkgs, + ... +}: +{ + services = { + ollama = { + enable = true; + package = pkgs.ollama; + syncModels = true; + loadModels = [ + "gemma3" + "deepseek-r1:latest" + "deepseek-r1:1.5b" + "qwen3" + #"qwen3-coder-next" + "qwen3-coder" + "lennyerik/zeta" + "llama3.1:8b" + "qwen2.5-coder:1.5b-base" + "nomic-embed-text:latest" + ]; + environmentVariables = { + FLASH_ATTENTION = "1"; + OLLAMA_KV_CACHE_TYPE = "q8_0"; + # Ollama memory configuration + OLLAMA_MAX_LOADED_MODELS = "2"; + OLLAMA_MAX_QUEUE = "4"; + OLLAMA_NUM_PARALLEL = "2"; + + # ROCm memory optimization + #HIP_VISIBLE_DEVICES = "0"; + #ROCR_VISIBLE_DEVICES = "0"; + + # context length for agents + OLLAMA_CONTEXT_LENGTH = "64000"; + }; + }; + open-webui = { + enable = true; + port = 21212; + }; + }; + users.users.ollama = { + extraGroups = [ + "render" + "video" + ]; + group = "ollama"; + isSystemUser = true; + }; + users.groups.ollama = { }; +} diff --git a/users/alice/non-server.nix b/users/alice/non-server.nix index 4f349ad..d529c27 100644 --- a/users/alice/non-server.nix +++ b/users/alice/non-server.nix @@ -1,51 +1,123 @@ -{ pkgs, outputs, ... }: +{ pkgs, ... }: { - programs.emacs = { - enable = true; - package = pkgs.emacs30-pgtk; - }; - programs.vesktop = { - enable = true; - settings = { - appBadge = false; - arRPC = true; - checkUpdates = false; - customTitleBar = false; - hardwareAcceleration = true; + programs = { + emacs = { + enable = true; + package = pkgs.emacs30-pgtk; }; - vencord.useSystem = true; - vencord.settings = { - autoUpdate = false; - autoUpdateNotification = false; - notifyAboutUpdates = false; - plugins = { - AnonymiseFileNames.enabled = true; - BetterFolders.enabled = false; - BetterGifAltText.enabled = true; - CallTimer.enabled = true; - ClearURLs.enabled = true; - CopyFileContents.enabled = true; - CtrlEnterSend.enabled = true; - CustomIdle = { - enabled = true; - remainInIdle = false; + vesktop = { + enable = true; + settings = { + appBadge = false; + arRPC = true; + checkUpdates = false; + customTitleBar = false; + hardwareAcceleration = true; + }; + vencord.useSystem = true; + vencord.settings = { + autoUpdate = false; + autoUpdateNotification = false; + notifyAboutUpdates = false; + plugins = { + AnonymiseFileNames.enabled = true; + BetterFolders.enabled = false; + BetterGifAltText.enabled = true; + CallTimer.enabled = true; + ClearURLs.enabled = true; + CopyFileContents.enabled = true; + CtrlEnterSend.enabled = true; + CustomIdle = { + enabled = true; + remainInIdle = false; + }; + FriendsSince.enabled = true; + GameActivityToggle.enabled = true; + ImplicitRelationships.enabled = true; + MutualGroupDMs.enabled = true; + QuickMention.enabled = true; + QuickReply.enabled = true; + ReplaceGoogleSearch = { + enabled = true; + customEngineName = "DuckDuckGo"; + }; + ReviewDB.enabled = true; + ShowConnections.enabled = true; }; - FriendsSince.enabled = true; - GameActivityToggle.enabled = true; - ImplicitRelationships.enabled = true; - MutualGroupDMs.enabled = true; - QuickMention.enabled = true; - QuickReply.enabled = true; - ReplaceGoogleSearch = { - enabled = true; - customEngineName = "DuckDuckGo"; + }; + }; + zed-editor = { + enable = true; + mutableUserSettings = false; + extensions = [ + "nix" + "toml" + "rust" + "java" + "kotlin" + "git firefly" + "make" + "dockerfile" + "sql" + "latex" + "terraform" + "log" + ]; + userSettings = { + colorize_brackets = true; + hard_tabs = false; + vim_mode = true; + minimap = { + show = "auto"; + }; + buffer_line_height = "comfortable"; + auto_update = false; + autosave = "on_focus_change"; + agent = { + default_model = { + provider = "ollama"; + model = "qwen2.5-coder:latest"; + }; + favorite_models = [ ]; + model_parameters = [ ]; + }; + telemetry = { + diagnostics = false; + metrics = false; + }; + journal = { + hour_format = "hour24"; + }; + edit_preditions = { + provider = "open_ai_compatible_api"; + open_ai_compatible_api = { + api_url = "http://localhost:11434/v1/completions"; + model = "zeta:latest"; + prompt_format = "infer"; + max_requests = 64; + }; + }; + texlab = { + build = { + onSave = true; + forwardSearchAfter = true; + }; + forwardSearch = { + executable = "zathura"; + args = [ + "--synctex-forward" + "%l:1:%f" + "-x" + "zed %%{input}:%%{line}" + "%p" + ]; + }; }; - ReviewDB.enabled = true; - ShowConnections.enabled = true; }; }; }; + home.packages = with pkgs; [ cmake shellcheck