feat: Changes to steamdeck configs

This commit is contained in:
uttarayan21
2025-05-04 02:19:14 +05:30
parent 3a2b8f079c
commit 90fb9bcc6b
6 changed files with 9 additions and 4 deletions

View File

@@ -0,0 +1,76 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.jellyfin;
in {
options.services.jellyfin = {
enable = mkEnableOption "Jellyfin Media Server";
package = mkOption {
type = types.package;
default = pkgs.jellyfin;
defaultText = literalExpression "pkgs.jellyfin";
description = "The package to use for Jellyfin";
};
# user = mkOption {
# type = types.str;
# default = "jellyfin";
# description = "User account under which Jellyfin runs.";
# };
#
# group = mkOption {
# type = types.str;
# default = "jellyfin";
# description = "Group under which Jellyfin runs.";
# };
dataDir = mkOption {
type = types.path;
default = "/var/lib/jellyfin";
description = "Directory where Jellyfin stores its data files";
};
};
config = mkIf cfg.enable {
users.users.jellyfin = {
name = "jellyfin";
uid = mkDefault 601;
gid = mkDefault config.users.groups.jellyfin.gid;
home = cfg.dataDir;
createHome = true;
shell = "/bin/bash";
description = "Jellyfin runner user account";
};
users.groups.jellyfin = {
name = "jellyfin";
gid = mkDefault 602;
description = "Jellyfin runner group";
};
environment.systemPackages = [cfg.package];
launchd.daemons.jellyfin = {
environment = {
HOME = cfg.dataDir;
};
path = [cfg.package pkgs.coreutils pkgs.darwin.DarwinTools];
command = "${lib.getExe cfg.package}";
serviceConfig = {
# ProcessType = "Background";
Label = "org.jellyfin.server";
RunAtLoad = true;
# KeepAlive = true;
UserName = "${config.users.users.jellyfin.name}";
GroupName = "${config.users.groups.jellyfin.name}";
StandardOutPath = "${cfg.dataDir}/log/jellyfin.log";
StandardErrorPath = "${cfg.dataDir}/log/jellyfin.error.log";
WorkingDirectory = cfg.dataDir;
};
};
};
}

98
modules/macos/ollama.nix Normal file
View File

@@ -0,0 +1,98 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.ollama;
in {
options = {
services.ollama = {
enable = mkEnableOption "Ollama AI model runner";
package = mkOption {
type = types.package;
default = pkgs.ollama;
defaultText = literalExpression "pkgs.ollama";
description = "The ollama package to use.";
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
description = "The host address to listen on.";
};
port = mkOption {
type = types.port;
default = 11434;
description = "The port to listen on.";
};
environmentVariables = mkOption {
type = types.attrs;
default = {};
description = "Environment variables to set for the Ollama service.";
};
loadModels = mkOption {
type = types.listOf types.str;
default = [];
description = "List of models to load on startup.";
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/ollama";
description = "Directory to store Ollama data.";
};
};
};
config = mkIf cfg.enable {
# users.users.ollama = {
# name = "ollama";
# uid = 601;
# gid = config.users.groups.ollama.gid;
# home = cfg.dataDir;
# createHome = true;
# description = "Ollama service user";
# };
#
# users.groups.ollama = {
# name = "ollama";
# gid = 602;
# };
launchd.daemons.ollama = {
path = [cfg.package];
command = "${cfg.package}/bin/ollama serve";
serviceConfig = {
Label = "com.ollama.service";
# ProgramArguments = ["serve"];
# WorkingDirectory = cfg.dataDir;
EnvironmentVariables =
{
OLLAMA_HOST = cfg.host;
OLLAMA_PORT = toString cfg.port;
}
// cfg.environmentVariables;
RunAtLoad = true;
KeepAlive = true;
# StandardOutPath = "/var/log/ollama.log";
# StandardErrorPath = "/var/log/ollama.error.log";
# UserName = "ollama";
# GroupName = "ollama";
};
};
# system.activationScripts.preActivation.text = mkIf (cfg.loadModels != []) ''
# # Load Ollama models
# ${concatMapStrings (model: ''
# ${cfg.package}/bin/ollama pull ${model}
# '')
# cfg.loadModels}
# '';
};
}