Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit a0e6533

Browse files
committed
add std flake and tullia
1 parent 0dc3f16 commit a0e6533

File tree

8 files changed

+560
-2
lines changed

8 files changed

+560
-2
lines changed

flake.lock

Lines changed: 447 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
inputs = {
3+
nixpkgs.follows = "tullia/nixpkgs";
4+
std.follows = "tullia/std";
5+
tullia.url = github:input-output-hk/tullia;
6+
};
7+
8+
outputs = {
9+
self,
10+
std,
11+
tullia,
12+
...
13+
} @ inputs:
14+
std.growOn {
15+
inherit inputs;
16+
cellsFrom = nix/cells;
17+
cellBlocks = [
18+
(std.functions "library")
19+
(std.functions "hydraJobs")
20+
(tullia.tasks "pipelines")
21+
(std.functions "actions")
22+
];
23+
}
24+
(
25+
tullia.fromStd {
26+
actions = std.harvest self ["cloud" "actions"];
27+
tasks = std.harvest self ["automation" "pipelines"];
28+
}
29+
)
30+
{
31+
hydraJobs = std.harvest self ["automation" "hydraJobs"];
32+
};
33+
34+
nixConfig = {
35+
extra-substituters = ["https://cache.iog.io"];
36+
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
37+
allow-import-from-derivation = true;
38+
};
39+
}

nix/cells/automation/hydraJobs.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
cell,
3+
inputs,
4+
}:
5+
6+
import "${inputs.self}/release.nix" {
7+
smash = inputs.self;
8+
supportedSystems = [inputs.nixpkgs.system];
9+
}

nix/cells/automation/pipelines.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
inputs,
3+
cell,
4+
}: {
5+
ci = {config, lib, ...}: {
6+
preset = {
7+
nix.enable = true;
8+
9+
github.ci = {
10+
# Tullia tasks can run locally or on Cicero.
11+
# When no facts are present we know that we are running locally and vice versa.
12+
# When running locally, the current directory is already bind-mounted into the container,
13+
# so we don't need to fetch the source from GitHub and we don't want to report a GitHub status.
14+
enable = config.actionRun.facts != {};
15+
repository = "input-output-hk/smash";
16+
revision = config.preset.github.lib.readRevision inputs.cells.cloud.library.actionCiInputName null;
17+
};
18+
};
19+
20+
command.text = config.preset.github.status.lib.reportBulk {
21+
bulk.text = "nix eval .#hydraJobs --apply __attrNames --json | nix-systems -i";
22+
each.text = ''nix build -L .#hydraJobs."$1".required'';
23+
skippedDescription = lib.escapeShellArg "No nix builder available for this system";
24+
};
25+
26+
memory = 1024 * 8;
27+
nomad.resources.cpu = 10000;
28+
};
29+
}

nix/cells/cloud/actions.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
cell,
3+
inputs,
4+
}: {
5+
"smash/ci" = {
6+
task = "ci";
7+
io = ''
8+
// This is a CUE expression that defines what events trigger a new run of this action.
9+
// There is no documentation for this yet. Ask SRE if you have trouble changing this.
10+
11+
let github = {
12+
#input: "${cell.library.actionCiInputName}"
13+
#repo: "input-output-hk/smash"
14+
}
15+
16+
#lib.merge
17+
#ios: [
18+
#lib.io.github_push & github,
19+
{ #lib.io.github_pr, github, #target_default: false },
20+
]
21+
'';
22+
};
23+
}

nix/cells/cloud/library.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
inputs,
3+
cell,
4+
}: {
5+
actionCiInputName = "GitHub event";
6+
}

nix/default.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ let
77
sources = import ./sources.nix { inherit pkgs; }
88
// sourcesOverride;
99
iohkNix = import sources.iohk-nix {};
10-
haskellNix = import sources."haskell.nix" {};
10+
haskellNix = import sources."haskell.nix" {
11+
pkgs = import iohkNix.sources.nixpkgs { inherit system; };
12+
};
1113
nixpkgs = haskellNix.sources.nixpkgs-2105;
1214

1315
# for inclusion in pkgs:

release.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
, sourcesOverride ? {}
3131

3232
# Import pkgs, including IOHK common nix lib
33-
, pkgs ? import ./nix { inherit sourcesOverride; }
33+
, pkgs ? import ./nix {
34+
inherit sourcesOverride;
35+
system = builtins.head supportedSystems;
36+
}
3437

3538
}:
3639

0 commit comments

Comments
 (0)