Skip to content
NixOS/NixOps driven Disciplina cluster, deployer and macOS builder
Nix
Branch: master
Clone or download
Pull request Compare This branch is 244 commits behind DisciplinaOU:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite
.git-crypt
deployments
docs
keys
modules
pkgs
state
.gitattributes
.gitconfig
.gitignore
README.md
default.nix
pkgs.nix
shell.nix

README.md

Primary Disciplina deployment specification.

To set up this repo, enter nix-shell and run:

git crypt unlock
cat .gitconfig >> .git/config

Darwin builder

nix-darwin profile for macOS builder. Runs Buildkite to build macOS apps on CI for QA team.

Provisioning

Darwin builder is the hardest of all three to provision because there's no NixOps support and nix-darwin provides relatively little control when compared to NixOS.

  1. Sign up for MacStadium and rent a server.

  2. Copy keys/production/buildkite-token to the newly provisioned server:

scp keys/production/buildkite-token administrator@1.2.3.4:~
  1. SSH to the server (default password is in the MacStadium ticket):
ssh administrator@1.2.3.4
  1. Activate passwordless sudo: https://apple.stackexchange.com/a/333055

  2. Install Nix:

curl https://nixos.org/nix/install | sh
  1. Install nix-darwin:
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
result/bin/darwin-installer
  1. Set up our Nix channels:
nix-channel --add https://github.com/serokell/nixpkgs/archive/master.tar.gz nixpkgs
nix-channel --add https://github.com/serokell/nix-darwin/archive/master.tar.gz darwin
nix-channel --add https://github.com/DisciplinaOU/disciplina-nixops/archive/master.tar.gz disciplina-nixops
nix-channel --update
  1. Update ~/.nixpkgs/darwin-configuration.nix to the effect of:
{
  imports = [
    <disciplina-nixops/deployments/darwin-builder.nix>
  ];

  # sysctl -n hw.ncpu
  nix.buildCores = 4;
  nix.maxJobs = 4;

  system.stateVersion = 3;
}
  1. Rebuild:
darwin-rebuild switch
  1. Update state/darwin-builder.ssh (in this repo) with the new IP.

Deployer

Singleton entity that is used to provision clusters in one-to-many relationship. Runs Buildkite to CD clusters on each GitHub push, and to build Flatpak bundles, LaTeX documents and HTML documentation as part of CI pipeline.

Provisioning

nix-shell --argstr env production --run 'nixops deploy -d deployer -s state/deployer.nixops'

Cluster

Actual Disciplina cluster. WIP.

Provisioning

If you want to create a personal staging cluster, enter nix-shell and run:

nixops create deployments/cluster.nix -d disciplina
nixops set-args --argstr domain yourname.disciplina.site -d disciplina
nixops deploy -d disciplina

Subsequent deploys should only run the last command. When you are done with your cluster and want to free up resources, run:

nixops destroy -d disciplina

If you want to deploy production cluster, run:

nix-shell --argstr env production --run 'nixops deploy -d cluster -s state/cluster.nixops'
You can’t perform that action at this time.