tonybtw

https://git.tonybtw.com/tonybtw.git git://git.tonybtw.com/tonybtw.git
1,384 bytes raw
1
{
2
  description = "Dev shell and builder for tonybtw.com (Makefile + pandoc)";
3
4
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5
6
  outputs = { self, nixpkgs, ... }:
7
    let
8
      systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
9
      foreach = f: builtins.listToAttrs (map (system: { name = system; value = f system; }) systems);
10
      toolsFor = pkgs: [
11
        pkgs.gnumake pkgs.pandoc pkgs.coreutils pkgs.gnused pkgs.gawk
12
        pkgs.findutils pkgs.python3 pkgs.bash
13
      ];
14
    in
15
    {
16
      packages = foreach (system:
17
        let pkgs = import nixpkgs { inherit system; }; in
18
        {
19
          default = pkgs.stdenvNoCC.mkDerivation {
20
            name = "tonybtw.com";
21
            src = ./.;
22
            nativeBuildInputs = toolsFor pkgs;
23
            buildPhase = "make site";
24
            installPhase = ''
25
              mkdir -p $out
26
              cp -r public/. $out/
27
            '';
28
          };
29
        });
30
31
      devShells = foreach (system:
32
        let pkgs = import nixpkgs { inherit system; }; in
33
        {
34
          default = pkgs.mkShell {
35
            packages = toolsFor pkgs ++ [ pkgs.woff2 ];
36
            shellHook = ''
37
              export PS1="(tonybtw-dev) $PS1"
38
              echo "build:  make"
39
              echo "serve:  make serve   (http://localhost:1313)"
40
            '';
41
          };
42
        });
43
    };
44
}