-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from siraben/flake
Add Nix flake
- Loading branch information
Showing
6 changed files
with
138 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,27 +6,25 @@ jobs: | |
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code base | ||
- name: 'Checkout codebase' | ||
if: github.event_name == 'push' | ||
uses: actions/checkout@v2.3.1 | ||
uses: actions/checkout@v2.4.0 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check out code base | ||
- name: 'Checkout codebase' | ||
if: github.event_name == 'pull_request' | ||
uses: actions/checkout@v2.3.1 | ||
uses: actions/checkout@v2.4.0 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- run: NIXPKGS_ALLOW_UNFREE=1 nix-build | ||
- name: "Copy book" | ||
run: "cp result/share/book.pdf ." | ||
- name: "Upload artifact to GitHub" | ||
uses: actions/upload-artifact@v2 | ||
- uses: cachix/install-nix-action@v14 | ||
- run: NIXPKGS_ALLOW_UNFREE=1 nix --experimental-features 'nix-command flakes' build -L --impure | ||
- name: 'Copy book' | ||
run: cp result/share/book.pdf . | ||
- name: 'Upload artifact to GitHub' | ||
uses: actions/[email protected] | ||
with: | ||
name: book.pdf | ||
path: book.pdf |
This file contains 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 |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
**/#*# | ||
tex/gitrev | ||
.DS_Store | ||
|
||
result |
This file contains 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 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 |
---|---|---|
@@ -1,30 +1,9 @@ | ||
with import <nixpkgs> {}; | ||
|
||
stdenv.mkDerivation rec { | ||
name = "math-comp-book"; | ||
version = "master"; | ||
src = ./.; | ||
|
||
nativeBuildInputs = [ git texlive.combined.scheme-full ]; | ||
|
||
buildPhase = '' | ||
cd tex | ||
make | ||
biber main | ||
make | ||
make | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p $out/share | ||
cp book.pdf $out/share | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Mathematical components book"; | ||
homepage = "https://github.com/math-comp/mcb"; | ||
license = lib.licenses.cc-by-nc-40; | ||
maintainers = with maintainers; [ siraben ]; | ||
platforms = platforms.all; | ||
}; | ||
} | ||
(import ( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
in fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; } | ||
) { | ||
src = ./.; | ||
}).defaultNix |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,46 @@ | ||
{ | ||
description = "Mathematical Components (the book)"; | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
utils.url = "github:numtide/flake-utils"; | ||
flake-compat = { | ||
url = "github:edolstra/flake-compat"; | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, utils, ... }: | ||
utils.lib.eachDefaultSystem (system: | ||
with import nixpkgs { inherit system; }; { | ||
defaultPackage = stdenv.mkDerivation { | ||
name = "math-comp-book"; | ||
version = "master"; | ||
src = ./.; | ||
|
||
nativeBuildInputs = [ git texlive.combined.scheme-full ]; | ||
|
||
buildPhase = '' | ||
cd tex | ||
make | ||
biber main | ||
make | ||
make | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p $out/share | ||
cp book.pdf $out/share | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Mathematical components book"; | ||
homepage = "https://github.com/math-comp/mcb"; | ||
license = lib.licenses.cc-by-nc-40; | ||
maintainers = with maintainers; [ siraben ]; | ||
platforms = platforms.all; | ||
}; | ||
}; | ||
} | ||
); | ||
} | ||
|