init
This commit is contained in:
commit
71ed2bc003
3 changed files with 132 additions and 0 deletions
67
derivations/cross_toolchain/binutils.nix
Normal file
67
derivations/cross_toolchain/binutils.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
{ pkgs }:
|
||||||
|
let
|
||||||
|
stdenv = pkgs.stdenv;
|
||||||
|
|
||||||
|
nativePackages = with pkgs; [
|
||||||
|
cmake
|
||||||
|
zlib
|
||||||
|
gnum4
|
||||||
|
bison
|
||||||
|
];
|
||||||
|
|
||||||
|
binutilsPkg = stdenv.mkDerivation {
|
||||||
|
name = "binutils";
|
||||||
|
version = "2.45";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "https://sourceware.org/pub/${name}/releases/${name}-${version}.tar.xz";
|
||||||
|
hash = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ nativePackages ];
|
||||||
|
buildInputs = [ ];
|
||||||
|
|
||||||
|
prePhases = "prepEnvironmentPhase";
|
||||||
|
prepEnvironmentPhase = ''
|
||||||
|
export LFS=$(pwd)
|
||||||
|
export LFSTOOLS=$(pwd)/tools
|
||||||
|
export LFS_TGT=$(uname -m)-lfs-linux-gnu
|
||||||
|
mkdir -v $LFSTOOLS
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
# Using --prefix=$out instead of $LFS/tools.
|
||||||
|
configurePhase = ''
|
||||||
|
echo "Configuring... "
|
||||||
|
echo "Starting config"
|
||||||
|
time ( ./configure --prefix=$LFSTOOLS \
|
||||||
|
--with-sysroot=$LFS \
|
||||||
|
--target=$LFS_TGT \
|
||||||
|
--disable-nls \
|
||||||
|
--enable-gprofng=no \
|
||||||
|
--disable-werror \
|
||||||
|
--enable-new-dtags \
|
||||||
|
--enable-default-hash-style=gnu
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
rm -r $LFS/$sourceRoot
|
||||||
|
cp -rvp $LFS/* $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
echo -e "\033[31mNix Develop -> $name: Loading...\033[0m"
|
||||||
|
|
||||||
|
if [[ "$(basename $(pwd))" != "$name" ]]; then
|
||||||
|
mkdir -p "$name"
|
||||||
|
cd "$name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$prepEnvironmentPhase"
|
||||||
|
echo -e "\033[36mNix Develop -> $name: Loaded.\033[0m"
|
||||||
|
echo -e "\033[36mNix Develop -> Current directory: $(pwd)\033[0m"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
binutilsPkg
|
||||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756542300,
|
||||||
|
"narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d7600c775f877cd87b4f5a831c28aa94137377aa",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
38
flake.nix
Normal file
38
flake.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
description = "A very basic flake";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
arch = "x86_64";
|
||||||
|
system = "${arch}-linux";
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
lib = pkgs.lib;
|
||||||
|
|
||||||
|
fs = lib.fileset;
|
||||||
|
|
||||||
|
# Cross Compilation Toolchain
|
||||||
|
binutilsStage = import ./derivations/cross_toolchain/binutils.nix { pkgs = pkgs; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.${system}.crossToolchain = {
|
||||||
|
binutils = binutilsStage;
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||||
|
|
||||||
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
git
|
||||||
|
nixfmt-rfc-style
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
echo "Welcome to LucyOS Dev Env"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue