Skip to content

Commit 0847b49

Browse files
committed
Nixify + add to website
1 parent 1f36bd8 commit 0847b49

File tree

10 files changed

+58
-112
lines changed

10 files changed

+58
-112
lines changed

docs/agda-spec/.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
result*
66

77
*.pdf
8-
src/latex/Ledger/*
9-
src/latex/MidnightExample/*
10-
src/latex/bclogo.sty
8+
src/latex/
119

1210
dist/
1311

docs/agda-spec/flake.nix

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/agda-spec/shell.nix

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/agda-spec/src/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
*.lof
22
!consensus-spec.bbl
33
!rules.pdf
4-

docs/website/contents/about-ouroboros/References.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The following artifacts influence and/or describe the Consensus implementation.
88
* [Ouroboros Praos][ouroboros-praos]
99
* [Ouroboros Genesis][ouroboros-genesis]
1010
* [Ledger specifications][cardano-ledger].
11-
* [Consensus (Praos) specification](/pdfs/consensus-spec.pdf)
11+
* Consensus (Praos) specification: [Agda style](/pdfs/consensus-spec-agda.pdf), [LaTeX style](/pdfs/consensus-spec.pdf)
1212
* [Quick reference table for all Cardano features](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-table.md).
1313
This includes the dates and first slot numbers of all eras and hard forks.
1414
* IOG media:

flake.lock

Lines changed: 17 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
url = "github:nix-community/flake-compat";
3232
flake = false;
3333
};
34+
agda-nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
3435
# for cabal-docspec
3536
cabal-extras = {
3637
url = "github:phadej/cabal-extras/cabal-docspec-0.0.0.20240703";
@@ -63,7 +64,8 @@
6364
inputs.iohkNix.overlays.haskell-nix-extra
6465
(import ./nix/tools.nix inputs)
6566
(import ./nix/haskell.nix inputs)
66-
(import ./nix/pdfs.nix)
67+
(import ./nix/agda.nix inputs)
68+
(import ./nix/pdfs.nix inputs)
6769
];
6870
};
6971
hydraJobs = import ./nix/ci.nix { inherit inputs pkgs; };
@@ -76,6 +78,8 @@
7678
ghc910 = hydraJobs.native.haskell910.devShell;
7779
ghc910-profiled = hydraJobs.native.haskell910.devShellProfiled;
7880

81+
agda-spec = pkgs.agda-spec.shell;
82+
7983
website = pkgs.mkShell {
8084
packages = [ pkgs.nodejs pkgs.yarn ];
8185
};
Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
1-
{ sources ? import ./nix/sources.nix
2-
, pkgs ? import sources.nixpkgs {
3-
overlays = [ ];
4-
config = { };
5-
}
6-
}:
1+
inputs: final: prev:
72

8-
with pkgs;
93
let
4+
pkgs = final;
5+
106
locales = {
117
LANG = "en_US.UTF-8";
128
LC_ALL = "en_US.UTF-8";
13-
LOCALE_ARCHIVE = if pkgs.system == "x86_64-linux"
14-
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
15-
else "";
9+
LOCALE_ARCHIVE =
10+
if pkgs.system == "x86_64-linux"
11+
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
12+
else "";
1613
};
1714

18-
customAgda = import sources.agda-nixpkgs {
19-
inherit (pkgs) system;
20-
};
15+
customAgda = inputs.agda-nixpkgs.legacyPackages.${pkgs.system};
2116

2217
agdaStdlib = customAgda.agdaPackages.standard-library;
2318

2419
agdaStdlibClasses = customAgda.agdaPackages.mkDerivation {
2520
inherit (locales) LANG LC_ALL LOCALE_ARCHIVE;
2621
pname = "agda-stdlib-classes";
2722
version = "2.0";
28-
src = fetchFromGitHub {
23+
src = pkgs.fetchFromGitHub {
2924
repo = "agda-stdlib-classes";
3025
owner = "omelkonian";
3126
rev = "v2.0";
@@ -41,7 +36,7 @@ let
4136
inherit (locales) LANG LC_ALL LOCALE_ARCHIVE;
4237
pname = "agda-stdlib-meta";
4338
version = "2.0";
44-
src = fetchFromGitHub {
39+
src = pkgs.fetchFromGitHub {
4540
repo = "stdlib-meta";
4641
owner = "input-output-hk";
4742
rev = "4fc4b1ed6e47d180516917d04be87cbacbf7d314";
@@ -56,33 +51,29 @@ let
5651
deps = [ agdaStdlib agdaStdlibClasses agdaStdlibMeta ];
5752
agdaWithPkgs = p: customAgda.agda.withPackages { pkgs = p; ghc = pkgs.ghc; };
5853

59-
in
60-
rec {
54+
attrs = pkgs.recurseIntoAttrs rec {
55+
agda = agdaWithPkgs deps;
6156

62-
agdaWithDeps = agdaWithPkgs deps;
63-
agda = agdaWithPkgs deps;
64-
65-
latex = texlive.combine {
66-
inherit (texlive)
67-
scheme-small
68-
xits
69-
collection-latexextra
70-
collection-latexrecommended
71-
collection-mathscience
72-
bclogo
73-
latexmk;
74-
};
57+
latex = pkgs.texlive.combine {
58+
inherit (pkgs.texlive)
59+
scheme-small
60+
xits
61+
collection-latexextra
62+
collection-latexrecommended
63+
collection-mathscience
64+
bclogo
65+
latexmk;
66+
};
7567

76-
mkSpecDerivation = { project, main }: rec {
77-
docs = stdenv.mkDerivation {
68+
docs = pkgs.stdenv.mkDerivation {
7869
inherit (locales) LANG LC_ALL LOCALE_ARCHIVE;
7970
pname = "docs";
8071
version = "0.1";
81-
src = "${formalLedger}";
72+
src = ../docs/agda-spec;
8273
meta = { };
83-
buildInputs = [ agdaWithDeps latex python3 ];
74+
buildInputs = [ agda latex pkgs.python3 ];
8475
buildPhase = ''
85-
OUT_DIR=$out make "${project}".docs
76+
OUT_DIR=$out make docs
8677
'';
8778
doCheck = true;
8879
checkPhase = ''
@@ -91,7 +82,9 @@ rec {
9182
dontInstall = true;
9283
};
9384

94-
hsExe = haskell.lib.disableLibraryProfiling (haskellPackages.callCabal2nixWithOptions "${project}" "${hsSrc}/haskell/${main}" "--no-haddock" {});
95-
85+
shell = pkgs.mkShell {
86+
packages = [ agda latex ];
87+
};
9688
};
97-
}
89+
in
90+
{ agda-spec = attrs; }

nix/ci.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let
4040
haskell96 = mkHaskellJobsFor pkgs.hsPkgs;
4141
} // lib.optionalAttrs (buildSystem == "x86_64-linux") {
4242
formatting = import ./formatting.nix pkgs;
43-
inherit (pkgs) consensus-pdfs;
43+
inherit (pkgs) consensus-pdfs agda-spec;
4444

4545
# ensure we can still build on 8.10, can be removed soon
4646
haskell810 = builtins.removeAttrs

nix/pdfs.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
final: prev: {
1+
inputs: final: prev: {
22
consensus-pdfs = final.stdenvNoCC.mkDerivation {
33
name = "ouroboros-consensus-pdfs";
44
src = ../docs;
@@ -35,6 +35,7 @@ final: prev: {
3535
3636
cp tech-reports/**/*.pdf $out/
3737
cp formal-spec/consensus-spec.pdf $out/
38+
cp ${final.agda-spec.docs}/pdfs/consensus-spec.pdf $out/consensus-spec-agda.pdf
3839
3940
mkdir -p $out/nix-support
4041
for pdf in $out/*.pdf; do

0 commit comments

Comments
 (0)