Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use flake

source_env_if_exists .envrc.local
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
target
README.html

# Nix
result
result-*

# direnv
.direnv/
.envrc.local
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

210 changes: 210 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
cardano-playground.url = "github:input-output-hk/cardano-playground/56ebfef5595c43014029b039ade01b0ef06233e0";
cardano-playground.flake = false; # otherwise, +9k dependencies in flake.lock…
sanchonet.url = "github:Hornan7/SanchoNet-Tutorials";
sanchonet.flake = false;
advisory-db.url = "github:rustsec/advisory-db";
advisory-db.flake = false;
};

outputs = inputs: let
inherit (inputs.nixpkgs) lib;
in
inputs.flake-parts.lib.mkFlake {inherit inputs;} ({config, ...}: {
imports = [
inputs.devshell.flakeModule
inputs.treefmt-nix.flakeModule
];

systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem = {system, ...}: let
internal = inputs.self.internal.${system};
in {
packages =
{
default = internal.acropolis-process-omnibus;
inherit (internal) acropolis-process-omnibus acropolis-process-replayer;
}
// (lib.optionalAttrs (system == "x86_64-linux") {
acropolis-process-omnibus-x86_64-windows = inputs.self.internal.x86_64-windows.acropolis-process-omnibus;
acropolis-process-replayer-x86_64-windows = inputs.self.internal.x86_64-windows.acropolis-process-replayer;
});

devshells.default = import ./nix/devshells.nix {inherit inputs;};

checks = internal.cargoChecks // internal.nixChecks;

treefmt =
/*
{ pkgs, ...}
*/
_: {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true; # Nix
# TODO: enable them one by one (large commits, mostly whitespace):
#prettier.enable = true;
#rustfmt.enable = true;
#rustfmt.package = internal.rustfmt;
#yamlfmt.enable = pkgs.system != "x86_64-darwin"; # a treefmt-nix+yamlfmt bug on Intel Macs
#taplo.enable = true; # TOML
#shfmt.enable = true;
};
# settings.formatter.rustfmt.options = [
# "--config-path"
# (builtins.path {
# name = "rustfmt.toml";
# path = ./rustfmt.toml;
# })
# ];
};
};

flake = {
internal =
lib.genAttrs config.systems (
targetSystem: import ./nix/internal/unix.nix {inherit inputs targetSystem;}
)
// lib.genAttrs ["x86_64-windows"] (
targetSystem: import ./nix/internal/windows.nix {inherit inputs targetSystem;}
);

hydraJobs = let
crossSystems = ["x86_64-windows"];
allJobs = {
acropolis-process-omnibus = lib.genAttrs (config.systems ++ crossSystems) (
targetSystem: inputs.self.internal.${targetSystem}.acropolis-process-omnibus
);
acropolis-process-replayer = lib.genAttrs (config.systems ++ crossSystems) (
targetSystem: inputs.self.internal.${targetSystem}.acropolis-process-replayer
);
devshell = lib.genAttrs config.systems (
targetSystem: inputs.self.devShells.${targetSystem}.default
);
inherit (inputs.self) checks;
};
in
allJobs
// {
required = inputs.nixpkgs.legacyPackages.x86_64-linux.releaseTools.aggregate {
name = "github-required";
meta.description = "All jobs required to pass CI";
constituents = lib.collect lib.isDerivation allJobs;
};
};

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";
};
};
});
}
2 changes: 1 addition & 1 deletion modules/genesis_bootstrapper/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn fetch_bytes(client: &reqwest::Client, url: &str) -> Result<Vec<u8>> {
if let Ok(path) = env::var("ACROPOLIS_OFFLINE_MIRROR") {
if let Ok(file) = File::open(&path) {
if let Ok(map) = from_reader::<_, HashMap<String, String>>(file) {
if let Some(path) = map.get(url) {
if let Some(path) = map.get(url.trim()) {
if let Ok(bytes) = fs::read(&Path::new(path).to_path_buf()) {
return Ok(bytes);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/parameters_state/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn fetch_text(url: &str) -> Result<String, Box<dyn std::error::Error>> {
if !path.is_empty() {
if let Ok(file) = File::open(path) {
if let Ok(map) = from_reader::<_, HashMap<String, String>>(file) {
if let Some(path_str) = map.get(url) {
if let Some(path_str) = map.get(url.trim()) {
if let Ok(s) = fs::read_to_string(&Path::new(path_str).to_path_buf()) {
return Ok(s);
}
Expand Down
Loading