Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Go delve workaround #1406

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/modules/languages/go.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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";

Expand Down
14 changes: 14 additions & 0 deletions src/modules/top-level.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -250,6 +261,8 @@ in
pkgs.pkg-config
];

hardeningDisable = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled with the default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


enterShell = ''
export PS1="\[\e[0;34m\](devenv)\[\e[0m\] ''${PS1-}"

Expand Down Expand Up @@ -284,6 +297,7 @@ in

shell = performAssertions (
(pkgs.mkShell.override { stdenv = config.stdenv; }) ({
hardeningDisable = config.hardeningDisable;
name = "devenv-shell";
packages = config.packages;
shellHook = ''
Expand Down
Loading