From d150421907782ea19615f4896104a8ea30fd3e7a Mon Sep 17 00:00:00 2001 From: tilpner Date: Sun, 23 Sep 2018 23:27:33 +0200 Subject: Add wip nix evaluator --- evaluators.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) 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 {}; builtins.readFile (stdenvNoCC.mkDerivation { name = "foo"; buildCommand = "echo success > $out"; }) + ''; + testOutput = "\"success\""; + }; + listAll = with self; [ ash sh -- cgit v1.2.3