From af7f36b3e8ddce86872a3599101ac68bbab74439 Mon Sep 17 00:00:00 2001 From: Kaiden Fey Date: Sun, 6 Sep 2020 18:55:39 +0200 Subject: Implementing initial stage1 builder --- stage1/README | 15 +++++++++++++++ stage1/default.nix | 14 ++++++++++++++ stage1/lib/root.h | 36 ++++++++++++++++++++++++++++++++++++ stage1/main.cpp | 13 +++++++++++++ stage1/meson.build | 7 +++++++ 5 files changed, 85 insertions(+) create mode 100644 stage1/README create mode 100644 stage1/default.nix create mode 100644 stage1/lib/root.h create mode 100644 stage1/main.cpp create mode 100644 stage1/meson.build diff --git a/stage1/README b/stage1/README new file mode 100644 index 00000000000..ccf38e66e0d --- /dev/null +++ b/stage1/README @@ -0,0 +1,15 @@ + + + ~~~~~~~~~~~~~~~~~~~~~~~ + + libkookie stage 1 tools + + ~~~~~~~~~~~~~~~~~~~~~~~ + +This is the libkookie stage 1 toolchain documentation. In order to +build a system with libkookie you need the stage 2 toolchain (namely +`builder`, the build root/ install wrapper). This derivation builds +this tool. + +You need to have a running nix installation to download the required +C++ environment. \ No newline at end of file diff --git a/stage1/default.nix b/stage1/default.nix new file mode 100644 index 00000000000..8dcfc1ed060 --- /dev/null +++ b/stage1/default.nix @@ -0,0 +1,14 @@ +with (import {}); + +llvmPackages_latest.stdenv.mkDerivation { + pname = "libkookie-stage1-tools"; + version = "0.0.0"; + src = ./.; + + nativeBuildInputs = with pkgs; [ meson ninja pkg-config ]; + + installPhase = '' + mkdir -p $out/bin + cp builder $out/bin/builder + ''; +} diff --git a/stage1/lib/root.h b/stage1/lib/root.h new file mode 100644 index 00000000000..3fbca0c5367 --- /dev/null +++ b/stage1/lib/root.h @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +using std::string; +namespace fs = std::filesystem; + +/** Root build type */ +enum r_type { + FULL_NIXOS, + FULL_DARWIN, + PARTIAL, + COLLECTION, +}; + +/** Root metadata */ +struct root_t { + string name; + string path; + enum r_type type; +}; + + +root_t get_root(string path) +{ + for(auto &entry: fs::recursive_directory_iterator(path)) { + std::cout << entry.path() << std::endl; + } + + return root_t { + "hyperion", + "roots/hyperion/default.nix", + FULL_NIXOS, + }; +} diff --git a/stage1/main.cpp b/stage1/main.cpp new file mode 100644 index 00000000000..6f2cd57fae8 --- /dev/null +++ b/stage1/main.cpp @@ -0,0 +1,13 @@ +#include +#include "root.h" + +int main(int argn, char **argv) +{ + std::cout << "I am a builder!" << std::endl; + + get_root("/Users/spacekookie/Projects/code/libkookie/roots"); + + std::cout << "uwu!" << std::endl; + return 0; +} + diff --git a/stage1/meson.build b/stage1/meson.build new file mode 100644 index 00000000000..df9b342b863 --- /dev/null +++ b/stage1/meson.build @@ -0,0 +1,7 @@ +project('libkookie-stage1-tools', 'cpp', + default_options : ['cpp_std=c++17']) + +executable('builder', + 'main.cpp', + link_args : '-lc++fs', + include_directories: include_directories('lib')) -- cgit v1.2.3