From e60410393cea222b16743a1a87f29c06b9b3543b Mon Sep 17 00:00:00 2001 From: adikro Date: Thu, 18 Dec 2025 21:04:00 +0100 Subject: rewrite of system modules, hm modules are next --- modules/sys/features/default.nix | 8 +++++++ modules/sys/features/nh.nix | 26 +++++++++++++++++++++ modules/sys/features/ollama.nix | 21 +++++++++++++++++ modules/sys/features/virtualization.nix | 41 +++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 modules/sys/features/default.nix create mode 100644 modules/sys/features/nh.nix create mode 100644 modules/sys/features/ollama.nix create mode 100644 modules/sys/features/virtualization.nix (limited to 'modules/sys/features') diff --git a/modules/sys/features/default.nix b/modules/sys/features/default.nix new file mode 100644 index 0000000..790dc25 --- /dev/null +++ b/modules/sys/features/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./nh.nix + ./ollama.nix + ./virtualization.nix + ]; +} diff --git a/modules/sys/features/nh.nix b/modules/sys/features/nh.nix new file mode 100644 index 0000000..d24d88b --- /dev/null +++ b/modules/sys/features/nh.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.nh = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + + config = lib.mkIf config.szpont.nh.enable { + nix.settings = { + trusted-users = [ "root" "adam" ]; + experimental-features = [ "nix-command" "flakes" ]; + }; + + programs.nh = { + enable = true; + flake = "/etc/nixos"; + }; + + environment.systemPackages = with pkgs; [ + nix-output-monitor + nvd + ]; + }; +} diff --git a/modules/sys/features/ollama.nix b/modules/sys/features/ollama.nix new file mode 100644 index 0000000..0989419 --- /dev/null +++ b/modules/sys/features/ollama.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + fileSystems."/models" = { + device = "/home/ollama"; + fsType = "none"; + options = [ "bind" ]; + }; + + services.ollama = { + enable = true; + package = pkgs.ollama-rocm; + loadModels = [ + "deepseek-r1:14b" + "qwen3:14b" + "qwen3-coder:30b" + ]; + syncModels = true; + user = "ollama"; + models = "/models"; + }; +} diff --git a/modules/sys/features/virtualization.nix b/modules/sys/features/virtualization.nix new file mode 100644 index 0000000..bb3e6cb --- /dev/null +++ b/modules/sys/features/virtualization.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.virtualization = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + kvm = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + docker = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; + }; + + config = lib.mkIf config.szpont.virtualization.enable (lib.mkMerge [ + (lib.mkIf config.szpont.virtualization.kvm.enable { + virtualisation.libvirtd = { + enable = true; + qemu.package = pkgs.qemu_kvm; + qemu.swtpm.enable = true; + }; + programs.virt-manager.enable = true; + users.users.adam.extraGroups = [ "libvirtd" ]; + boot.initrd.kernelModules = [ "kvm-amd" ]; + }) + + (lib.mkIf config.szpont.virtualization.docker.enable { + virtualisation.docker.enable = true; + environment.systemPackages = [ pkgs.docker-compose ]; + users.users.adam.extraGroups = [ "docker" ]; + }) + ]); +} -- cgit v1.3