-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathflake.nix
64 lines (62 loc) · 1.73 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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";
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
inputs.systems.url = "github:nix-systems/default";
inputs.flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
outputs =
{ nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
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
'';
};
}
);
}