-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
50 lines (48 loc) · 1.72 KB
/
flake.nix
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
{
description = "news.cryptic.io";
# inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-20.09";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.syndicate-rss.url = "github:marcopolo/syndicate-rss";
# Devving
# inputs.syndicate-rss.url = "/Users/marcomunizaga/code/syndicate-rss";
outputs = { self, nixpkgs, flake-utils, syndicate-rss }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
syn-rss-bin = "${syndicate-rss.defaultPackage.${system}}/bin/syndicate-rss";
syndicateBlogPosts = pkgs.writeScriptBin "syndicateBlogPosts"
(builtins.concatStringsSep "\n"
(builtins.map
(feed:
''${syn-rss-bin} \
--in '${feed.url}' \
--out ./content \
--noContent \
--extraFieldValue feedName="${feed.name}" \
${if feed?author
then ''--author "${feed.author}"''
else ""} \
--lastN 10 \
''
)
(import "${self}/feeds.nix")));
in
{
devShell = pkgs.mkShell {
buildInputs = [ pkgs.zola syndicate-rss.defaultPackage.${system} syndicateBlogPosts ];
};
defaultPackage = pkgs.stdenv.mkDerivation {
name = "blog-1.0.0";
buildInputs = [ pkgs.zola ];
src = ./.;
installPhase = ''
mkdir $out
zola build
cp -r public/* $out/
'';
};
}
);
}