From 32124eb8e2c8e1fcf373c327f9147f885cb919d5 Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Tue, 7 Jan 2025 14:11:56 +0200 Subject: [PATCH] Add sas devshell Signed-off-by: Nikolaos Karaolidis --- flake.nix | 1 + hosts/common/shells/sas/default.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 hosts/common/shells/sas/default.nix diff --git a/flake.nix b/flake.nix index 6e986b0..dfb3474 100644 --- a/flake.nix +++ b/flake.nix @@ -107,6 +107,7 @@ nix = import ./hosts/common/shells/nix { inherit pkgs; }; nodejs = import ./hosts/common/shells/nodejs { inherit pkgs; }; python = import ./hosts/common/shells/python { inherit pkgs; }; + sas = import ./hosts/common/shells/sas { inherit pkgs; }; }; formatter = pkgs.nixfmt-rfc-style; diff --git a/hosts/common/shells/sas/default.nix b/hosts/common/shells/sas/default.nix new file mode 100644 index 0000000..c528f1e --- /dev/null +++ b/hosts/common/shells/sas/default.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: +pkgs.mkShell { + packages = with pkgs; [ + go + gopls + go-tools + golangci-lint + golangci-lint-langserver + jdk17 + ]; + + shellHook = '' + if git rev-parse --is-inside-work-tree &> /dev/null; then + TOP="$(git rev-parse --show-toplevel)" + if ! grep -q "^\.go$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".go" >> "$TOP/.git/info/exclude"; fi + if ! grep -q "^\.gradle$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".gradle" >> "$TOP/.git/info/exclude"; fi + else + TOP="$(pwd)" + fi + + export GOPATH="$TOP/.go" + export GOPROXY=goproxy.unx.sas.com + export GONOSUMDB=*.sas.com,sassoftware.io + export JAVA_HOME="${pkgs.jdk17.home}" + export GRADLE_USER_HOME="$TOP/.gradle" + mkdir -p "$GRADLE_USER_HOME" && cp -f ~/.gradle/gradle.properties "$GRADLE_USER_HOME/gradle.properties" + ''; +}