diff --git a/src/modules/languages/go.nix b/src/modules/languages/go.nix index d7855952d..6fd2e6ec2 100644 --- a/src/modules/languages/go.nix +++ b/src/modules/languages/go.nix @@ -21,6 +21,12 @@ in defaultText = lib.literalExpression "pkgs.go"; description = "The Go package to use."; }; + + enableHardeningWorkaround = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable hardening workaround required for Delve debugger (https://github.com/go-delve/delve/issues/3085)"; + }; }; config = lib.mkIf cfg.enable { @@ -39,6 +45,8 @@ in (buildWithSpecificGo pkgs.gotests) ]; + hardeningDisable = (lib.optional (cfg.enableHardeningWorkaround) "fortify"); + env.GOROOT = cfg.package + "/share/go/"; env.GOPATH = config.env.DEVENV_STATE + "/go"; diff --git a/src/modules/top-level.nix b/src/modules/top-level.nix index edf4b361c..063d1aa8d 100644 --- a/src/modules/top-level.nix +++ b/src/modules/top-level.nix @@ -136,6 +136,17 @@ in ''; }; + hardeningDisable = lib.mkOption { + type = types.listOf types.str; + internal = true; + default = [ ]; + example = [ "fortify" ]; + description = '' + This options allows modules to disable selected hardening modules. + Currently used only for Go + ''; + }; + warnings = lib.mkOption { type = types.listOf types.str; internal = true; @@ -284,6 +295,7 @@ in shell = performAssertions ( (pkgs.mkShell.override { stdenv = config.stdenv; }) ({ + hardeningDisable = config.hardeningDisable; name = "devenv-shell"; packages = config.packages; shellHook = ''