~yoctocell/yoctocell.xyz

yoctocell.xyz/default.nix -rw-r--r-- 1.4 KiB
46c74072Xinglu Chen templates: footer: Fix typo 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ compiler ? "ghc884"
, pkgs
}:
let
  haskellPackages = pkgs.haskell.packages.${compiler}.override {
    overrides = hpNew: hpOld: {
      yoctocell-xyz = hpNew.callCabal2nix "yoctocell-xyz" ./. { };
    };
  };

  site = haskellPackages.yoctocell-xyz;
  siteBuild = pkgs.writeScriptBin "site-build"
    ''
      ${site}/bin/site build
    '';
  siteWatch = pkgs.writeScriptBin "site-watch"
    ''
      ${site}/bin/site watch
    '';

  updateServer = pkgs.writeScriptBin "update-server"
    ''
      openring \
      -s https://drewdevault.com/feed.xml \
      -s https://protesilaos.com/codelog.xml \
      -s https://ambrevar.xyz/atom.xml \
      -s https://guix.gnu.org/feeds/blog.atom \
      -s https://brettgilio.com/rss.xml \
      -s https://brown.121407.xyz/posts/rss.xml \
      < ~/src/yoctocell.xyz/src/templates/webring-in.html \
      > ~/src/yoctocell.xyz/src/templates/webring-out.html

      ./result/bin/site build

      rsync -aAXv --delete public/ root@yoctocell.xyz:/var/www/yoctocell.xyz
    '';
in
{
  inherit site siteBuild siteWatch;

  shell = haskellPackages.shellFor {
    packages = p: with p; [
      site
    ];

    buildInputs = with haskellPackages; [
      updateServer
      brittany
      cabal-install
    ];

    withHoogle = true;

    shellHook = ''
      git config sendemail.to '~yoctocell/yoctocell.xyz-devel@lists.sr.ht'
      rm -rf .git/hooks/pre-push
      ln -s ${updateServer}/bin/update-server .git/hooks/pre-push
    '';

  };
}