diff --git a/.envrc b/.envrc index 3550a30..cc5c18b 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,12 @@ -use flake +#!/usr/bin/env bash + +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +# `use devenv` supports the same options as the `devenv shell` command. +# +# To silence all output, use `--quiet`. +# +# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true +use devenv diff --git a/.gitignore b/.gitignore index d77c07f..dbca001 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,14 @@ coverage.xml htmlcov/ # VSCode lol .vscode + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/README.md b/README.md index 49141dd..fdc3e57 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This is the git repository for the [Open Computing Facility](https://ocf.berkeley.edu/)'s [Kubernetes](https://k8s.io/) cluster. The repository is a [transpire](https://github.com/ocf/transpire) toplevel repository built through GitHub Actions CI and pushed to [ocf/cluster](https://github.com/ocf/cluster), which is then deployed by ArgoCD. The goal is for every non-dynamic Kubernetes object to be generated by a transpire module. +## Contributing + +The [Open Computing Facility](https://ocf.berkeley.edu/) (OCF) is an all-volunteer student organization dedicated to free computing for all University of California, Berkeley students, faculty, and staff. Students from all backgrounds are encouraged to [join as staff](https://ocf.io/getinvolved)! If you're not a student, or just want to make a one time contribution, please use the standard GitHub pull request workflow. Thanks for helping out :) + +### Setup + +Install devenv and run `devenv shell` in the root of the repo after cloning it. You won't need to run this command if you have direnv installed; the tools defined in `devenv.nix` will become immediately available upon entering the repository. + ## Deploying Software 1. Create a new Python file in `apps/` with a function `objects()` that yields Kubernetes objects (dicts or `python-kubernetes` objects are both accepted). See the other Python files in that folder for examples. Helper functions are provided for Helm charts, although not all software will use helm charts. @@ -42,8 +50,3 @@ A bootstrap script is provided to help bring up new clusters when needed. It ins ```bash ./bootstrap.sh ``` - -## Contributing - -The [Open Computing Facility](https://ocf.berkeley.edu/) (OCF) is an all-volunteer student organization dedicated to free computing for all University of California, Berkeley students, faculty, and staff. Students from all backgrounds are encouraged to [join as staff](https://ocf.io/getinvolved)! If you're not a student, or just want to make a one time contribution, please use the standard GitHub pull request workflow. Thanks for helping out :) - diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..1dce351 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,198 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1765837513, + "owner": "cachix", + "repo": "devenv", + "rev": "ae61898e634c79b8a322214f59f2613d53795dac", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1765121682, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765464257, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "09e45f2598e1a8499c3594fe11ec2943f34fe509", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1762808025, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1764580874, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "dcf61356c3ab25f1362b4a4428a6d871e84f1d1d", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "pyproject-build-systems": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ], + "pyproject-nix": [ + "transpire", + "pyproject-nix" + ], + "uv2nix": [ + "transpire", + "uv2nix" + ] + }, + "locked": { + "lastModified": 1763662255, + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "rev": "042904167604c681a090c07eb6967b4dd4dae88c", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "type": "github" + } + }, + "pyproject-nix": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764134915, + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "2c8df1383b32e5443c921f61224b198a2282a657", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ], + "transpire": "transpire" + } + }, + "transpire": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "pyproject-build-systems": "pyproject-build-systems", + "pyproject-nix": "pyproject-nix", + "uv2nix": "uv2nix" + }, + "locked": { + "lastModified": 1765877276, + "owner": "ocf", + "repo": "transpire", + "rev": "3f6a1ce298af8538a11bafadc8b8bbf6b3ef0e2f", + "type": "github" + }, + "original": { + "owner": "ocf", + "repo": "transpire", + "type": "github" + } + }, + "uv2nix": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ], + "pyproject-nix": [ + "transpire", + "pyproject-nix" + ] + }, + "locked": { + "lastModified": 1765631794, + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "4cca323a547a1aaa9b94929c4901bed5343eafe8", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..0eb649a --- /dev/null +++ b/devenv.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + packages = with pkgs; [ + git + teleport + k9s + kubectl + inputs.transpire.packages.${pkgs.system}.default + ]; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..a0a0bc1 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + transpire: + url: github:ocf/transpire + inputs: + nixpkgs: + follows: nixpkgs + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend