-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
31db13d
commit 7a17c65
Showing
1 changed file
with
51 additions
and
96 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,106 +1,61 @@ | ||
{ | ||
description = "Standar cross compile flake for Rust Lang Projects"; | ||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
fenix.url = "github:nix-community/fenix/monthly"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
crane.url = "github:ipetkov/crane"; | ||
}; | ||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
outputs = | ||
inputs @ { flake-parts | ||
, fenix | ||
{ self | ||
, nixpkgs | ||
, flake-utils | ||
, crane | ||
, self | ||
, ... | ||
}: { | ||
, | ||
}: | ||
let | ||
# inherit (pkgs) lib; | ||
genSystems = nixpkgs.lib.genAttrs [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
]; | ||
pkgsFor = nixpkgs.legacyPackages; | ||
|
||
# Toolchain | ||
# toolchain = with fenix.packages.${system}; | ||
# fromToolchainFile { | ||
# file = ./rust-toolchain.toml; | ||
# sha256 = "sha256-U2yfueFohJHjif7anmJB5vZbpP7G6bICH4ZsjtufRoU="; | ||
# }; | ||
# craneLib = crane.lib.${system}.overrideToolchain toolchain; | ||
|
||
# # src = craneLib.cleanCargoSource (craneLib.path ./.); | ||
# buildInputs = with pkgs; [ | ||
# pkg-config | ||
# fontconfig | ||
|
||
# dbus | ||
# wayland | ||
# wayland-protocols | ||
# libxkbcommon | ||
# xorg.libXcursor | ||
# xorg.libxcb | ||
# xorg.libX11 | ||
# xorg.libXi | ||
# xorg.libXrandr | ||
# ]; | ||
in | ||
{ | ||
overlays.default = _: prev: { | ||
sss = prev.callPackage ./crates/sss_cli { }; | ||
sss_code = prev.callPackage ./crates/sss_code { }; | ||
}; | ||
} // | ||
inputs.flake-parts.lib.mkFlake | ||
{ | ||
inherit inputs; | ||
} | ||
{ | ||
systems = [ "x86_64-linux" ]; | ||
perSystem = | ||
{ config | ||
, pkgs | ||
, system | ||
, ... | ||
}: | ||
let | ||
inherit (pkgs) lib; | ||
# Toolchain | ||
toolchain = with fenix.packages.${system}; | ||
fromToolchainFile { | ||
file = ./rust-toolchain.toml; | ||
sha256 = "sha256-U2yfueFohJHjif7anmJB5vZbpP7G6bICH4ZsjtufRoU="; | ||
}; | ||
craneLib = crane.lib.${system}.overrideToolchain toolchain; | ||
|
||
src = craneLib.cleanCargoSource (craneLib.path ./.); | ||
buildInputs = with pkgs; [ | ||
pkg-config | ||
fontconfig | ||
packages = genSystems (system: self.overlays.default null pkgsFor.${system}); | ||
|
||
dbus | ||
wayland | ||
wayland-protocols | ||
libxkbcommon | ||
xorg.libXcursor | ||
xorg.libxcb | ||
xorg.libX11 | ||
xorg.libXi | ||
xorg.libXrandr | ||
]; | ||
commonArgs = { | ||
inherit src; | ||
inherit buildInputs; | ||
}; | ||
# Compile all artifacts for x86_64-unknown-linux-gnu | ||
linuxArtifacts = craneLib.buildDepsOnly (commonArgs | ||
// { | ||
CARGO_BUILD_TARGET = "x86_64-unknown-linux-gnu"; | ||
doCheck = false; | ||
}); | ||
|
||
# Compile app for x86_64-unknown-linux-gnu | ||
linuxApp = craneLib.buildPackage ( | ||
commonArgs | ||
// { | ||
doCheck = false; | ||
cargoArtifacts = linuxArtifacts; | ||
} | ||
); | ||
in | ||
{ | ||
# nix build | ||
packages = { | ||
default = linuxApp; | ||
}; | ||
|
||
# nix run | ||
apps = { | ||
default = flake-utils.lib.mkApp { | ||
drv = linuxApp; | ||
}; | ||
}; | ||
|
||
# nix develop | ||
devShells.default = craneLib.devShell { | ||
packages = with pkgs; [ | ||
toolchain | ||
oranda | ||
cargo-dist | ||
cargo-release | ||
] ++ buildInputs; | ||
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; | ||
}; | ||
}; | ||
}; | ||
# inputs.flake-parts.lib.mkFlake { | ||
# # nix develop | ||
# devShells.default = craneLib.devShell { | ||
# packages = with pkgs; [ | ||
# toolchain | ||
# oranda | ||
# cargo-dist | ||
# cargo-release | ||
# ] ++ buildInputs; | ||
# LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; | ||
# }; | ||
#}; | ||
}; | ||
} |