Skip to content

Commit 61cb926

Browse files
committed
wip: initial layout
1 parent 9ebb1f6 commit 61cb926

File tree

15 files changed

+148
-0
lines changed

15 files changed

+148
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
outputs = {std, ...} @ inputs:
3+
std.growOn {
4+
inherit inputs;
5+
cellsFrom = ./ops;
6+
cellBlocks = with std.blockTypes; [
7+
# Software Delivery Lifecycle (Packaging Layers)
8+
# For deeper context, please consult:
9+
# https://std.divnix.com/patterns/four-packaging-layers.html
10+
(installables "packages" {ci.build = true;})
11+
(runnables "operables")
12+
(containers "oci-images" {ci.publish = true;})
13+
(kubectl "deployments" {ci.apply = true;})
14+
];
15+
};
16+
17+
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
18+
19+
inputs = {
20+
std.url = "github:divnix/std";
21+
std.inputs.nixpkgs.follows = "nixpkgs";
22+
std.inputs.n2c.follows = "n2c";
23+
n2c.url = "github:nlewo/nix2container";
24+
n2c.inputs.nixpkgs.follows = "std/nixpkgs";
25+
};
26+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
let
2+
inherit (inputs.std) dmerge;
3+
inherit (inputs.std.inputs) haumea;
4+
inherit (inputs.std.lib.ops) readYAML;
5+
6+
loadYaml = _: _: readYAML;
7+
baseline = with haumea.lib;
8+
load {
9+
src = ./deployments;
10+
loader = [(matchers.regex ''^.+\.(yaml|yml)'' loadYaml)];
11+
};
12+
in {
13+
my-srv-a = dmerge baseline.my-srv-a {
14+
meta.description = "Development Environment for my-srv-a";
15+
deployment = {
16+
spec.template.spec.containers = dmerge.updateOn "name" [
17+
{
18+
name = "my-srv-a";
19+
image = cell.oci-images.my-srv-a.image.name;
20+
}
21+
];
22+
};
23+
};
24+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apiVersion: v1
2+
kind: Service
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let
2+
inherit (inputs) std;
3+
in {
4+
my-srv-a = std.lib.ops.mkStandardOCI {
5+
name = "ghcr.io/myorg/myrepo/my-srv-a";
6+
operable = cell.operables.my-srv-a;
7+
meta.description = "Minimal OCI Image for my-srv-a";
8+
};
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
let
2+
inherit (inputs) std;
3+
inherit (inputs.nixpkgs) lib;
4+
in {
5+
my-srv-a = std.lib.ops.mkOperable {
6+
package = cell.packages.my-srv-a;
7+
runtimeScript = lib.getExe cell.packages.my-srv-a;
8+
meta.description = "A thin warpper around my-srv-a binary executable";
9+
};
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let
2+
inherit (inputs) nixpkgs std self;
3+
4+
src = std.incl self [
5+
"folder"
6+
"my.file"
7+
];
8+
in {
9+
my-srv-a = {
10+
meta.description = "my-srv-a binary executable";
11+
};
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
let
2+
inherit (inputs.std) dmerge;
3+
inherit (inputs.std.inputs) haumea;
4+
inherit (inputs.std.lib.ops) readYAML;
5+
6+
loadYaml = _: _: readYAML;
7+
baseline = with haumea.lib;
8+
load {
9+
src = ./deployments;
10+
loader = [(matchers.regex ''^.+\.(yaml|yml)'' loadYaml)];
11+
};
12+
in {
13+
my-srv-a = dmerge baseline.my-srv-a {
14+
meta.description = "Development Environment for my-srv-a";
15+
deployment = {
16+
spec.template.spec.containers = dmerge.updateOn "name" [
17+
{
18+
name = "my-srv-a";
19+
image = cell.oci-images.my-srv-a.image.name;
20+
}
21+
];
22+
};
23+
};
24+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apiVersion: apps/v1
2+
kind: Deployment

0 commit comments

Comments
 (0)