mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-03 07:55:13 +00:00
* Add default.nix for nix support * Convert to flake * gitignore before building the source * Add default.nix and shell.nix for legacy workflows * Use https://github.com/oxalica/rust-overlay This one works for development workflow, with a functional rust-analyzer for using with language server support in IDEs. Also add .vscode/ for pre-configured settings. * Add documentation * Restore old TOC and apply TOC patch manually * Clarify that these two commands are either-or * Add installing from local checkout (nix-env) * Add note about version update * Improve Nix workflow, for zero maintenance Use https://github.com/nmattia/naersk This avoids having to set a sha and version in Nix scripts. * Simplify using crate2nix Ref: https://www.reddit.com/r/rust/comments/mmbfnj/nixifying_a_rust_project/ * Use rootCrate * Propagate openssl deps to non-shell build * Try the oxalica overlay * Get rid of gitignore crate cf. https://www.reddit.com/r/rust/comments/mmbfnj/nixifying_a_rust_project/gtsgxal/?context=3 * Configure himalaya crate under defaultCrateOverrides * Specify openssl in buildInputs * Make a note about a potential error when using Nix 2.4pre * Remove PKG_CONFIG_PATH (unnecessary) * Add cargo-watch Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru> Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
82 lines
2.7 KiB
Nix
82 lines
2.7 KiB
Nix
{
|
|
description = "Minimalist CLI email client";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
crate2nix = {
|
|
url = "github:balsoft/crate2nix/tools-nix-version-comparison";
|
|
flake = false;
|
|
};
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix, ... }:
|
|
utils.lib.eachDefaultSystem
|
|
(system:
|
|
let
|
|
name = "himalaya";
|
|
|
|
# Imports
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
rust-overlay.overlay
|
|
(self: super: {
|
|
# Because rust-overlay bundles multiple rust packages into one
|
|
# derivation, specify that mega-bundle here, so that crate2nix
|
|
# will use them automatically.
|
|
rustc = self.rust-bin.stable.latest.default;
|
|
cargo = self.rust-bin.stable.latest.default;
|
|
})
|
|
];
|
|
};
|
|
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
|
|
generatedCargoNix;
|
|
|
|
# Create the cargo2nix project
|
|
project = pkgs.callPackage (generatedCargoNix {
|
|
inherit name;
|
|
src = ./.;
|
|
}) {
|
|
# Individual crate overrides go here
|
|
# Example: https://github.com/balsoft/simple-osd-daemons/blob/6f85144934c0c1382c7a4d3a2bbb80106776e270/flake.nix#L28-L50
|
|
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
|
|
# The himalaya crate itself is overriden here. Typically we
|
|
# configure non-Rust dependencies (see below) here.
|
|
${name} = oldAttrs: {
|
|
inherit buildInputs nativeBuildInputs;
|
|
};
|
|
};
|
|
};
|
|
|
|
# Configuration for the non-Rust dependencies
|
|
buildInputs = with pkgs; [ openssl.dev ];
|
|
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ];
|
|
in rec {
|
|
packages.${name} = project.rootCrate.build;
|
|
|
|
# `nix build`
|
|
defaultPackage = packages.${name};
|
|
|
|
# `nix run`
|
|
apps.${name} = utils.lib.mkApp {
|
|
inherit name;
|
|
drv = packages.${name};
|
|
};
|
|
defaultApp = apps.${name};
|
|
|
|
# `nix develop`
|
|
devShell = pkgs.mkShell {
|
|
inputsFrom = builtins.attrValues self.packages.${system};
|
|
buildInputs = with pkgs; [ cargo cargo-watch trunk ];
|
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
|
};
|
|
}
|
|
);
|
|
}
|