-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
56 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,22 @@ | ||
{ pkgs ? import <nixpkgs> { } | ||
, crossPkgs ? pkgs | ||
, fenix ? import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { } | ||
, defaultFeatures ? true | ||
, features ? "" | ||
}: | ||
{ pimalaya ? import (fetchTarball "https://github.com/pimalaya/nix/archive/master.tar.gz") | ||
, ... | ||
} @args: | ||
|
||
let | ||
inherit (pkgs) binutils gnutar lib mktemp stdenv wine zip; | ||
inherit (crossPkgs) buildPlatform hostPlatform; | ||
|
||
mkToolchain = import ./rust-toolchain.nix { inherit lib fenix; }; | ||
rustTarget = if buildPlatform == hostPlatform then null else hostPlatform.rust.rustcTarget; | ||
rustToolchain = mkToolchain.fromTarget rustTarget; | ||
rustPlatform = crossPkgs.makeRustPlatform { | ||
rustc = rustToolchain; | ||
cargo = rustToolchain; | ||
}; | ||
|
||
# HACK: https://github.com/NixOS/nixpkgs/issues/177129 | ||
empty-libgcc_eh = stdenv.mkDerivation { | ||
pname = "empty-libgcc_eh"; | ||
version = "0"; | ||
dontUnpack = true; | ||
installPhase = '' | ||
mkdir -p "$out"/lib | ||
"${lib.getExe' binutils "ar"}" r "$out"/lib/libgcc_eh.a | ||
''; | ||
}; | ||
|
||
himalaya = import ./package.nix { | ||
pimalaya.mkDefault ({ | ||
src = ./.; | ||
version = "1.0.0"; | ||
mkPackage = ({ lib, pkgs, rustPlatform, defaultFeatures, features }: import ./package.nix { | ||
inherit lib rustPlatform; | ||
fetchFromGitHub = crossPkgs.fetchFromGitHub; | ||
stdenv = crossPkgs.stdenv; | ||
apple-sdk = if hostPlatform.isx86_64 then crossPkgs.apple-sdk_13 else crossPkgs.apple-sdk_14; | ||
installShellFiles = crossPkgs.installShellFiles; | ||
fetchFromGitHub = pkgs.fetchFromGitHub; | ||
stdenv = pkgs.stdenv; | ||
apple-sdk = if pkgs.hostPlatform.isx86_64 then pkgs.apple-sdk_13 else pkgs.apple-sdk_14; | ||
installShellFiles = pkgs.installShellFiles; | ||
installShellCompletions = false; | ||
installManPages = false; | ||
notmuch = crossPkgs.notmuch; | ||
gpgme = crossPkgs.gpgme; | ||
pkg-config = crossPkgs.pkg-config; | ||
notmuch = pkgs.notmuch; | ||
gpgme = pkgs.gpgme; | ||
pkg-config = pkgs.pkg-config; | ||
buildNoDefaultFeatures = !defaultFeatures; | ||
buildFeatures = lib.strings.splitString "," features; | ||
}; | ||
in | ||
|
||
himalaya.overrideAttrs (drv: { | ||
version = "1.0.0"; | ||
|
||
propagatedBuildInputs = (drv.propagatedBuildInputs or [ ]) | ||
++ lib.optional hostPlatform.isWindows empty-libgcc_eh; | ||
|
||
src = crossPkgs.nix-gitignore.gitignoreSource [ ] ./.; | ||
|
||
cargoDeps = rustPlatform.importCargoLock { | ||
lockFile = ./Cargo.lock; | ||
allowBuiltinFetchGit = true; | ||
}; | ||
}) | ||
buildFeatures = lib.splitString "," features; | ||
}); | ||
} // removeAttrs args [ "pimalaya" ]) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[toolchain] | ||
channel = "1.82.0" | ||
profile = "default" | ||
components = [ "rust-src", "rust-analyzer" ] | ||
components = ["rust-src", "rust-analyzer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,6 @@ | ||
{ pkgs ? import <nixpkgs> { } | ||
, fenix ? import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { } | ||
, withNotmuch ? false | ||
, withGpg ? false | ||
, withOpenSsl ? false | ||
}: | ||
{ pimalaya ? import (fetchTarball "https://github.com/pimalaya/nix/archive/master.tar.gz") | ||
, ... | ||
} @args: | ||
|
||
let | ||
inherit (pkgs) lib; | ||
mkRustToolchain = import ./rust-toolchain.nix { inherit lib fenix; }; | ||
rust = mkRustToolchain.fromFile; | ||
in | ||
|
||
pkgs.mkShell { | ||
buildInputs = [ ] | ||
# Nix language | ||
++ [ pkgs.nixd pkgs.nixpkgs-fmt ] | ||
|
||
# Rust | ||
++ [ rust ] | ||
|
||
# Cargo features | ||
++ lib.optional withNotmuch pkgs.notmuch | ||
++ lib.optional withGpg pkgs.gpgme | ||
++ lib.optional withOpenSsl pkgs.openssl; | ||
} | ||
pimalaya.mkShell ({ rustToolchainFile = ./rust-toolchain.toml; } | ||
// removeAttrs args [ "pimalaya" ]) |