Skip to content
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
82 changes: 42 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
# Autosave files
*~

# build
[Oo]bj/
[Bb]in/
packages/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

# Mac bundle stuff
*.dmg
*.app

# resharper
*_Resharper.*
*.Resharper

# dotCover
*.dotCover
# Autosave files
*~

# build
[Oo]bj/
[Bb]in/
packages/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

# Mac bundle stuff
*.dmg
*.app

# resharper
*_Resharper.*
*.Resharper

# dotCover
*.dotCover

result
52 changes: 52 additions & 0 deletions 0001-patch-csproj-to-find-the-openxml-dll.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 8c764df6ad27d08b207029879f63d59838c6b53d Mon Sep 17 00:00:00 2001
From: Jappie Klooster <jappieklooster@hotmail.com>
Date: Mon, 25 Jul 2022 13:36:18 +0200
Subject: [PATCH] patch csproj to find the openxml dll

---
XlsxValidator.csproj | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/XlsxValidator.csproj b/XlsxValidator.csproj
index 06bba76..272b4b5 100644
--- a/XlsxValidator.csproj
+++ b/XlsxValidator.csproj
@@ -53,7 +53,7 @@
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v3.5'">
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml">
- <HintPath>..\packages\DocumentFormat.OpenXml\lib\net35\DocumentFormat.OpenXml.dll</HintPath>
+ <HintPath>lib\dotnet\DocumentFormat.OpenXml\net35\DocumentFormat.OpenXml.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
@@ -62,7 +62,7 @@
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3')">
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml">
- <HintPath>..\packages\DocumentFormat.OpenXml\lib\net40\DocumentFormat.OpenXml.dll</HintPath>
+ <HintPath>lib\dotnet\DocumentFormat.OpenXml\net40\DocumentFormat.OpenXml.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
@@ -71,7 +71,7 @@
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml">
- <HintPath>..\packages\DocumentFormat.OpenXml\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
+ <HintPath>lib\dotnet\DocumentFormat.OpenXml\net46\DocumentFormat.OpenXml.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
@@ -80,7 +80,7 @@
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v1.0')">
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml">
- <HintPath>..\packages\DocumentFormat.OpenXml\lib\netstandard1.3\DocumentFormat.OpenXml.dll</HintPath>
+ <HintPath>lib\dotnet\DocumentFormat.OpenXml\netstandard1.3\DocumentFormat.OpenXml.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
--
2.33.3

45 changes: 45 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
some_program/default.nix
nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }'
*/

{ lib
, stdenv
, fetchFromGitHub
, fetchNuGet
, buildDotnetPackage
, dotnetPackages
, pkg-config
, callPackage
}:
let
openxml = callPackage ./nix/openxml.nix {};
in
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/dotnet/build-dotnet-package/default.nix
buildDotnetPackage rec {
pname = "xlsx-validator";
baseName = pname; # workaround for "called without baseName"
version = "1.0";
src = ./XlsxValidator;
projectFile = ["./XlsxValidator.csproj"];

patches = [ ./0001-patch-csproj-to-find-the-openxml-dll.patch];


# we patch in the openxml ref by hand,
# nix doesn't appear to do depencencies yet
preBuild = ''
set -xe
cp -r ${openxml}/lib ./lib
ls
ls ./lib/dotnet/DocumentFormat.OpenXml
'';
nativeBuildInputs = [
pkg-config
];
meta = {
homepage = "some_homepage";
description = "some_description";
license = lib.licenses.mit;
};
}
6 changes: 6 additions & 0 deletions nix/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# convenience insta build script
let
pkgs = import ./pin.nix {};
in
pkgs.callPackage ../default.nix {}
# pkgs.callPackage ./openxml.nix {}
13 changes: 13 additions & 0 deletions nix/openxml.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
get's openxml
*/
{ fetchNuGet,
}:

# https://www.nuget.org/packages/DocumentFormat.OpenXml
fetchNuGet {
pname = "DocumentFormat.OpenXml";
version = "2.17.1";
sha256 = "05fcyh53hz6m45pgq49lvgaz9a150hkgl66xx6i4inaax9kcpr46";
outputFiles = [ "lib/*" ];
}
6 changes: 6 additions & 0 deletions nix/pin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import (builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nixos-pin-2022.05.07";
url = "https://github.com/nixos/nixpkgs/";
rev = "18854d7bbc472919eace2303779d1653a78bd63b";
})
6 changes: 6 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let
pkgs = import ./nix/pin.nix {};
in
pkgs.mkShell {
buildInputs = [pkgs.dotnet-sdk];
}