Functional DevOps

(in a dysfunctional world)

Vaibhav Sagar (@vbhvsgr)

Why DevOps?

Works on my machine

Works on my machine

What happens after you write the last line of code?

DevOps Desiderata

Automatic

Repeatable

Idempotent

Reversible

Atomic

A Tiny Web Service

Blank Me Up

app/Main.hs

Blank Me Up

name:                blank-me-up
version:             0.1.0.0
license:             BSD3
build-type:          Simple
cabal-version:       >=1.10

executable blank-me-up
  main-is:             Main.hs
  build-depends:       base >=4.9 && <5
                     , scotty
  default-language:    Haskell2010

app/blank-me-up.cabal

Nix

Service

nix/service.nix

Service

nix/service.nix

Service

nix/service.nix

Service

nix/service.nix

Functional?

Shipping It

Webserver

ops/webserver.nix

Webserver

Deployment

ops/trivial.nix

Deployment

ops/trivial-vbox.nix

Deployment

Functional?

Requirements Change

Patched

nix/patched.nix

Service

nix/service-patched.nix

Webserver

nix/webserver.nix

Deploy

Rollback

Summary

Nix

  • Package manager
  • Programming language
  • Build/environment tool

NixOS

  • Operating system built around Nix

NixOps

  • Cloud deployment tool on top of NixOS

DevOps with Nix

  • Automatic
  • Repeatable
  • Idempotent
  • Reversible
  • Atomic
  • Functional!

Thank You

Questions?