2021-04-17 22:06:11 +00:00
|
|
|
{
|
2021-04-27 12:54:53 +00:00
|
|
|
description = "📫 CLI email client";
|
2021-04-17 22:06:11 +00:00
|
|
|
|
|
|
|
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:
|
2021-06-03 14:51:48 +00:00
|
|
|
let
|
2021-04-17 22:06:11 +00:00
|
|
|
name = "himalaya";
|
|
|
|
|
|
|
|
# Imports
|
2021-06-03 14:51:48 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [
|
2021-04-17 22:06:11 +00:00
|
|
|
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;
|
2021-06-03 13:33:25 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/applications/
|
|
|
|
cp assets/himalaya.desktop $out/share/applications/
|
|
|
|
'';
|
2021-04-17 22:06:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Configuration for the non-Rust dependencies
|
|
|
|
buildInputs = with pkgs; [ openssl.dev ];
|
|
|
|
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ];
|
2021-06-03 14:51:48 +00:00
|
|
|
in
|
|
|
|
rec {
|
|
|
|
packages = {
|
|
|
|
${name} = project.rootCrate.build;
|
|
|
|
|
|
|
|
"${name}-vim" = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
|
|
|
inherit (packages.${name}) version;
|
|
|
|
name = "${name}-vim";
|
|
|
|
src = self;
|
|
|
|
buildInputs = [ packages.${name} ];
|
2021-08-03 13:11:52 +00:00
|
|
|
dontConfigure = false;
|
|
|
|
configurePhase = "cd vim/";
|
2021-06-03 14:51:48 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s ${packages.${name}}/bin/himalaya $out/bin/himalaya
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2021-04-17 22:06:11 +00:00
|
|
|
|
|
|
|
# `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}";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|