blob: 8d29ca6b72ad5cc4659f24b968ebfd2b7bd6fb50 (
about) (
plain) (
blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
let
niv-sources = import ./nix/sources.nix;
pkgs = import niv-sources.nixpkgs { };
src = pkgs.nix-gitignore.gitignoreSource [ "!.git" ] ./.;
utils-i18n = pkgs.callPackage ./nix/utils-i18n.nix { };
pkgs-next = pkgs.callPackage ./nix/nixpkgs-next.nix { };
jekyllEnv = pkgs.bundlerEnv {
name = "jekyll-env";
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./nix/gemset.nix;
};
mktorrent-newer = pkgs.mktorrent.overrideAttrs (oldAttrs: {
src = pkgs.fetchFromGitHub {
owner = "Rudde";
repo = "mktorrent";
rev = "ea1fbf29d19f34a93f7d984c1ac29d6d08f1f508";
sha256 = "1cjq96qridpvqhphj3ljnhysnqkdck415wxaqy768r0rvzqq1ja4";
};
});
buildInputs = with pkgs; [
jekyllEnv
pkgs-next.mdpo
mktorrent-newer
ffmpeg
perl
graphviz
nixfmt
git
shellcheck
jq
niv
(hunspellWithDicts (with utils-i18n.dicts; [ en pt fr eo ]))
];
in rec {
site = pkgs.stdenv.mkDerivation {
inherit src buildInputs;
name = "website-site";
phases = [ "unpackPhase" "buildPhase" ];
buildPhase = ''
patchShebangs .
jekyll build -d $out --trace
'';
};
test = pkgs.stdenv.mkDerivation {
inherit src buildInputs;
name = "website-test";
phases = [ "unpackPhase" "buildPhase" ];
buildPhase = ''
patchShebangs .
./tests.sh
touch $out
'';
};
shell = pkgs.mkShell {
inherit buildInputs;
name = "website-shell";
shellHook = ''
echo 'Starting a live server with:'
echo ' jekyll serve --future --livereload --trace'
echo 'Server with feature flags:'
echo ' jekyll serve --future --livereload --trace -c $(cfg podcast screencast)'
cfg() {
T="$(mktemp --suffix .yml)"
cp _config.yml "$T"
for flag in "$@"; do
printf '\n%s: true\n' "$flag" >> "$T"
done
echo "$T"
}
'';
};
publishScript = pkgs.writeShellScriptBin "publish.sh" ''
set -eux
SERVER_URL='root@euandre.org'
REMOTE_PATH='/home/user-data/www/default/'
OUT_DOCS='${site}'
${pkgs.rsync}/bin/rsync -avzP \
--rsh="ssh -o StrictHostKeyChecking=no" \
"$OUT_DOCS/" \
"$SERVER_URL:$REMOTE_PATH" \
--delete
'';
}
|