mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-07 07:09:15 +00:00
add(nix): docker for darwin
This commit is contained in:
parent
191d01a209
commit
8a260ee62e
6 changed files with 127 additions and 61 deletions
61
nix/hosts/bismuth/services/colima.nix
Normal file
61
nix/hosts/bismuth/services/colima.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = lib.lists.optionals config.docker.enable (
|
||||
let
|
||||
darwinPkgs = lib.lists.optionals pkgs.stdenv.isDarwin [pkgs.colima];
|
||||
in
|
||||
[
|
||||
pkgs.docker
|
||||
pkgs.docker-compose
|
||||
]
|
||||
++ darwinPkgs
|
||||
);
|
||||
|
||||
environment.userLaunchAgents = let
|
||||
path =
|
||||
builtins.concatStringsSep ":"
|
||||
(map (p: "${p}/bin") [
|
||||
pkgs.docker
|
||||
pkgs.docker-compose
|
||||
]);
|
||||
defaultPath = "/usr/bin:/bin:/usr/sbin:/sbin";
|
||||
in {
|
||||
"colima.plist" = {
|
||||
# https://github.com/abiosoft/colima/issues/490
|
||||
# Doesn't work at the moment
|
||||
enable = false;
|
||||
# make sure docker and docker-compose is in the path, otherwise `colima` won't launch
|
||||
text = ''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key> <string>org.nix.colima</string>
|
||||
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>${path}:${defaultPath}</string>
|
||||
</dict>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>${pkgs.colima}/bin/colima</string>
|
||||
<string>start</string>
|
||||
</array>
|
||||
|
||||
<key>RunAtLoad</key> <true/>
|
||||
|
||||
<key>KeepAlive</key> <true/>
|
||||
|
||||
<key>ThrottleInterval</key> <integer>60</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
6
nix/hosts/bismuth/services/default.nix
Normal file
6
nix/hosts/bismuth/services/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./llama-cpp.nix
|
||||
./colima.nix
|
||||
];
|
||||
}
|
||||
29
nix/hosts/bismuth/services/llama-cpp.nix
Normal file
29
nix/hosts/bismuth/services/llama-cpp.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{llama-cpp, ...}: {
|
||||
environment.userLaunchAgents = {
|
||||
"llama-server.plist" = {
|
||||
enable = false;
|
||||
text = ''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key> <string>org.nix.llama-server</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>${llama-cpp}/bin/llama-server</string>
|
||||
<string>--model</string>
|
||||
<string>/Users/leana/llm/mistral_7B-Q4_K_M.gguf</string>
|
||||
</array>
|
||||
|
||||
<key>RunAtLoad</key> <true/>
|
||||
|
||||
<key>KeepAlive</key> <true/>
|
||||
|
||||
<key>ThrottleInterval</key> <integer>60</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue