diff --git a/.gitignore b/.gitignore index a7821db7..7836021d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ src/debug.sh src/debuga.sh src/a.sc src/lua +result diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..0e79afc1 --- /dev/null +++ b/default.nix @@ -0,0 +1,58 @@ +{ lib +, stdenv +, fetchFromGitHub +, makeWrapper +, pkg-config +, which +, bison +, gnuplot +, libxls +, libxlsxwriter +, libxml2 +, libzip +, ncurses +, xlsSupport ? false +}: + +stdenv.mkDerivation rec { + pname = "sc-im"; + version = "9.9.9"; + + src = ./src; + + nativeBuildInputs = [ + makeWrapper + pkg-config + which + bison + ]; + + buildInputs = [ + gnuplot + libxml2 + libzip + ncurses + ] ++ lib.optionals xlsSupport [ + libxls + libxlsxwriter + ]; + + makeFlags = [ "prefix=${placeholder "out"}" ]; + + hardeningDisable = [ "fortify" ]; + + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration"; + + postInstall = '' + wrapProgram "$out/bin/sc-im" --prefix PATH : "${lib.makeBinPath [ gnuplot ]}" + ''; + + meta = with lib; { + changelog = "https://github.com/andmarti1424/sc-im/blob/${src.rev}/CHANGES"; + homepage = "https://github.com/andmarti1424/sc-im"; + description = "An ncurses spreadsheet program for terminal"; + license = licenses.bsdOriginal; + maintainers = with maintainers; [ dotlambda ]; + platforms = platforms.unix; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..76f9307b --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1723362943, + "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..cebe29c3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "Dev Flake for SC-IM"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [ + "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" + ] (system: let + pkgs = import nixpkgs { + inherit system; + overlays = []; + }; + in { + devShells.default = pkgs.mkShell rec { + name = "sc-im-dev"; + + packages = with pkgs; [ + makeWrapper + pkg-config + which + bison + gnuplot + libxml2 + libzip + ncurses + + #libxls + #libxlsxwriter + ]; + + shellHook = let + icon = "f121"; + in '' + export PS1="$(echo -e '\u${icon}') {\[$(tput sgr0)\]\[\033[38;5;228m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]} (${name}) \\$ \[$(tput sgr0)\]" + ''; + }; + + packages.default = pkgs.callPackage ./default.nix {}; + }); +}