Files
mingw-sword-build/flake.nix
T
Greg Hellings 0a67ee2420 Try to fix non-existent builds
Somehow I'm ending up with no file. Try to diagnose why, but also try to
fix it at the same problem without being 100% sure of the root cause
2025-02-06 17:01:32 -06:00

109 lines
3.5 KiB
Nix

# To update to the newest version of SWORD do the following:
# * Scroll down to the line where the "rev" is listed
# * Update that value to match the latest revision of SWORD's SVN trunk
# * Comment out the hash line below that
# * Run a `nix build` on the current target
# * When you receive an error about the hash mismatch, copy the correct value
# and paste it into the hash as the new value, then uncomment the hash
# * Run the build again. It won't need to re-fetch the sources, it will only
# execute the build
{
description = "Subversion SWORD builds.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
hooks.url = "github:cachix/git-hooks.nix";
};
outputs =
{ flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.flake-root.flakeModule ];
flake = {
# Universal things
overlays.default = _final: _prev: { };
};
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
perSystem =
{ pkgs, self', ... }@inputs':
{
_module.args.pkgs = import inputs.nixpkgs {
inherit (inputs') system;
overlays = [
(_: prev: {
icu = prev.icu76;
})
];
};
devShells.default = pkgs.mkShell {
# These will just be available
packages = with pkgs; [ pre-commit ];
buildInputs = self'.checks.pre-commit.enabledPackages;
inherit (self'.checks.pre-commit) shellHook;
};
checks = {
pre-commit = inputs.hooks.lib.${inputs'.system}.run {
src = ./.;
hooks = {
check-added-large-files.enable = true;
check-case-conflicts.enable = true;
check-merge-conflicts.enable = true;
check-symlinks.enable = true;
deadnix.enable = true;
end-of-file-fixer.enable = true;
fix-byte-order-marker.enable = true;
mixed-line-endings.enable = true;
nixfmt-rfc-style.enable = true;
trim-trailing-whitespace.enable = true;
};
};
};
# This is not special, this is just flakes
packages =
let
tar =
win:
let
svnSword = (
win.sword.overrideAttrs {
src = pkgs.fetchsvn {
url = "https://svn.crosswire.org/svn/sword/trunk";
rev = "3895";
hash = "sha256-ju6TsfiAUquXbost6PzStHDLfvOJTNON/iSIupi6IOc=";
};
}
);
in
pkgs.writeShellApplication {
name = "package-sword";
runtimeInputs = with pkgs; [
gnutar
xz
];
text = ''
out=$(pwd)
pushd ${svnSword}
tar cvhaf "$out/sword.tar.xz" ./* --transform "s+^\\./+sword/+"
'';
};
in
with pkgs.pkgsCross;
{
default = tar mingwW64;
x86 = tar mingwW64;
ucrt = tar ucrt64;
ucrtAarch = tar ucrtAarch64;
};
};
};
}