modules/services/colima: init
This commit is contained in:
parent
d787ec69c3
commit
58bf3ecb2d
11 changed files with 488 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
services.colima = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "colima";
|
||||
outPath = "@colima@";
|
||||
};
|
||||
dockerPackage = config.lib.test.mkStubPackage {
|
||||
name = "docker";
|
||||
outPath = "@docker@";
|
||||
};
|
||||
perlPackage = config.lib.test.mkStubPackage {
|
||||
name = "perl";
|
||||
outPath = "@perl@";
|
||||
};
|
||||
sshPackage = config.lib.test.mkStubPackage {
|
||||
name = "openssh";
|
||||
outPath = "@openssh@";
|
||||
};
|
||||
|
||||
profiles.default.settings = {
|
||||
cpu = 4;
|
||||
memory = 8;
|
||||
kubernetes.enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.colima/default/colima.yaml
|
||||
assertFileContent home-files/.colima/default/colima.yaml ${./custom-settings-expected.yaml}
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
darwin = super.darwin // {
|
||||
DarwinTools = config.lib.test.mkStubPackage {
|
||||
name = "DarwinTools";
|
||||
outPath = "@DarwinTools@";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
services.colima = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "colima";
|
||||
outPath = "@colima@";
|
||||
};
|
||||
dockerPackage = config.lib.test.mkStubPackage {
|
||||
name = "docker";
|
||||
outPath = "@docker@";
|
||||
};
|
||||
perlPackage = config.lib.test.mkStubPackage {
|
||||
name = "perl";
|
||||
outPath = "@perl@";
|
||||
};
|
||||
sshPackage = config.lib.test.mkStubPackage {
|
||||
name = "openssh";
|
||||
outPath = "@openssh@";
|
||||
};
|
||||
coreutilsPackage = config.lib.test.mkStubPackage {
|
||||
name = "coreutils";
|
||||
outPath = "@coreutils@";
|
||||
};
|
||||
curlPackage = config.lib.test.mkStubPackage {
|
||||
name = "curl";
|
||||
outPath = "@curl@";
|
||||
};
|
||||
bashPackage = config.lib.test.mkStubPackage {
|
||||
name = "bashNonInteractive";
|
||||
outPath = "@bashNonInteractive@";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.colima/default/colima.yaml
|
||||
|
||||
serviceFile=LaunchAgents/org.nix-community.home.colima-default.plist
|
||||
|
||||
assertFileExists "$serviceFile"
|
||||
|
||||
assertFileContent "$serviceFile" ${./expected-agent.plist}
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
cpu: 4
|
||||
kubernetes:
|
||||
enabled: true
|
||||
memory: 8
|
||||
4
tests/modules/services/colima/darwin/default.nix
Normal file
4
tests/modules/services/colima/darwin/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"colima-default-config" = ./colima-default-config.nix;
|
||||
"colima-custom-settings" = ./colima-custom-settings.nix;
|
||||
}
|
||||
30
tests/modules/services/colima/darwin/expected-agent.plist
Normal file
30
tests/modules/services/colima/darwin/expected-agent.plist
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>@colima@/bin:@perl@/bin:@docker@/bin:@openssh@/bin:@coreutils@/bin:@curl@/bin:@bashNonInteractive@/bin:@DarwinTools@/bin</string>
|
||||
</dict>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>Label</key>
|
||||
<string>org.nix-community.home.colima-default</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>@colima@/bin/colima</string>
|
||||
<string>start</string>
|
||||
<string>default</string>
|
||||
<string>-f</string>
|
||||
<string>--activate=true</string>
|
||||
<string>--save-config=false</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/home/hm-user/.local/state/colima-default.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/home/hm-user/.local/state/colima-default.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
3
tests/modules/services/colima/default.nix
Normal file
3
tests/modules/services/colima/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{ lib, pkgs, ... }:
|
||||
(lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin (import ./darwin/default.nix))
|
||||
// (lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux (import ./linux/default.nix))
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
services.colima = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "colima";
|
||||
outPath = "@colima@";
|
||||
};
|
||||
dockerPackage = config.lib.test.mkStubPackage {
|
||||
name = "docker";
|
||||
outPath = "@docker@";
|
||||
};
|
||||
perlPackage = config.lib.test.mkStubPackage {
|
||||
name = "perl";
|
||||
outPath = "@perl@";
|
||||
};
|
||||
sshPackage = config.lib.test.mkStubPackage {
|
||||
name = "openssh";
|
||||
outPath = "@openssh@";
|
||||
};
|
||||
coreutilsPackage = config.lib.test.mkStubPackage {
|
||||
name = "coreutils";
|
||||
outPath = "@coreutils@";
|
||||
};
|
||||
curlPackage = config.lib.test.mkStubPackage {
|
||||
name = "curl";
|
||||
outPath = "@curl@";
|
||||
};
|
||||
bashPackage = config.lib.test.mkStubPackage {
|
||||
name = "bashNonInteractive";
|
||||
outPath = "@bashNonInteractive@";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.colima/default/colima.yaml
|
||||
|
||||
assertFileExists home-files/.config/systemd/user/colima-default.service
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/colima-default.service \
|
||||
${./expected-service.service}
|
||||
'';
|
||||
}
|
||||
3
tests/modules/services/colima/linux/default.nix
Normal file
3
tests/modules/services/colima/linux/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"colima-default-config" = ./colima-default-config.nix;
|
||||
}
|
||||
19
tests/modules/services/colima/linux/expected-service.service
Normal file
19
tests/modules/services/colima/linux/expected-service.service
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
[Service]
|
||||
Environment=PATH=@colima@/bin:@perl@/bin:@docker@/bin:@openssh@/bin:@coreutils@/bin:@curl@/bin:@bashNonInteractive@/bin
|
||||
ExecStart=@colima@/bin/colima start default \
|
||||
-f \
|
||||
--activate=true \
|
||||
--save-config=false
|
||||
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
StandardError=append:/home/hm-user/.local/state/colima-default.log
|
||||
StandardOutput=append:/home/hm-user/.local/state/colima-default.log
|
||||
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Description=Colima container runtime (default profile)
|
||||
Wants=network-online.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue