Skip to content

Commit

Permalink
feat: setup devenv shell
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusramberg committed Feb 5, 2025
1 parent 6f2a4d4 commit 238fb08
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 46 deletions.
12 changes: 1 addition & 11 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

watch_file devenv.nix
watch_file devenv.lock
watch_file devenv.yaml
if ! use flake . --impure
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
use flake . --no-pure-eval
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
helmfile-nix
result
.direnv
.devenv
221 changes: 220 additions & 1 deletion flake.lock

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

44 changes: 36 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,55 @@
{
description = "helmfile-nix";

inputs.devenv.url = "github:cachix/devenv";
inputs.devenv.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";

outputs = { self, nixpkgs, flake-utils, gomod2nix }:
(flake-utils.lib.eachDefaultSystem (system:
outputs =
{
devenv,
flake-utils,
gomod2nix,
nixpkgs,
self,
}@inputs:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};

# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
# This has no effect on other platforms.
callPackage =
pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
in {
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
in
{
packages.default = callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
devShells.default = callPackage ./shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
(
{ pkgs, ... }:
let
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; };
in
{
packages = with pkgs; [
goEnv
gomod2nix.legacyPackages.${system}.gomod2nix
docker
helmfile
kubernetes-helm
];
}
)
];
};
}));
}
));
}
26 changes: 0 additions & 26 deletions shell.nix

This file was deleted.

0 comments on commit 238fb08

Please sign in to comment.