commit faec92ae37a2a035d98aad4a7df5648edb635346 Author: Gregor Kleen Date: Thu May 11 09:50:56 2023 +0200 set up hakyll diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..c971ef0 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,4 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((haskell-mode . ((tab-width . 4)))) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..10f2696 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +**/.direnv +**/result +**/result-* + +.stack-work + +_cache +_site + +**/#*# +**/.#* + +.pre-commit-config.yaml + +uniworx-de.cabal diff --git a/content/index.html b/content/index.html new file mode 100644 index 0000000..478f7a8 --- /dev/null +++ b/content/index.html @@ -0,0 +1 @@ +Hello World diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..87352b8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,170 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1683560683, + "narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "006c75898cf814ef9497252b022e91c946ba8e17", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1683786124, + "narHash": "sha256-0NdMJ09GrR8NulIQSThytukQrTz2oDcsczMUy2u/qKg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0bda75b5203a0a8bdad82a787039e8c8bc0a8746", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1682879489, + "narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681303793, + "narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fe2ecaf706a5907b5e54d979fbde4924d84b65fc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fb58866e20af98779017134319b5663b8215d912", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c35d233 --- /dev/null +++ b/flake.nix @@ -0,0 +1,90 @@ +{ + inputs = { + nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + }; + + flake-parts = { + type = "github"; + owner = "hercules-ci"; + repo = "flake-parts"; + }; + + pre-commit-hooks-nix = { + type = "github"; + owner = "cachix"; + repo = "pre-commit-hooks.nix"; + }; + }; + + outputs = inputs @ { + self, + nixpkgs, + flake-parts, + pre-commit-hooks-nix, + ... + }: + flake-parts.lib.mkFlake + {inherit inputs;} + ({...}: { + imports = [ + pre-commit-hooks-nix.flakeModule + ]; + + config = { + systems = ["x86_64-linux"]; + + perSystem = { + system, + config, + pkgs, + ... + }: { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + (pkgs.symlinkJoin { + inherit (stack) name; + paths = [stack]; + nativeBuildInputs = [makeWrapper]; + + postBuild = '' + wrapProgram $out/bin/stack \ + --add-flags "\ + --nix \ + --no-nix-pure \ + --nix-shell-file=${pkgs.writeText "shell.nix" '' + { ghc }: + + with (import {}); + + haskell.lib.buildStackProject { + inherit ghc; + name = "uniworx-de"; + buildInputs = [ zlib ]; + } + ''} \ + --nix-path=nixpkgs=${nixpkgs} \ + " + ''; + }) + ]; + shellHook = '' + ${config.pre-commit.installationScript} + ''; + }; + + pre-commit = { + settings.hooks = { + alejandra.enable = true; + fourmolu.enable = true; + }; + }; + + packages = { + }; + }; + }; + }); +} diff --git a/fourmolu.yaml b/fourmolu.yaml new file mode 100644 index 0000000..47e652d --- /dev/null +++ b/fourmolu.yaml @@ -0,0 +1 @@ +indentation: 2 diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..a082090 --- /dev/null +++ b/package.yaml @@ -0,0 +1,28 @@ +name: uniworx-de +version: 1.0.0 + +default-extensions: + - OverloadedStrings + - NoImplicitPrelude + - ViewPatterns + +executables: + site: + main: Main + source-dirs: src + + ghc-options: + - -threaded + - -Werror + - -Wall + - -Wmissing-home-modules + - -Wredundant-constraints + - -Widentities + - -Wincomplete-uni-patterns + - -fwarn-tabs + - -j + + dependencies: + - base + - hakyll + - filepath diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..099d88e --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,28 @@ +module Main (main) where + +import Prelude + +import Hakyll + +import qualified Data.List as List +import Data.Maybe +import System.FilePath + +config :: Configuration +config = defaultConfiguration + +stripPathPrefix :: FilePath -> Routes +stripPathPrefix (splitDirectories -> prefix) = + customRoute $ + joinPath . (\x -> fromMaybe x $ List.stripPrefix prefix x) . splitDirectories . toFilePath + +main :: IO () +main = hakyllWith config $ do + match "content/index.html" $ do + route $ stripPathPrefix "content" + + compile $ do + getResourceBody + >>= loadAndApplyTemplate "templates/site-layout.html" defaultContext + + match "templates/*" $ compile templateBodyCompiler diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..d6286a1 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,3 @@ +resolver: lts-20.20 +packages: + - . diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..97140f7 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: [] +snapshots: +- completed: + sha256: 126fa33ceb11f5e85ceb4e86d434756bd9a8439e2e5776d306a15fbc63b01e89 + size: 650041 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/20.yaml + original: lts-20.20 diff --git a/templates/site-layout.html b/templates/site-layout.html new file mode 100644 index 0000000..4fcbfb1 --- /dev/null +++ b/templates/site-layout.html @@ -0,0 +1,12 @@ + + + + + + + + + + $body$ + +