mirror of
https://github.com/atuinsh/atuin.git
synced 2026-09-27 12:01:48 +02:00
From `atuin.nix`:
```nix
# native-tls pulls OpenSSL into the sqlx-macros proc-macro, which rustc dlopens at
# build time. With OPENSSL_NO_VENDOR it links libssl.so.3 dynamically, so the loader
# needs it on LD_LIBRARY_PATH while the proc-macro is loaded.
preBuild = ''
export LD_LIBRARY_PATH="${lib.makeLibraryPath [ openssl ]}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
'';
```
The same fix is needed for the Nix dev shell so that you can run, e.g.,
`cargo run`, yet it was not present there. This PR copies the fix into
the nix dev shell shell hook.
<!-- Thank you for making a PR! Bug fixes are always welcome, but if
you're adding a new feature or changing an existing one, we'd really
appreciate if you open an issue, post on the forum, or drop in on
Discord -->
## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
83 lines
2.4 KiB
Nix
83 lines
2.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
outputs =
|
|
inputs@{ flake-parts, fenix, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
perSystem =
|
|
{ pkgs, system, ... }:
|
|
let
|
|
toolchain = fenix.packages.${system}.fromToolchainFile {
|
|
file = ./rust-toolchain.toml;
|
|
sha256 = "sha256-P30Tm3O7vQAE725YtDCDHGjNrSsfZO4us11UwJGZSJo=";
|
|
};
|
|
atuin = pkgs.callPackage ./atuin.nix {
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
cargo = toolchain;
|
|
rustc = toolchain;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
packages = {
|
|
inherit atuin;
|
|
default = atuin;
|
|
};
|
|
|
|
formatter = pkgs.nixfmt-tree;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
inputsFrom = [ atuin ];
|
|
|
|
nativeBuildInputs =
|
|
(with pkgs; [
|
|
cargo-edit
|
|
rust-analyzer
|
|
])
|
|
++ [ toolchain ];
|
|
|
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
|
|
|
shellHook = ''
|
|
# See atuin.nix's preBuild for explanation.
|
|
export LD_LIBRARY_PATH="${
|
|
pkgs.lib.makeLibraryPath [ pkgs.openssl ]
|
|
}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
|
|
|
echo >&2 "Setting development database path"
|
|
export ATUIN_DB_PATH="/tmp/atuin_dev.db"
|
|
export ATUIN_RECORD_STORE_PATH="/tmp/atuin_records.db"
|
|
|
|
if [ -e "''${ATUIN_DB_PATH}" ]; then
|
|
echo >&2 "''${ATUIN_DB_PATH} already exists, you might want to double-check that"
|
|
fi
|
|
|
|
if [ -e "''${ATUIN_RECORD_STORE_PATH}" ]; then
|
|
echo >&2 "''${ATUIN_RECORD_STORE_PATH} already exists, you might want to double-check that"
|
|
fi
|
|
'';
|
|
};
|
|
};
|
|
|
|
flake.overlays.default = final: _: {
|
|
inherit (inputs.self.packages.${final.stdenv.hostPlatform.system}) atuin;
|
|
};
|
|
};
|
|
}
|