Skip to content

add nix flake for easier dev env #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ src/debug.sh
src/debuga.sh
src/a.sc
src/lua
result
58 changes: 58 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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 {};
});
}