From 1e233b960c1131029d87fa53ceabf2c0b49dcf61 Mon Sep 17 00:00:00 2001 From: jamie Date: Sun, 15 Jun 2025 19:53:48 +0100 Subject: feat: add linter to flake and format --- css/default.scss | 2 +- css/syntax.css | 14 +++++++---- flake.lock | 37 ++++++++++++++++++++++++++++- flake.nix | 18 ++++++++++++-- index.html | 4 ++-- justfile | 4 ++++ site.hs | 6 ++--- templates/archive.html | 3 ++- templates/default.html | 62 +++++++++++++++++++++++------------------------- templates/post-list.html | 6 ++--- templates/post.html | 11 +++------ 11 files changed, 108 insertions(+), 59 deletions(-) diff --git a/css/default.scss b/css/default.scss index a33ba78..a163f7f 100644 --- a/css/default.scss +++ b/css/default.scss @@ -158,4 +158,4 @@ article .header { float: left; font-size: 1.8rem; } -} \ No newline at end of file +} diff --git a/css/syntax.css b/css/syntax.css index 3e02bca..8eb42ef 100644 --- a/css/syntax.css +++ b/css/syntax.css @@ -78,7 +78,8 @@ pre.numberSource { padding-left: 4px; } -div.sourceCode {} +div.sourceCode { +} @media screen { a.sourceLine::before { @@ -109,7 +110,8 @@ code span.bn { } /* BaseN */ -code span.bu {} +code span.bu { +} /* BuiltIn */ code span.cf { @@ -163,7 +165,8 @@ code span.er { } /* Error */ -code span.ex {} +code span.ex { +} /* Extension */ code span.fl { @@ -176,7 +179,8 @@ code span.fu { } /* Function */ -code span.im {} +code span.im { +} /* Import */ code span.in { @@ -238,4 +242,4 @@ code span.wa { font-style: italic; } -/* Warning */ \ No newline at end of file +/* Warning */ diff --git a/flake.lock b/flake.lock index 2bdaf91..84f562e 100644 --- a/flake.lock +++ b/flake.lock @@ -64,11 +64,46 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1747958103, + "narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1749194973, + "narHash": "sha256-eEy8cuS0mZ2j/r/FE0/LYBSBcIs/MKOIVakwHVuqTfk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "a05be418a1af1198ca0f63facb13c985db4cb3c5", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index aa7851f..4670d05 100644 --- a/flake.nix +++ b/flake.nix @@ -3,16 +3,19 @@ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; # https://community.flake.parts/haskell-flake + treefmt-nix.url = "github:numtide/treefmt-nix"; }; outputs = inputs @ { - self, nixpkgs, flake-parts, ... }: flake-parts.lib.mkFlake {inherit inputs;} { systems = nixpkgs.lib.systems.flakeExposed; - imports = [inputs.haskell-flake.flakeModule]; + imports = [ + inputs.haskell-flake.flakeModule + inputs.treefmt-nix.flakeModule + ]; perSystem = { self', @@ -31,6 +34,17 @@ }; }; + treefmt = { + flakeCheck = true; + programs = { + alejandra.enable = true; + deadnix.enable = true; + just.enable = true; + prettier.enable = true; + stylish-haskell.enable = true; + }; + }; + packages.default = self'.packages.skiletro; # haskell-flake doesn't set the default package, but you can do it here. }; }; diff --git a/index.html b/index.html index e8eaa46..455ebf6 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ title: Home

Welcome

- +

Welcome to my blog!

@@ -13,4 +13,4 @@ title: Home

Posts

$partial("templates/post-list.html")$ -

…or you can find more in the archives.

\ No newline at end of file +

…or you can find more in the archives.

diff --git a/justfile b/justfile index 61dc613..afbcc5d 100644 --- a/justfile +++ b/justfile @@ -3,6 +3,8 @@ default: @just --list --unsorted run *args: + nix fmt + git add . nix build .# ./result/bin/site {{ args }} @@ -10,6 +12,8 @@ watch: (run "watch") # Build and watch baw: + nix fmt + git add . nix build .# ./result/bin/site clean ./result/bin/site build diff --git a/site.hs b/site.hs index a392545..571eac3 100644 --- a/site.hs +++ b/site.hs @@ -1,9 +1,9 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} -import Data.Monoid (mappend) -import Hakyll -import Hakyll.Web.Sass (sassCompiler) +import Data.Monoid (mappend) +import Hakyll +import Hakyll.Web.Sass (sassCompiler) -------------------------------------------------------------------------------- main :: IO () diff --git a/templates/archive.html b/templates/archive.html index 80b148f..346e978 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -1,2 +1,3 @@ Here you can find all my previous posts: -$partial("templates/post-list.html")$ \ No newline at end of file + +$partial("templates/post-list.html")$ diff --git a/templates/default.html b/templates/default.html index c899cab..0fb6145 100644 --- a/templates/default.html +++ b/templates/default.html @@ -1,37 +1,35 @@ + + + + + My Hakyll Blog - $title$ + + + - - - - - My Hakyll Blog - $title$ - - - + +
+ + +
- -
- - -
+
+

$title$

+ $body$ +
-
-

$title$

- $body$ -
- - - - - \ No newline at end of file + + + diff --git a/templates/post-list.html b/templates/post-list.html index e40d724..6d50e33 100644 --- a/templates/post-list.html +++ b/templates/post-list.html @@ -1,7 +1,5 @@ \ No newline at end of file + diff --git a/templates/post.html b/templates/post.html index e154d51..69d8bae 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,11 +1,6 @@
- Posted on $date$ - $if(author)$ - by $author$ - $endif$ + Posted on $date$ $if(author)$ by $author$ $endif$
-
- $body$ -
-
\ No newline at end of file +
$body$
+ -- cgit v1.3.1