A domain-specific language for Infrastructure as Code

Overview

Skyr

A domain-specific language for Infrastructure As Code, with a phased execution model, allowing for expressive and highly dynamic IaC solutions.

Disclaimer

Please note that this is a quick and dirty repo, very much in early development. Don't use this for anything real!

Usage

At its core, Skyr is a basic functional language:

import List

ints = [12, 32, 43]

square = fn(n: Integer) => n * 2

squaredInts = List.map(ints, square)

type MyRecord = {
  ints: [Integer]
  string: String
}

value: MyRecord = {
  ints: squaredInts
  string: "Hello, Skyr"
}

It is strictly typed, with inference and basic parametric polymorphism.

identity = fn(x) => x

string = identity("string")
integer = identity(123)

Resources

What makes the language special, and domain-specific, are what're called resources. Resources are expressions that represent a stateful resource external to the program.

Anything that can be interacted with using a CRUD (Create, Read, Update, Delete) interface can be exposed as a resource in Skyr.

Here's an example from the standard library.

import Random

Random.Identifier {
  name: "my-id"
  byteLength: 4
}

Here, we're defining that there should be a random identifier that can be used for different purposes.

By giving the resource a name, the resulting state can be used in subsequent parts of the code.

import Random
import FileSystem

id = Random.Identifier {
  name: "my-id"
  byteLength: 4
}

FileSystem.File {
  path: "my-file.txt"
  content: id.hex
}

Here, we're generating a file called my-file.txt with the content filled with the resulting generated ID in a hexadecimal represenation.

Applying State

To apply a configuration, we use the Skyr CLI.

$ skyr apply
Create Random.Identifier(my-id) {
  name: "my-id"
  byteLength: 3
}

Continue?

Skyr creates an action plan based on what it knows. In this case, we're not ready to create the file because it's dependent on the identifier for its content. So, the first phase creates the identifier. We enter yes in the prompt.

$ skyr apply
Create Random.Identifier(my-id) {
  name: "my-id"
  byteLength: 3
}

Continue? yes

Created Random.Identifier(my-id) in 164.583µs

Create FileSystem.File(my-file.txt) {
  path: "my-file.txt"
  content: "fa3a12"
}

Continue?

After the identifier has been created, the file can be created, since it now has all the values it depends on.

You might also like...
Leetcode Solutions in Rust, Advent of Code Solutions in Rust and more

RUST GYM Rust Solutions Leetcode Solutions in Rust AdventOfCode Solutions in Rust This project demostrates how to create Data Structures and to implem

:crab: Small exercises to get you used to reading and writing Rust code!
:crab: Small exercises to get you used to reading and writing Rust code!

rustlings 🦀 ❤️ Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This inclu

Crabzilla provides a simple interface for running JavaScript modules alongside Rust code.

Crabzilla Crabzilla provides a simple interface for running JavaScript modules alongside Rust code. Example use crabzilla::*; use std::io::stdin; #[i

Shuttle is a library for testing concurrent Rust code

Shuttle Shuttle is a library for testing concurrent Rust code. It is an implementation of a number of randomized concurrency testing techniques, inclu

On-the-fly machine code executing from Deno

jit from js Execute raw machine code from JavaScript. I hope you know what you're doing :) const inst = new Uint8Array([0xC3]); // ret const noop = ji

a cheat-sheet for mathematical notation in Rust 🦀 code form

math-as-rust 🦀 Based on math-as-code This is a reference to ease developers into mathematical notation by showing comparisons with Rust code.

Some UwU and OwO for your Rust code

UwU Types Some UwU and OwO for your Rust code This is a Rust crate inspired by this tweet from @thingskatedid / @katef. Credits Some extra functionali

The source code that accompanies Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson
The source code that accompanies Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson

Hands-on Rust Source Code This repository contains the source code for the examples found in Hands-on Rust. These are also available from my publisher

Source code from Atlas, our 64k demo presented at Revision 2019 with Macau Exports

Atlas source code dump This is a dump of the source code for the engine, graphics tool and player for Atlas, our 64k demo released with Macau Exports

Owner
Emil Broman
Emil Broman
Now, the Host is Mine! - Super Fast Sub-domain Takeover Detection!

NtH1M - Super Fast Sub-domain Takeover Detection Notice This is a sad notice that our Internet Hero (@TheBinitGhimire) had recent demise on 26th of Ju

Captain Nick Lucifer* 5 Nov 5, 2022
A Domain Driven Design example application in Rust.

Rust Domain Driven Design Example rust-ddd Rust Domain-Driven-Design (DDD) Summery This repository is used to present how I find implementing DDD in R

Behrouz R.Farsi 6 Nov 15, 2022
Domain modeling. Event sourcing. CQRS.

f(model) - Functional Domain Modeling with Rust Publicly available at crates.io and docs.rs When you’re developing an information system to automate t

Fraktalio 12 Oct 7, 2023
An inquiry into nondogmatic software development. An experiment showing double performance of the code running on JVM comparing to equivalent native C code.

java-2-times-faster-than-c An experiment showing double performance of the code running on JVM comparing to equivalent native C code ⚠️ The title of t

xemantic 49 Aug 14, 2022
Rust Sandbox [code for 15 concepts of Rust language]

Rust-Programming-Tutorial Rust Sandbox [code for 15 concepts of Rust language]. The first time I've been introduced to Rust was on January 2022, you m

Bek Brace 4 Aug 30, 2022
A repository for showcasing my knowledge of the Rust programming language, and continuing to learn the language.

Learning Rust I started learning the Rust programming language before using GitHub, but increased its usage afterwards. I have found it to be a fast a

Sean P. Myrick V19.1.7.2 2 Nov 8, 2022
Nyah is a programming language runtime built for high performance and comes with a scripting language.

?? Nyah ( Unfinished ) Nyah is a programming language runtime built for high performance and comes with a scripting language. ??️ Status Nyah is not c

Stacker 3 Mar 6, 2022
Mewl, program in cats' language; A just-for-fun language

Mewl The programming language of cats' with the taste of lisp ?? What,Why? Well, 2 years ago in 2020, I created a esoteric programming language called

Palash Bauri 14 Oct 23, 2022
lelang programming language is a toy language based on LLVM.

lelang leang是一门使用Rust编写,基于LLVM(inkwell llvm safe binding library)实现的编程语言,起初作为课程实验项目,现在为个人长期维护项目。 Target Features 支持8至64位的整形类型和32/64位浮点 基本的函数定义,调用,声明外部

Aya0wind 5 Sep 4, 2022
The Devils' Programming Language (Quantum Programming Language)

devilslang has roots in Scheme and ML-flavored languages: it's the culmination of everything I expect from a programming language, including the desire to keep everything as minimalistic and concise as possible. At its core, devilslang is lambda-calculus with pattern-matching, structural types, fiber-based concurrency, and syntactic extension.

Devils' Language 2 Aug 26, 2022