esv/flake.nix

53 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{
description = "Read the Word of God from your command line";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
bible = {
url = "https://bolls.life/static/translations/ESV.zip";
flake = false;
};
};
outputs = { self, nixpkgs, bible }:
let
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
packages = forAllSystems ({ pkgs }: {
default =
let binName = "esv"; in
pkgs.stdenv.mkDerivation {
name = binName;
src = self;
buildInputs = [ ];
nativeBuildInputs = with pkgs; [ shellcheck gawk unzip python3 python312Packages.pandas ];
buildPhase = ''
python3 ${./convert.py} ${bible}
cat ${./esv.sh} > ${binName}
echo '#EOF' >> ${binName}
tar czf - esv.awk esv.tsv >> ${binName}
chmod +x ${binName}
'';
installPhase = ''
mkdir -p $out/bin/
cp ${binName} $out/bin/
'';
};
});
};
}