diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a0d288..b939d73 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,14 +23,14 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - name: Build Thesis - run: nix -Lv develop .#default --command typst compile ./template/thesis.typ thesis.pdf --root "./" + run: nix -Lv build .#default - name: Upload Release Asset - Assignment id: upload uses: actions/upload-artifact@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: ./thesis.pdf + path: ./result/thesis.pdf name: thesis.pdf retention-days: 5 - name: Comment PR Link diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 81f7c28..a66fb2a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,7 +24,7 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - name: Build Thesis - run: nix -Lv develop .#default --command typst compile ./template/thesis.typ thesis.pdf --root "./" + run: nix -Lv build .#default - name: Create initial tag run: | if [ -z "$(git tag -l 'v*')" ]; then @@ -46,4 +46,4 @@ jobs: draft: false prerelease: false files: | - thesis.pdf + ./result/thesis.pdf diff --git a/flake.lock b/flake.lock index ec1f217..0e0b7b8 100644 --- a/flake.lock +++ b/flake.lock @@ -16,24 +16,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -57,11 +39,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729413321, - "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", "type": "github" }, "original": { @@ -87,6 +69,26 @@ "type": "github" } }, + "parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -112,8 +114,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", + "parts": "parts", "pre-commit-hooks": "pre-commit-hooks", "typst-nix": "typst-nix", "typst-packages": "typst-packages" @@ -134,27 +136,12 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "typst-nix": { "inputs": { "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2", + "systems": "systems", "typst-packages": [ "typst-packages" ] @@ -176,11 +163,11 @@ "typst-packages": { "flake": false, "locked": { - "lastModified": 1729608754, - "narHash": "sha256-iJkICZYj4BcRAHfXbXcYyLh3RO+oyICR1eMOXWyWufU=", + "lastModified": 1729773179, + "narHash": "sha256-bvBnEDrl+zgWEqi2EouVhh4bZoJ9uYyx1eMkj330Sso=", "owner": "typst", "repo": "packages", - "rev": "8feafc65720edaf3a85105c3cb94c9ab039925c2", + "rev": "0bf668dc16b396c8fe811ef7de63b46fea7d62a0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c9dc3c3..693b604 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,9 @@ { inputs = { - nixpkgs = { - url = "github:NixOS/nixpkgs/nixos-unstable"; - }; - flake-utils = { - url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; }; pre-commit-hooks = { url = "github:cachix/git-hooks.nix"; @@ -21,74 +20,69 @@ }; }; outputs = - { self - , nixpkgs - , flake-utils - , pre-commit-hooks - , typst-nix - , typst-packages - , ... - }: - flake-utils.lib.eachDefaultSystem ( - system: - let - pkgs = import nixpkgs { inherit system; }; - in - with pkgs; - { - checks = { - pre-commit-check = pre-commit-hooks.lib.${system}.run { - src = ./.; - hooks = { - nixpkgs-fmt.enable = true; + inputs: + inputs.parts.lib.mkFlake { inherit inputs; } { + systems = [ + "aarch64-darwin" + "x86_64-linux" + ]; + imports = [ + inputs.pre-commit-hooks.flakeModule + ]; + perSystem = + { + system, + config, + pkgs, + ... + }: + { + pre-commit = { + check.enable = true; + settings.hooks = { + nixfmt-rfc-style.enable = true; + deadnix.enable = true; + statix.enable = true; typstyle.enable = true; }; }; - }; - - packages = { - default = typst-nix.lib.${system}.mkTypstDerivation { - name = "nixy-thesis-typst"; - src = ./.; - extraFonts = with pkgs; [ - noto-fonts - open-sans - jetbrains-mono - ]; - extraCompileFlags = [ - "--root" - "./" - ]; - mainFile = "template/thesis.typ"; - outputFile = "thesis.pdf"; - typstPackages = { - preview = "${typst-packages}/packages/preview"; + packages = { + default = inputs.typst-nix.lib.${system}.mkTypstDerivation { + name = "modern-uit-thesis"; + src = ./.; + extraFonts = pkgs.symlinkJoin { + name = "typst-fonts"; + paths = with pkgs; [ + noto-fonts + open-sans + jetbrains-mono + texlivePackages.charter + ]; + }; + extraCompileFlags = [ + "--root" + "./" + ]; + mainFile = "template/thesis.typ"; + outputFile = "thesis.pdf"; + typstPackages = { + preview = "${inputs.typst-packages}/packages/preview"; + }; }; }; - }; - - devShells.default = mkShell { - inherit (self.checks.${system}.pre-commit-check) shellHook; - - nativeBuildInputs = [ - self.checks.${system}.pre-commit-check.enabledPackages - typst - typstyle - tinymist - just - typos - ]; - - TYPST_FONT_PATHS = pkgs.symlinkJoin { - name = "typst-fonts"; - paths = with pkgs; [ - noto-fonts - open-sans - jetbrains-mono - texlivePackages.charter + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + typst + typstyle + tinymist + just + typos ]; + + shellHook = '' + ${config.pre-commit.installationScript} + ''; }; }; - } - ); + }; } diff --git a/lib.typ b/lib.typ index 6aed116..131b140 100644 --- a/lib.typ +++ b/lib.typ @@ -157,10 +157,7 @@ // The value needs to be of the 'datetime' type. // More info: https://typst.app/docs/reference/foundations/datetime/ // Example: datetime(year: 2024, month: 03, day: 17) - date: datetime.today(), - - // The date that you are submitting your work. - submission-date: datetime.today(), + date: datetime(year: 2024, month: 12, day: 16), // Format in which the date will be displayed on cover page. // More info: https://typst.app/docs/reference/foundations/datetime/#format @@ -258,7 +255,7 @@ // Set raw text font. // Default is JetBrains Mono at 9tp with DejaVu Sans Mono as fallback - show raw: set text(font: ("JetBrains Mono", "Fira Code"), size: 9pt) + show raw: set text(font: ("JetBrains Mono", "DejaVu Sans Mono"), size: 9pt) // Configure page size and margins. set page( @@ -520,7 +517,7 @@ faculty: faculty, department: department, major: major, - submission-date: submission-date, + date: date, ) // Use front matter stylings diff --git a/modules/frontpage.typ b/modules/frontpage.typ index a79c688..12fef1c 100644 --- a/modules/frontpage.typ +++ b/modules/frontpage.typ @@ -6,7 +6,7 @@ faculty: "", department: "", major: "", - submission-date: none, + date: none, ) = { set document(title: title, author: author) set page( @@ -77,7 +77,7 @@ text( 10pt, weight: "light", - degree + " thesis in " + major + " — " + submission-date.display("[month repr:long] [year]"), + degree + " thesis in " + major + " — " + date.display("[month repr:long] [year]"), ), ) diff --git a/template/thesis.pdf b/template/thesis.pdf index 9f691f6..5f36a61 100644 Binary files a/template/thesis.pdf and b/template/thesis.pdf differ diff --git a/template/thesis.typ b/template/thesis.typ index 4addfd6..91c4625 100644 --- a/template/thesis.typ +++ b/template/thesis.typ @@ -70,7 +70,7 @@ table-index: true, listing-index: true, abbreviations: abbreviations, - submission-date: datetime.today(), + date: datetime(year: 2024, month: 12, day: 16), bibliography: bibliography("refs.bib", title: "Bibliography", style: "ieee"), ) diff --git a/template/utils/feedback.typ b/template/utils/feedback.typ index b77a4a7..92452f3 100644 --- a/template/utils/feedback.typ +++ b/template/utils/feedback.typ @@ -12,7 +12,7 @@ )[ #text( weight: 700, - counter("feedback").display() + ". Feedback: ", + context (counter("feedback").display() + ". Feedback: "), ) #feedback #if response != none {