Skip to content

Commit

Permalink
restore nix for docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-noland committed Oct 22, 2024
1 parent fb80828 commit 0119cf3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 86 deletions.
60 changes: 44 additions & 16 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,54 @@
{
dpdk-sys,
buildPkgs ? (import ./outside.nix {}).muslEnv,
toolPkgs ? import <nixpkgs> {},
pkgs ? import <nixpkgs> { },
}: rec {

inherit buildPkgs;

project-name = "hedgehog-dataplane";

toolchain = toolPkgs.buildEnv {
name = "${project-name}-toolchain";
paths = toolchainPackages { pkgs = toolPkgs; };
pathsToLink = [ "/" ];
};
inherit pkgs;

mdbook-citeproc = import ./nix/mdbook-citeproc.nix (with pkgs; {
inherit lib stdenv fetchFromGitHub rustPlatform CoreServices;
});

mdbook-alerts = import ./nix/mdbook-alerts.nix (with pkgs; {
inherit lib stdenv fetchFromGitHub rustPlatform CoreServices;
});

buildDeps = pkgs: (with pkgs; [
bash
bash-completion
coreutils
git
mdbook
mdbook-admonish
mdbook-katex
mdbook-mermaid
mdbook-plantuml
pandoc # needed for mdbook-citeproc to work (runtime exe dep)
plantuml # needed for mdbook-plantuml to work (runtime exe dep)
]) ++ [
mdbook-citeproc
mdbook-alerts
];

shell = toolPkgs.mkShell {
shell = pkgs.buildFHSUserEnv {
name = "${project-name}-shell";
packages = (toolchainPackages toolPkgs);
shellHook = ''
export PS1="\[\e[1;32m\][${project-name}]\[\e[0m\] $PS1"
export LIBCLANG_PATH=${toolPkgs.llvmPackages.libclang.lib}/lib
export LD_LIBRARY_PATH=$LIBCLANG_PATH:$LD_LIBRARY_PATH
targetPkgs = buildDeps;
};

design-docs = pkgs.stdenv.mkDerivation {
name = "${project-name}-design-docs";
src = ./design-docs/src/mdbook;
buildInputs = buildDeps pkgs;
buildPhase = ''
set -euo pipefail;
rm --force --recursive book;
mdbook build;
'';
installPhase = ''
set -euo pipefail;
cp -a book $out;
'';
};

}
61 changes: 0 additions & 61 deletions flake.lock

This file was deleted.

15 changes: 6 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This is currently scratch work while I figure out how to build this project with flakes
{
description = "Hedgehog dataplane scratch flake";
description = "Hedgehog dataplane";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
Expand All @@ -12,13 +11,11 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
build-flags = (import ./nix/flags.nix).release;
overlays = (import ./nix/overlays.nix { inherit build-flags; });
buildPkgs = (import ./nix/outside.nix { inherit pkgs overlays; }).muslEnv;
defaultBuild = (import ./default.nix { inherit buildPkgs; toolPkgs = pkgs; });
in {
defaultPackage = defaultBuild.dpdk;
# defaultPackage = build-flags;
default = import ./default.nix { inherit pkgs; };
in
{
devShell = default.shell;
packages.design-docs = default.design-docs;
}
);
}

0 comments on commit 0119cf3

Please sign in to comment.