diff --git a/.gitignore b/.gitignore index b792dbf..029252c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ _site/ _cache/ dist/ +dist-newstyle/ +result* diff --git a/default.nix b/default.nix index d543a51..4b124f0 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,8 @@ -{ haskellPackages, haskell }: +{ pkgs ? import {} }: -haskell.lib.disableSharedExecutables (haskellPackages.callCabal2nix "site" ./. {}) +with pkgs; + +rec { + site = haskellPackages.callPackage ./site {}; + rauhala-info = callPackage ./rauhala.info { site = site; }; +} diff --git a/rauhala.info/.envrc b/rauhala.info/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/rauhala.info/.envrc @@ -0,0 +1 @@ +use nix diff --git a/rauhala.info/.gitignore b/rauhala.info/.gitignore new file mode 100644 index 0000000..2f71f5d --- /dev/null +++ b/rauhala.info/.gitignore @@ -0,0 +1,2 @@ +_site +_cache diff --git a/contact.markdown b/rauhala.info/contact.markdown similarity index 100% rename from contact.markdown rename to rauhala.info/contact.markdown diff --git a/css/default.css b/rauhala.info/css/default.css similarity index 100% rename from css/default.css rename to rauhala.info/css/default.css diff --git a/css/highlight.css b/rauhala.info/css/highlight.css similarity index 100% rename from css/highlight.css rename to rauhala.info/css/highlight.css diff --git a/rauhala.info/default.nix b/rauhala.info/default.nix new file mode 100644 index 0000000..e0238b5 --- /dev/null +++ b/rauhala.info/default.nix @@ -0,0 +1,24 @@ +{ stdenv, glibcLocales, site }: + +stdenv.mkDerivation { + pname = "rauhala.info"; + version = "0.1.0"; + + src = builtins.filterSource (path: type: baseNameOf path != "_cache" && baseNameOf path != "_site") ./.; + + phases = ["buildPhase" "installPhase"]; + + + buildPhase = '' + export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive" + export LANG=en_US.UTF-8 + + cp -r $src/* . + ${site}/bin/site build + ''; + + installPhase = '' + mkdir -p $out/share/ + cp -r _site/* $out/share/ + ''; +} diff --git a/images/Git-Icon-Black.png b/rauhala.info/images/Git-Icon-Black.png similarity index 100% rename from images/Git-Icon-Black.png rename to rauhala.info/images/Git-Icon-Black.png diff --git a/images/Git-Icon-Black_orig.png b/rauhala.info/images/Git-Icon-Black_orig.png similarity index 100% rename from images/Git-Icon-Black_orig.png rename to rauhala.info/images/Git-Icon-Black_orig.png diff --git a/images/git_16.png b/rauhala.info/images/git_16.png similarity index 100% rename from images/git_16.png rename to rauhala.info/images/git_16.png diff --git a/images/git_32.png b/rauhala.info/images/git_32.png similarity index 100% rename from images/git_32.png rename to rauhala.info/images/git_32.png diff --git a/images/profile.jpg b/rauhala.info/images/profile.jpg similarity index 100% rename from images/profile.jpg rename to rauhala.info/images/profile.jpg diff --git a/images/profile_grayscale.jpg b/rauhala.info/images/profile_grayscale.jpg similarity index 100% rename from images/profile_grayscale.jpg rename to rauhala.info/images/profile_grayscale.jpg diff --git a/index.markdown b/rauhala.info/index.markdown similarity index 100% rename from index.markdown rename to rauhala.info/index.markdown diff --git a/posts/guides/demobot.md b/rauhala.info/posts/guides/demobot.md similarity index 100% rename from posts/guides/demobot.md rename to rauhala.info/posts/guides/demobot.md diff --git a/resources/2104943D6033C.txt b/rauhala.info/resources/2104943D6033C.txt similarity index 100% rename from resources/2104943D6033C.txt rename to rauhala.info/resources/2104943D6033C.txt diff --git a/rauhala.info/shell.nix b/rauhala.info/shell.nix new file mode 100644 index 0000000..a3eb7d3 --- /dev/null +++ b/rauhala.info/shell.nix @@ -0,0 +1,10 @@ +with (import {}); + +let site = haskellPackages.callPackage ../site {}; + +in + +mkShell { + buildInputs = [ site ]; +} + diff --git a/templates/default.html b/rauhala.info/templates/default.html similarity index 100% rename from templates/default.html rename to rauhala.info/templates/default.html diff --git a/templates/guides.html b/rauhala.info/templates/guides.html similarity index 100% rename from templates/guides.html rename to rauhala.info/templates/guides.html diff --git a/templates/post-list.html b/rauhala.info/templates/post-list.html similarity index 100% rename from templates/post-list.html rename to rauhala.info/templates/post-list.html diff --git a/templates/post.html b/rauhala.info/templates/post.html similarity index 100% rename from templates/post.html rename to rauhala.info/templates/post.html diff --git a/well-known/keybase.txt b/rauhala.info/well-known/keybase.txt similarity index 100% rename from well-known/keybase.txt rename to rauhala.info/well-known/keybase.txt diff --git a/release.nix b/release.nix deleted file mode 100644 index ebeb385..0000000 --- a/release.nix +++ /dev/null @@ -1,44 +0,0 @@ -let - pin = builtins.fromJSON (builtins.readFile ./nixpkgs.json); - pinnedPkgs = with pin; import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; - inherit sha256; - }) {}; - -in - -{ pkgs ? pinnedPkgs }: - -let - haskellPackages = pkgs.haskellPackages; - site = pkgs.callPackage ./default.nix {}; - website = with pkgs; stdenv.mkDerivation { - pname = "rauhala.info"; - version = "0.1.0"; - src = lib.cleanSource ./.; - LANG = "en_US.UTF-8"; - LOCALE_ARCHIVE = lib.optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; - buildPhase = '' - ${site}/bin/site clean - ${site}/bin/site build - ''; - installPhase = '' - mkdir -p $out/share/ - mv _site $out/share/html - ''; - }; - shell = pkgs.buildEnv { - name = "site-shell"; - paths = []; - buildInputs = [ - haskellPackages.ghcid - haskellPackages.hasktags - (haskellPackages.ghcWithHoogle (h: site.buildInputs ++ site.propagatedBuildInputs)) - ]; - }; - -in - -{ - inherit site shell website; -} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 5dbfe72..0000000 --- a/shell.nix +++ /dev/null @@ -1,2 +0,0 @@ -(import ./release.nix {}).shell - diff --git a/site/.envrc b/site/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/site/.envrc @@ -0,0 +1 @@ +use nix diff --git a/LICENSE b/site/LICENSE similarity index 100% rename from LICENSE rename to site/LICENSE diff --git a/site.hs b/site/app/site.hs similarity index 58% rename from site.hs rename to site/app/site.hs index 05468fb..bf7c12f 100644 --- a/site.hs +++ b/site/app/site.hs @@ -1,9 +1,6 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} -import Data.Monoid (mappend) import Hakyll -import Data.List (sortBy, sortOn) -import Data.Time (formatTime, defaultTimeLocale) -------------------------------------------------------------------------------- @@ -39,22 +36,6 @@ main = hakyllWith defaultConfiguration $ do match "templates/*" $ compile templateBodyCompiler -modFirst :: [Item a] -> Compiler [Item a] -modFirst = fmap reverse . modified - where - modified = sortByM (getItemModificationTime . itemIdentifier) - sortByM f xs = map fst . sortOn snd <$> mapM (\x -> (,) x <$> f x) xs - --------------------------------------------------------------------------------- -postCtx :: Context String -postCtx = - dateField "date" "%B %e, %Y" `mappend` - modifiedField "modified" "%B %e, %Y" `mappend` - defaultContext - where - modifiedField key format = field key $ \i -> do - time <- getItemModificationTime $ itemIdentifier i - return $ formatTime defaultTimeLocale format time prepend :: a -> [a] -> [a] prepend = (:) diff --git a/site/default.nix b/site/default.nix new file mode 100644 index 0000000..17ed554 --- /dev/null +++ b/site/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, hakyll, stdenv, time }: +mkDerivation { + pname = "site"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ base hakyll time ]; + license = stdenv.lib.licenses.bsd3; +} diff --git a/site/shell.nix b/site/shell.nix new file mode 100644 index 0000000..cbf6d05 --- /dev/null +++ b/site/shell.nix @@ -0,0 +1,16 @@ +with (import {}); + +let site = haskellPackages.callPackage ./. {}; + +in + +mkShell { + buildInputs = [ + ghcid + stylish-haskell + haskellPackages.cabal-install + hlint + (haskellPackages.ghcWithPackages (_: site.buildInputs ++ site.propagatedBuildInputs)) + ]; +} + diff --git a/site.cabal b/site/site.cabal similarity index 94% rename from site.cabal rename to site/site.cabal index a539b59..8795d02 100644 --- a/site.cabal +++ b/site/site.cabal @@ -9,6 +9,7 @@ maintainer: mats.rauhala@iki.fi executable site main-is: site.hs + hs-source-dirs: app build-depends: base == 4.* , hakyll >= 4.10 , time