summaryrefslogtreecommitdiff
path: root/pkgs/pjournal/default.nix
blob: 024ab652a20a8b9dbd0fd1185b7f499eaa26fdcc (plain)
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
{ callPackage, fetchgit, fetchFromGitHub, makeRustPlatform, stdenv, pkgs, ... }:

let mkRustPlatform = { date, channel }:
      let
        mozillaOverlay = fetchFromGitHub {
            owner = "mozilla";
            repo = "nixpkgs-mozilla";
            rev = "5300241b41243cb8962fad284f0004afad187dad";
            sha256 = "1h3g3817anicwa9705npssvkwhi876zijyyvv4c86qiklrkn5j9w";
          };
          mozilla = callPackage "${mozillaOverlay.out}/package-set.nix" {};
          rustSpecific = (mozilla.rustChannelOf { inherit date channel; }).rust;
      in
        makeRustPlatform {
          cargo = rustSpecific;
          rustc = rustSpecific;
        };
in let
  rustPlatform = mkRustPlatform {
    date = "2020-01-15";
    channel = "nightly";
  };
in rustPlatform.buildRustPackage rec {
  pname = "pjournal";
  version = "0.1.0";

  # https://git.breakds.org/breakds/nixvital/src/branch/master/pkgs/simple-reflection-server/default.nix
  postInstall = ''
    mkdir $out/etc/
    cp -r templates $out/etc
    cp -r static $out/etc
    wrapProgram "$out/bin/pjournal" \
      --add-flags "--template-path $out/etc/templates" \
      --add-flags "--static-path $out/etc/static"
  '';

  preConfigure = ''
    export HOME=$(mktemp -d)
  '';

  buildInputs = with pkgs; [
    openssl pkgconfig postgresql makeWrapper
  ];

  src = fetchgit {
    url = "https://git.orbekk.com/pjournal.git";
    rev = "079e2067f30c099202fd51751ff966c527741b7a";
    sha256 = "0pm8npys8z1ap7wjk85gvh1gyglrq4hah8mwyc8pqq8xqd6r666j";
  };

  cargoSha256 = "0v3dv8vrzk1gwaii0x8xvmxbs5h7rmcqchqmg57p7405q016fxsw";
  # verifyCargoDeps = true;
}