feat(nix): simplify flake.nix, remove devenv
This commit is contained in:
@@ -2,16 +2,12 @@
|
||||
description = "Conventional commits for Jujutsu";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
alejandra = {
|
||||
url = "github:kamadorueda/alejandra/4.0.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
devenv = {
|
||||
url = "github:cachix/devenv";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -19,8 +15,16 @@
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-trusted-public-keys = ["devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="];
|
||||
extra-substituters = ["https://devenv.cachix.org" "https://phundrak.cachix.org"];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
|
||||
"phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="
|
||||
];
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://devenv.cachix.org"
|
||||
"https://phundrak.cachix.org"
|
||||
];
|
||||
};
|
||||
|
||||
outputs = {
|
||||
@@ -29,37 +33,65 @@
|
||||
rust-overlay,
|
||||
alejandra,
|
||||
...
|
||||
} @ inputs:
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
overlays = [(import rust-overlay)];
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
rustVersion = pkgs.rust-bin.stable.latest.default;
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = rustVersion;
|
||||
rustc = rustVersion;
|
||||
targets = {
|
||||
linux-x86_64 = {
|
||||
crossPkgs = pkgs;
|
||||
triple = "x86_64-unknown-linux-gnu";
|
||||
exeSuffix = "";
|
||||
};
|
||||
linux-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-multiplatform;
|
||||
triple = "aarch64-unknown-linux-gnu";
|
||||
exeSuffix = "";
|
||||
};
|
||||
windows-x86_64 = {
|
||||
crossPkgs = pkgs.pkgsCross.mingwW64;
|
||||
triple = "x86_64-pc-windows-gnu";
|
||||
exeSuffix = ".exe";
|
||||
};
|
||||
windows-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-windows;
|
||||
triple = "aarch64-pc-windows-gnu";
|
||||
exeSuffix = ".exe";
|
||||
};
|
||||
macos-x86_64 = {
|
||||
crossPkgs = pkgs.pkgsCross.x86_64-darwin;
|
||||
triple = "x86_64-apple-darwin";
|
||||
exeSuffix = "";
|
||||
};
|
||||
macos-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-darwin;
|
||||
triple = "aarch64-apple-darwin";
|
||||
exeSuffix = "";
|
||||
};
|
||||
};
|
||||
mkRustBuild = import ./nix/package.nix;
|
||||
packages = {
|
||||
linux-x86_64 = mkRustBuild {inherit pkgs; target = targets.linux-x86_64; };
|
||||
linux-aarch64 = mkRustBuild { inherit pkgs; target = targets.linux-aarch64; };
|
||||
windows-x86_64 = mkRustBuild { inherit pkgs; target = targets.windows-x86_64; };
|
||||
macos-aarch64 = mkRustBuild { inherit pkgs; target = targets.macos-aarch64; };
|
||||
};
|
||||
defaultBySystem = {
|
||||
"x86_64-linux" = packages.linux-x86_64;
|
||||
"aarch64-linux" = packages.linux-aarch64;
|
||||
"x86_64-windows" = packages.windows-x86_64;
|
||||
"aarch64-macos" = packages.macos-aarch64;
|
||||
};
|
||||
in {
|
||||
formatter = alejandra.defaultPackage.${system};
|
||||
packages = let
|
||||
nativeRustVersion = pkgs.rust-bin.stable.latest.default;
|
||||
nativeRustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = nativeRustVersion;
|
||||
rustc = nativeRustVersion;
|
||||
packages =
|
||||
packages
|
||||
// {
|
||||
default = defaultBySystem.${system} or packages.linux-x86_64;
|
||||
};
|
||||
mingwPkgs = pkgs.pkgsCross.mingwW64;
|
||||
windowsRustVersion = pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = ["x86_64-pc-windows-gnu"];
|
||||
};
|
||||
windowsRustPlatform = mingwPkgs.makeRustPlatform {
|
||||
cargo = windowsRustVersion;
|
||||
rustc = windowsRustVersion;
|
||||
};
|
||||
in
|
||||
import ./nix/package.nix {inherit pkgs nativeRustPlatform windowsRustPlatform;};
|
||||
devShell = import ./nix/shell.nix {
|
||||
inherit inputs pkgs rustVersion;
|
||||
};
|
||||
devShell = import ./nix/shell.nix {inherit pkgs rustVersion;};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user