first commit
This commit is contained in:
8
hosts/common/extraServices/default.nix
Normal file
8
hosts/common/extraServices/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
imports = [
|
||||
./flatpak.nix
|
||||
./ollama.nix
|
||||
./podman.nix
|
||||
./virtualisation.nix
|
||||
];
|
||||
}
|
||||
23
hosts/common/extraServices/flatpak.nix
Normal file
23
hosts/common/extraServices/flatpak.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.extraServices.flatpak;
|
||||
in {
|
||||
options.extraServices.flatpak.enable = mkEnableOption "enable flatpak";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.flatpak.enable = true;
|
||||
xdg.portal = {
|
||||
# xdg desktop intergration (required for flatpak)
|
||||
enable = true;
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-hyprland
|
||||
];
|
||||
config.common.default = "*";
|
||||
};
|
||||
};
|
||||
}
|
||||
27
hosts/common/extraServices/ollama.nix
Normal file
27
hosts/common/extraServices/ollama.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.extraServices.ollama;
|
||||
in {
|
||||
options.extraServices.ollama.enable = mkEnableOption "enable ollama";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
package = pkgs.ollama-vulkan;
|
||||
host = "[::]";
|
||||
openFirewall = true;
|
||||
environmentVariables = {
|
||||
OLLAMA_HOST = "0.0.0.0";
|
||||
};
|
||||
};
|
||||
nixpkgs.config = {
|
||||
rocmSupport = config.services.xserver.videoDrivers == ["amdgpu"];
|
||||
cudaSupport = config.services.xserver.videoDrivers == ["nvidia"];
|
||||
};
|
||||
};
|
||||
}
|
||||
33
hosts/common/extraServices/podman.nix
Normal file
33
hosts/common/extraServices/podman.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.extraServices.podman;
|
||||
in {
|
||||
options.extraServices.podman.enable = mkEnableOption "enable podman";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
dockerSocket.enable = true;
|
||||
autoPrune = {
|
||||
enable = true;
|
||||
dates = "weekly";
|
||||
flags = [
|
||||
"--filter=until=24h"
|
||||
"--filter=label!=important"
|
||||
];
|
||||
};
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
podman-compose
|
||||
];
|
||||
};
|
||||
}
|
||||
42
hosts/common/extraServices/virtualisation.nix
Normal file
42
hosts/common/extraServices/virtualisation.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.extraServices.virtualisation;
|
||||
in {
|
||||
options.extraServices.virtualisation.enable = mkEnableOption "enable virtualisation";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
package = pkgs.qemu_kvm;
|
||||
runAsRoot = true;
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.virt-manager.enable = true;
|
||||
environment = {
|
||||
systemPackages = [pkgs.qemu];
|
||||
etc = {
|
||||
"ovmf/OVMF_CODE.fd" = {
|
||||
source = "${(pkgs.OVMF.override {
|
||||
secureBoot = true;
|
||||
tpmSupport = true;
|
||||
}).fd}/FV/OVMF_CODE.fd";
|
||||
};
|
||||
"ovmf/OVMF_VARS.fd" = {
|
||||
source = "${(pkgs.OVMF.override {
|
||||
secureBoot = true;
|
||||
tpmSupport = true;
|
||||
}).fd}/FV/OVMF_VARS.fd";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user