diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8dcbdd4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..835184b --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Linux Kernel Build Environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = + { + nixpkgs, + ... + }: + { + # devShells.x86_64-linux.default = + # let + # pkgs = import nixpkgs { + # system = "x86_64-linux"; + # }; + # in + # (pkgs.buildFHSUserEnv { + # name = "kernel-build-env"; + # targetPkgs = + # pkgs: + # (builtins.attrValues { + # inherit (pkgs) + # python3 + # pkg-config + # gnumake + # ncurses + # binutils + # linuxHeaders + # libelf + # flex + # bison + # gdb + # strace + # gcc + # ; + + # inherit (pkgs.qt5) qtbase; + # # inherit (pkgs.linux) nativeBuildInputs; + # }) + # ++ [ + # pkgs.llvmPackages.clangUseLLVM + # pkgs.openssl.dev + # pkgs.ncurses.dev + # ]; + # runScript = pkgs.writeScript "init.sh" '' + # # set the cross-compilation environment variables. + # # export CROSS_COMPILE=riscv64-unknown-linux-gnu- + # # export ARCH=riscv + # # export PKG_CONFIG_PATH="${pkgs.ncurses.dev}/lib/pkgconfig:" + + # # set the CFLAGS and CPPFLAGS to enable the rv64gc and lp64d. + # # as described here: + # # https://github.com/graysky2/kernel_compiler_patch#alternative-way-to-define-a--march-option-without-this-patch + # # export KCFLAGS=' -march=rv64gc -mabi=lp64d' + # # export KCPPFLAGS=' -march=rv64gc -mabi=lp64d' + + # exec zsh + # ''; + # }).env; + }; +}