Skip to content

Instantly share code, notes, and snippets.

@metacoma
Created March 21, 2024 10:59
Show Gist options
  • Save metacoma/33965abefb0b87985336180a0c5b8df4 to your computer and use it in GitHub Desktop.
Save metacoma/33965abefb0b87985336180a0c5b8df4 to your computer and use it in GitHub Desktop.
organist project nickel
let inputs = import "./nickel.lock.ncl" in
let organist = inputs.organist in
let k8s_namespace = import "./k8s/namespace.yaml" in
let knative_memory_broker = import "./k8s/knative/eventing/broker-memory.ncl" in
let knative_memory_broker_configmap = import "./k8s/knative/eventing/configmap.yml" in
let users = import "./users.yaml" in
let teams = {
alpha = {
name = "Alpha"
}
} in
{
shells = organist.shells.Bash,
shells.build = {
packages = {},
},
shells.dev = {
packages.hello = organist.import_nix "nixpkgs#hello",
},
files = std.record.from_array (users
|> std.array.map
(
fun user_record => {
field = "%{user_record.username}.yaml",
value = {
materialisation_method = 'Copy,
content = std.serialize 'Yaml
(
k8s_namespace & {
metadata.name | force = user_record.username,
metadata.labels."kubernetes.io/metadata.name" | force = user_record.username
}
)
}
}
)
) & {
"test.yaml".materialisation_method = 'Copy,
"test.yaml".content = "hello world"
} & std.record.from_array (users
|> std.array.map
(
fun user_record => {
field = "%{user_record.username}/broker.yaml",
value = {
materialisation_method = 'Copy,
content = std.serialize 'Yaml
(
knative_memory_broker & {
metadata.name | force = user_record.username,
metadata.labels."kubernetes.io/metadata.name" | force = user_record.username,
spec.config.name | force = "user-broker"
}
)
}
}
)
) & std.record.from_array (users
|> std.array.map
(
fun user_record => {
field = "%{user_record.username}/broker-configmap.yaml",
value = {
materialisation_method = 'Copy,
content = std.serialize 'Yaml
(
knative_memory_broker_configmap & {
metadata.name | force = "user-broker",
metadata.labels."kubernetes.io/metadata.name" | force = user_record.username,
}
)
}
}
)
)
}
| organist.OrganistExpression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment