summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2020-02-08 12:21:18 -0500
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2020-02-08 12:21:18 -0500
commit18534a0afee963fe025a70eb1ad4b1c92f9bd86e (patch)
tree95bd5bb803be81cf978ab2fc46616196da5cb794
parenta84826a46bd6847f8c159a1c038c20c13e62603e (diff)
Add nix package definition
-rw-r--r--.gitignore1
-rw-r--r--package.nix45
-rw-r--r--shell.nix1
3 files changed, 47 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3c18fd1..866918d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/target
**/*.rs.bk
run.sh
+result
diff --git a/package.nix b/package.nix
new file mode 100644
index 0000000..f315641
--- /dev/null
+++ b/package.nix
@@ -0,0 +1,45 @@
+{ callPackage, 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
+ wrapProgram "$out/bin/simple-reflection-server" \
+ --prefix ROCKET_TEMPLATE_DIR : "$out/etc/templates"
+ '';
+
+ buildInputs = with pkgs; [
+ openssl pkgconfig postgresql
+ ];
+
+ src = ./.;
+
+ cargoSha256 = "1s2cix5a74g0cwfw93sak8mx7yrxba476fz89zgpz01y57wzgybr";
+ # verifyCargoDeps = true;
+}
+
+
diff --git a/shell.nix b/shell.nix
index 99825a3..0407793 100644
--- a/shell.nix
+++ b/shell.nix
@@ -8,5 +8,6 @@ pkgs.stdenv.mkDerivation {
openssl
sqlite
pkgconfig
+ postgresql
];
}