Fix infinite recursion with pkgs.devshell.mkShell

This commit is contained in:
jhonas 2022-10-11 10:44:32 +02:00
parent aa428101e8
commit f74ffebc23
Signed by: teutat3s
GPG key ID: 924889A86D0B0FEB
2 changed files with 40 additions and 57 deletions

View file

@ -12,63 +12,46 @@
"x86_64-darwin" "x86_64-darwin"
"x86_64-linux" "x86_64-linux"
] ]
(system: (
let system:
pkgs = import nixpkgs { let
inherit system; pkgs = import nixpkgs {
}; inherit system;
in
{ overlays = [
devshell.overlay
(import ./overlay.nix)
];
};
in
{
devshellModules.tritonshell = { config, lib, ... }: { devshellModules.tritonshell = { config, lib, ... }: {
options.environment = { options.environment = {
enable = lib.mkEnableOption "environment"; enable = lib.mkEnableOption "triton DevOps shell environment";
# TODO: add real config here
}; };
config = config =
# TODO: set some devshell config here, like add a new command lib.mkIf config.environment.enable (import ./tritonshell.nix { inherit devshell pkgs self system; });
let };
pkgs = import nixpkgs { # Internal utility package with shell function and env vars helper.
inherit system; # These get source'd in devshell.bash.extra when starting tritonshell
packages = {
overlays = [ triton-utils = import ./pkgs/triton-utils.nix { inherit pkgs; };
devshell.overlay triton-docker-env =
(import ./overlay.nix) let
]; # CUSTOMIZE:
}; # variables used to set triton env vars in tritonshell
# adjust to suit your Triton Data Center setup
# HINT: add your extra devshell pkgs here, use any packages you want # take a look at ./pkgs/triton-docker-env-shell.nix to see how these get used
# available in your devshell's PATH cnsBaseDomain = "greenbaum.zone";
# Use https://search.nixos.org/packages to find available packages dataCenters = [ "cgn-1" "lev-1" ];
# in the unstable channel mantaDomain = "eu-central.manta.greenbaum.cloud";
# These get appended to devshell.packages in ./tritonshell.nix tritonApiDomain = "api.greenbaum.cloud";
extraDevshellPkgs = with pkgs; [ in
#hello import ./pkgs/triton-docker-env.nix {
]; inherit pkgs cnsBaseDomain dataCenters mantaDomain tritonApiDomain;
in
lib.optionalAttrs config.environment.enable {
devShells.default =
(import ./tritonshell.nix { inherit extraDevshellPkgs devshell pkgs self system; });
};
}; };
# Internal utility package with shell function and env vars helper. };
# These get source'd in devshell.bash.extra when starting tritonshell }
packages = { );
triton-utils = import ./pkgs/triton-utils.nix { inherit pkgs; };
triton-docker-env =
let
# CUSTOMIZE:
# variables used to set triton env vars in tritonshell
# adjust to suit your Triton Data Center setup
# take a look at ./pkgs/triton-docker-env-shell.nix to see how these get used
cnsBaseDomain = "greenbaum.zone";
dataCenters = [ "cgn-1" "lev-1" ];
mantaDomain = "eu-central.manta.greenbaum.cloud";
tritonApiDomain = "api.greenbaum.cloud";
in
import ./pkgs/triton-docker-env.nix {
inherit pkgs cnsBaseDomain dataCenters mantaDomain tritonApiDomain;
};
};
});
} }

View file

@ -1,5 +1,5 @@
{ extraDevshellPkgs, devshell, pkgs, self, system, ... }: { devshell, pkgs, self, system, ... }:
pkgs.devshell.mkShell { {
# devshell docs: https://numtide.github.io/devshell/modules_schema.html # devshell docs: https://numtide.github.io/devshell/modules_schema.html
name = "tritonshell"; name = "tritonshell";
@ -62,7 +62,7 @@ pkgs.devshell.mkShell {
# useful for working with JSON data # useful for working with JSON data
jq jq
bunyan-rs bunyan-rs
] ++ extraDevshellPkgs; ];
env = [ env = [
# workaround for TLS certs bug in docker-compose, CERTIFICATE_VERIFY_FAILED # workaround for TLS certs bug in docker-compose, CERTIFICATE_VERIFY_FAILED