diff options
author | tilpner | 2018-09-23 23:27:33 +0200 |
---|---|---|
committer | tilpner | 2018-09-23 23:27:33 +0200 |
commit | d150421907782ea19615f4896104a8ea30fd3e7a (patch) | |
tree | b9b2170065aa5042edba968d22aad95df63e6f66 | |
parent | 9256a12173b6d60eb13d55c67db01985c0a96526 (diff) | |
download | qeval-d150421907782ea19615f4896104a8ea30fd3e7a.tar.gz qeval-d150421907782ea19615f4896104a8ea30fd3e7a.tar.xz qeval-d150421907782ea19615f4896104a8ea30fd3e7a.zip |
Add wip nix evaluator
-rw-r--r-- | evaluators.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/evaluators.nix b/evaluators.nix index a88fc56..a9fffc2 100644 --- a/evaluators.nix +++ b/evaluators.nix @@ -407,6 +407,48 @@ let testOutput = "\"success\""; }; + nix = + let + nixpkgsAsDerivation = runCommand "nixpkgs-as-derivation" {} '' + cp -a ${path} $out + ''; + in + prepareJob { + name = "nix"; + mem = 200; + storeDrives.nix = [ + (nix.override { + storeDir = "/tmp/nix/store"; + stateDir = "/tmp/nix/var"; + }) + ]; + + storeDrives.nixpkgs = [ nixpkgsAsDerivation ]; + + preCommand = '' + mkdir -p /tmp/nix/var/nix/db + touch /tmp/nix/var/nix/db/big-lock + + # echo nixbld1:x:30001:30000:Nix build user 1:/:/bin/sh >> /etc/passwd + # echo nixbld:x:30000:nixbld1 >> /etc/group + + mkdir -p /etc/nix + echo 'build-users-group =' >> /etc/nix/nix.conf + + nix-instantiate --eval -E "42" + ''; + + command = '' + export NIX_PATH=nixpkgs=${toString nixpkgsAsDerivation} + nix-instantiate --eval --read-write-mode --option allow-unsafe-native-code-during-evaluation true "$1" + ''; + + testInput = '' + with import <nixpkgs> {}; builtins.readFile (stdenvNoCC.mkDerivation { name = "foo"; buildCommand = "echo success > $out"; }) + ''; + testOutput = "\"success\""; + }; + listAll = with self; [ ash sh |