alejandr0angul0.dev/flake.nix

111 lines
2.9 KiB
Nix
Raw Normal View History

2023-08-18 03:22:40 +00:00
{
description = "Alejandro Angulo's Personal Website";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devenv.url = "github:cachix/devenv";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = {
self,
nixpkgs,
flake-utils,
devenv,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
utf8Locale = pkgs.glibcLocales.override {
allLocales = false;
locales = ["en_US.UTF-8/UTF-8"];
2023-08-18 03:22:40 +00:00
};
in {
packages.alejandr0angul0-dot-dev = pkgs.stdenv.mkDerivation {
name = "alejandr0angul0-dot-dev";
src = self;
buildPhase = ''
${pkgs.hugo}/bin/hugo --minify
'';
doCheck = true;
checkPhase = ''
env LOCALE_ARCHIVE=${utf8Locale}/lib/locale/locale-archive LC_ALL=en_US.UTF-8 \
${pkgs.html-proofer}/bin/htmlproofer public \
--allow-hash-href \
--ignore-empty-alt \
--disable-external \
--no-enforce-https
'';
installPhase = ''
cp -r public "$out"
'';
2023-08-18 03:22:40 +00:00
};
2023-09-17 22:43:15 +00:00
# Workaround for cachix/devenv#756
# See here: https://github.com/cachix/devenv/issues/756
packages.devenv-up = self.devShell.${system}.config.procfileScript;
2023-08-18 03:22:40 +00:00
defaultPackage = self.packages.${system}.alejandr0angul0-dot-dev;
apps = rec {
hugo = flake-utils.lib.mkApp {drv = pkgs.hugo;};
default = hugo;
};
devShell = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({pkgs, ...}: {
languages.javascript = {
enable = true;
npm.install.enable = true;
corepack.enable = true;
};
packages = with pkgs; [
actionlint
alejandra
hugo
html-proofer
awscli2
];
pre-commit = {
hooks = {
actionlint.enable = true;
alejandra.enable = true;
eslint.enable = true;
markdownlint = {
enable = true;
excludes = ["node_modules"];
};
prettier = {
enable = true;
excludes = ["flake.lock"];
};
};
2023-08-25 03:29:54 +00:00
settings.markdownlint.config = {
MD013.code_blocks = false;
};
2023-08-18 03:22:40 +00:00
};
2023-09-17 22:43:15 +00:00
processes.hugo-server.exec = "${pkgs.hugo}/bin/hugo server";
2023-08-18 03:22:40 +00:00
enterShell = ''
export PATH=./node_modules/.bin:$PATH
'';
})
];
};
});
}