Reshuffle the files for better nix organization
This commit is contained in:
1 parent
712b61059f
commit
c62ff908af
31 files changed
+74
-67
No files matched your search
@@ -1,3 +1,5 @@
|
||||
_site/
|
||||
_cache/
|
||||
dist/
|
||||
dist-newstyle/
|
||||
result*
|
||||
+7
-2
@@ -1,3 +1,8 @@
|
||||
{ haskellPackages, haskell }:
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
haskell.lib.disableSharedExecutables (haskellPackages.callCabal2nix "site" ./. {})
|
||||
with pkgs;
|
||||
|
||||
rec {
|
||||
site = haskellPackages.callPackage ./site {};
|
||||
rauhala-info = callPackage ./rauhala.info { site = site; };
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
use nix
|
||||
@@ -0,0 +1,2 @@
|
||||
_site
|
||||
_cache
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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/
|
||||
'';
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,10 @@
|
||||
with (import <nixpkgs> {});
|
||||
|
||||
let site = haskellPackages.callPackage ../site {};
|
||||
|
||||
in
|
||||
|
||||
mkShell {
|
||||
buildInputs = [ site ];
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-44
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
use nix
|
||||
File renamed without changes.
@@ -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 = (:)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
with (import <nixpkgs> {});
|
||||
|
||||
let site = haskellPackages.callPackage ./. {};
|
||||
|
||||
in
|
||||
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
ghcid
|
||||
stylish-haskell
|
||||
haskellPackages.cabal-install
|
||||
hlint
|
||||
(haskellPackages.ghcWithPackages (_: site.buildInputs ++ site.propagatedBuildInputs))
|
||||
];
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user