From e0e31ec7ca5ae58be408a995a690b22486e7c62a Mon Sep 17 00:00:00 2001 From: Konstantin Nazarov Date: Fri, 6 Dec 2024 19:44:09 +0000 Subject: [PATCH] Initial commit --- .gitignore | 20 ++++++++++++++++++++ flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++++ rve.nix | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 rve.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b050c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*.o +*.a +*.gcda +*.gcno +*.gcov +lcov.info +test/*.test +vm +lisp +asm +sd +compile_commands.json +.cache +CMakeFiles +cmake_install.cmake +CMakeCache.txt +CTestTestfile.cmake +Testing +result +build \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ecbc5a6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1733513735, + "narHash": "sha256-cSC8KVc0q7HfukrEN3fqMmVowJdgOF33cAVBjNtW+tU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "992e5d075b51886298efa1c2100d35c62cb0ca97", + "type": "github" + }, + "original": { + "owner": "NixOS", + "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..9e06636 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Nix flake for rve"; + + # Flake inputs + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; # also valid: "nixpkgs"; + }; + + # Flake outputs + outputs = { self, nixpkgs }: + let + # Systems supported + allSystems = [ + "x86_64-linux" # 64-bit Intel/AMD Linux + "aarch64-linux" # 64-bit ARM Linux + "x86_64-darwin" # 64-bit Intel macOS + "aarch64-darwin" # 64-bit ARM macOS + ]; + + # Helper to provide system-specific attributes + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + packages = forAllSystems( {pkgs }: + { + lisp = (pkgs.callPackage ./rve.nix {}); + default = (pkgs.callPackage ./rve.nix {}); + } + ); + overlays.default = final: prev: { + lisp = (prev.callPackage ./rve.nix {}); + }; + }; +} diff --git a/rve.nix b/rve.nix new file mode 100644 index 0000000..0608629 --- /dev/null +++ b/rve.nix @@ -0,0 +1,32 @@ +{ pkgs, stdenv }: +pkgs.gcc13Stdenv.mkDerivation rec { + pname = "rve"; + version = "0.1.0"; + + dontPatch = true; + + preBuild = '' + patchShebangs bin/*.sh + ''; + + installFlags = "PREFIX=${placeholder "out"} VERSION=${version}"; + + nativeBuildInputs = with pkgs; [ pkg-config cmake ninja ]; + + buildInputs = with pkgs; [ gdb linuxPackages.perf jq lcov ]; + + hardeningDisable = [ "all" ]; + cmakeFlags = [ + "-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE" + "-DCMAKE_BUILD_TYPE=Debug" + ]; + shellHook = '' + export CMAKE_BUILD_TYPE=Debug + ln -s build/compile_commands.json compile_commands.json + ''; + + doCheck = true; + + src = ./.; + +}