c8h4.io/flake.nix
Christoph Heiss b11dc64f02
flake: Add script to update public GPG key
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-10-17 22:26:17 +02:00

78 lines
1.9 KiB
Nix

{
description = "c8h4.io website";
inputs = {
nixpkgs.url =
"github:NixOS/nixpkgs/21ad1050bf67f6a31acc38d41b7999e1a0bd0ca0"; # 31-07-2023
flake-utils.url =
"github:numtide/flake-utils/919d646de7be200f3bf08cb76ae1f09402b6f9b4"; # 11-07-2023
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
src = ./.;
c8h4-io = pkgs.stdenv.mkDerivation {
name = "c8h4-io-hugo";
inherit src;
buildInputs = with pkgs; [ hugo ];
buildPhase = ''
hugo --minify
'';
installPhase = ''
mkdir -p $out
cp -vr public/* $out/
'';
};
in {
checks = rec {
inherit c8h4-io;
default = c8h4-io;
c8h4-io-prettier = pkgs.stdenv.mkDerivation {
name = "c8h4-io-prettier";
inherit src;
buildInputs = with pkgs; [ nodePackages.prettier ];
buildPhase = ''
prettier --check .
'';
installPhase = ''
mkdir -p $out
'';
};
};
packages = rec {
inherit c8h4-io;
default = c8h4-io;
update-gpg-key = pkgs.writeShellScriptBin "c8h4-io-update-gpg-key" ''
${pkgs.gnupg}/bin/gpg --export --armor 9C561D6430B28D6BDCBC9CEB73D5E7FDEE3DE49A >static/gpg.asc
'';
};
apps.devserver = let
drv = pkgs.writeShellScript "c8h4-io-hugo-devserver" ''
${pkgs.hugo}/bin/hugo server
'';
in {
type = "app";
program = "${drv}";
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
deadnix
hugo
nixfmt
nodePackages.prettier
statix
];
};
});
}