summaryrefslogtreecommitdiff
path: root/flake.nix
blob: e6400750452590c8dd0eb3a61ab554f38a8d1a86 (plain) (blame)
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
{
  outputs = { self, nixpkgs }@inputs:
    let
      forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
    in
    {
      devShells = forAllSystems (system:
        let pkgs = nixpkgs.legacyPackages.${system}; in
        with pkgs; {
          default = mkShell {
            buildInputs = [
              git
              hugo
              nodePackages_latest.prettier
            ];
          };
        }
      );
      packages = forAllSystems (system:
        let pkgs = nixpkgs.legacyPackages.${system}; in
        with pkgs; {
          default = buildGoModule {
            name = "check-caps-lock";
            src = ./.;
            nativeBuildInputs = [ hugo git ];

            vendorHash = "sha256-HMUsA2XlRAZfQOQCjQlby7UriY6d2h3xZlqPguhrwOw=";

            buildPhase = ''
              export HUGO_PARAMS_ENV=production
              export HUGO_PARAMS_FOOTER_TEXT="built on $(date -u --iso-8601=seconds)"
              hugo --logLevel debug
            '';

            postInstall = ''
              rm -rf $out
              cp -r public $out
            '';
          };
        }
      );
    };
}