Skip to content

Commit

Permalink
add flake
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Jun 8, 2023
1 parent 807703e commit 16f15bb
Show file tree
Hide file tree
Showing 4 changed files with 325 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake . --impure

# Kubernetes
export KUBECONFIG=$DEVENV_STATE/kube/config
export KIND_CLUSTER_NAME=vault-operator
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
.idea
/.devenv/
/.direnv/
/dist/
255 changes: 255 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "Run main.go in Kubernetes with one command, also port-forward your app into Kubernetes";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devenv.url = "github:cachix/devenv";
};

outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devenv.flakeModule
];

systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];

perSystem = { config, self', inputs', pkgs, system, ... }: rec {
devenv.shells = {
default = {
languages = {
go.enable = true;
};

packages = with pkgs; [
gnumake

golangci-lint
goreleaser

kind
kubectl
kustomize
];

scripts = {
versions.exec = ''
go version
golangci-lint version
echo "goreleaser $(goreleaser --version | sed -n '9p' | cut -d ' ' -f 5)"
kind version
kubectl version --client
echo kustomize $(kustomize version --short)
'';
};

enterShell = ''
versions
'';

# https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
containers = pkgs.lib.mkForce { };
};

ci = devenv.shells.default;
};
};
};
}

0 comments on commit 16f15bb

Please sign in to comment.