From d08e97f9354964024649d77961f2b8ae4fcfd20a Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Thu, 3 Aug 2023 12:36:30 +1200 Subject: [PATCH] Add Nix flake and add result to .gitignore --- .gitignore | 1 + flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 2ac0f6c..0fafc5a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ csto doc/ include/ +result test.lua lua diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..59bf9bd --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1690881714, + "narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9e1960bc196baf6881340d53dccb203a951745a2", + "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..fbc8c6b --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Callisto, a featureful extension runtime for Lua 5.4"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + forAllSystems = fn: + nixpkgs.lib.genAttrs [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + ] (system: + fn (import nixpkgs { + inherit system; + }) + ); + in + { + packages = forAllSystems (pkgs: { + default = pkgs.stdenv.mkDerivation { + name = "callisto"; + src = ./.; + buildPhase = '' + make + ''; + installPhase = '' + mkdir -p $out/bin + make DESTDIR="$out" PREFIX=/ install + ''; + }; + }); + }; +}