-
Notifications
You must be signed in to change notification settings - Fork 0
Build/CI: Add base nix build for cross compiles from linux #26
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
tnichols217
wants to merge
4
commits into
develop
Choose a base branch
from
30-add-nix-build
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use flake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,3 +60,7 @@ _ReSharper*/ | |
| artifacts/ | ||
| # Scanner configuration file (user-specific) | ||
| scan_config.ini | ||
|
|
||
| result | ||
| out | ||
| .direnv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| { | ||
| description = "BFD9010: An HL7 FHIR API for Scanners"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
|
|
||
| outputs = | ||
| { nixpkgs, utils, ... }: | ||
| utils.lib.eachDefaultSystem ( | ||
| system: | ||
| let | ||
| pkgs = import nixpkgs { inherit system; }; | ||
| in | ||
| { | ||
| packages = rec { | ||
| nugetDeps = pkgs.dotnetCorePackages.addNuGetDeps { | ||
| nugetDeps = ./nix/deps.json; | ||
| }; | ||
| default = app; | ||
| base = { | ||
| pname = "BFD9010.Gui"; | ||
| version = "1.0.0"; | ||
| src = ./.; | ||
|
|
||
| nativeBuildInputs = [ | ||
| pkgs.dotnetCorePackages.sdk_8_0 | ||
| pkgs.cacert | ||
| ]; | ||
|
|
||
| # Explicitly set runtimeId to null to block the host-side targeting pack additions | ||
| runtimeId = null; | ||
|
|
||
| # Explicitly feed our win-x64 target down into the underlying NuGet fetcher mapping | ||
| # meta.platforms = [ "x86_64-windows" ]; | ||
|
|
||
| configurePhase = '' | ||
| export HOME=$TMPDIR | ||
| export DOTNET_CLI_HOME=$TMPDIR | ||
|
|
||
| # The addNuGetDeps hook outputs its organized cache folder to $nugetDeps | ||
| # We map the standard .NET environment variable straight to it | ||
| export NUGET_PACKAGES=$nugetDeps | ||
| ''; | ||
|
|
||
| buildPhase = '' | ||
| # Pure offline compilation phase using only the decoupled Windows targets | ||
| dotnet restore BFD9010/BFD9010.Gui/BFD9010.Gui.csproj \ | ||
| -r win-x86 \ | ||
| --source "$nugetDeps" \ | ||
| -p:EnableWindowsTargeting=true | ||
|
|
||
| dotnet publish BFD9010/BFD9010.Gui/BFD9010.Gui.csproj \ | ||
| -c Release \ | ||
| -r win-x86 \ | ||
| --no-restore \ | ||
| -p:TargetFramework=net8.0-windows \ | ||
| --self-contained true \ | ||
| -o $out/share/bfd9010 | ||
| ''; | ||
|
|
||
| installPhase = '' | ||
| mkdir -p $out/bin | ||
|
|
||
| cat <<EOF > $out/bin/bfd9010-server | ||
| #!/usr/bin/env bash | ||
| export WINEDEBUG=-all | ||
| export WINEARCH=win32 | ||
| export WINEPREFIX=\$HOME/.local/share/bfd9010-wine | ||
| if [ ! -d "\$WINEPREFIX" ]; then | ||
| echo "Initializing 32-bit Wine environment..." | ||
| ${pkgs.wine}/bin/wineboot -u | ||
| fi | ||
| exec ${pkgs.wine}/bin/wine $out/share/bfd9010/bfd9010.exe "\$@" | ||
| EOF | ||
|
|
||
| chmod +x $out/bin/bfd9010-server | ||
| ''; | ||
| }; | ||
| app = pkgs.stdenv.mkDerivation (nugetDeps base); | ||
| }; | ||
|
|
||
| # Spin up a quick development shell with 'nix develop' | ||
| devShells.default = pkgs.mkShell { | ||
| buildInputs = with pkgs; [ | ||
| dotnetCorePackages.runtime_8_0 | ||
| dotnetCorePackages.sdk_8_0 | ||
| nuget-to-json | ||
| nil | ||
| nixd | ||
| ]; | ||
|
|
||
| shellHook = '' | ||
| export DOTNET_ROOT="${pkgs.dotnetCorePackages.sdk_10_0}/share/dotnet" | ||
| ''; | ||
| }; | ||
| } | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.