Skip to content

Commit

Permalink
Merge pull request #34 from metaspace/flake-update
Browse files Browse the repository at this point in the history
build: add nix package and docs in nix flake
  • Loading branch information
ojeda authored Nov 7, 2024
2 parents 6eed0ff + 0509148 commit 58e57db
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 4 deletions.
63 changes: 63 additions & 0 deletions flake.lock

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

47 changes: 43 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# To use get a shell ready to build the website run `nix develop`.
#
# To set up automatic rendering of the HTML in the development shell, run:
#
# python3 pre.py
# mdbook watch
#
# If you also want to serve the HTML from a local webserver, run
#
# python3 pre.py
# mdbook serve
#
# To build the book:
#
# nix build .\#default
#
# The build artifacts are available through the symlink `result` in the current
# working directory directory.
#
# Note: flakes and the `nix` command are experimental and must be enabled
# explicitly [1][2]. Also see the NixOS Wiki entry on flakes [3].
#
# [1] https://nix.dev/manual/nix/2.17/contributing/experimental-features#xp-feature-nix-command
# [2] https://nix.dev/manual/nix/2.17/contributing/experimental-features#xp-feature-flakes
# [3] https://nixos.wiki/wiki/Flakes

{
description = "Shell for building rust-for-linux.com";
Expand All @@ -14,12 +39,26 @@
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell { packages = with pkgs; [
buildDeps = with pkgs; [
python3
mdbook
]; };
];
in
{
devShells.default = pkgs.mkShell { packages = buildDeps; };
packages.default = pkgs.stdenv.mkDerivation {
name = "rust-for-linux.com";
nativeBuildInputs = buildDeps;
src = ./.;
buildPhase = ''
python3 pre.py
mdbook build
python3 post.py
'';
installPhase = ''
cp -r book $out
'';
};
}
);
}

0 comments on commit 58e57db

Please sign in to comment.