summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix79
1 files changed, 79 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..2bde98d
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,79 @@
+{
+ description = "Stefan Kreutz's personal website";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ nixpkgs,
+ flake-parts,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
+
+ perSystem =
+ { pkgs, system, ... }:
+ let
+ src = builtins.path {
+ path = ./.;
+ name = "blog";
+ };
+ in
+ rec {
+ # nix develop
+ devShells.default = pkgs.mkShell {
+ nativeBuildInputs = with pkgs; [
+ ghc
+ cabal-install
+ lychee
+ zlib
+ ];
+ };
+
+ # nix build .
+ # nix run nixpkgs#python3 -- -m http.server --directory ./result/srv/www.skreutz.com --bind 127.0.0.1 8080
+ # open http://127.0.0.1:8080/
+ packages.default = packages.site;
+
+ # nix run .#generator -- --help
+ packages.generator = pkgs.haskell.lib.compose.justStaticExecutables (
+ pkgs.haskellPackages.callCabal2nix "blog" src { }
+ );
+
+ # nix build .#site
+ packages.site = pkgs.callPackage ./site.nix {
+ inherit self;
+ inherit (packages) generator;
+ };
+
+ # nix flake check
+ checks.links = pkgs.stdenvNoCC.mkDerivation {
+ inherit src;
+ name = "offline-link-check";
+ dontBuild = true;
+ doCheck = true;
+ nativeBuildInputs = with pkgs; [ lychee ];
+ checkPhase = ''
+ "${packages.generator}/bin/site" rebuild
+ lychee --offline --no-progress --require-https --root-dir "$( realpath _site )" _site
+ '';
+ installPhase = ''
+ mkdir $out
+ '';
+ };
+
+ # nix fmt
+ formatter = pkgs.nixfmt-tree;
+ };
+ };
+}
Generated by cgit. See skreutz.com for my tech blog and contact information.