Browse Source

Add nix shell

main
Alex Feldman-Crough 2 weeks ago
parent
commit
bea4cc4e2d
  1. 2
      .envrc
  2. 13
      nix/nixpkgs/default.nix
  3. 3
      nix/nixpkgs/version.toml
  4. 9
      shell.nix
  5. 8
      src/socket/pool.rs

2
.envrc

@ -0,0 +1,2 @@
export NIX_PATH="nixpkgs=$PWD/nix/nixpkgs"
use nix

13
nix/nixpkgs/default.nix

@ -0,0 +1,13 @@
let
defaultSha =
"0000000000000000000000000000000000000000000000000000000000000000";
version = builtins.fromTOML
(builtins.readFile ./version.toml);
tarball = builtins.fetchTarball {
url = "${version.repo}/archive/${version.commit}.tar.gz";
sha256 = version.sha256 or defaultSha;
};
in
import tarball

3
nix/nixpkgs/version.toml

@ -0,0 +1,3 @@
repo = "https://github.com/NixOS/nixpkgs"
commit = "7e9b0dff974c89e070da1ad85713ff3c20b0ca97"
sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36"

9
shell.nix

@ -0,0 +1,9 @@
with import <nixpkgs> {};
pkgs.mkShell {
buildInputs = with pkgs; [
cargo
pkgconfig
zeromq
];
}

8
src/socket/pool.rs

@ -18,6 +18,14 @@ impl ConnectionManager {
}
}
pub struct WrappedConnectionManager<T, E>
where
Error: Into<E>,
{
connection_manager: ConnectionManager<T>,
initialize: Socket -> Result<T, E>,
}
#[async_trait]
impl bb8::ManageConnection for ConnectionManager {
type Connection = Socket;

Loading…
Cancel
Save