Skip to content

Commit

Permalink
Problem: Without fractalide in the context, requires don't work
Browse files Browse the repository at this point in the history
Solution: Use extraSrcs to put compiler-lib into the fractalide
derivation.

racket -l- raco test works, as long as you don't try to run it inside
a Nix derivation. If you try to do it inside Nix, raco tries and fails
to create $HOME.

But it's slower than a full racket plus a user-installed fractalide:

```
$ time raco test modules/rkt/rkt-fbp/agents/plumbing/
[ . . . ]
raco test: (submod "modules/rkt/rkt-fbp/agents/plumbing/transform-in-msgs.rkt" test)
raco test: (submod "modules/rkt/rkt-fbp/agents/plumbing/transform-ins-msgs.rkt" test)
18 tests passed

real	0m13,330s
user	0m11,797s
sys	0m1,541s
```

```
pkgs$ time $(nix-build -A fractalide-tests-pkg.env)/bin/racket -l- raco test $(nix-build -A fractalide-tests-pkg.env)/share/racket/pkgs/*/modules/rkt/rkt-fbp/agents/plumbing
[ . . . ]
raco test: (submod "/nix/store/0siifhd8zjlkq2j793la97p0r19j3in8-fractalide-env/share/racket/pkgs/fractalide/modules/rkt/rkt-fbp/agents/plumbing/transform-in-msgs.rkt" test)
raco test: @(test-responsible '("[email protected]" "[email protected]"))
raco test: (submod "/nix/store/0siifhd8zjlkq2j793la97p0r19j3in8-fractalide-env/share/racket/pkgs/fractalide/modules/rkt/rkt-fbp/agents/plumbing/transform-ins-msgs.rkt" test)
raco test: @(test-responsible '("[email protected]" "[email protected]"))
18 tests passed

real	0m29,413s
user	0m15,441s
sys	0m12,025s
```
  • Loading branch information
clacke committed Aug 15, 2018
1 parent 14bef8b commit 119a6d7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,23 @@ pkgs {
};

# fractalide/racket2nix#78 workaround
# This simple switcheroo only works because fractalide happens to depend on all of
# I considered just flattening, but fractalide/racket2nix#156

# This simple addition works because fractalide happens to depend on all of
# compiler-lib's dependencies (because it happens to depend on compiler-lib).
fractalide-tests-pkg = fractalide.overrideRacketDerivation (oldAttrs: {
src = fetchurl {
extraSrcs = [(fetchurl {
url = "https://download.racket-lang.org/releases/6.12/pkgs/compiler-lib.zip";
sha1 = "8921c26c498e920aca398df7afb0ab486636430f";
};
})];
# Remove compiler-lib from its own dependencies.
racketBuildInputs = builtins.filter (input: input.name != "compiler-lib") oldAttrs.racketBuildInputs;
});

fractalide-tests = self.runCommand "fractalide-tests" {
buildInputs = [ fractalide-tests-pkg.env ];
} ''
racket -l- raco test ${fractalide.env}/share/racket/pkgs/*/modules/rkt/rkt-fbp/agents
racket -l- raco test ${fractalide-tests-pkg.env}/share/racket/pkgs/*/modules/rkt/rkt-fbp/agents
'';
})
];
Expand Down

0 comments on commit 119a6d7

Please sign in to comment.