Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 447 additions & 0 deletions flake.lock

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
inputs = {
nixpkgs.follows = "tullia/nixpkgs";
std.follows = "tullia/std";
tullia.url = github:input-output-hk/tullia;
};

outputs = {
self,
std,
tullia,
...
} @ inputs:
std.growOn {
inherit inputs;
cellsFrom = nix/cells;
cellBlocks = [
(std.functions "library")
(std.functions "hydraJobs")
(tullia.tasks "pipelines")
(std.functions "actions")
];
}
(
tullia.fromStd {
actions = std.harvest self ["cloud" "actions"];
tasks = std.harvest self ["automation" "pipelines"];
}
)
{
hydraJobs = std.harvest self ["automation" "hydraJobs"];
};

nixConfig = {
extra-substituters = ["https://cache.iog.io"];
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
allow-import-from-derivation = true;
};
}
9 changes: 9 additions & 0 deletions nix/cells/automation/hydraJobs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
cell,
inputs,
}:

import "${inputs.self}/release.nix" {
smash = inputs.self;
supportedSystems = [inputs.nixpkgs.system];
}
29 changes: 29 additions & 0 deletions nix/cells/automation/pipelines.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
inputs,
cell,
}: {
ci = {config, lib, ...}: {
preset = {
nix.enable = true;

github.ci = {
# Tullia tasks can run locally or on Cicero.
# When no facts are present we know that we are running locally and vice versa.
# When running locally, the current directory is already bind-mounted into the container,
# so we don't need to fetch the source from GitHub and we don't want to report a GitHub status.
enable = config.actionRun.facts != {};
repository = "input-output-hk/smash";
revision = config.preset.github.lib.readRevision inputs.cells.cloud.library.actionCiInputName null;
};
};

command.text = config.preset.github.status.lib.reportBulk {
bulk.text = "nix eval .#hydraJobs --apply __attrNames --json | nix-systems -i";
each.text = ''nix build -L .#hydraJobs."$1".required'';
skippedDescription = lib.escapeShellArg "No nix builder available for this system";
};

memory = 1024 * 8;
nomad.resources.cpu = 10000;
};
}
23 changes: 23 additions & 0 deletions nix/cells/cloud/actions.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
cell,
inputs,
}: {
"smash/ci" = {
task = "ci";
io = ''
// This is a CUE expression that defines what events trigger a new run of this action.
// There is no documentation for this yet. Ask SRE if you have trouble changing this.

let github = {
#input: "${cell.library.actionCiInputName}"
#repo: "input-output-hk/smash"
}

#lib.merge
#ios: [
#lib.io.github_push & github,
{ #lib.io.github_pr, github, #target_default: false },
]
'';
};
}
6 changes: 6 additions & 0 deletions nix/cells/cloud/library.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
inputs,
cell,
}: {
actionCiInputName = "GitHub event";
}
6 changes: 4 additions & 2 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ let
sources = import ./sources.nix { inherit pkgs; }
// sourcesOverride;
iohkNix = import sources.iohk-nix {};
haskellNix = import sources."haskell.nix" {};
nixpkgs = haskellNix.sources.nixpkgs-2105;
haskellNix = import sources."haskell.nix" {
pkgs = import nixpkgs { inherit system; };
};
nixpkgs = iohkNix.nixpkgs;

# for inclusion in pkgs:
overlays =
Expand Down
5 changes: 4 additions & 1 deletion release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
, sourcesOverride ? {}

# Import pkgs, including IOHK common nix lib
, pkgs ? import ./nix { inherit sourcesOverride; }
, pkgs ? import ./nix {
inherit sourcesOverride;
system = builtins.head supportedSystems;
}

}:

Expand Down