Skip to content

Commit ffe4e66

Browse files
committed
Move more github build to nix
1 parent 8ddaf36 commit ffe4e66

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

.github/workflows/build.yml

+8-15
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@ on:
66
jobs:
77
build:
88
runs-on: ubuntu-22.04
9+
permissions:
10+
contents: read
11+
id-token: write
912
steps:
10-
- uses: actions/checkout@v3
11-
- name: Setup dotnet
12-
uses: actions/setup-dotnet@v3
13-
with:
14-
dotnet-version: '6.x'
15-
- uses: actions/cache@v3
16-
with:
17-
path: ~/.nuget/packages
18-
# Look to see if there is a cache hit for the corresponding requirements file
19-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
20-
restore-keys: |
21-
${{ runner.os }}-nuget
22-
- name: Install dependencies
23-
run: dotnet restore
13+
- uses: actions/checkout@v4
14+
- uses: DeterminateSystems/nix-installer-action@v12
15+
- uses: DeterminateSystems/[email protected]
2416
- name: Build
25-
run: dotnet build
17+
run: nix run .#build
18+

flake.nix

+21-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,25 @@
1313
outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
1414
let
1515
forEachSystem = nixpkgs.lib.genAttrs (import systems);
16-
packagesf = pkgs: with pkgs; [
17-
dotnet-sdk_6
18-
bashInteractive
19-
];
16+
dotnet = pkgs: pkgs.dotnet-sdk_6;
2017
in
2118
{
19+
packages = forEachSystem (system:
20+
let
21+
pkgs = nixpkgs.legacyPackages.${system};
22+
in
23+
{
24+
default = pkgs.writeShellScriptBin "dotnet-run" ''
25+
cd SampleSolrApp
26+
${dotnet pkgs}/bin/dotnet run -v minimal
27+
'';
28+
29+
build = pkgs.writeShellScriptBin "dotnet-run" ''
30+
${dotnet pkgs}/bin/dotnet build
31+
'';
32+
}
33+
);
34+
2235
devShells = forEachSystem
2336
(system:
2437
let
@@ -30,7 +43,10 @@
3043
modules = [
3144
{
3245
# https://devenv.sh/reference/options/
33-
packages = packagesf pkgs ++ [
46+
packages = [
47+
(dotnet pkgs)
48+
pkgs.bashInteractive
49+
] ++ [
3450
(pkgs.vscode-with-extensions.override {
3551
vscodeExtensions = with pkgs.vscode-extensions; [
3652
ms-dotnettools.csharp

0 commit comments

Comments
 (0)