Skip to content

Commit

Permalink
Merge #2766
Browse files Browse the repository at this point in the history
2766: Misc dev env fixes r=rvl a=rvl

### Issue Number

Found while working on #2765.

### Overview

This is a mixed bag of small tweaks.

- ~Adds `.dir-locals.el` with conservative presets for Emacs users.~
- Add tracing of job names to Hydra evaluation (thanks for the tip @hamishmack)
- Delete some unneeded code in `shell.nix` (thanks for the tip @jbgi @nrdxp)
- Change `scripts/gen-hie.sh` to make symlinks if `hie.yaml` and `.ghci` don't exist.
- `.gitignore` and `.editorconfig` tweaks.


Co-authored-by: Rodney Lorrimar <[email protected]>
  • Loading branch information
iohk-bors[bot] and rvl authored Jul 20, 2021
2 parents 914668d + 038f712 commit a6ae584
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ insert_final_newline = true
[stack.yaml]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
indent_size = 8

[*.hs]
indent_size = 4
max_line_length = 80

[*.nix]
indent_size = 2
max_line_length = 100
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
### Haskell ###
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dump-hi
*.dyn_hi
*.tix
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog

### Cabal ###
dist
dist-*
.ghc.environment.*
cabal*.project.local*

### Stack ###
.stack-work/
*.project.local*
stack.yaml.lock
.HTF/
.ghc.environment.*

### Local configs ###
.ghci
*.tix
hie.yaml

### Nix ###
Expand Down
12 changes: 12 additions & 0 deletions nix/util.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@
"versionTag: \"${cabalName}\" does not have a version in YYYY.M.D format";
(name + tag + lib.concatStrings rest);

# Recursively traces an attrset as it's evaluated.
# This is helpful to use in the Hydra jobset so that we can more
# easily locate evaluation problems.
traceNames = let
go = prefix: builtins.mapAttrs (n: v:
if builtins.isAttrs v
then if v ? type && v.type == "derivation"
then __trace (prefix + n) v
else go (prefix + n + ".") v
else v);
in
go;
}
2 changes: 1 addition & 1 deletion release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,4 @@ let
in if (jobset != null) then f path jobset else [];

in
platformJobs // required
pkgs.commonLib.traceNames "job " (platformJobs // required)
29 changes: 24 additions & 5 deletions scripts/gen-hie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,29 @@ echo "Generating $out. Some cabal builds may be necessary."

setup_cabal_plan

make_hie > $out
tmp=$(mktemp -d)
cleanup() { rm -rf "$tmp"; }
trap cleanup EXIT

make_hie > "$tmp/hie.yaml"
mv "$tmp/hie.yaml" $out

make_ghci > "$tmp/.ghci"
mv "$tmp/.ghci" $ghci

symlink() {
src="$1"
target="$2"

if [ ! -e "$target" ] || [ -L "$target" ]; then
ln -vsf "$src" "$target"
else
echo "Refusing to overwrite $target - check the file then run:"
echo " ln -sf $src $target"
fi
}

make_ghci > $ghci
symlink "$ghci" .ghci
symlink "$out" hie.yaml

echo "Finished. Type the following to enable your config:"
echo " ln -sf $out hie.yaml"
echo " ln -sf $ghci .ghci"
echo "Finished."
11 changes: 1 addition & 10 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let
mkShell = name: project: project.shellFor rec {
inherit name;
packages = ps: lib.attrValues (selectProjectPackages ps);
buildInputs = (with walletPackages; [
nativeBuildInputs = (with walletPackages; [
cardano-node
cardano-cli
cardano-address
Expand Down Expand Up @@ -59,15 +59,6 @@ let

CARDANO_NODE_CONFIGS = pkgs.cardano-node-deployments;

# If any build input has bash completions, add it to the search
# path for shell completions.
XDG_DATA_DIRS = lib.concatStringsSep ":" (
[(builtins.getEnv "XDG_DATA_DIRS")] ++
(lib.filter
(share: builtins.pathExists (share + "/bash-completion"))
(map (p: p + "/share") buildInputs))
);

meta.platforms = lib.platforms.unix;
};
in
Expand Down

0 comments on commit a6ae584

Please sign in to comment.