diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-05-01 21:26:57 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | f26677eee3e281927d82492dba9cdf214c2d60ef (patch) | |
| tree | 02680166c6c8f6274bd632b10aed31a94fea7b99 | |
| parent | add basic love2d support (diff) | |
| download | alive-f26677eee3e281927d82492dba9cdf214c2d60ef.tar.gz alive-f26677eee3e281927d82492dba9cdf214c2d60ef.zip | |
use flake.nix instead of shell.nix
| -rw-r--r-- | flake.lock | 43 | ||||
| -rw-r--r-- | flake.nix | 179 | ||||
| -rw-r--r-- | shell.nix | 154 |
3 files changed, 222 insertions, 154 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ee1e911 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1619345332, + "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1619792299, + "narHash": "sha256-hpg6wU0QLcNXj5/Nj8NT4p97R9SUGR8RBwjYNsMSKng=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "be58d0fbaa401922a090735edfc08442aed69b47", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-20.09", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c6b3015 --- /dev/null +++ b/flake.nix @@ -0,0 +1,179 @@ +{ + description = "alive"; + + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-20.09; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils, ... } @ inputs: + flake-utils.lib.eachDefaultSystem (system: + with import nixpkgs { inherit system; }; + let + mkLua = { lua, luaPkgs }: + let + luarocks-build-cpp = luaPkgs.buildLuarocksPackage rec { + pname = "luarocks-build-cpp"; + version = "0.2.0-1"; + + knownRockspec = (pkgs.fetchurl { + url = "mirror://luarocks//${pname}-${version}.rockspec"; + sha256 = "AzDZV9u6V71YNJFBfj3cR1COjFFWhGmsJkGsUMErSZs="; + }).outPath; + + src = pkgs.fetchFromGitHub { + owner = "osch"; + repo = pname; + rev = "v0.2.0"; + sha256 = "PamppWdV3cQMDK+t2V09/cNRskGuRNeuyvUODmopLaQ="; + }; + propagatedBuildInputs = [ lua ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; + description = "Lua binding to FLTK, the Fast Light ToolKit"; + license.fullName = "MIT"; + }; + }; + + luarocks-fetch-gitrec = luaPkgs.buildLuarocksPackage rec { + pname = "luarocks-fetch-gitrec"; + version = "0.2-2"; + + src = pkgs.fetchurl { + url = "mirror://luarocks//${pname}-${version}.src.rock"; + sha256 = "Dp3bKIG4swrD4+1NNtRTgyj68Di2cSUlh1r7Z2Rkzn0="; + }; + propagatedBuildInputs = with pkgs; [ lua git ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; + description = "Lua binding to FLTK, the Fast Light ToolKit"; + license.fullName = "MIT"; + }; + }; + + fltk4lua = luaPkgs.buildLuarocksPackage rec { + pname = "fltk4lua"; + version = "0.2-1"; + + src = pkgs.fetchurl { + url = "mirror://luarocks//${pname}-${version}.src.rock"; + sha256 = "fD31FruqVriMecFcvSV4W7JRia38+bg7j3T5k5pFZec="; + }; + buildInputs = with pkgs; [ fltk libjpeg ]; + propagatedBuildInputs = [ lua luarocks-build-cpp luarocks-fetch-gitrec ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; + description = "Lua binding to FLTK, the Fast Light ToolKit"; + license.fullName = "MIT"; + }; + }; + + losc = luaPkgs.buildLuarocksPackage rec { + pname = "losc"; + version = "1.0.0-1"; + + src = pkgs.fetchurl { + url = "mirror://luarocks//${pname}-${version}.src.rock"; + sha256 = "MArhj51V1awF5k2zToFYEXpS2c6o8bnNDn4wLhooHos="; + }; + buildInputs = with pkgs; [ stdenv.cc.cc.lib ]; + propagatedBuildInputs = [ lua ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/davidgranstrom/losc"; + description = "Open Sound Control (OSC) for lua/luajit with no external dependencies."; + license.fullName = "MIT"; + }; + }; + + discount = luaPkgs.buildLuarocksPackage { + pname = "discount"; + version = "0.4-1"; + + knownRockspec = (pkgs.fetchurl { + url = https://luarocks.org/discount-0.4-1.rockspec; + sha256 = "0mc2mwkprf8li2v91vga77rwi0xhv989nxshi66z2d45lbl1dcpd"; + }).outPath; + + src = pkgs.fetchurl { + url = https://craigbarnes.gitlab.io/dist/lua-discount/lua-discount-0.4.tar.gz; + sha256 = "1bfyrxjr26gbahawdynlbp48ma01gyd3b6xbljvxb2aavvfywc9m"; + }; + + buildInputs = [ pkgs.discount ]; + propagatedBuildInputs = [ lua ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/craigbarnes/lua-discount"; + description = "Lua bindings for the Discount Markdown library"; + license.fullName = "ISC"; + }; + }; + + ldoc = luaPkgs.buildLuarocksPackage rec { + pname = "ldoc"; + version = "scm-2"; + + knownRockspec = (pkgs.fetchurl { + url = "mirror://luarocks//${pname}-${version}.rockspec"; + sha256 = "PHQhpQPfmlPhwIXoce5WZ+eoARmSecy1ac7Bfu4zg38="; + }).outPath; + + src = pkgs.fetchFromGitHub { + owner = "s-ol"; + repo = "LDoc"; + rev = "moonscript"; + sha256 = "3jieGp9++cWtLMKccP+xqrtdCiNG/9BYZlHmH1l8XV8="; + }; + propagatedBuildInputs = with luaPkgs; [ + lua penlight markdown + ]; + + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; + description = "Lua binding to FLTK, the Fast Light ToolKit"; + license.fullName = "MIT"; + }; + }; + in + (lua.withPackages (p: with p; [ + moonscript lpeg + luafilesystem luasocket luasystem fltk4lua losc bit32 + ldoc busted discount + ])); + in rec { + packages.alive-env-lua53 = stdenv.mkDerivation { + name = "alive-env-lua53"; + src = self; + + nativeBuildInputs = with pkgs; [ (mkLua { lua = lua5_3; luaPkgs = lua53Packages; }) ]; + + shellHook = '' + export LUA_PATH="?.lua;?/init.lua" + ''; + }; + + packages.alive-env-luajit = stdenv.mkDerivation { + name = "alive-env-luajit"; + src = self; + + nativeBuildInputs = with pkgs; [ + (mkLua { lua = luajit; luaPkgs = luajitPackages; }) + love_11 + ]; + + shellHook = '' + source <( + LUA_PATH="?.lua;?/init.lua" luajit -e \ + "print(string.format('export LUA_PATH=%q; export LUA_CPATH=%q', package.path, package.cpath))" + ) + ''; + }; + + defaultPackage = packages.alive-env-luajit; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index c1f9b1f..0000000 --- a/shell.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ pkgs ? import <nixpkgs> {} -}: - -let - # lua = pkgs.lua5_3; - # luaPkgs = pkgs.lua53Packages; - lua = pkgs.luajit; - luaPkgs = pkgs.luajitPackages; - - luarocks-build-cpp = luaPkgs.buildLuarocksPackage rec { - pname = "luarocks-build-cpp"; - version = "0.2.0-1"; - - knownRockspec = (pkgs.fetchurl { - url = "mirror://luarocks//${pname}-${version}.rockspec"; - sha256 = "AzDZV9u6V71YNJFBfj3cR1COjFFWhGmsJkGsUMErSZs="; - }).outPath; - - src = pkgs.fetchFromGitHub { - owner = "osch"; - repo = pname; - rev = "v0.2.0"; - sha256 = "PamppWdV3cQMDK+t2V09/cNRskGuRNeuyvUODmopLaQ="; - }; - propagatedBuildInputs = [ lua ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; - description = "Lua binding to FLTK, the Fast Light ToolKit"; - license.fullName = "MIT"; - }; - }; - - luarocks-fetch-gitrec = luaPkgs.buildLuarocksPackage rec { - pname = "luarocks-fetch-gitrec"; - version = "0.2-2"; - - src = pkgs.fetchurl { - url = "mirror://luarocks//${pname}-${version}.src.rock"; - sha256 = "Dp3bKIG4swrD4+1NNtRTgyj68Di2cSUlh1r7Z2Rkzn0="; - }; - propagatedBuildInputs = with pkgs; [ lua git ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; - description = "Lua binding to FLTK, the Fast Light ToolKit"; - license.fullName = "MIT"; - }; - }; - - fltk4lua = luaPkgs.buildLuarocksPackage rec { - pname = "fltk4lua"; - version = "0.2-1"; - - src = pkgs.fetchurl { - url = "mirror://luarocks//${pname}-${version}.src.rock"; - sha256 = "fD31FruqVriMecFcvSV4W7JRia38+bg7j3T5k5pFZec="; - }; - buildInputs = with pkgs; [ fltk libjpeg ]; - propagatedBuildInputs = [ lua luarocks-build-cpp luarocks-fetch-gitrec ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; - description = "Lua binding to FLTK, the Fast Light ToolKit"; - license.fullName = "MIT"; - }; - }; - - losc = luaPkgs.buildLuarocksPackage rec { - pname = "losc"; - version = "1.0.0-1"; - - src = pkgs.fetchurl { - url = "mirror://luarocks//${pname}-${version}.src.rock"; - sha256 = "MArhj51V1awF5k2zToFYEXpS2c6o8bnNDn4wLhooHos="; - }; - buildInputs = with pkgs; [ stdenv.cc.cc.lib ]; - propagatedBuildInputs = [ lua ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/davidgranstrom/losc"; - description = "Open Sound Control (OSC) for lua/luajit with no external dependencies."; - license.fullName = "MIT"; - }; - }; - - discount = luaPkgs.buildLuarocksPackage { - pname = "discount"; - version = "0.4-1"; - - knownRockspec = (pkgs.fetchurl { - url = https://luarocks.org/discount-0.4-1.rockspec; - sha256 = "0mc2mwkprf8li2v91vga77rwi0xhv989nxshi66z2d45lbl1dcpd"; - }).outPath; - - src = pkgs.fetchurl { - url = https://craigbarnes.gitlab.io/dist/lua-discount/lua-discount-0.4.tar.gz; - sha256 = "1bfyrxjr26gbahawdynlbp48ma01gyd3b6xbljvxb2aavvfywc9m"; - }; - - buildInputs = [ pkgs.discount ]; - propagatedBuildInputs = [ lua ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/craigbarnes/lua-discount"; - description = "Lua bindings for the Discount Markdown library"; - license.fullName = "ISC"; - }; - }; - - ldoc = luaPkgs.buildLuarocksPackage rec { - pname = "ldoc"; - version = "scm-2"; - - knownRockspec = (pkgs.fetchurl { - url = "mirror://luarocks//${pname}-${version}.rockspec"; - sha256 = "PHQhpQPfmlPhwIXoce5WZ+eoARmSecy1ac7Bfu4zg38="; - }).outPath; - - src = pkgs.fetchFromGitHub { - owner = "s-ol"; - repo = "LDoc"; - rev = "moonscript"; - sha256 = "3jieGp9++cWtLMKccP+xqrtdCiNG/9BYZlHmH1l8XV8="; - }; - propagatedBuildInputs = with luaPkgs; [ - lua penlight markdown - ]; - - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/siffiejoe/lua-fltk4lua/"; - description = "Lua binding to FLTK, the Fast Light ToolKit"; - license.fullName = "MIT"; - }; - }; - -in pkgs.mkShell { - name = "alv-env"; - buildInputs = with pkgs; [ - (lua.withPackages (p: with p; [ - moonscript lpeg - luafilesystem luasocket luasystem fltk4lua losc bit32 - ldoc busted discount - ])) - love_11 - ]; - shellHook = '' - echo 'setting paths' - source <( - LUA_PATH="?.lua;?/init.lua" luajit -e \ - "print(string.format('export LUA_PATH=%q; export LUA_CPATH=%q', package.path, package.cpath))" - ) - ''; -} |
