style: format entire depot with nixpkgs-fmt
This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: cynthia <cynthia@tvl.fyi> Reviewed-by: edef <edef@edef.eu> Reviewed-by: eta <tvl@eta.st> Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
parent
2d10d60fac
commit
aa122cbae7
310 changed files with 7278 additions and 5490 deletions
|
@ -30,7 +30,8 @@ let
|
|||
</style>
|
||||
'';
|
||||
};
|
||||
in pkgs.runCommandNoCC "corp-website" {} ''
|
||||
in
|
||||
pkgs.runCommandNoCC "corp-website" { } ''
|
||||
mkdir $out
|
||||
cp ${index} $out/index.html
|
||||
''
|
||||
|
|
13
default.nix
13
default.nix
|
@ -4,7 +4,9 @@
|
|||
|
||||
{ nixpkgsBisectPath ? null
|
||||
, parentTargetMap ? null
|
||||
, nixpkgsConfig ? {}, ... }@args:
|
||||
, nixpkgsConfig ? { }
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
let
|
||||
inherit (builtins)
|
||||
|
@ -70,7 +72,8 @@ let
|
|||
# Is this tree node eligible for build inclusion?
|
||||
eligible = node: (node ? outPath) && !(node.meta.ci.skip or false);
|
||||
|
||||
in readTree.fix(self: (readDepot {
|
||||
in
|
||||
readTree.fix (self: (readDepot {
|
||||
depot = self;
|
||||
|
||||
# Pass third_party as 'pkgs' (for compatibility with external
|
||||
|
@ -110,8 +113,10 @@ in readTree.fix(self: (readDepot {
|
|||
});
|
||||
|
||||
# Derivation that gcroots all depot targets.
|
||||
ci.gcroot = with self.third_party.nixpkgs; makeSetupHook {
|
||||
ci.gcroot = with self.third_party.nixpkgs; makeSetupHook
|
||||
{
|
||||
name = "depot-gcroot";
|
||||
deps = self.ci.targets;
|
||||
} emptyFile;
|
||||
}
|
||||
emptyFile;
|
||||
})
|
||||
|
|
|
@ -33,7 +33,8 @@ let
|
|||
cp ${frontend} $out/index.html
|
||||
''}/")
|
||||
'';
|
||||
in depot.nix.buildLisp.program {
|
||||
in
|
||||
depot.nix.buildLisp.program {
|
||||
name = "gemma";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
|
@ -14,7 +14,8 @@ let
|
|||
};
|
||||
package = python3Packages.buildPythonPackage opts;
|
||||
script = python3Packages.buildPythonApplication opts;
|
||||
in depot.nix.readTree.drvTargets {
|
||||
in
|
||||
depot.nix.readTree.drvTargets {
|
||||
inherit script;
|
||||
python = python3.withPackages (_: [ package ]);
|
||||
setAlarm = pkgs.writeShellScriptBin "set-alarm" ''
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ depot ? (import ../../../. { })
|
||||
, pkgs ? depot.third_party.nixpkgs
|
||||
, ... }:
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
basePkg = pkgs.haskellPackages.callPackage ./pkg.nix { };
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{ mkDerivation, base, bytestring, chatter, containers, envy
|
||||
, irc-client, lens, lib, random, relude, text
|
||||
{ mkDerivation
|
||||
, base
|
||||
, bytestring
|
||||
, chatter
|
||||
, containers
|
||||
, envy
|
||||
, irc-client
|
||||
, lens
|
||||
, lib
|
||||
, random
|
||||
, relude
|
||||
, text
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "owothia";
|
||||
|
@ -8,8 +18,16 @@ mkDerivation {
|
|||
isLibrary = false;
|
||||
isExecutable = true;
|
||||
executableHaskellDepends = [
|
||||
base bytestring chatter containers envy irc-client lens random
|
||||
relude text
|
||||
base
|
||||
bytestring
|
||||
chatter
|
||||
containers
|
||||
envy
|
||||
irc-client
|
||||
lens
|
||||
random
|
||||
relude
|
||||
text
|
||||
];
|
||||
license = "unknown";
|
||||
hydraPlatforms = lib.platforms.none;
|
||||
|
|
|
@ -12,7 +12,8 @@ let
|
|||
gopkgs."github.com".pkg.browser.gopkg
|
||||
];
|
||||
};
|
||||
in uggc.overrideAttrs(old: {
|
||||
in
|
||||
uggc.overrideAttrs (old: {
|
||||
buildCommand = old.buildCommand + ''
|
||||
install -D ${./uggc.desktop} $out/share/applications/uggc.desktop
|
||||
sed "s|@out@|$out|g" -i $out/share/applications/uggc.desktop
|
||||
|
|
|
@ -38,6 +38,7 @@ let
|
|||
"ecl" # refuses to create non-ASCII paths even on POSIX…
|
||||
];
|
||||
};
|
||||
in bin // {
|
||||
in
|
||||
bin // {
|
||||
inherit lib;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
# rules_go.
|
||||
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, ... }:
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins)
|
||||
|
@ -94,7 +95,8 @@ let
|
|||
goDeps = uniqueDeps;
|
||||
goImportPath = path;
|
||||
};
|
||||
in gopkg;
|
||||
in
|
||||
gopkg;
|
||||
|
||||
# Build a tree of Go libraries out of an external Go source
|
||||
# directory that follows the standard Go layout and was not built
|
||||
|
@ -124,7 +126,8 @@ let
|
|||
# Build a Go library out of the specified gRPC definition.
|
||||
grpc = args: proto (args // { extraDeps = [ protoLibs.goGrpc.gopkg ]; });
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
# Only the high-level builder functions are exposed, but made
|
||||
# overrideable.
|
||||
program = makeOverridable program;
|
||||
|
|
|
@ -29,7 +29,8 @@ let
|
|||
# Example use of buildGo.program, which builds an executable using
|
||||
# the specified name and dependencies (which in turn must have been
|
||||
# created via buildGo.package etc.)
|
||||
in buildGo.program {
|
||||
in
|
||||
buildGo.program {
|
||||
name = "example";
|
||||
|
||||
srcs = [
|
||||
|
|
32
nix/buildGo/external/default.nix
vendored
32
nix/buildGo/external/default.nix
vendored
|
@ -52,13 +52,21 @@ let
|
|||
|
||||
toPackage = self: src: path: depMap: entry:
|
||||
let
|
||||
localDeps = map (d: lib.attrByPath (d ++ [ "gopkg" ]) (
|
||||
localDeps = map
|
||||
(d: lib.attrByPath (d ++ [ "gopkg" ])
|
||||
(
|
||||
throw "missing local dependency '${lib.concatStringsSep "." d}' in '${path}'"
|
||||
) self) entry.localDeps;
|
||||
)
|
||||
self)
|
||||
entry.localDeps;
|
||||
|
||||
foreignDeps = map (d: lib.attrByPath [ d.path ] (
|
||||
foreignDeps = map
|
||||
(d: lib.attrByPath [ d.path ]
|
||||
(
|
||||
throw "missing foreign dependency '${d.path}' in '${path}, imported at ${d.position}'"
|
||||
) depMap) entry.foreignDeps;
|
||||
)
|
||||
depMap)
|
||||
entry.foreignDeps;
|
||||
|
||||
args = {
|
||||
srcs = map (f: src + ("/" + f)) entry.files;
|
||||
|
@ -74,22 +82,28 @@ let
|
|||
binArgs = args // {
|
||||
name = (last ((lib.splitString "/" path) ++ entry.locator));
|
||||
};
|
||||
in if entry.isCommand then (program binArgs) else (package libArgs);
|
||||
in
|
||||
if entry.isCommand then (program binArgs) else (package libArgs);
|
||||
|
||||
in { src, path, deps ? [] }: let
|
||||
in
|
||||
{ src, path, deps ? [ ] }:
|
||||
let
|
||||
# Build a map of dependencies (from their import paths to their
|
||||
# derivation) so that they can be conditionally imported only in
|
||||
# sub-packages that require them.
|
||||
depMap = listToAttrs (map (d: {
|
||||
depMap = listToAttrs (map
|
||||
(d: {
|
||||
name = d.goImportPath;
|
||||
value = d;
|
||||
}) (map (d: d.gopkg) deps));
|
||||
})
|
||||
(map (d: d.gopkg) deps));
|
||||
|
||||
name = pathToName path;
|
||||
analysisOutput = runCommand "${name}-structure.json" { } ''
|
||||
${analyser}/bin/analyser -path ${path} -source ${src} > $out
|
||||
'';
|
||||
analysis = fromJSON (readFile analysisOutput);
|
||||
in lib.fix(self: foldl' lib.recursiveUpdate {} (
|
||||
in
|
||||
lib.fix (self: foldl' lib.recursiveUpdate { } (
|
||||
map (entry: mkset entry.locator (toPackage self src path depMap entry)) analysis
|
||||
))
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
let
|
||||
inherit (builtins) fetchGit map;
|
||||
in rec {
|
||||
in
|
||||
rec {
|
||||
goProto = external {
|
||||
path = "github.com/golang/protobuf";
|
||||
src = fetchGit {
|
||||
|
|
|
@ -70,11 +70,16 @@ let
|
|||
implFilter = impl: xs:
|
||||
let
|
||||
isFilterSet = x: builtins.isAttrs x && !(lib.isDerivation x);
|
||||
in builtins.map (
|
||||
in
|
||||
builtins.map
|
||||
(
|
||||
x: if isFilterSet x then x.${impl.name} or x.default else x
|
||||
) (builtins.filter (
|
||||
)
|
||||
(builtins.filter
|
||||
(
|
||||
x: !(isFilterSet x) || x ? ${impl.name} || x ? default
|
||||
) xs);
|
||||
)
|
||||
xs);
|
||||
|
||||
# Generates lisp code which instructs the given lisp implementation to load
|
||||
# all the given dependencies.
|
||||
|
@ -103,15 +108,19 @@ let
|
|||
# 'allDeps' flattens the list of dependencies (and their
|
||||
# dependencies) into one ordered list of unique deps which
|
||||
# all use the given implementation.
|
||||
allDeps = impl: deps: let
|
||||
allDeps = impl: deps:
|
||||
let
|
||||
# The override _should_ propagate itself recursively, as every derivation
|
||||
# would only expose its actually used dependencies. Use implementation
|
||||
# attribute created by withExtras if present, override in all other cases
|
||||
# (mainly bundled).
|
||||
deps' = builtins.map (dep: dep."${impl.name}" or (dep.overrideLisp (_: {
|
||||
deps' = builtins.map
|
||||
(dep: dep."${impl.name}" or (dep.overrideLisp (_: {
|
||||
implementation = impl;
|
||||
}))) deps;
|
||||
in (lib.toposort dependsOn (lib.unique (
|
||||
})))
|
||||
deps;
|
||||
in
|
||||
(lib.toposort dependsOn (lib.unique (
|
||||
lib.flatten (deps' ++ (map (d: d.lispDeps) deps'))
|
||||
))).result;
|
||||
|
||||
|
@ -138,14 +147,17 @@ let
|
|||
withExtras = f: args:
|
||||
let
|
||||
drv = (makeOverridable f) args;
|
||||
in lib.fix (self:
|
||||
drv.overrideLisp (old:
|
||||
in
|
||||
lib.fix (self:
|
||||
drv.overrideLisp
|
||||
(old:
|
||||
let
|
||||
implementation = old.implementation or defaultImplementation;
|
||||
brokenOn = old.brokenOn or [ ];
|
||||
targets = lib.subtractLists (brokenOn ++ [ implementation.name ])
|
||||
(builtins.attrNames impls);
|
||||
in {
|
||||
in
|
||||
{
|
||||
passthru = (old.passthru or { }) // {
|
||||
repl = implementation.lispWith [ self ];
|
||||
|
||||
|
@ -153,12 +165,14 @@ let
|
|||
meta = (old.passthru.meta or { }) // {
|
||||
inherit targets;
|
||||
};
|
||||
} // builtins.listToAttrs (builtins.map (impl: {
|
||||
} // builtins.listToAttrs (builtins.map
|
||||
(impl: {
|
||||
inherit (impl) name;
|
||||
value = self.overrideLisp (_: {
|
||||
implementation = impl;
|
||||
});
|
||||
}) (builtins.attrValues impls));
|
||||
})
|
||||
(builtins.attrValues impls));
|
||||
}) // {
|
||||
overrideLisp = new: withExtras f (args // new args);
|
||||
});
|
||||
|
@ -170,7 +184,9 @@ let
|
|||
lispDeps = allDeps implementation (implFilter implementation deps);
|
||||
lispNativeDeps = allNative native lispDeps;
|
||||
filteredSrcs = implFilter implementation srcs;
|
||||
in runCommandNoCC name {
|
||||
in
|
||||
runCommandNoCC name
|
||||
{
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath lispNativeDeps;
|
||||
LANG = "C.UTF-8";
|
||||
} ''
|
||||
|
@ -452,7 +468,8 @@ let
|
|||
} $@
|
||||
'';
|
||||
|
||||
bundled = name: runCommandNoCC "${name}-cllib" {
|
||||
bundled = name: runCommandNoCC "${name}-cllib"
|
||||
{
|
||||
passthru = {
|
||||
lispName = name;
|
||||
lispNativeDeps = [ ];
|
||||
|
@ -489,7 +506,8 @@ let
|
|||
|
||||
# See https://ccl.clozure.com/docs/ccl.html#building-definitions
|
||||
faslExt =
|
||||
/**/ if targetPlatform.isPowerPC && targetPlatform.is32bit then "pfsl"
|
||||
/**/
|
||||
if targetPlatform.isPowerPC && targetPlatform.is32bit then "pfsl"
|
||||
else if targetPlatform.isPowerPC && targetPlatform.is64bit then "p64fsl"
|
||||
else if targetPlatform.isx86_64 && targetPlatform.isLinux then "lx64fsl"
|
||||
else if targetPlatform.isx86_32 && targetPlatform.isLinux then "lx32fsl"
|
||||
|
@ -598,8 +616,11 @@ let
|
|||
filteredSrcs = implFilter implementation srcs;
|
||||
lispNativeDeps = (allNative native filteredDeps);
|
||||
lispDeps = allDeps implementation filteredDeps;
|
||||
testDrv = if ! isNull tests
|
||||
then testSuite {
|
||||
testDrv =
|
||||
if ! isNull tests
|
||||
then
|
||||
testSuite
|
||||
{
|
||||
name = tests.name or "${name}-test";
|
||||
srcs = filteredSrcs ++ (tests.srcs or [ ]);
|
||||
deps = filteredDeps ++ (tests.deps or [ ]);
|
||||
|
@ -607,7 +628,9 @@ let
|
|||
inherit implementation;
|
||||
}
|
||||
else null;
|
||||
in lib.fix (self: runCommandNoCC "${name}-cllib" {
|
||||
in
|
||||
lib.fix (self: runCommandNoCC "${name}-cllib"
|
||||
{
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath lispNativeDeps;
|
||||
LANG = "C.UTF-8";
|
||||
passthru = passthru // {
|
||||
|
@ -656,18 +679,25 @@ let
|
|||
deps = lispDeps;
|
||||
srcs = filteredSrcs;
|
||||
};
|
||||
testDrv = if ! isNull tests
|
||||
then testSuite {
|
||||
testDrv =
|
||||
if ! isNull tests
|
||||
then
|
||||
testSuite
|
||||
{
|
||||
name = tests.name or "${name}-test";
|
||||
srcs =
|
||||
( # testSuite does run implFilter as well
|
||||
filteredSrcs ++ (tests.srcs or []));
|
||||
(
|
||||
# testSuite does run implFilter as well
|
||||
filteredSrcs ++ (tests.srcs or [ ])
|
||||
);
|
||||
deps = filteredDeps ++ (tests.deps or [ ]);
|
||||
expression = tests.expression;
|
||||
inherit implementation;
|
||||
}
|
||||
else null;
|
||||
in lib.fix (self: runCommandNoCC "${name}" {
|
||||
in
|
||||
lib.fix (self: runCommandNoCC "${name}"
|
||||
{
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
LANG = "C.UTF-8";
|
||||
|
@ -678,7 +708,8 @@ let
|
|||
lispBinary = true;
|
||||
tests = testDrv;
|
||||
};
|
||||
} (''
|
||||
}
|
||||
(''
|
||||
${if ! isNull testDrv
|
||||
then "echo 'Test ${testDrv} succeeded'"
|
||||
else ""}
|
||||
|
@ -714,11 +745,13 @@ let
|
|||
}:
|
||||
implementation.bundled or (defaultBundled implementation) name;
|
||||
|
||||
in (makeOverridable bundled') {
|
||||
in
|
||||
(makeOverridable bundled') {
|
||||
inherit name;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
library = withExtras library;
|
||||
program = withExtras program;
|
||||
inherit bundled;
|
||||
|
|
|
@ -22,7 +22,8 @@ let
|
|||
# By default, buildLisp.program expects the entry point to be
|
||||
# `$name:main`. This can be overridden by configuring the `main`
|
||||
# attribute.
|
||||
in buildLisp.program {
|
||||
in
|
||||
buildLisp.program {
|
||||
name = "example";
|
||||
deps = [ libExample ];
|
||||
|
||||
|
|
|
@ -35,18 +35,35 @@ let
|
|||
}:
|
||||
{ content
|
||||
, ...
|
||||
}@page: let
|
||||
}@page:
|
||||
let
|
||||
source = builtins.toFile (basename false page) content;
|
||||
in runExecline (basename gzip page) {} ([
|
||||
(if requireLint then "if" else "foreground") [
|
||||
bins.mandoc "-mdoc" "-T" "lint" source
|
||||
in
|
||||
runExecline (basename gzip page) { } ([
|
||||
(if requireLint then "if" else "foreground")
|
||||
[
|
||||
bins.mandoc
|
||||
"-mdoc"
|
||||
"-T"
|
||||
"lint"
|
||||
source
|
||||
]
|
||||
"importas" "out" "out"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
] ++ (if gzip then [
|
||||
"redirfd" "-w" "1" "$out"
|
||||
bins.gzip "-c" source
|
||||
"redirfd"
|
||||
"-w"
|
||||
"1"
|
||||
"$out"
|
||||
bins.gzip
|
||||
"-c"
|
||||
source
|
||||
] else [
|
||||
bins.cp "--reflink=auto" source "$out"
|
||||
bins.cp
|
||||
"--reflink=auto"
|
||||
source
|
||||
"$out"
|
||||
]));
|
||||
|
||||
buildManPages =
|
||||
|
@ -56,20 +73,30 @@ let
|
|||
, ...
|
||||
}@args:
|
||||
pages:
|
||||
runExecline "${name}-man-pages" {
|
||||
runExecline "${name}-man-pages"
|
||||
{
|
||||
inherit derivationArgs;
|
||||
} ([
|
||||
"importas" "out" "out"
|
||||
] ++ lib.concatMap ({ name, section, content }@page: [
|
||||
"if" [ bins.mkdir "-p" (manDir page) ]
|
||||
"if" [
|
||||
bins.ln "-s"
|
||||
}
|
||||
([
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
] ++ lib.concatMap
|
||||
({ name, section, content }@page: [
|
||||
"if"
|
||||
[ bins.mkdir "-p" (manDir page) ]
|
||||
"if"
|
||||
[
|
||||
bins.ln
|
||||
"-s"
|
||||
(buildManPage args page)
|
||||
(target gzip page)
|
||||
]
|
||||
]) pages);
|
||||
])
|
||||
pages);
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: buildManPages;
|
||||
|
||||
single = buildManPage;
|
||||
|
|
|
@ -29,7 +29,8 @@ let
|
|||
unsafeDiscardStringContext;
|
||||
|
||||
inherit (pkgs) lib runCommandNoCC writeText;
|
||||
in rec {
|
||||
in
|
||||
rec {
|
||||
# Creates a Nix expression that yields the target at the specified
|
||||
# location in the repository.
|
||||
#
|
||||
|
@ -42,7 +43,8 @@ in rec {
|
|||
descend = expr: attr: "builtins.getAttr \"${attr}\" (${expr})";
|
||||
targetExpr = foldl' descend "import ./. {}" target.__readTree;
|
||||
subtargetExpr = descend targetExpr target.__subtarget;
|
||||
in if target ? __subtarget then subtargetExpr else targetExpr;
|
||||
in
|
||||
if target ? __subtarget then subtargetExpr else targetExpr;
|
||||
|
||||
# Create a pipeline label from the target's tree location.
|
||||
mkLabel = target:
|
||||
|
@ -78,7 +80,8 @@ in rec {
|
|||
label = mkLabel target;
|
||||
drvPath = unsafeDiscardStringContext target.drvPath;
|
||||
shouldSkip' = shouldSkip parentTargetMap;
|
||||
in {
|
||||
in
|
||||
{
|
||||
label = ":nix: " + label;
|
||||
key = hashString "sha1" label;
|
||||
skip = shouldSkip' label drvPath;
|
||||
|
@ -96,11 +99,13 @@ in rec {
|
|||
#
|
||||
# This works by assigning each element a chunk ID based on its
|
||||
# index, and then grouping all elements by their chunk ID.
|
||||
chunksOf = n: list: let
|
||||
chunksOf = n: list:
|
||||
let
|
||||
chunkId = idx: toString (idx / n + 1);
|
||||
assigned = lib.imap1 (idx: value: { inherit value; chunk = chunkId idx; }) list;
|
||||
unchunk = mapAttrs (_: elements: map (e: e.value) elements);
|
||||
in unchunk (lib.groupBy (e: e.chunk) assigned);
|
||||
in
|
||||
unchunk (lib.groupBy (e: e.chunk) assigned);
|
||||
|
||||
# Define a build pipeline chunk as a JSON file, using the pipeline
|
||||
# format documented on
|
||||
|
@ -120,61 +125,66 @@ in rec {
|
|||
attrValues (mapAttrs (makePipelineChunk name) (chunksOf 192 steps));
|
||||
|
||||
# Create a pipeline structure for the given targets.
|
||||
mkPipeline = {
|
||||
mkPipeline =
|
||||
{
|
||||
# HEAD branch of the repository on which release steps, GC
|
||||
# anchoring and other "mainline only" steps should run.
|
||||
headBranch,
|
||||
|
||||
# List of derivations as read by readTree (in most cases just the
|
||||
headBranch
|
||||
, # List of derivations as read by readTree (in most cases just the
|
||||
# output of readTree.gather) that should be built in Buildkite.
|
||||
#
|
||||
# These are scheduled as the first build steps and run as fast as
|
||||
# possible, in order, without any concurrency restrictions.
|
||||
drvTargets,
|
||||
|
||||
# Derivation map of a parent commit. Only targets which no longer
|
||||
drvTargets
|
||||
, # Derivation map of a parent commit. Only targets which no longer
|
||||
# correspond to the content of this map will be built. Passing an
|
||||
# empty map will always build all targets.
|
||||
parentTargetMap ? {},
|
||||
|
||||
# A list of plain Buildkite step structures to run alongside the
|
||||
parentTargetMap ? { }
|
||||
, # A list of plain Buildkite step structures to run alongside the
|
||||
# build for all drvTargets, but before proceeding with any
|
||||
# post-build actions such as status reporting.
|
||||
#
|
||||
# Can be used for things like code formatting checks.
|
||||
additionalSteps ? [],
|
||||
|
||||
# A list of plain Buildkite step structures to run after all
|
||||
additionalSteps ? [ ]
|
||||
, # A list of plain Buildkite step structures to run after all
|
||||
# previous steps succeeded.
|
||||
#
|
||||
# Can be used for status reporting steps and the like.
|
||||
postBuildSteps ? [ ]
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
# Convert a target into all of its build and post-build steps,
|
||||
# treated separately as they need to be in different chunks.
|
||||
targetToSteps = target: let
|
||||
targetToSteps = target:
|
||||
let
|
||||
step = mkStep headBranch parentTargetMap target;
|
||||
|
||||
# Split build/post-build steps
|
||||
splitExtraSteps = partition ({ postStep, ... }: postStep)
|
||||
(attrValues (mapAttrs (name: value: {
|
||||
(attrValues (mapAttrs
|
||||
(name: value: {
|
||||
inherit name value;
|
||||
postStep = (value ? prompt) || (value.postBuild or false);
|
||||
}) (target.meta.ci.extraSteps or {})));
|
||||
})
|
||||
(target.meta.ci.extraSteps or { })));
|
||||
|
||||
mkExtraStep' = { name, value, ... }: mkExtraStep step name value;
|
||||
extraBuildSteps = map mkExtraStep' splitExtraSteps.wrong; # 'wrong' -> no prompt
|
||||
extraPostSteps = map mkExtraStep' splitExtraSteps.right; # 'right' -> has prompt
|
||||
in {
|
||||
in
|
||||
{
|
||||
buildSteps = [ step ] ++ extraBuildSteps;
|
||||
postSteps = extraPostSteps;
|
||||
};
|
||||
|
||||
# Combine all target steps into separate build and post-build step lists.
|
||||
steps = foldl' (acc: t: {
|
||||
steps = foldl'
|
||||
(acc: t: {
|
||||
buildSteps = acc.buildSteps ++ t.buildSteps;
|
||||
postSteps = acc.postSteps ++ t.postSteps;
|
||||
}) { buildSteps = []; postSteps = []; } (map targetToSteps drvTargets);
|
||||
})
|
||||
{ buildSteps = [ ]; postSteps = [ ]; }
|
||||
(map targetToSteps drvTargets);
|
||||
|
||||
buildSteps =
|
||||
# Add build steps for each derivation target and their extra
|
||||
|
@ -194,7 +204,8 @@ in rec {
|
|||
buildChunks = pipelineChunks "build" buildSteps;
|
||||
postBuildChunks = pipelineChunks "post" postSteps;
|
||||
chunks = buildChunks ++ postBuildChunks;
|
||||
in runCommandNoCC "buildkite-pipeline" {} ''
|
||||
in
|
||||
runCommandNoCC "buildkite-pipeline" { } ''
|
||||
mkdir $out
|
||||
echo "Generated ${toString (length chunks)} pipeline chunks"
|
||||
${
|
||||
|
@ -206,7 +217,8 @@ in rec {
|
|||
# Create a drvmap structure for the given targets, containing the
|
||||
# mapping of all target paths to their derivations. The mapping can
|
||||
# be persisted for future use.
|
||||
mkDrvmap = drvTargets: writeText "drvmap.json" (toJSON (listToAttrs (map (target: {
|
||||
mkDrvmap = drvTargets: writeText "drvmap.json" (toJSON (listToAttrs (map
|
||||
(target: {
|
||||
name = mkLabel target;
|
||||
value = {
|
||||
drvPath = unsafeDiscardStringContext target.drvPath;
|
||||
|
@ -217,7 +229,8 @@ in rec {
|
|||
target.__subtarget
|
||||
];
|
||||
};
|
||||
}) drvTargets)));
|
||||
})
|
||||
drvTargets)));
|
||||
|
||||
# Implementation of extra step logic.
|
||||
#
|
||||
|
@ -278,15 +291,15 @@ in rec {
|
|||
|
||||
# Create the Buildkite configuration for an extra step, optionally
|
||||
# wrapping it in a gate group.
|
||||
mkExtraStep = parent: key: {
|
||||
command,
|
||||
label ? key,
|
||||
prompt ? false,
|
||||
needsOutput ? false,
|
||||
branches ? null,
|
||||
alwaysRun ? false,
|
||||
postBuild ? false
|
||||
}@cfg: let
|
||||
mkExtraStep = parent: key: { command
|
||||
, label ? key
|
||||
, prompt ? false
|
||||
, needsOutput ? false
|
||||
, branches ? null
|
||||
, alwaysRun ? false
|
||||
, postBuild ? false
|
||||
}@cfg:
|
||||
let
|
||||
parentLabel = parent.env.READTREE_TARGET;
|
||||
|
||||
step = {
|
||||
|
@ -303,8 +316,11 @@ in rec {
|
|||
exec ${command}
|
||||
'';
|
||||
};
|
||||
in if (isString prompt)
|
||||
then mkGatedStep {
|
||||
in
|
||||
if (isString prompt)
|
||||
then
|
||||
mkGatedStep
|
||||
{
|
||||
inherit step label parent prompt;
|
||||
}
|
||||
else step;
|
||||
|
|
|
@ -19,7 +19,8 @@ let
|
|||
let
|
||||
drvOutOutputs = drvOut.outputs or [ "out" ];
|
||||
in
|
||||
pkgs.runCommandLocal drvOut.name {
|
||||
pkgs.runCommandLocal drvOut.name
|
||||
{
|
||||
# we inherit all attributes in order to replicate
|
||||
# the original derivation as much as possible
|
||||
outputs = drvOutOutputs;
|
||||
|
@ -29,15 +30,18 @@ let
|
|||
}
|
||||
# the outputs of the original derivation are replicated
|
||||
# by creating a symlink to the old output path
|
||||
(lib.concatMapStrings (output: ''
|
||||
(lib.concatMapStrings
|
||||
(output: ''
|
||||
target=${lib.escapeShellArg drvOut.${output}}
|
||||
# if the target is already a symlink, follow it until it’s not;
|
||||
# this is done to prevent too many dereferences
|
||||
target=$(readlink -e "$target")
|
||||
# link to the output
|
||||
ln -s "$target" "${"$"}${output}"
|
||||
'') drvOutOutputs));
|
||||
'')
|
||||
drvOutOutputs));
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: drvSeqL;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ let
|
|||
inherit (depot.nix.runTestsuite) runTestsuite it assertEq;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: emptyDerivation;
|
||||
inherit tests;
|
||||
}
|
||||
|
|
|
@ -21,12 +21,16 @@ let
|
|||
|
||||
builder = bins.exec;
|
||||
args = [
|
||||
bins.importas "out" "out"
|
||||
bins.s6-touch "$out"
|
||||
bins.importas
|
||||
"out"
|
||||
"out"
|
||||
bins.s6-touch
|
||||
"$out"
|
||||
];
|
||||
};
|
||||
|
||||
in (derivation emptiness) // {
|
||||
in
|
||||
(derivation emptiness) // {
|
||||
# This allows us to call the empty derivation
|
||||
# like a function and override fields/add new fields.
|
||||
__functor = _: overrides:
|
||||
|
|
|
@ -11,9 +11,16 @@ let
|
|||
|
||||
fooOut = emptyDerivation {
|
||||
builder = writeExecline "foo-builder" { } [
|
||||
"importas" "out" "out"
|
||||
"redirfd" "-w" "1" "$out"
|
||||
bins.s6-echo "-n" "foo"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
"redirfd"
|
||||
"-w"
|
||||
"1"
|
||||
"$out"
|
||||
bins.s6-echo
|
||||
"-n"
|
||||
"foo"
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -26,7 +33,8 @@ let
|
|||
"bar")
|
||||
];
|
||||
|
||||
in runTestsuite "emptyDerivation" [
|
||||
in
|
||||
runTestsuite "emptyDerivation" [
|
||||
empty
|
||||
overrideBuilder
|
||||
]
|
||||
|
|
|
@ -16,14 +16,17 @@ let
|
|||
# escapeExecline [ "if" [ "somecommand" ] "true" ]
|
||||
# == ''"if" { "somecommand" } "true"''
|
||||
escapeExecline = execlineList: lib.concatStringsSep " "
|
||||
(let
|
||||
(
|
||||
let
|
||||
go = arg:
|
||||
if builtins.isString arg then [ (escapeExeclineArg arg) ]
|
||||
else if builtins.isPath arg then [ (escapeExeclineArg "${arg}") ]
|
||||
else if lib.isDerivation arg then [ (escapeExeclineArg arg) ]
|
||||
else if builtins.isList arg then [ "{" ] ++ builtins.concatMap go arg ++ [ "}" ]
|
||||
else abort "escapeExecline can only hande nested lists of strings, was ${lib.generators.toPretty {} arg}";
|
||||
in builtins.concatMap go execlineList);
|
||||
in
|
||||
builtins.concatMap go execlineList
|
||||
);
|
||||
|
||||
in
|
||||
escapeExecline
|
||||
|
|
|
@ -26,14 +26,16 @@
|
|||
|
||||
let
|
||||
getBins = drv: xs:
|
||||
let f = x:
|
||||
let
|
||||
f = x:
|
||||
# TODO(Profpatsch): typecheck
|
||||
let x' = if builtins.isString x then { use = x; as = x; } else x;
|
||||
in {
|
||||
name = x'.as;
|
||||
value = "${lib.getBin drv}/bin/${x'.use}";
|
||||
};
|
||||
in builtins.listToAttrs (builtins.map f xs);
|
||||
in
|
||||
builtins.listToAttrs (builtins.map f xs);
|
||||
|
||||
|
||||
tests = import ./tests.nix {
|
||||
|
@ -42,7 +44,8 @@ let
|
|||
inherit (depot.nix.runTestsuite) assertEq it runTestsuite;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: getBins;
|
||||
inherit tests;
|
||||
}
|
||||
|
|
|
@ -106,14 +106,16 @@ let
|
|||
];
|
||||
rfcExamples = it "the examples from the RFC" [
|
||||
(assertEq "a subset is deleted and overwritten"
|
||||
(mergePatch testTarget testPatch) {
|
||||
(mergePatch testTarget testPatch)
|
||||
{
|
||||
a = "z";
|
||||
c = {
|
||||
d = "e";
|
||||
};
|
||||
})
|
||||
(assertEq "a more complicated example from the example section"
|
||||
(mergePatch {
|
||||
(mergePatch
|
||||
{
|
||||
title = "Goodbye!";
|
||||
author = {
|
||||
givenName = "John";
|
||||
|
@ -121,7 +123,8 @@ let
|
|||
};
|
||||
tags = [ "example" "sample" ];
|
||||
content = "This will be unchanged";
|
||||
} {
|
||||
}
|
||||
{
|
||||
title = "Hello!";
|
||||
phoneNumber = "+01-123-456-7890";
|
||||
author.familyName = null;
|
||||
|
@ -144,7 +147,8 @@ let
|
|||
(assertEq "test number ${toString index}"
|
||||
(mergePatch target patch)
|
||||
res);
|
||||
in it "the test suite from the RFC" [
|
||||
in
|
||||
it "the test suite from the RFC" [
|
||||
(r 1 { "a" = "b"; } { "a" = "c"; } { "a" = "c"; })
|
||||
(r 2 { "a" = "b"; } { "b" = "c"; } { "a" = "b"; "b" = "c"; })
|
||||
(r 3 { "a" = "b"; } { "a" = null; } { })
|
||||
|
@ -172,14 +176,16 @@ let
|
|||
{ "a" = { "bb" = { }; }; })
|
||||
];
|
||||
|
||||
in runTestsuite "mergePatch" [
|
||||
in
|
||||
runTestsuite "mergePatch" [
|
||||
emptyPatch
|
||||
nonAttrs
|
||||
rfcExamples
|
||||
rfcTests
|
||||
];
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: mergePatch;
|
||||
|
||||
inherit tests;
|
||||
|
|
|
@ -6,9 +6,11 @@ let
|
|||
;
|
||||
in
|
||||
|
||||
rustSimpleBin {
|
||||
rustSimpleBin
|
||||
{
|
||||
name = "nint";
|
||||
dependencies = [
|
||||
depot.third_party.rust-crates.serde_json
|
||||
];
|
||||
} (builtins.readFile ./nint.rs)
|
||||
}
|
||||
(builtins.readFile ./nint.rs)
|
||||
|
|
|
@ -43,10 +43,13 @@ let
|
|||
children = readDir path;
|
||||
isVisible = f: f == ".skip-subtree" || (substring 0 1 f) != ".";
|
||||
names = filter isVisible (attrNames children);
|
||||
in listToAttrs (map (name: {
|
||||
in
|
||||
listToAttrs (map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = children.${name};
|
||||
}) names);
|
||||
})
|
||||
names);
|
||||
|
||||
# Create a mark containing the location of this attribute and
|
||||
# a list of all child attribute names added by readTree.
|
||||
|
@ -58,7 +61,8 @@ let
|
|||
# Import a file and enforce our calling convention
|
||||
importFile = args: scopedArgs: path: parts: filter:
|
||||
let
|
||||
importedFile = if scopedArgs != {}
|
||||
importedFile =
|
||||
if scopedArgs != { }
|
||||
then builtins.scopedImport scopedArgs path
|
||||
else import path;
|
||||
pathType = builtins.typeOf importedFile;
|
||||
|
@ -76,7 +80,8 @@ let
|
|||
dir = readDirVisible initPath;
|
||||
joinChild = c: initPath + ("/" + c);
|
||||
|
||||
self = if rootDir
|
||||
self =
|
||||
if rootDir
|
||||
then { __readTree = [ ]; }
|
||||
else importFile args scopedArgs initPath parts argsFilter;
|
||||
|
||||
|
@ -88,7 +93,9 @@ let
|
|||
# should be ignored, but its content is not inspected by
|
||||
# readTree
|
||||
filterDir = f: dir."${f}" == "directory";
|
||||
children = if hasAttr ".skip-subtree" dir then [] else map (c: {
|
||||
children = if hasAttr ".skip-subtree" dir then [ ] else
|
||||
map
|
||||
(c: {
|
||||
name = c;
|
||||
value = readTree {
|
||||
inherit argsFilter scopedArgs;
|
||||
|
@ -97,22 +104,28 @@ let
|
|||
rootDir = false;
|
||||
parts = (parts ++ [ c ]);
|
||||
};
|
||||
}) (filter filterDir (attrNames dir));
|
||||
})
|
||||
(filter filterDir (attrNames dir));
|
||||
|
||||
# Import Nix files
|
||||
nixFiles = if hasAttr ".skip-subtree" dir then []
|
||||
nixFiles =
|
||||
if hasAttr ".skip-subtree" dir then [ ]
|
||||
else filter (f: f != null) (map nixFileName (attrNames dir));
|
||||
nixChildren = map (c: let
|
||||
nixChildren = map
|
||||
(c:
|
||||
let
|
||||
p = joinChild (c + ".nix");
|
||||
childParts = parts ++ [ c ];
|
||||
imported = importFile args scopedArgs p childParts argsFilter;
|
||||
in {
|
||||
in
|
||||
{
|
||||
name = c;
|
||||
value =
|
||||
if isAttrs imported
|
||||
then imported // marker childParts { }
|
||||
else imported;
|
||||
}) nixFiles;
|
||||
})
|
||||
nixFiles;
|
||||
|
||||
nodeValue = if dir ? "default.nix" then self else { };
|
||||
|
||||
|
@ -162,14 +175,16 @@ let
|
|||
# Determine whether a given value is a derivation.
|
||||
# Copied from nixpkgs/lib for cases where lib is not available yet.
|
||||
isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit gather;
|
||||
|
||||
__functor = _:
|
||||
{ path
|
||||
, args
|
||||
, filter ? (_parts: x: x)
|
||||
, scopedArgs ? {} }:
|
||||
, scopedArgs ? { }
|
||||
}:
|
||||
readTree {
|
||||
inherit args scopedArgs;
|
||||
argsFilter = filter;
|
||||
|
|
|
@ -104,7 +104,8 @@ let
|
|||
|
||||
assertMarkerByPath = path:
|
||||
assertEq "${lib.concatStringsSep "." path} is marked correctly"
|
||||
(lib.getAttrFromPath path read-markers).__readTree path;
|
||||
(lib.getAttrFromPath path read-markers).__readTree
|
||||
path;
|
||||
|
||||
markers = it "marks nodes correctly" [
|
||||
(assertMarkerByPath [ "directory-marked" ])
|
||||
|
@ -119,7 +120,8 @@ let
|
|||
read-markers.directory-marked.nested.__readTreeChildren [ ])
|
||||
];
|
||||
|
||||
in runTestsuite "readTree" [
|
||||
in
|
||||
runTestsuite "readTree" [
|
||||
example
|
||||
traversal-logic
|
||||
wrong
|
||||
|
|
|
@ -23,7 +23,8 @@ let
|
|||
inherit pkgs;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: runExecline;
|
||||
local = runExeclineLocal;
|
||||
inherit tests;
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
{ stdenv, pkgs, runExecline, runExeclineLocal, getBins, writeScript
|
||||
{ stdenv
|
||||
, pkgs
|
||||
, runExecline
|
||||
, runExeclineLocal
|
||||
, getBins
|
||||
, writeScript
|
||||
# https://www.mail-archive.com/skaware@list.skarnet.org/msg01256.html
|
||||
, coreutils }:
|
||||
, coreutils
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
|
@ -31,49 +37,80 @@ let
|
|||
builder = bins.execlineIf;
|
||||
args =
|
||||
(block [
|
||||
bins.redirfd "-r" "0" file # read file to stdin
|
||||
bins.s6-grep "-F" "-q" line # and grep for the line
|
||||
bins.redirfd
|
||||
"-r"
|
||||
"0"
|
||||
file # read file to stdin
|
||||
bins.s6-grep
|
||||
"-F"
|
||||
"-q"
|
||||
line # and grep for the line
|
||||
])
|
||||
++ [
|
||||
# if the block succeeded, touch $out
|
||||
bins.importas "-ui" "out" "out"
|
||||
bins.s6-touch "$out"
|
||||
bins.importas
|
||||
"-ui"
|
||||
"out"
|
||||
"out"
|
||||
bins.s6-touch
|
||||
"$out"
|
||||
];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
};
|
||||
|
||||
# basic test that touches out
|
||||
basic = runExeclineLocal "run-execline-test-basic" {
|
||||
} [
|
||||
"importas" "-ui" "out" "out"
|
||||
"${bins.s6-touch}" "$out"
|
||||
basic = runExeclineLocal "run-execline-test-basic"
|
||||
{ } [
|
||||
"importas"
|
||||
"-ui"
|
||||
"out"
|
||||
"out"
|
||||
"${bins.s6-touch}"
|
||||
"$out"
|
||||
];
|
||||
|
||||
# whether the stdin argument works as intended
|
||||
stdin = fileHasLine "foo" (runExeclineLocal "run-execline-test-stdin" {
|
||||
stdin = fileHasLine "foo" (runExeclineLocal "run-execline-test-stdin"
|
||||
{
|
||||
stdin = "foo\nbar\nfoo";
|
||||
} [
|
||||
"importas" "-ui" "out" "out"
|
||||
"importas"
|
||||
"-ui"
|
||||
"out"
|
||||
"out"
|
||||
# this pipes stdout of s6-cat to $out
|
||||
# and s6-cat redirects from stdin to stdout
|
||||
"redirfd" "-w" "1" "$out" bins.s6-cat
|
||||
"redirfd"
|
||||
"-w"
|
||||
"1"
|
||||
"$out"
|
||||
bins.s6-cat
|
||||
]);
|
||||
|
||||
|
||||
wrapWithVar = runExeclineLocal "run-execline-test-wrap-with-var" {
|
||||
wrapWithVar = runExeclineLocal "run-execline-test-wrap-with-var"
|
||||
{
|
||||
builderWrapper = writeScript "var-wrapper" ''
|
||||
#!${bins.execlineb} -S0
|
||||
export myvar myvalue $@
|
||||
'';
|
||||
} [
|
||||
"importas" "-ui" "v" "myvar"
|
||||
"if" [ bins.s6-test "myvalue" "=" "$v" ]
|
||||
"importas" "out" "out"
|
||||
bins.s6-touch "$out"
|
||||
"importas"
|
||||
"-ui"
|
||||
"v"
|
||||
"myvar"
|
||||
"if"
|
||||
[ bins.s6-test "myvalue" "=" "$v" ]
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
bins.s6-touch
|
||||
"$out"
|
||||
];
|
||||
|
||||
in [
|
||||
in
|
||||
[
|
||||
basic
|
||||
stdin
|
||||
wrapWithVar
|
||||
|
|
|
@ -99,7 +99,8 @@ let
|
|||
(context: desc: res:
|
||||
if res
|
||||
then { yep = { test = desc; }; }
|
||||
else { nope = {
|
||||
else {
|
||||
nope = {
|
||||
test = desc;
|
||||
inherit context;
|
||||
};
|
||||
|
@ -144,31 +145,50 @@ let
|
|||
yep = _: true;
|
||||
nope = _: false;
|
||||
};
|
||||
res = partitionTests (it:
|
||||
res = partitionTests
|
||||
(it:
|
||||
(partitionTests goodAss it.asserts).err == [ ]
|
||||
) itResults;
|
||||
)
|
||||
itResults;
|
||||
prettyRes = lib.generators.toPretty { } res;
|
||||
in
|
||||
if res.err == [ ]
|
||||
then depot.nix.runExecline.local "testsuite-${name}-successful" {} [
|
||||
"importas" "out" "out"
|
||||
then
|
||||
depot.nix.runExecline.local "testsuite-${name}-successful" { } [
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
# force derivation to rebuild if test case list changes
|
||||
"ifelse" [ bins.s6-false ] [
|
||||
bins.printf "" (builtins.hashString "sha512" prettyRes)
|
||||
"ifelse"
|
||||
[ bins.s6-false ]
|
||||
[
|
||||
bins.printf
|
||||
""
|
||||
(builtins.hashString "sha512" prettyRes)
|
||||
]
|
||||
"if" [ bins.printf "%s\n" "testsuite ${name} successful!" ]
|
||||
bins.s6-touch "$out"
|
||||
"if"
|
||||
[ bins.printf "%s\n" "testsuite ${name} successful!" ]
|
||||
bins.s6-touch
|
||||
"$out"
|
||||
]
|
||||
else depot.nix.runExecline.local "testsuite-${name}-failed" {
|
||||
else
|
||||
depot.nix.runExecline.local "testsuite-${name}-failed"
|
||||
{
|
||||
stdin = prettyRes + "\n";
|
||||
} [
|
||||
"importas" "out" "out"
|
||||
"if" [ bins.printf "%s\n" "testsuite ${name} failed!" ]
|
||||
"if" [ bins.s6-cat ]
|
||||
"exit" "1"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
"if"
|
||||
[ bins.printf "%s\n" "testsuite ${name} failed!" ]
|
||||
"if"
|
||||
[ bins.s6-cat ]
|
||||
"exit"
|
||||
"1"
|
||||
]);
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit
|
||||
assertEq
|
||||
assertThrows
|
||||
|
|
|
@ -45,14 +45,16 @@ let
|
|||
let
|
||||
withLeading = p: if builtins.substring 0 1 p == "/" then p else "/" + p;
|
||||
fullPath =
|
||||
/**/ if builtins.isPath path then path
|
||||
/**/
|
||||
if builtins.isPath path then path
|
||||
else if builtins.isString path then (root + withLeading path)
|
||||
else builtins.throw "Unsupported path type ${builtins.typeOf path}";
|
||||
strPath = toString fullPath;
|
||||
contextPath = "${fullPath}";
|
||||
belowRoot = builtins.substring rootLength (-1) strPath;
|
||||
prefix = builtins.substring 0 rootLength strPath;
|
||||
in assert toString root == prefix; {
|
||||
in
|
||||
assert toString root == prefix; {
|
||||
src = contextPath;
|
||||
dst = belowRoot;
|
||||
};
|
||||
|
@ -63,8 +65,10 @@ in
|
|||
# TODO(sterni): teach readTree to also read symlinked directories,
|
||||
# so we ln -sT instead of cp -aT.
|
||||
pkgs.runCommandNoCC "sparse-${builtins.baseNameOf root}" { } (
|
||||
lib.concatMapStrings ({ src, dst }: ''
|
||||
lib.concatMapStrings
|
||||
({ src, dst }: ''
|
||||
mkdir -p "$(dirname "$out${dst}")"
|
||||
cp -aT --reflink=auto "${src}" "$out${dst}"
|
||||
'') symlinks
|
||||
'')
|
||||
symlinks
|
||||
)
|
||||
|
|
|
@ -4,11 +4,13 @@ let
|
|||
# if so sets `isTag` to `true` and sets the name and value.
|
||||
# If not, sets `isTag` to `false` and sets `errmsg`.
|
||||
verifyTag = tag:
|
||||
let cases = builtins.attrNames tag;
|
||||
let
|
||||
cases = builtins.attrNames tag;
|
||||
len = builtins.length cases;
|
||||
in
|
||||
if builtins.length cases == 1
|
||||
then let name = builtins.head cases; in {
|
||||
then
|
||||
let name = builtins.head cases; in {
|
||||
isTag = true;
|
||||
name = name;
|
||||
val = tag.${name};
|
||||
|
@ -63,7 +65,8 @@ let
|
|||
# ] 1
|
||||
# => { smol = 1; }
|
||||
discrDef = defTag: fs: v:
|
||||
let res = lib.findFirst
|
||||
let
|
||||
res = lib.findFirst
|
||||
(t: t.val v)
|
||||
null
|
||||
(map assertIsTag fs);
|
||||
|
@ -148,7 +151,8 @@ let
|
|||
;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit
|
||||
verifyTag
|
||||
tagName
|
||||
|
|
|
@ -41,7 +41,8 @@ let
|
|||
(discr [
|
||||
{ bool = lib.isBool; }
|
||||
{ int = lib.isInt; }
|
||||
] true)
|
||||
]
|
||||
true)
|
||||
{ bool = true; })
|
||||
(assertEq "fallback to default"
|
||||
(discrDef "def" [
|
||||
|
@ -53,19 +54,24 @@ let
|
|||
|
||||
match-test = it "can match things" [
|
||||
(assertEq "match example"
|
||||
(let
|
||||
(
|
||||
let
|
||||
success = { res = 42; };
|
||||
failure = { err = "no answer"; };
|
||||
matcher = {
|
||||
res = i: i + 1;
|
||||
err = _: 0;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
one = match success matcher;
|
||||
two = match failure matcher;
|
||||
}
|
||||
)
|
||||
{
|
||||
one = 43;
|
||||
two = 0;
|
||||
})
|
||||
{ one = 43;
|
||||
two = 0; })
|
||||
(assertEq "matchLam & pipe"
|
||||
(lib.pipe { foo = 42; } [
|
||||
(matchLam {
|
||||
|
|
|
@ -27,4 +27,5 @@ let
|
|||
# Actual ACL entries
|
||||
ACLs = list acl;
|
||||
};
|
||||
in config: pkgs.writeText "tailscale-acl.json" (toJSON (aclConfig config))
|
||||
in
|
||||
config: pkgs.writeText "tailscale-acl.json" (toJSON (aclConfig config))
|
||||
|
|
|
@ -120,9 +120,11 @@ let
|
|||
# directory. If not, either the target doesn't exist or is a regular file.
|
||||
# TODO(sterni): is there a way to check reliably if the symlink target exists?
|
||||
isSymlinkDir = builtins.pathExists (path' + "/.");
|
||||
in {
|
||||
in
|
||||
{
|
||||
${thisPathType} =
|
||||
/**/ if thisPathType != "symlink" then true
|
||||
/**/
|
||||
if thisPathType != "symlink" then true
|
||||
else if isSymlinkDir then "directory"
|
||||
else "regular-or-missing";
|
||||
};
|
||||
|
@ -151,9 +153,11 @@ let
|
|||
|
||||
Type: path(-like) -> bool
|
||||
*/
|
||||
realPathIsDirectory = path: let
|
||||
realPathIsDirectory = path:
|
||||
let
|
||||
pt = pathType' path;
|
||||
in pt ? directory || pt.symlink or null == "directory";
|
||||
in
|
||||
pt ? directory || pt.symlink or null == "directory";
|
||||
|
||||
/* Check whether the given path is a regular file.
|
||||
Throws if the path in question doesn't exist.
|
||||
|
@ -169,7 +173,8 @@ let
|
|||
*/
|
||||
isSymlink = path: pathType' path ? symlink;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit
|
||||
storePathName
|
||||
pathType
|
||||
|
|
|
@ -26,38 +26,53 @@ let
|
|||
pathPredicates = it "judges paths correctly" (lib.flatten [
|
||||
# isDirectory
|
||||
(assertUtilsPred "directory isDirectory"
|
||||
(isDirectory ./directory) true)
|
||||
(isDirectory ./directory)
|
||||
true)
|
||||
(assertUtilsPred "symlink not isDirectory"
|
||||
(isDirectory ./symlink-directory) false)
|
||||
(isDirectory ./symlink-directory)
|
||||
false)
|
||||
(assertUtilsPred "file not isDirectory"
|
||||
(isDirectory ./directory/file) false)
|
||||
(isDirectory ./directory/file)
|
||||
false)
|
||||
# realPathIsDirectory
|
||||
(assertUtilsPred "directory realPathIsDirectory"
|
||||
(realPathIsDirectory ./directory) true)
|
||||
(realPathIsDirectory ./directory)
|
||||
true)
|
||||
(assertUtilsPred "symlink to directory realPathIsDirectory"
|
||||
(realPathIsDirectory ./symlink-directory) true)
|
||||
(realPathIsDirectory ./symlink-directory)
|
||||
true)
|
||||
(assertUtilsPred "realPathIsDirectory resolves chained symlinks"
|
||||
(realPathIsDirectory ./symlink-symlink-directory) true)
|
||||
(realPathIsDirectory ./symlink-symlink-directory)
|
||||
true)
|
||||
# isRegularFile
|
||||
(assertUtilsPred "file isRegularFile"
|
||||
(isRegularFile ./directory/file) true)
|
||||
(isRegularFile ./directory/file)
|
||||
true)
|
||||
(assertUtilsPred "symlink not isRegularFile"
|
||||
(isRegularFile ./symlink-file) false)
|
||||
(isRegularFile ./symlink-file)
|
||||
false)
|
||||
(assertUtilsPred "directory not isRegularFile"
|
||||
(isRegularFile ./directory) false)
|
||||
(isRegularFile ./directory)
|
||||
false)
|
||||
# isSymlink
|
||||
(assertUtilsPred "symlink to file isSymlink"
|
||||
(isSymlink ./symlink-file) true)
|
||||
(isSymlink ./symlink-file)
|
||||
true)
|
||||
(assertUtilsPred "symlink to directory isSymlink"
|
||||
(isSymlink ./symlink-directory) true)
|
||||
(isSymlink ./symlink-directory)
|
||||
true)
|
||||
(assertUtilsPred "symlink to symlink isSymlink"
|
||||
(isSymlink ./symlink-symlink-file) true)
|
||||
(isSymlink ./symlink-symlink-file)
|
||||
true)
|
||||
(assertUtilsPred "symlink to missing file isSymlink"
|
||||
(isSymlink ./missing) true)
|
||||
(isSymlink ./missing)
|
||||
true)
|
||||
(assertUtilsPred "directory not isSymlink"
|
||||
(isSymlink ./directory) false)
|
||||
(isSymlink ./directory)
|
||||
false)
|
||||
(assertUtilsPred "file not isSymlink"
|
||||
(isSymlink ./directory/file) false)
|
||||
(isSymlink ./directory/file)
|
||||
false)
|
||||
# missing files throw
|
||||
(assertThrows "isDirectory throws on missing file"
|
||||
(isDirectory ./does-not-exist))
|
||||
|
@ -89,15 +104,18 @@ let
|
|||
|
||||
storePathNameTests = it "correctly gets the basename of a store path" [
|
||||
(assertEq "base name of a derivation"
|
||||
(storePathName depot.tools.cheddar) depot.tools.cheddar.name)
|
||||
(storePathName depot.tools.cheddar)
|
||||
depot.tools.cheddar.name)
|
||||
(assertEq "base name of a store path string"
|
||||
(storePathName cheddarStorePath) depot.tools.cheddar.name)
|
||||
(storePathName cheddarStorePath)
|
||||
depot.tools.cheddar.name)
|
||||
(assertEq "base name of a path within a store path"
|
||||
(storePathName "${cheddarStorePath}/bin/cheddar") "cheddar")
|
||||
(assertEq "base name of a path"
|
||||
(storePathName ../default.nix) "default.nix")
|
||||
(assertEq "base name of a cleanSourced path"
|
||||
(storePathName cleanedSource) cleanedSource.name)
|
||||
(storePathName cleanedSource)
|
||||
cleanedSource.name)
|
||||
];
|
||||
in
|
||||
|
||||
|
|
|
@ -8,11 +8,13 @@ let
|
|||
|
||||
finalEmacs = (emacsPackagesGen emacs).emacsWithPackages deps;
|
||||
|
||||
srcFile = if isString src
|
||||
srcFile =
|
||||
if isString src
|
||||
then toFile "${name}.el" src
|
||||
else src;
|
||||
|
||||
in depot.nix.writeScriptBin name ''
|
||||
in
|
||||
depot.nix.writeScriptBin name ''
|
||||
#!/bin/sh
|
||||
${finalEmacs}/bin/emacs --batch --no-site-file --script ${srcFile} $@
|
||||
''
|
||||
|
|
|
@ -14,9 +14,10 @@ name:
|
|||
# "env": don’t substitute, set # and 0…n environment vaariables, where n=$#
|
||||
# "none": don’t substitute or set any positional arguments
|
||||
# "env-no-push": like "env", but bypass the push-phase. Not recommended.
|
||||
argMode ? "var",
|
||||
# Number of arguments to be substituted as variables (passed to "var"/"-s" or "var-full"/"-S"
|
||||
readNArgs ? 0,
|
||||
argMode ? "var"
|
||||
, # Number of arguments to be substituted as variables (passed to "var"/"-s" or "var-full"/"-S"
|
||||
readNArgs ? 0
|
||||
,
|
||||
}:
|
||||
# Nested list of lists of commands.
|
||||
# Inner lists are translated to execline blocks.
|
||||
|
|
|
@ -14,16 +14,22 @@ name:
|
|||
# string of the executable script that is put in $out
|
||||
script:
|
||||
|
||||
depot.nix.runExecline name {
|
||||
depot.nix.runExecline name
|
||||
{
|
||||
stdin = script;
|
||||
derivationArgs = {
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
};
|
||||
} [
|
||||
"importas" "out" "out"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
# this pipes stdout of s6-cat to $out
|
||||
# and s6-cat redirects from stdin to stdout
|
||||
"if" [ "redirfd" "-w" "1" "$out" bins.s6-cat ]
|
||||
bins.s6-chmod "0755" "$out"
|
||||
"if"
|
||||
[ "redirfd" "-w" "1" "$out" bins.s6-cat ]
|
||||
bins.s6-chmod
|
||||
"0755"
|
||||
"$out"
|
||||
]
|
||||
|
|
|
@ -5,8 +5,13 @@ let
|
|||
;
|
||||
|
||||
linkTo = name: path: depot.nix.runExecline.local name { } [
|
||||
"importas" "out" "out"
|
||||
bins.s6-ln "-s" path "$out"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
bins.s6-ln
|
||||
"-s"
|
||||
path
|
||||
"$out"
|
||||
];
|
||||
|
||||
# Build a rust executable, $out is the executable.
|
||||
|
@ -14,10 +19,11 @@ let
|
|||
linkTo name "${rustSimpleBin args src}/bin/${name}";
|
||||
|
||||
# Like `rustSimple`, but put the binary in `$out/bin/`.
|
||||
rustSimpleBin = {
|
||||
name,
|
||||
dependencies ? [],
|
||||
doCheck ? true,
|
||||
rustSimpleBin =
|
||||
{ name
|
||||
, dependencies ? [ ]
|
||||
, doCheck ? true
|
||||
,
|
||||
}: src:
|
||||
(if doCheck then testRustSimple else pkgs.lib.id)
|
||||
(pkgs.buildRustCrate ({
|
||||
|
@ -26,7 +32,8 @@ let
|
|||
crateName = name;
|
||||
crateBin = [ name ];
|
||||
dependencies = dependencies;
|
||||
src = pkgs.runCommandLocal "write-main.rs" {
|
||||
src = pkgs.runCommandLocal "write-main.rs"
|
||||
{
|
||||
src = src;
|
||||
passAsFile = [ "src" ];
|
||||
} ''
|
||||
|
@ -38,10 +45,11 @@ let
|
|||
|
||||
# Build a rust library, that can be used as dependency to `rustSimple`.
|
||||
# Wrapper around `pkgs.buildRustCrate`, takes all its arguments.
|
||||
rustSimpleLib = {
|
||||
name,
|
||||
dependencies ? [],
|
||||
doCheck ? true,
|
||||
rustSimpleLib =
|
||||
{ name
|
||||
, dependencies ? [ ]
|
||||
, doCheck ? true
|
||||
,
|
||||
}: src:
|
||||
(if doCheck then testRustSimple else pkgs.lib.id)
|
||||
(pkgs.buildRustCrate ({
|
||||
|
@ -49,7 +57,8 @@ let
|
|||
version = "1.0.0";
|
||||
crateName = name;
|
||||
dependencies = dependencies;
|
||||
src = pkgs.runCommandLocal "write-lib.rs" {
|
||||
src = pkgs.runCommandLocal "write-lib.rs"
|
||||
{
|
||||
src = src;
|
||||
passAsFile = [ "src" ];
|
||||
} ''
|
||||
|
@ -73,18 +82,29 @@ let
|
|||
let
|
||||
crate = buildTests: rustDrv.override { inherit buildTests; };
|
||||
tests = depot.nix.runExecline.local "${rustDrv.name}-tests-run" { } [
|
||||
"importas" "out" "out"
|
||||
"if" [
|
||||
"pipeline" [ bins.s6-ls "${crate true}/tests" ]
|
||||
"forstdin" "-o0" "test"
|
||||
"importas" "test" "test"
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
"if"
|
||||
[
|
||||
"pipeline"
|
||||
[ bins.s6-ls "${crate true}/tests" ]
|
||||
"forstdin"
|
||||
"-o0"
|
||||
"test"
|
||||
"importas"
|
||||
"test"
|
||||
"test"
|
||||
"${crate true}/tests/$test"
|
||||
]
|
||||
bins.s6-touch "$out"
|
||||
bins.s6-touch
|
||||
"$out"
|
||||
];
|
||||
in depot.nix.drvSeqL [ tests ] (crate false);
|
||||
in
|
||||
depot.nix.drvSeqL [ tests ] (crate false);
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit
|
||||
rustSimple
|
||||
rustSimpleBin
|
||||
|
|
|
@ -12,12 +12,17 @@ let
|
|||
;
|
||||
|
||||
run = drv: depot.nix.runExecline.local "run-${drv.name}" { } [
|
||||
"if" [ drv ]
|
||||
"importas" "out" "out"
|
||||
"${coreutils}/bin/touch" "$out"
|
||||
"if"
|
||||
[ drv ]
|
||||
"importas"
|
||||
"out"
|
||||
"out"
|
||||
"${coreutils}/bin/touch"
|
||||
"$out"
|
||||
];
|
||||
|
||||
rustTransitiveLib = rustSimpleLib {
|
||||
rustTransitiveLib = rustSimpleLib
|
||||
{
|
||||
name = "transitive";
|
||||
} ''
|
||||
pub fn transitive(s: &str) -> String {
|
||||
|
@ -37,7 +42,8 @@ let
|
|||
}
|
||||
'';
|
||||
|
||||
rustTestLib = rustSimpleLib {
|
||||
rustTestLib = rustSimpleLib
|
||||
{
|
||||
name = "test_lib";
|
||||
dependencies = [ rustTransitiveLib ];
|
||||
} ''
|
||||
|
@ -48,7 +54,8 @@ let
|
|||
}
|
||||
'';
|
||||
|
||||
rustWithLib = run (rustSimple {
|
||||
rustWithLib = run (rustSimple
|
||||
{
|
||||
name = "rust-with-lib";
|
||||
dependencies = [ rustTestLib ];
|
||||
} ''
|
||||
|
@ -60,7 +67,8 @@ let
|
|||
'');
|
||||
|
||||
|
||||
in depot.nix.readTree.drvTargets {
|
||||
in
|
||||
depot.nix.readTree.drvTargets {
|
||||
inherit
|
||||
rustTransitiveLib
|
||||
rustWithLib
|
||||
|
|
|
@ -34,11 +34,14 @@ with builtins; let
|
|||
#
|
||||
# This function is the low-level primitive used to create types. For
|
||||
# many cases the higher-level 'typedef' function is more appropriate.
|
||||
typedef' = { name, checkType
|
||||
typedef' =
|
||||
{ name
|
||||
, checkType
|
||||
, checkToBool ? (result: result.ok)
|
||||
, toError ? (_: result: result.err)
|
||||
, def ? null
|
||||
, match ? null }: {
|
||||
, match ? null
|
||||
}: {
|
||||
inherit name checkToBool toError;
|
||||
|
||||
# check :: a -> bool
|
||||
|
@ -85,16 +88,23 @@ with builtins; let
|
|||
});
|
||||
};
|
||||
|
||||
checkEach = name: t: l: foldl' (acc: e:
|
||||
let res = t.checkType e;
|
||||
checkEach = name: t: l: foldl'
|
||||
(acc: e:
|
||||
let
|
||||
res = t.checkType e;
|
||||
isT = t.checkToBool res;
|
||||
in {
|
||||
in
|
||||
{
|
||||
ok = acc.ok && isT;
|
||||
err = if isT
|
||||
err =
|
||||
if isT
|
||||
then acc.err
|
||||
else acc.err + "${prettyPrint e}: ${t.toError e res}\n";
|
||||
}) { ok = true; err = "expected type ${name}, but found:\n"; } l;
|
||||
in lib.fix (self: {
|
||||
})
|
||||
{ ok = true; err = "expected type ${name}, but found:\n"; }
|
||||
l;
|
||||
in
|
||||
lib.fix (self: {
|
||||
# Primitive types
|
||||
any = typedef "any" (_: true);
|
||||
unit = typedef "unit" (v: v == { });
|
||||
|
@ -136,7 +146,8 @@ in lib.fix (self: {
|
|||
list = t: typedef' rec {
|
||||
name = "list<${t.name}>";
|
||||
|
||||
checkType = v: if isList v
|
||||
checkType = v:
|
||||
if isList v
|
||||
then checkEach name (self.type t) v
|
||||
else {
|
||||
ok = false;
|
||||
|
@ -147,7 +158,8 @@ in lib.fix (self: {
|
|||
attrs = t: typedef' rec {
|
||||
name = "attrs<${t.name}>";
|
||||
|
||||
checkType = v: if isAttrs v
|
||||
checkType = v:
|
||||
if isAttrs v
|
||||
then checkEach name (self.type t) (attrValues v)
|
||||
else {
|
||||
ok = false;
|
||||
|
@ -172,9 +184,11 @@ in lib.fix (self: {
|
|||
# checkField checks an individual field of the struct against
|
||||
# its definition and creates a typecheck result. These results
|
||||
# are aggregated during the actual checking.
|
||||
checkField = def: name: value: let result = def.checkType value; in rec {
|
||||
checkField = def: name: value:
|
||||
let result = def.checkType value; in rec {
|
||||
ok = def.checkToBool result;
|
||||
err = if !ok && isNull value
|
||||
err =
|
||||
if !ok && isNull value
|
||||
then "missing required ${def.name} field '${name}'\n"
|
||||
else "field '${name}': ${def.toError value result}\n";
|
||||
};
|
||||
|
@ -185,7 +199,8 @@ in lib.fix (self: {
|
|||
if (length has) == 0 then acc
|
||||
else if (hasAttr (head has) def)
|
||||
then checkExtraneous def (tail has) acc
|
||||
else checkExtraneous def (tail has) {
|
||||
else
|
||||
checkExtraneous def (tail has) {
|
||||
ok = false;
|
||||
err = acc.err + "unexpected struct field '${head has}'\n";
|
||||
};
|
||||
|
@ -197,28 +212,36 @@ in lib.fix (self: {
|
|||
init = { ok = true; err = ""; };
|
||||
extraneous = checkExtraneous def (attrNames value) init;
|
||||
|
||||
checkedFields = map (n:
|
||||
checkedFields = map
|
||||
(n:
|
||||
let v = if hasAttr n value then value."${n}" else null;
|
||||
in checkField def."${n}" n v) (attrNames def);
|
||||
in checkField def."${n}" n v)
|
||||
(attrNames def);
|
||||
|
||||
combined = foldl' (acc: res: {
|
||||
combined = foldl'
|
||||
(acc: res: {
|
||||
ok = acc.ok && res.ok;
|
||||
err = if !res.ok then acc.err + res.err else acc.err;
|
||||
}) init checkedFields;
|
||||
in {
|
||||
})
|
||||
init
|
||||
checkedFields;
|
||||
in
|
||||
{
|
||||
ok = combined.ok && extraneous.ok;
|
||||
err = combined.err + extraneous.err;
|
||||
};
|
||||
|
||||
struct' = name: def: typedef' {
|
||||
inherit name def;
|
||||
checkType = value: if isAttrs value
|
||||
checkType = value:
|
||||
if isAttrs value
|
||||
then (checkStruct (self.attrs self.type def) value)
|
||||
else { ok = false; err = typeError name value; };
|
||||
|
||||
toError = _: result: "expected '${name}'-struct, but found:\n" + result.err;
|
||||
};
|
||||
in arg: if isString arg then (struct' arg) else (struct' "anon" arg);
|
||||
in
|
||||
arg: if isString arg then (struct' arg) else (struct' "anon" arg);
|
||||
|
||||
# Enums & pattern matching
|
||||
enum =
|
||||
|
@ -235,11 +258,14 @@ in lib.fix (self: {
|
|||
let
|
||||
actionKeys = attrNames actions;
|
||||
missing = foldl' (m: k: if (elem k actionKeys) then m else m ++ [ k ]) [ ] def;
|
||||
in if (length missing) > 0
|
||||
in
|
||||
if (length missing) > 0
|
||||
then throw "Missing match action for members: ${prettyPrint missing}"
|
||||
else actions."${e x}");
|
||||
else actions."${e x}"
|
||||
);
|
||||
});
|
||||
in arg: if isString arg then (enum' arg) else (enum' "anon" arg);
|
||||
in
|
||||
arg: if isString arg then (enum' arg) else (enum' "anon" arg);
|
||||
|
||||
# Sum types
|
||||
#
|
||||
|
@ -252,10 +278,13 @@ in lib.fix (self: {
|
|||
checkType = (x:
|
||||
let variant = elemAt (attrNames x) 0;
|
||||
in if isAttrs x && length (attrNames x) == 1 && hasAttr variant def
|
||||
then let t = def."${variant}";
|
||||
then
|
||||
let
|
||||
t = def."${variant}";
|
||||
v = x."${variant}";
|
||||
res = t.checkType v;
|
||||
in if t.checkToBool res
|
||||
in
|
||||
if t.checkToBool res
|
||||
then { ok = true; }
|
||||
else {
|
||||
ok = false;
|
||||
|
@ -267,15 +296,18 @@ in lib.fix (self: {
|
|||
};
|
||||
sum' = name: def: lib.fix (s: (plain name def) // {
|
||||
match = x: actions:
|
||||
let variant = deepSeq (s x) (elemAt (attrNames x) 0);
|
||||
let
|
||||
variant = deepSeq (s x) (elemAt (attrNames x) 0);
|
||||
actionKeys = attrNames actions;
|
||||
defKeys = attrNames def;
|
||||
missing = foldl' (m: k: if (elem k actionKeys) then m else m ++ [ k ]) [ ] defKeys;
|
||||
in if (length missing) > 0
|
||||
in
|
||||
if (length missing) > 0
|
||||
then throw "Missing match action for variants: ${prettyPrint missing}"
|
||||
else actions."${variant}" x."${variant}";
|
||||
});
|
||||
in arg: if isString arg then (sum' arg) else (sum' "anon" arg);
|
||||
in
|
||||
arg: if isString arg then (sum' arg) else (sum' "anon" arg);
|
||||
|
||||
# Typed function definitions
|
||||
#
|
||||
|
@ -289,15 +321,19 @@ in lib.fix (self: {
|
|||
mkFunc = sig: f: {
|
||||
inherit sig;
|
||||
__toString = self: foldl' (s: t: "${s} -> ${t.name}")
|
||||
"λ :: ${(head self.sig).name}" (tail self.sig);
|
||||
"λ :: ${(head self.sig).name}"
|
||||
(tail self.sig);
|
||||
__functor = _: f;
|
||||
};
|
||||
|
||||
defun' = sig: func: if length sig > 2
|
||||
defun' = sig: func:
|
||||
if length sig > 2
|
||||
then mkFunc sig (x: defun' (tail sig) (func ((head sig) x)))
|
||||
else mkFunc sig (x: ((head (tail sig)) (func ((head sig) x))));
|
||||
|
||||
in sig: func: if length sig < 2
|
||||
in
|
||||
sig: func:
|
||||
if length sig < 2
|
||||
then (throw "Signature must at least have two types (a -> b)")
|
||||
else defun' sig func;
|
||||
|
||||
|
@ -320,7 +356,8 @@ in lib.fix (self: {
|
|||
else
|
||||
let
|
||||
iok = pred v;
|
||||
in if isBool iok then {
|
||||
in
|
||||
if isBool iok then {
|
||||
ok = iok;
|
||||
err = "${prettyPrint v} does not conform to restriction '${restriction}'";
|
||||
} else
|
||||
|
|
|
@ -70,7 +70,8 @@ let
|
|||
|
||||
testEnum = it "checks enum definitions and matching" [
|
||||
(assertEq "enum is matched correctly"
|
||||
"It is in fact red!" (colour.match "red" colourMatcher))
|
||||
"It is in fact red!"
|
||||
(colour.match "red" colourMatcher))
|
||||
(assertThrows "out of bounds enum fails"
|
||||
(colour.match "alpha" (colourMatcher // {
|
||||
alpha = "This should never happen";
|
||||
|
@ -97,7 +98,8 @@ let
|
|||
testSum = it "checks sum types definitions and matching" [
|
||||
(assertDoesNotThrow "creature sum type" some-human)
|
||||
(assertEq "sum type is matched correctly"
|
||||
"It's a human named Brynhjulf" (creature.match some-human {
|
||||
"It's a human named Brynhjulf"
|
||||
(creature.match some-human {
|
||||
human = v: "It's a human named ${v.name}";
|
||||
pet = v: "It's not supposed to be a pet!";
|
||||
})
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
${pkgs.bind}/bin/named-checkzone -i local ${zone} ${file} | tee $out
|
||||
'';
|
||||
|
||||
in depot.nix.readTree.drvTargets {
|
||||
in
|
||||
depot.nix.readTree.drvTargets {
|
||||
nixery-dev = checkZone "nixery.dev" ./nixery.dev.zone;
|
||||
tvl-fyi = checkZone "tvl.fyi" ./tvl.fyi.zone;
|
||||
tvl-su = checkZone "tvl.su" ./tvl.su.zone;
|
||||
|
|
|
@ -4,6 +4,8 @@ depot.third_party.naersk.buildPackage {
|
|||
src = ./.;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
pkgconfig openssl systemd.dev
|
||||
pkgconfig
|
||||
openssl
|
||||
systemd.dev
|
||||
];
|
||||
}
|
||||
|
|
|
@ -10,13 +10,17 @@
|
|||
# This file is the Nix derivation used to build release binaries for
|
||||
# several different architectures and operating systems.
|
||||
|
||||
let pkgs = import ((import <nixpkgs> {}).fetchFromGitHub {
|
||||
let
|
||||
pkgs = import
|
||||
((import <nixpkgs> { }).fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs-channels";
|
||||
rev = "541d9cce8af7a490fb9085305939569567cb58e6";
|
||||
sha256 = "0jgz72hhzkd5vyq5v69vpljjlnf0lqaz7fh327bvb3cvmwbfxrja";
|
||||
}) {};
|
||||
in with pkgs; buildGoPackage rec {
|
||||
})
|
||||
{ };
|
||||
in
|
||||
with pkgs; buildGoPackage rec {
|
||||
name = "kontemplate-${version}";
|
||||
version = "canon";
|
||||
src = ./.;
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
let
|
||||
inherit (builtins) listToAttrs;
|
||||
inherit (lib) range;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${depot.path}/ops/modules/atward.nix"
|
||||
"${depot.path}/ops/modules/clbot.nix"
|
||||
|
@ -55,7 +56,13 @@ in {
|
|||
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"igb" "xhci_pci" "nvme" "ahci" "usbhid" "usb_storage" "sr_mod"
|
||||
"igb"
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sr_mod"
|
||||
];
|
||||
|
||||
# Enable SSH in the initrd so that we can enter disk encryption
|
||||
|
@ -205,7 +212,8 @@ in {
|
|||
age.secrets =
|
||||
let
|
||||
secretFile = name: depot.ops.secrets."${name}.age";
|
||||
in {
|
||||
in
|
||||
{
|
||||
clbot.file = secretFile "clbot";
|
||||
gerrit-queue.file = secretFile "gerrit-queue";
|
||||
grafana.file = secretFile "grafana";
|
||||
|
@ -511,7 +519,8 @@ in {
|
|||
static_configs = [{
|
||||
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
}];
|
||||
} {
|
||||
}
|
||||
{
|
||||
job_name = "nginx";
|
||||
scrape_interval = "5s";
|
||||
static_configs = [{
|
||||
|
@ -526,7 +535,8 @@ in {
|
|||
domain = "status.tvl.su";
|
||||
rootUrl = "https://status.tvl.su";
|
||||
analytics.reporting.enable = false;
|
||||
extraOptions = let
|
||||
extraOptions =
|
||||
let
|
||||
options = {
|
||||
auth = {
|
||||
generic_oauth = {
|
||||
|
@ -572,12 +582,15 @@ in {
|
|||
else builtins.toString value;
|
||||
|
||||
# Turn an nested options attrset into a flat listToAttrs-compatible list.
|
||||
encodeOptions = prefix: inp: concatLists (mapAttrsToList (name: value:
|
||||
encodeOptions = prefix: inp: concatLists (mapAttrsToList
|
||||
(name: value:
|
||||
if (typeOf value) == "set"
|
||||
then encodeOptions (prefix ++ [ name ]) value
|
||||
else [ (nameValuePair (encodeName (prefix ++ [ name ])) (optionToString value)) ]
|
||||
) inp);
|
||||
in listToAttrs (encodeOptions [] options);
|
||||
)
|
||||
inp);
|
||||
in
|
||||
listToAttrs (encodeOptions [ ] options);
|
||||
|
||||
provision = {
|
||||
enable = true;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
let
|
||||
cfg = config.services.depot.atward;
|
||||
description = "atward - (attempt to) cleverly route queries";
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.atward = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ let
|
|||
# NixOS in $STATE_DIRECTORY
|
||||
(cd / && ${rebuild-system}/bin/rebuild-system)
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.auto-deploy = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ let
|
|||
echo "Skipping GC, enough space available"
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.automatic-gc = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.clbot = {
|
||||
enable = mkEnableOption description;
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ let
|
|||
inherit default;
|
||||
type = lib.types.str;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.gerrit-queue = {
|
||||
enable = lib.mkEnableOption description;
|
||||
gerritUrl = mkStringOption "https://cl.tvl.fyi";
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
let
|
||||
cfg = config.services.depot.git-serving;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.git-serving = with lib; {
|
||||
enable = mkEnableOption "Enable cgit & josh configuration";
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ let
|
|||
|
||||
exec ${depot.third_party.irccat}/bin/irccat
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.irccat = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ let
|
|||
ln -s ${besadiiWithConfig "change-merged"} $out/change-merged
|
||||
ln -s ${besadiiWithConfig "patchset-created"} $out/patchset-created
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
services.gerrit = {
|
||||
enable = true;
|
||||
listenAddress = "[::]:4778"; # 4778 - grrt
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
cfg = config.services.depot.nixery;
|
||||
description = "Nixery - container images on-demand";
|
||||
storagePath = "/var/lib/nixery/${pkgs.nixpkgsCommits.unstable}";
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.nixery = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ let
|
|||
reverse_proxy = true
|
||||
set_xauthrequest = true
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.oauth2_proxy = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
let
|
||||
cfg = config.services.depot.owothia;
|
||||
description = "owothia - i'm a service owo";
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.owothia = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
let
|
||||
cfg = config.services.depot.panettone;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.panettone = with lib; {
|
||||
enable = mkEnableOption "Panettone issue tracker";
|
||||
|
||||
|
@ -62,17 +63,20 @@ in {
|
|||
assertion =
|
||||
cfg.dbHost != "localhost" || config.services.postgresql.enable;
|
||||
message = "Panettone requires a postgresql database";
|
||||
} {
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
cfg.dbHost != "localhost" || config.services.postgresql.enableTCPIP;
|
||||
message = "Panettone can only connect to the postgresql database over TCP";
|
||||
} {
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
cfg.dbHost != "localhost" || (lib.any
|
||||
(user: user.name == cfg.dbUser)
|
||||
config.services.postgresql.ensureUsers);
|
||||
message = "Panettone requires a database user";
|
||||
} {
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
cfg.dbHost != "localhost" || (lib.any
|
||||
(db: db == cfg.dbName)
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
let
|
||||
cfg = config.services.depot.paroxysm;
|
||||
description = "TVL's majestic IRC bot";
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.paroxysm.enable = lib.mkEnableOption description;
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
|
@ -8,7 +8,8 @@ let
|
|||
enableDaemon = true;
|
||||
withKDE = false;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.quassel = with lib; {
|
||||
enable = mkEnableOption "Quassel IRC daemon";
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ let
|
|||
inherit default;
|
||||
type = lib.types.str;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.restic = {
|
||||
enable = lib.mkEnableOption description;
|
||||
bucketEndpoint = mkStringOption "objects.dc-sto1.glesys.net";
|
||||
|
|
|
@ -28,7 +28,8 @@ let
|
|||
concatStringsSep " "
|
||||
(attrValues (mapAttrs (key: value: "-${key} \"${toString value}\"")
|
||||
(args // overrideArgs)));
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.smtprelay = {
|
||||
enable = mkEnableOption description;
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
let
|
||||
cfg = config.services.depot.sourcegraph;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.sourcegraph = with lib; {
|
||||
enable = mkEnableOption "SourceGraph code search engine";
|
||||
|
||||
|
@ -51,7 +52,8 @@ in {
|
|||
# Sourcegraph needs a higher nofile limit, it logs warnings
|
||||
# otherwise (unclear whether it actually affects the service).
|
||||
extraOptions = [
|
||||
"--ulimit" "nofile=10000:10000"
|
||||
"--ulimit"
|
||||
"nofile=10000:10000"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,7 +22,8 @@ let
|
|||
echo 'username=buildkite'
|
||||
echo "password=$(jq -r '.gerritPassword' /run/agenix/buildkite-besadii-config)"
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.depot.buildkite = {
|
||||
enable = lib.mkEnableOption description;
|
||||
agentCount = lib.mkOption {
|
||||
|
@ -33,7 +34,8 @@ in {
|
|||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Run the Buildkite agents using the default upstream module.
|
||||
services.buildkite-agents = builtins.listToAttrs (map (n: rec {
|
||||
services.buildkite-agents = builtins.listToAttrs (map
|
||||
(n: rec {
|
||||
name = "whitby-${toString n}";
|
||||
value = {
|
||||
inherit name;
|
||||
|
@ -53,19 +55,22 @@ in {
|
|||
nix
|
||||
];
|
||||
};
|
||||
}) agents);
|
||||
})
|
||||
agents);
|
||||
|
||||
# Set up a group for all Buildkite agent users
|
||||
users = {
|
||||
groups.buildkite-agents = { };
|
||||
users = builtins.listToAttrs (map (n: rec {
|
||||
users = builtins.listToAttrs (map
|
||||
(n: rec {
|
||||
name = "buildkite-agent-whitby-${toString n}";
|
||||
value = {
|
||||
isSystemUser = true;
|
||||
group = lib.mkForce "buildkite-agents";
|
||||
extraGroups = [ name "docker" ];
|
||||
};
|
||||
}) agents);
|
||||
})
|
||||
agents);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ let
|
|||
|
||||
inherit (depot.ops) users;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
services.openldap = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ let
|
|||
drvTargets = depot.ci.targets;
|
||||
additionalSteps = [ protoCheck ];
|
||||
|
||||
parentTargetMap = if (externalArgs ? parentTargetMap)
|
||||
parentTargetMap =
|
||||
if (externalArgs ? parentTargetMap)
|
||||
then builtins.fromJSON (builtins.readFile externalArgs.parentTargetMap)
|
||||
else { };
|
||||
|
||||
|
@ -40,7 +41,8 @@ let
|
|||
};
|
||||
|
||||
drvmap = depot.nix.buildkite.mkDrvmap depot.ci.targets;
|
||||
in pkgs.runCommandNoCC "depot-pipeline" {} ''
|
||||
in
|
||||
pkgs.runCommandNoCC "depot-pipeline" { } ''
|
||||
mkdir $out
|
||||
cp -r ${pipeline}/* $out
|
||||
cp ${drvmap} $out/drvmap.json
|
||||
|
|
|
@ -15,7 +15,8 @@ let
|
|||
whitby = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNh/w4BSKov0jdz3gKBc98tpoLta5bb87fQXWBhAl2I";
|
||||
|
||||
default.publicKeys = tazjin ++ grfn ++ sterni ++ [ whitby ];
|
||||
in {
|
||||
in
|
||||
{
|
||||
"besadii.age" = default;
|
||||
"buildkite-agent-token.age" = default;
|
||||
"buildkite-graphql-token.age" = default;
|
||||
|
|
3
third_party/agenix/default.nix
vendored
3
third_party/agenix/default.nix
vendored
|
@ -9,7 +9,8 @@ let
|
|||
agenix = import src {
|
||||
inherit pkgs;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit src;
|
||||
cli = agenix.agenix;
|
||||
}
|
||||
|
|
6
third_party/arion/default.nix
vendored
6
third_party/arion/default.nix
vendored
|
@ -1,8 +1,10 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
(import (pkgs.fetchFromGitHub {
|
||||
(import
|
||||
(pkgs.fetchFromGitHub {
|
||||
owner = "hercules-ci";
|
||||
repo = "arion";
|
||||
rev = "db6d4d7490dff363de60cebbece3ae9361e3ce43";
|
||||
sha256 = "0d8nqmc7fjshigax2g47ips262v8ml27x0ksq59kmprgb7ckzi5l";
|
||||
}) { inherit pkgs; }).arion
|
||||
})
|
||||
{ inherit pkgs; }).arion
|
||||
|
|
3
third_party/bat_syntaxes/default.nix
vendored
3
third_party/bat_syntaxes/default.nix
vendored
|
@ -8,7 +8,8 @@
|
|||
|
||||
let
|
||||
inherit (pkgs) bat runCommandNoCC;
|
||||
in runCommandNoCC "bat-syntaxes.bin" {} ''
|
||||
in
|
||||
runCommandNoCC "bat-syntaxes.bin" { } ''
|
||||
export HOME=$PWD
|
||||
mkdir -p .config/bat/syntaxes
|
||||
cp ${./Prolog.sublime-syntax} .config/bat/syntaxes
|
||||
|
|
3
third_party/cgit/default.nix
vendored
3
third_party/cgit/default.nix
vendored
|
@ -2,7 +2,8 @@
|
|||
|
||||
let
|
||||
inherit (pkgs) stdenv gzip bzip2 xz luajit zlib autoconf openssl pkgconfig;
|
||||
in stdenv.mkDerivation rec {
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cgit";
|
||||
version = "master";
|
||||
src = ./.;
|
||||
|
|
3
third_party/clj2nix/default.nix
vendored
3
third_party/clj2nix/default.nix
vendored
|
@ -5,4 +5,5 @@ pkgs.callPackage "${(pkgs.fetchFromGitHub {
|
|||
repo = "clj2nix";
|
||||
rev = "3d0a38c954c8e0926f57de1d80d357df05fc2f94";
|
||||
sha256 = "0y77b988qdgsrp4w72v1f5rrh33awbps2qdgp2wr2nmmi44541w5";
|
||||
})}/clj2nix.nix" {}
|
||||
})}/clj2nix.nix"
|
||||
{ }
|
||||
|
|
13
third_party/default.nix
vendored
13
third_party/default.nix
vendored
|
@ -24,11 +24,11 @@
|
|||
# be able to pass `specialArgs`. We depend on this because `depot`
|
||||
# needs to be partially evaluated in NixOS configuration before
|
||||
# module imports are resolved.
|
||||
nixos = {
|
||||
configuration,
|
||||
specialArgs ? {},
|
||||
system ? builtins.currentSystem,
|
||||
...
|
||||
nixos =
|
||||
{ configuration
|
||||
, specialArgs ? { }
|
||||
, system ? builtins.currentSystem
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
eval = import "${pkgs.path}/nixos/lib/eval-config.nix" {
|
||||
|
@ -47,7 +47,8 @@
|
|||
"${pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix"
|
||||
];
|
||||
}).config;
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit (eval) pkgs config options;
|
||||
system = eval.config.system.build.toplevel;
|
||||
vm = vmConfig.system.build.vm;
|
||||
|
|
9
third_party/dhall/default.nix
vendored
9
third_party/dhall/default.nix
vendored
|
@ -5,11 +5,14 @@ let
|
|||
# broken most of the time. The binaries are also fully static
|
||||
# builds, instead of the half-static crap that nixpkgs produces.
|
||||
easy-dhall-nix =
|
||||
import (builtins.fetchTarball {
|
||||
import
|
||||
(builtins.fetchTarball {
|
||||
url = "https://github.com/justinwoo/easy-dhall-nix/archive/eae7f64c4d6c70681e5a56c84198236930ba425e.tar.gz";
|
||||
sha256 = "1y2x15v8a679vlpxazjpibfwajp6zph60f8wjcm4xflbvazk0dx7";
|
||||
}) { inherit pkgs; };
|
||||
in {
|
||||
})
|
||||
{ inherit pkgs; };
|
||||
in
|
||||
{
|
||||
dhall = easy-dhall-nix.dhall-simple;
|
||||
dhall-bash = easy-dhall-nix.dhall-bash-simple;
|
||||
dhall-docs = easy-dhall-nix.dhall-docs-simple;
|
||||
|
|
6
third_party/elmPackages_0_18/default.nix
vendored
6
third_party/elmPackages_0_18/default.nix
vendored
|
@ -7,9 +7,11 @@
|
|||
|
||||
{ pkgs, ... }:
|
||||
|
||||
(import (pkgs.fetchFromGitHub {
|
||||
(import
|
||||
(pkgs.fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
rev = "14f9ee66e63077539252f8b4550049381a082518";
|
||||
sha256 = "1wn7nmb1cqfk2j91l3rwc6yhimfkzxprb8wknw5wi57yhq9m6lv1";
|
||||
}) {}).elmPackages
|
||||
})
|
||||
{ }).elmPackages
|
||||
|
|
18
third_party/gerrit_plugins/builder.nix
vendored
18
third_party/gerrit_plugins/builder.nix
vendored
|
@ -1,13 +1,14 @@
|
|||
{ depot, pkgs, ... }:
|
||||
{
|
||||
buildGerritBazelPlugin = {
|
||||
name,
|
||||
src,
|
||||
depsOutputHash,
|
||||
overlayPluginCmd ? ''
|
||||
buildGerritBazelPlugin =
|
||||
{ name
|
||||
, src
|
||||
, depsOutputHash
|
||||
, overlayPluginCmd ? ''
|
||||
cp -R "${src}" "$out/plugins/${name}"
|
||||
'',
|
||||
postPatch ? "",
|
||||
''
|
||||
, postPatch ? ""
|
||||
,
|
||||
}: ((depot.third_party.gerrit.override {
|
||||
name = "${name}.jar";
|
||||
|
||||
|
@ -25,7 +26,8 @@
|
|||
installPhase = ''
|
||||
cp "bazel-bin/plugins/${name}/${name}.jar" "$out"
|
||||
'';
|
||||
postPatch = if super ? postPatch then ''
|
||||
postPatch =
|
||||
if super ? postPatch then ''
|
||||
${super.postPatch}
|
||||
${postPatch}
|
||||
'' else postPatch;
|
||||
|
|
3
third_party/gerrit_plugins/default.nix
vendored
3
third_party/gerrit_plugins/default.nix
vendored
|
@ -2,7 +2,8 @@
|
|||
|
||||
let
|
||||
inherit (import ./builder.nix args) buildGerritBazelPlugin;
|
||||
in depot.nix.readTree.drvTargets {
|
||||
in
|
||||
depot.nix.readTree.drvTargets {
|
||||
# https://gerrit.googlesource.com/plugins/owners
|
||||
owners = buildGerritBazelPlugin rec {
|
||||
name = "owners";
|
||||
|
|
3
third_party/gerrit_plugins/oauth/default.nix
vendored
3
third_party/gerrit_plugins/oauth/default.nix
vendored
|
@ -2,7 +2,8 @@
|
|||
|
||||
let
|
||||
inherit (import ../builder.nix args) buildGerritBazelPlugin;
|
||||
in buildGerritBazelPlugin rec {
|
||||
in
|
||||
buildGerritBazelPlugin rec {
|
||||
name = "oauth";
|
||||
depsOutputHash = "sha256:0j86amkw54y177s522hc988hqg034fsrkywbsb9a7h14zwcqbran";
|
||||
src = pkgs.fetchgit {
|
||||
|
|
9
third_party/gitignoreSource/default.nix
vendored
9
third_party/gitignoreSource/default.nix
vendored
|
@ -1,14 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
gitignoreNix = import (pkgs.fetchFromGitHub {
|
||||
gitignoreNix = import
|
||||
(pkgs.fetchFromGitHub {
|
||||
owner = "hercules-ci";
|
||||
repo = "gitignore";
|
||||
rev = "f9e996052b5af4032fe6150bba4a6fe4f7b9d698";
|
||||
sha256 = "0jrh5ghisaqdd0vldbywags20m2cxpkbbk5jjjmwaw0gr8nhsafv";
|
||||
}) { inherit (pkgs) lib; };
|
||||
})
|
||||
{ inherit (pkgs) lib; };
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
__functor = _: gitignoreNix.gitignoreSource;
|
||||
|
||||
# expose extra functions here
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
depot.nix.buildGo.external {
|
||||
path = "github.com/charmbracelet/bubbletea";
|
||||
src =
|
||||
let gitSrc = pkgs.fetchFromGitHub {
|
||||
let
|
||||
gitSrc = pkgs.fetchFromGitHub {
|
||||
owner = "charmbracelet";
|
||||
repo = "bubbletea";
|
||||
rev = "v0.13.1";
|
||||
|
@ -11,7 +12,8 @@ depot.nix.buildGo.external {
|
|||
};
|
||||
# The examples/ directory is fairly extensive,
|
||||
# but it also adds most of the dependencies.
|
||||
in pkgs.runCommand gitSrc.name {} ''
|
||||
in
|
||||
pkgs.runCommand gitSrc.name { } ''
|
||||
mkdir -p $out
|
||||
ln -s "${gitSrc}"/* $out
|
||||
rm -r $out/examples
|
||||
|
|
12
third_party/josh/default.nix
vendored
12
third_party/josh/default.nix
vendored
|
@ -8,7 +8,8 @@ let
|
|||
rev = "69dc986e506ba5631c8bbf52835da076a18ec8dc";
|
||||
hash = "sha256:0ybc6ivjkm7bchaszs9lhbl1gbjnyhwq7a3vw6jml3ama84l52lb";
|
||||
};
|
||||
in depot.third_party.naersk.buildPackage {
|
||||
in
|
||||
depot.third_party.naersk.buildPackage {
|
||||
inherit src;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
|
@ -18,8 +19,11 @@ in depot.third_party.naersk.buildPackage {
|
|||
];
|
||||
|
||||
cargoBuildOptions = x: x ++ [
|
||||
"-p" "josh"
|
||||
"-p" "josh-proxy"
|
||||
"-p" "josh-ui"
|
||||
"-p"
|
||||
"josh"
|
||||
"-p"
|
||||
"josh-proxy"
|
||||
"-p"
|
||||
"josh-ui"
|
||||
];
|
||||
}
|
||||
|
|
3
third_party/lisp/bordeaux-threads.nix
vendored
3
third_party/lisp/bordeaux-threads.nix
vendored
|
@ -5,7 +5,8 @@
|
|||
let
|
||||
src = with pkgs; srcOnly lispPackages.bordeaux-threads;
|
||||
getSrc = f: "${src}/src/${f}";
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "bordeaux-threads";
|
||||
deps = [ depot.third_party.lisp.alexandria ];
|
||||
|
||||
|
|
3
third_party/lisp/cl-json.nix
vendored
3
third_party/lisp/cl-json.nix
vendored
|
@ -10,7 +10,8 @@ let
|
|||
rev = "6dfebb9540bfc3cc33582d0c03c9ec27cb913e79";
|
||||
sha256 = "0fx3m3x3s5ji950yzpazz4s0img3l6b3d6l3jrfjv0lr702496lh";
|
||||
};
|
||||
in buildLisp.library {
|
||||
in
|
||||
buildLisp.library {
|
||||
name = "cl-json";
|
||||
deps = [ (buildLisp.bundled "asdf") ];
|
||||
|
||||
|
|
6
third_party/lisp/cl-plus-ssl.nix
vendored
6
third_party/lisp/cl-plus-ssl.nix
vendored
|
@ -3,12 +3,14 @@
|
|||
|
||||
with depot.nix;
|
||||
|
||||
let src = pkgs.fetchgit {
|
||||
let
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/cl-plus-ssl/cl-plus-ssl.git";
|
||||
rev = "29081992f6d7b4e3aa2c5eeece4cd92b745071f4";
|
||||
hash = "sha256:16lyrixl98b7vy29dbbzkbq0xaz789350dajrr1gdny5i55rkjq0";
|
||||
};
|
||||
in buildLisp.library {
|
||||
in
|
||||
buildLisp.library {
|
||||
name = "cl-plus-ssl";
|
||||
deps = with depot.third_party.lisp; [
|
||||
alexandria
|
||||
|
|
6
third_party/lisp/cl-yacc.nix
vendored
6
third_party/lisp/cl-yacc.nix
vendored
|
@ -1,12 +1,14 @@
|
|||
{ depot, pkgs, ... }:
|
||||
|
||||
let src = pkgs.fetchFromGitHub {
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jech";
|
||||
repo = "cl-yacc";
|
||||
rev = "1334f5469251ffb3f8738a682dc8ee646cb26635";
|
||||
sha256 = "16946pzf8vvadnyfayvj8rbh4zjzw90h0azz2qk1mxrvhh5wklib";
|
||||
};
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "cl-yacc";
|
||||
|
||||
srcs = map (f: src + ("/" + f)) [
|
||||
|
|
3
third_party/lisp/closure-common.nix
vendored
3
third_party/lisp/closure-common.nix
vendored
|
@ -3,7 +3,8 @@
|
|||
let
|
||||
src = with pkgs; srcOnly lispPackages.closure-common;
|
||||
getSrcs = builtins.map (p: "${src}/${p}");
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "closure-common";
|
||||
|
||||
# closure-common.asd surpresses some warnings otherwise breaking
|
||||
|
|
3
third_party/lisp/easy-routes.nix
vendored
3
third_party/lisp/easy-routes.nix
vendored
|
@ -9,7 +9,8 @@ let
|
|||
sha256 = "06lnipwc6mmg0v5gybcnr7wn5xmn5xfd1gs19vbima777245bfka";
|
||||
};
|
||||
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "easy-routes";
|
||||
deps = with depot.third_party.lisp; [
|
||||
hunchentoot
|
||||
|
|
3
third_party/lisp/hunchentoot.nix
vendored
3
third_party/lisp/hunchentoot.nix
vendored
|
@ -15,7 +15,8 @@ let
|
|||
"url-rewrite.lisp"
|
||||
];
|
||||
};
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "hunchentoot";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/ironclad.nix
vendored
3
third_party/lisp/ironclad.nix
vendored
|
@ -6,7 +6,8 @@ let
|
|||
src = with pkgs; srcOnly lispPackages.ironclad;
|
||||
getSrc = f: "${src}/src/${f}";
|
||||
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "ironclad";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/lass.nix
vendored
3
third_party/lisp/lass.nix
vendored
|
@ -8,7 +8,8 @@ let
|
|||
sha256 = "11mxzyx34ynsfsrs8pgrarqi9s442vkpmh7kdpzvarhj7i97g8yx";
|
||||
};
|
||||
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "lass";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
6
third_party/lisp/lisp-binary.nix
vendored
6
third_party/lisp/lisp-binary.nix
vendored
|
@ -1,13 +1,15 @@
|
|||
# A library to easily read and write complex binary formats.
|
||||
{ depot, pkgs, ... }:
|
||||
|
||||
let src = pkgs.fetchFromGitHub {
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "j3pic";
|
||||
repo = "lisp-binary";
|
||||
rev = "052df578900dea59bf951e0a6749281fa73432e4";
|
||||
sha256 = "1i1s5g01aimfq6lndcl1pnw7ly5hdh0wmjp2dj9cjjwbkz9lnwcf";
|
||||
};
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "lisp-binary";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/local-time.nix
vendored
3
third_party/lisp/local-time.nix
vendored
|
@ -4,7 +4,8 @@
|
|||
let
|
||||
inherit (depot.nix) buildLisp;
|
||||
src = with pkgs; srcOnly lispPackages.local-time;
|
||||
in buildLisp.library {
|
||||
in
|
||||
buildLisp.library {
|
||||
name = "local-time";
|
||||
deps = [
|
||||
depot.third_party.lisp.cl-fad
|
||||
|
|
3
third_party/lisp/nibbles.nix
vendored
3
third_party/lisp/nibbles.nix
vendored
|
@ -3,7 +3,8 @@
|
|||
let
|
||||
inherit (depot.nix.buildLisp) bundled;
|
||||
src = with pkgs; srcOnly lispPackages.nibbles;
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "nibbles";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/postmodern.nix
vendored
3
third_party/lisp/postmodern.nix
vendored
|
@ -88,6 +88,7 @@ let
|
|||
];
|
||||
};
|
||||
|
||||
in postmodern // {
|
||||
in
|
||||
postmodern // {
|
||||
inherit s-sql cl-postgres;
|
||||
}
|
||||
|
|
3
third_party/lisp/routes.nix
vendored
3
third_party/lisp/routes.nix
vendored
|
@ -20,7 +20,8 @@ let
|
|||
];
|
||||
};
|
||||
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "routes";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
6
third_party/lisp/s-xml/default.nix
vendored
6
third_party/lisp/s-xml/default.nix
vendored
|
@ -1,7 +1,8 @@
|
|||
# XML serialiser for Common Lisp.
|
||||
{ depot, pkgs, ... }:
|
||||
|
||||
let src = pkgs.applyPatches {
|
||||
let
|
||||
src = pkgs.applyPatches {
|
||||
name = "s-xml-source";
|
||||
src = pkgs.lispPackages.s-xml.src;
|
||||
|
||||
|
@ -9,7 +10,8 @@ let src = pkgs.applyPatches {
|
|||
./0001-fix-definition-order-in-xml.lisp.patch
|
||||
];
|
||||
};
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "s-xml";
|
||||
|
||||
srcs = map (f: src + ("/src/" + f)) [
|
||||
|
|
6
third_party/lisp/trivial-ldap.nix
vendored
6
third_party/lisp/trivial-ldap.nix
vendored
|
@ -1,12 +1,14 @@
|
|||
{ depot, pkgs, ... }:
|
||||
|
||||
let src = pkgs.fetchFromGitHub {
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "rwiker";
|
||||
repo = "trivial-ldap";
|
||||
rev = "3b8f1ff85f29ea63e6ab2d0d27029d68b046faf8";
|
||||
sha256 = "1zaa4wnk5y5ff211pkg6dl27j4pjwh56hq0246slxsdxv6kvp1z9";
|
||||
};
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "trivial-ldap";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/trivial-mimes.nix
vendored
3
third_party/lisp/trivial-mimes.nix
vendored
|
@ -11,7 +11,8 @@ let
|
|||
# generally fail — we are not using ASDF after all.
|
||||
'';
|
||||
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "trivial-mimes";
|
||||
|
||||
deps = [
|
||||
|
|
3
third_party/lisp/uax-15.nix
vendored
3
third_party/lisp/uax-15.nix
vendored
|
@ -4,7 +4,8 @@ let
|
|||
inherit (pkgs) runCommand;
|
||||
inherit (depot.nix.buildLisp) bundled;
|
||||
src = with pkgs; srcOnly lispPackages.uax-15;
|
||||
in depot.nix.buildLisp.library {
|
||||
in
|
||||
depot.nix.buildLisp.library {
|
||||
name = "uax-15";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
3
third_party/lisp/usocket-server.nix
vendored
3
third_party/lisp/usocket-server.nix
vendored
|
@ -4,7 +4,8 @@
|
|||
let
|
||||
inherit (depot.nix) buildLisp;
|
||||
src = with pkgs; srcOnly lispPackages.usocket-server;
|
||||
in buildLisp.library {
|
||||
in
|
||||
buildLisp.library {
|
||||
name = "usocket-server";
|
||||
|
||||
deps = with depot.third_party.lisp; [
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue