summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjamie <git@skilet.ro>2025-06-15 19:53:48 +0100
committerjamie <git@skilet.ro>2025-06-15 19:53:48 +0100
commit1e233b960c1131029d87fa53ceabf2c0b49dcf61 (patch)
tree21d557a1cd972593f89f14798ea70e1911d03e56
parent7cd5896bdd7b96a0f90f6f3b3720343cd5cbe4d9 (diff)
feat: add linter to flake and format
-rw-r--r--css/default.scss2
-rw-r--r--css/syntax.css14
-rw-r--r--flake.lock37
-rw-r--r--flake.nix18
-rw-r--r--index.html4
-rw-r--r--justfile4
-rw-r--r--site.hs6
-rw-r--r--templates/archive.html3
-rw-r--r--templates/default.html62
-rw-r--r--templates/post-list.html6
-rw-r--r--templates/post.html11
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
<h2>Welcome</h2>
-<img src="/images/haskell-logo.png" style="float: right; margin: 10px;" />
+<img src="/images/haskell-logo.png" style="float: right; margin: 10px" />
<p>Welcome to my blog!</p>
@@ -13,4 +13,4 @@ title: Home
<h2>Posts</h2>
$partial("templates/post-list.html")$
-<p>…or you can find more in the <a href="/archive.html">archives</a>.</p> \ No newline at end of file
+<p>…or you can find more in the <a href="/archive.html">archives</a>.</p>
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
+<!-- prettier-ignore -->
+$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 @@
<!doctype html>
<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="x-ua-compatible" content="ie=edge" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>My Hakyll Blog - $title$</title>
+ <link rel="stylesheet" href="/css/default.css" />
+ <link rel="stylesheet" href="/css/syntax.css" />
+ </head>
-<head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>My Hakyll Blog - $title$</title>
- <link rel="stylesheet" href="/css/default.css" />
- <link rel="stylesheet" href="/css/syntax.css" />
-</head>
+ <body>
+ <header>
+ <div class="logo">
+ <a href="/">My Hakyll Blog</a>
+ </div>
+ <nav>
+ <a href="/">Home</a>
+ <a href="/about.html">About</a>
+ <a href="/contact.html">Contact</a>
+ <a href="/archive.html">Archive</a>
+ </nav>
+ </header>
-<body>
- <header>
- <div class="logo">
- <a href="/">My Hakyll Blog</a>
- </div>
- <nav>
- <a href="/">Home</a>
- <a href="/about.html">About</a>
- <a href="/contact.html">Contact</a>
- <a href="/archive.html">Archive</a>
- </nav>
- </header>
+ <main role="main">
+ <h1>$title$</h1>
+ $body$
+ </main>
- <main role="main">
- <h1>$title$</h1>
- $body$
- </main>
-
- <footer>
- Site proudly generated by
- <a href="http://jaspervdj.be/hakyll">Hakyll</a>
- </footer>
-</body>
-
-</html> \ No newline at end of file
+ <footer>
+ Site proudly generated by
+ <a href="http://jaspervdj.be/hakyll">Hakyll</a>
+ </footer>
+ </body>
+</html>
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 @@
<ul>
$for(posts)$
- <li>
- <a href="$url$">$title$</a> - $date$
- </li>
+ <li><a href="$url$">$title$</a> - $date$</li>
$endfor$
-</ul> \ No newline at end of file
+</ul>
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 @@
<article>
<section class="header">
- Posted on $date$
- $if(author)$
- by $author$
- $endif$
+ Posted on $date$ $if(author)$ by $author$ $endif$
</section>
- <section>
- $body$
- </section>
-</article> \ No newline at end of file
+ <section>$body$</section>
+</article>