2configs
3modules
machines
···
1
1
-
{ self, config, pkgs, ... }:
1
1
+
{
2
2
+
self,
3
3
+
config,
4
4
+
pkgs,
5
5
+
...
6
6
+
}:
2
7
let
3
8
opencrow = self.inputs.opencrow.packages.${pkgs.system}.opencrow;
4
9
pi = self.inputs.llm-agents.packages.${pkgs.system}.pi;
···
1
1
-
{ config, lib, pkgs, ... }:
1
1
+
{
2
2
+
config,
3
3
+
lib,
4
4
+
pkgs,
5
5
+
...
6
6
+
}:
2
7
let
3
8
users = [ "opencrow" ];
4
9
5
10
# Generate one var per user with random password
6
6
-
userGenerators = lib.listToAttrs (map (user: {
7
7
-
name = "radicale-${user}";
8
8
-
value = {
9
9
-
files."htpasswd-line" = { };
10
10
-
files."password" = { };
11
11
-
runtimeInputs = with pkgs; [ apacheHttpd coreutils ];
12
12
-
script = ''
13
13
-
password=$(head -c 32 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 24)
14
14
-
echo "$password" > "$out/password"
15
15
-
htpasswd -nbB ${user} "$password" > "$out/htpasswd-line"
16
16
-
'';
17
17
-
};
18
18
-
}) users);
11
11
+
userGenerators = lib.listToAttrs (
12
12
+
map (user: {
13
13
+
name = "radicale-${user}";
14
14
+
value = {
15
15
+
files."htpasswd-line" = { };
16
16
+
files."password" = { };
17
17
+
runtimeInputs = with pkgs; [
18
18
+
apacheHttpd
19
19
+
coreutils
20
20
+
];
21
21
+
script = ''
22
22
+
password=$(head -c 32 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 24)
23
23
+
echo "$password" > "$out/password"
24
24
+
htpasswd -nbB ${user} "$password" > "$out/htpasswd-line"
25
25
+
'';
26
26
+
};
27
27
+
}) users
28
28
+
);
19
29
20
20
-
loadCredentials = map (user:
21
21
-
"radicale-${user}-htpasswd:${config.clan.core.vars.generators."radicale-${user}".files."htpasswd-line".path}"
30
30
+
loadCredentials = map (
31
31
+
user:
32
32
+
"radicale-${user}-htpasswd:${
33
33
+
config.clan.core.vars.generators."radicale-${user}".files."htpasswd-line".path
34
34
+
}"
22
35
) users;
23
36
24
37
assembleHtpasswd = pkgs.writeShellScript "radicale-htpasswd" (
25
25
-
lib.concatMapStringsSep "\n" (user:
26
26
-
"cat \${CREDENTIALS_DIRECTORY}/radicale-${user}-htpasswd"
27
27
-
) users
38
38
+
lib.concatMapStringsSep "\n" (user: "cat \${CREDENTIALS_DIRECTORY}/radicale-${user}-htpasswd") users
28
39
);
29
40
in
30
41
{
···
38
38
name = "${name}.json";
39
39
path = pkgs.writeText "${name}.json" (
40
40
builtins.toJSON {
41
41
-
inherit (ws) directory on_enter on_leave on_create;
41
41
+
inherit (ws)
42
42
+
directory
43
43
+
on_enter
44
44
+
on_leave
45
45
+
on_create
46
46
+
;
42
47
}
43
48
);
44
49
}) cfg.workspaces
···
43
43
44
44
lass.workspace-manager.enable = true;
45
45
46
46
-
services.ollama = let
47
47
-
gpuTargets = [ "gfx1100" ]; # Radeon 890M (gfx1150/RDNA 3.5) - only build for fallback target
48
48
-
customRocblas = pkgs.rocmPackages.rocblas.override {
49
49
-
withHipBlasLt = false; # hipblaslt takes extremely long to build; rocblas's own Tensile kernels work fine
50
50
-
inherit gpuTargets;
46
46
+
services.ollama =
47
47
+
let
48
48
+
gpuTargets = [ "gfx1100" ]; # Radeon 890M (gfx1150/RDNA 3.5) - only build for fallback target
49
49
+
customRocblas = pkgs.rocmPackages.rocblas.override {
50
50
+
withHipBlasLt = false; # hipblaslt takes extremely long to build; rocblas's own Tensile kernels work fine
51
51
+
inherit gpuTargets;
52
52
+
};
53
53
+
customRocsparse = pkgs.rocmPackages.rocsparse.override {
54
54
+
inherit gpuTargets;
55
55
+
};
56
56
+
customRocsolver = pkgs.rocmPackages.rocsolver.override {
57
57
+
inherit gpuTargets;
58
58
+
rocblas = customRocblas;
59
59
+
rocsparse = customRocsparse;
60
60
+
};
61
61
+
customHipblas = pkgs.rocmPackages.hipblas.override {
62
62
+
rocblas = customRocblas;
63
63
+
rocsolver = customRocsolver;
64
64
+
rocsparse = customRocsparse;
65
65
+
};
66
66
+
customRocmPackages = pkgs.rocmPackages // {
67
67
+
rocblas = customRocblas;
68
68
+
hipblas = customHipblas;
69
69
+
rocsolver = customRocsolver;
70
70
+
rocsparse = customRocsparse;
71
71
+
};
72
72
+
in
73
73
+
{
74
74
+
enable = true;
75
75
+
package = pkgs.ollama-rocm.override {
76
76
+
rocmGpuTargets = gpuTargets;
77
77
+
rocmPackages = customRocmPackages;
78
78
+
};
79
79
+
environmentVariables = {
80
80
+
HSA_OVERRIDE_GFX_VERSION = "11.0.0"; # Radeon 890M (gfx1150/RDNA 3.5) - fallback to gfx1100
81
81
+
OLLAMA_NUM_CTX = "16384"; # 48 GiB RAM shared with GPU; 32k OOMs with 32B model
82
82
+
};
51
83
};
52
52
-
customRocsparse = pkgs.rocmPackages.rocsparse.override {
53
53
-
inherit gpuTargets;
54
54
-
};
55
55
-
customRocsolver = pkgs.rocmPackages.rocsolver.override {
56
56
-
inherit gpuTargets;
57
57
-
rocblas = customRocblas;
58
58
-
rocsparse = customRocsparse;
59
59
-
};
60
60
-
customHipblas = pkgs.rocmPackages.hipblas.override {
61
61
-
rocblas = customRocblas;
62
62
-
rocsolver = customRocsolver;
63
63
-
rocsparse = customRocsparse;
64
64
-
};
65
65
-
customRocmPackages = pkgs.rocmPackages // {
66
66
-
rocblas = customRocblas;
67
67
-
hipblas = customHipblas;
68
68
-
rocsolver = customRocsolver;
69
69
-
rocsparse = customRocsparse;
70
70
-
};
71
71
-
in {
72
72
-
enable = true;
73
73
-
package = pkgs.ollama-rocm.override {
74
74
-
rocmGpuTargets = gpuTargets;
75
75
-
rocmPackages = customRocmPackages;
76
76
-
};
77
77
-
environmentVariables = {
78
78
-
HSA_OVERRIDE_GFX_VERSION = "11.0.0"; # Radeon 890M (gfx1150/RDNA 3.5) - fallback to gfx1100
79
79
-
OLLAMA_NUM_CTX = "16384"; # 48 GiB RAM shared with GPU; 32k OOMs with 32B model
80
80
-
};
81
81
-
};
82
84
83
85
# extra-container for testing declarative containers without full rebuilds
84
86
programs.extra-container.enable = true;