Skip to content

Commit

Permalink
Setup project in VS Code (#31)
Browse files Browse the repository at this point in the history
* VS Code integration
* Update flake-compat
* Add documentation how to setup project in vs code
  • Loading branch information
ssledz authored Nov 11, 2024
1 parent e3d9d8b commit f770fca
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 12 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,49 @@ locally
```
nix run -L .#fida-contracts:exe:fida-contracts-serialise -- -o ~/now/fida-purs-module/
```

### VS Code Setup

- Install direnv

```
nix profile install nixpkgs#direnv
```

and add following line

for zsh -> to the `~/.zshrc`

```
eval "$(direnv hook zsh)"
```

for bash -> `~/.bashrc`

```
eval "$(direnv hook bash)"
```

- Install https://github.com/nix-community/nix-direnv

```
nix profile install nixpkgs#nix-direnv
```

and add following to the `~/.zshrc` (`~/.bashrc`) file

```
source $HOME/.nix-profile/share/nix-direnv/direnvrc
```

- Allow .envrc to be loaded

```
cd fida-contracts
direnv allow
```

- Install VS Code extensions

* direnv
* Haskell
10 changes: 10 additions & 0 deletions fida-contracts.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"haskell.manageHLS": "PATH"
}
}
12 changes: 5 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
CHaP.follows = "cardano-transaction-lib/plutip/CHaP";
plutip.follows = "cardano-transaction-lib/plutip";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
};

outputs = { self, nixpkgs, haskell-nix, iohk-nix, CHaP, plutip, ... }:
Expand Down
3 changes: 2 additions & 1 deletion src/Fida/Contract/Insurance/PiggyBank.hs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ mkPiggyBankValidator (InsuranceId cs) (FidaCardId n) (PBankFidaCard {pbfcPaidCla
isFidaCardOwner = valueOf (valueSpent txInfo) cs (fidaCardTokenName n) == 1
isClaimPaid = fromMaybe True (((`elem` pbfcPaidClaims) . claimId) <$> mClaim)

mkPiggyBankValidator _ _ _ _ _ = False
mkPiggyBankValidator _ _ _ _ _ =
traceError "ERROR-PIGGY-BANK-VALIDATOR-32"

{-# INLINEABLE mkPiggyBankValidatorUntyped #-}
mkPiggyBankValidatorUntyped ::
Expand Down

0 comments on commit f770fca

Please sign in to comment.