~yoctocell/yoctocell.xyz

ref: 0ee07b94a76a0151cc4e3ba34a7424c8435bb7a2 yoctocell.xyz/default.nix -rw-r--r-- 1.0 KiB
0ee07b94Xinglu Chen Main: Add context for source code url 1 year, 9 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
{ 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"
    ''
      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
    '';

  };
}