diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..4a12f513b --- /dev/null +++ b/default.nix @@ -0,0 +1,33 @@ +{ + stdenv, + wasmer, + lib, +}: let + fs = lib.fileset; + sourceFiles = + fs.difference + ./. + (fs.unions [ + (fs.fileFilter (file: file.hasExt "nix") ./.) + (fs.fileFilter (file: file.hasExt "bat") ./.) + ]); +in + fs.trace sourceFiles + stdenv.mkDerivation { + pname = "onyx"; + version = "0.1.13"; + + src = fs.toSource { + root = ./.; + fileset = sourceFiles; + }; + buildInputs = [wasmer]; + + installPhase = '' + runHook preInstall + source ./settings.sh + export ONYX_INSTALL_DIR=$out/ + ./build.sh compile install + runHook postInstall + ''; + } diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..416c5c27e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1737062831, + "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c", + "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 000000000..406864ccd --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Onyx programming language flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { + self, + nixpkgs, + }: let + forAllSys = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all; + in { + packages = forAllSys (system: let + pkgs = import nixpkgs {inherit system;}; + + onyx = pkgs.callPackage ./default.nix {}; + in { + default = onyx; + }); + }; +}