diff --git a/default.nix b/default.nix index edc2888..b1d374d 100644 --- a/default.nix +++ b/default.nix @@ -1,53 +1,22 @@ -{ mozillaOverlay ? import , - rustManifest ? ./channel-rust-nightly.toml, +{ pkgs ? import {}, }: let - pkgs = import { overlays = [ mozillaOverlay ]; }; -in + cargoSha256 = "11hvxh8drqpimax7b5z5r8qiwzy00j5r0xdshml0wgzxnmrnxzqc"; -with pkgs; - -let - rustChannelOfTargets = _channel: _date: - (pkgs.lib.rustLib.fromManifestFile rustManifest { - inherit (pkgs) stdenv fetchurl patchelf; - }).rust; - rust = - rustChannelOfTargets "nightly" null; - rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform { - rustc = rust; - cargo = rust; - }); - - cargoSha256 = "0jbpwr84ncfj5nigznr06fpwaj89n839534n81hqwacflh1z43ix"; - - ticker-update = rustPlatform.buildRustPackage { - name = "ticker-update"; + build = pname: pkgs.rustPlatform.buildRustPackage { + inherit pname; + version = "0.1.0"; src = ./.; - buildInputs = [ - pkg-config openssl postgresql.lib - rust + buildInputs = with pkgs; [ + pkg-config openssl + postgresql.lib ]; - preBuild = "pushd ticker-update"; - postBuild = "popd"; - inherit cargoSha256; - }; - - ticker-serve = rustPlatform.buildRustPackage { - name = "ticker-serve"; - src = ./.; - buildInputs = [ - pkg-config openssl postgresql.lib - rust - ]; - preBuild = "pushd ticker-serve"; + preBuild = "pushd ${pname}"; postBuild = "popd"; inherit cargoSha256; }; in { - inherit - rustPlatform - ticker-update - ticker-serve; + ticker-update = build "ticker-update"; + ticker-serve = build "ticker-serve"; } diff --git a/shell.nix b/shell.nix index acbeaec..5e7b55d 100644 --- a/shell.nix +++ b/shell.nix @@ -1,15 +1,15 @@ { pkgs ? import {} }: -with pkgs; - let - default = import ./default.nix {}; + default = import ./default.nix { inherit pkgs; }; in -stdenv.mkDerivation { +pkgs.stdenv.mkDerivation { name = "env"; buildInputs = - default.ticker-update.buildInputs; + [ pkgs.rustPlatform.rust.cargo ] ++ + default.ticker-update.buildInputs ++ + default.ticker-serve.buildInputs; shellHook = '' echo "Run 'cargo build --release'"