From c3f7b9d25048387ee13186e2257a3e71da9c8f33 Mon Sep 17 00:00:00 2001 From: vasu1124 Date: Sun, 10 Mar 2024 19:15:45 +0100 Subject: [PATCH] switch from shell.nix to flake.nix --- .envrc | 2 +- flake.lock | 27 ++++++++++++++++++++++ flake.nix | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc index 4a4726a5..c4b17d79 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use_nix +use_flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..5879aa40 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1709961763, + "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..bdb3df59 --- /dev/null +++ b/flake.nix @@ -0,0 +1,68 @@ +/* +SPDX-FileCopyrightText: 2024 vasu1124 + +SPDX-License-Identifier: Apache-2.0 +*/ +{ + description = "Nix flake for introspect"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs, ... }: + let + pname = "introspect"; + + # System types to support. + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + + in + { + # Add dependencies that are only needed for development + devShells = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + go_1_21 # golang 1.21 + gopls # go language server + gotools # go imports + go-tools # static checks + gnumake # standard make + + etcd + # mongodb-5_0 + cfssl + istioctl + gettext + jq + fluxcd + kubernetes-helm + kustomize + krew + sops + minikube + kind + kubelogin-oidc + kubectx + tilt + kubebuilder + skaffold + delve + ctlptl + cue + ]; + }; + }); + + }; +}