From d7b828f79f1ec6dfd7d31942402ad0b5951fc4a3 Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Mon, 11 Apr 2022 15:05:27 +0200 Subject: [PATCH] Add develop shell --- flake.nix | 1 + shell.nix | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 shell.nix diff --git a/flake.nix b/flake.nix index f4a58f7..c5f7696 100644 --- a/flake.nix +++ b/flake.nix @@ -68,5 +68,6 @@ stateVersion = "21.11"; }; }; + devShell.${system} = import ./shell.nix { pkgs = pkgsUnstable; }; }; } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..be552ad --- /dev/null +++ b/shell.nix @@ -0,0 +1,30 @@ +{ pkgs ? import { } }: + +pkgs.mkShell rec { + name = "qois-infrastructure-shell"; + buildInputs = let + extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide ]; + vscode-with-extensions = + pkgs.vscode-with-extensions.override { vscodeExtensions = extensions; }; + in with pkgs; [ vscode-with-extensions nixfmt rnix-lsp ]; + LANG = "C.UTF-8"; + LC_ALL = "C.UTF-8"; + shellHook = '' + # Bring xdg data dirs of dependencies and current program into the + # environment. This will allow us to get shell completion if any + # and there might be other benefits as well. + xdg_inputs=( "''${buildInputs[@]}" ) + for p in "''${xdg_inputs[@]}"; do + if [[ -d "$p/share" ]]; then + XDG_DATA_DIRS="''${XDG_DATA_DIRS}''${XDG_DATA_DIRS+:}$p/share" + fi + done + export XDG_DATA_DIRS + + # Make sure we support the pure case as well as non nixos cases + # where dynamic bash completions were not sourced. + #if ! type _completion_loader > /dev/null; then + # . ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh + #fi + ''; +}