We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a33d077 commit 8ee6637Copy full SHA for 8ee6637
nix/misc.nix
@@ -64,4 +64,39 @@ in
64
};
65
66
67
+ mkOci = {
68
+ srv,
69
+ img,
70
+ cfgs ? [],
71
+ dirs ? [],
72
+ }: {
73
+ lib,
74
+ pkgs,
75
+ config,
76
+ ...
77
+ }:
78
+ with lib; {
79
+ imports = [
80
+ ];
81
+
82
+ options = {
83
+ services."${srv}" = {
84
+ enable = mkOption {
85
+ default = false;
86
+ type = types.bool;
87
+ };
88
89
90
91
+ config = mkIf config.services."${srv}".enable {
92
+ virtualisation.oci-containers.containers.${srv} = {
93
+ image = img;
94
+ volumes =
95
+ (map (x: x + ":" + x + ":ro") cfgs)
96
+ ++ (map (x: x + ":" + x) dirs);
97
+ cmd =
98
+ concatMap (x: ["-f" x]) cfgs;
99
100
101
102
}
prv
0 commit comments