-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathraw.nix
65 lines (61 loc) · 2.69 KB
/
raw.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ pkgs ? import (fetchTarball { # TODO: remove, as it move into examples.nix
url = "https://github.com/NixOS/nixpkgs/archive/e8c38b73aeb218e27163376a2d617e61a2ad9b59.tar.gz";
sha256 = "1n6gdjny8k5rwkxh6sp1iwg1y3ni1pm7lvh9sisifgjb18jdvzbm";
}) {}
}:
pkgs.lib.makeScope pkgs.lib.callPackageWith (raw/*deterload-scope itself*/: {
deterPkgs = let callPackageDefaultThrowWith = autoArgs: fn: args:
let inherit (pkgs.lib) isFunction functionArgs intersectAttrs mapAttrs filterAttrs attrNames makeOverridable;
f = if isFunction fn then fn else import fn;
fargs = functionArgs f;
allArgs = intersectAttrs fargs autoArgs // args;
missingArgs =
# Throw error message for missing args
(mapAttrs (name: value: throw ''Argument "${name}" has not been overrided'')
# Filter out arguments that have a default value
(filterAttrs (name: value: ! value)
# Filter out arguments that would be passed
(removeAttrs fargs (attrNames allArgs))));
in makeOverridable f (allArgs // missingArgs);
in pkgs.lib.makeScope callPackageDefaultThrowWith (self: pkgs // {
riscv64-pkgs = pkgs.pkgsCross.riscv64;
riscv64-stdenv = self.riscv64-pkgs.gcc14Stdenv;
riscv64-cc = self.riscv64-stdenv.cc;
riscv64-fortran = self.riscv64-pkgs.wrapCCWith {
cc = self.riscv64-stdenv.cc.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
};
# fixup wrapped prefix, which only appear if hostPlatform!=targetPlatform
# for more details see <nixpkgs>/pkgs/build-support/cc-wrapper/default.nix
stdenvNoCC = self.riscv64-pkgs.stdenvNoCC.override {
hostPlatform = pkgs.stdenv.hostPlatform;
};
# Beginning from 24.05, wrapCCWith receive `runtimeShell`.
# If leave it empty, the default uses riscv64-pkgs.runtimeShell,
# thus executing the sheBang will throw error:
# `cannot execute: required file not found`.
runtimeShell = pkgs.runtimeShell;
};
rmExt = name: builtins.concatStringsSep "."
(pkgs.lib.init
(pkgs.lib.splitString "." name));
writeShScript = name: passthru: text: pkgs.writeTextFile {
inherit name;
text = ''
#!/usr/bin/env sh
${text}
'';
executable = true;
derivationArgs = { inherit passthru; };
};
});
benchmarks = raw.deterPkgs.callPackage ./benchmarks {};
build = raw.deterPkgs.callPackage ./builders {};
spec2006 = builtins.mapAttrs (name: benchmark: (raw.build benchmark))
(pkgs.lib.filterAttrs (n: v: (pkgs.lib.isDerivation v)) raw.benchmarks.spec2006);
openblas = raw.build raw.benchmarks.openblas;
})