From 2f81f94db50c24e3f522bc63de5228214819e592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amy=20de=20Buitl=C3=A9ir?= Date: Tue, 16 Sep 2025 13:26:31 +0100 Subject: [PATCH] switch to flake --- .envrc | 2 +- .gitignore | 1 + Makefile | 14 ++++-- flake.lock | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 +++++++++++++ shell.nix | 17 ------- 6 files changed, 171 insertions(+), 21 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/.gitignore b/.gitignore index 8c635b2..474e332 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *-generated.adoc *.BAK +.direnv diff --git a/Makefile b/Makefile index c0fc6c9..15c84e7 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ debug : .PHONY: all all : html pdf +.PHONY: adoc +adoc : $(ADOC_FILES) + .PHONY: html html : $(HTML_FILE) @@ -47,13 +50,13 @@ epub : $(EPUB_FILE) > sed -i 's/\x0d\x1b.\x4b//g' $@ # The last line fixes some weird characters generated by some nix commands -$(HTML_FILE) : $(ADOC_FILES) +$(HTML_FILE) : adoc > asciidoctor -b html5 -d book $(ADOC_ATTRIBUTES) $(ADOC_HTML_ATTRIBUTES) -o $@ $(MAIN_ADOC_FILE) -$(PDF_FILE) : $(ADOC_FILES) +$(PDF_FILE) : adoc > asciidoctor-pdf -d book $(ADOC_ATTRIBUTES) $(ADOC_PDF_ATTRIBUTES) -o $@ $(MAIN_ADOC_FILE) -$(EPUB_FILE) : $(ADOC_FILES) +$(EPUB_FILE) : adoc > asciidoctor-epub3 -d book $(ADOC_ATTRIBUTES) $(ADOC_EPUB_ATTRIBUTES) -o $@ $(MAIN_ADOC_FILE) .PHONY: clean @@ -65,5 +68,10 @@ clean : spellcheck : > cat index.html | aspell --lang=en_IE --encoding=utf-8 --add-extra-dicts=./wordlist --mode=html list | sort -u +.PHONY: backup +backup : adoc +> rm -rf source.BAK +> cp -r source source.BAK + # dictionary/en_book.rws : wordlist # > aspell --lang=en create master ./$@ < $< diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..55378ed --- /dev/null +++ b/flake.lock @@ -0,0 +1,128 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1758024132, + "narHash": "sha256-T68/gCn378Owm2I93V/pY0TPXjzdBmt9JeXMX9Q9PbM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b780ce5f517649d8c0a36b566282ff69aaf6704f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1687361485, + "narHash": "sha256-VnehRY7mr8jNTZmAfcav3vW5JrFXt6fdcjGGz4rpxN0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3923eeb462005fe77d4273228c563ea139fa070e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "run-code-inline": "run-code-inline" + } + }, + "run-code-inline": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1692469027, + "narHash": "sha256-1mCjD1zO3bSN9Kpn5A8QiL2Q4GWHpY8xcHb3k5c1YSc=", + "ref": "refs/heads/main", + "rev": "37443f8a1c793eec5b48ea9d28f8041c060ccf59", + "revCount": 8, + "type": "git", + "url": "https://codeberg.org/mhwombat/run-code-inline" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/mhwombat/run-code-inline" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2bd0202 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + run-code-inline.url = "git+https://codeberg.org/mhwombat/run-code-inline"; + }; + + outputs = { self, nixpkgs, flake-utils, run-code-inline }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells = rec { + default = pkgs.mkShell { + buildInputs = [ + run-code-inline.packages.${system}.default + # pkgs.asciidoctor + pkgs.asciidoctor-with-extensions + # pkgs.python311Packages.pygments don't need to install, asciidoctor includes it + pkgs.rubyPackages.rbs + pkgs.rubyPackages.racc + pkgs.rubyPackages.coderay + pkgs.rubyPackages.rouge + ]; + }; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index d61a5ae..0000000 --- a/shell.nix +++ /dev/null @@ -1,17 +0,0 @@ -with (import {}); -let - run-code-inline = (builtins.getFlake git+https://codeberg.org/mhwombat/run-code-inline).packages.${builtins.currentSystem}.default; -in -mkShell { - buildInputs = [ - run-code-inline - # asciidoctor - asciidoctor-with-extensions - # python311Packages.pygments don't need to install, asciidoctor includes it - rubyPackages.rbs - rubyPackages.racc - rubyPackages.coderay - rubyPackages.rouge - ]; -# outputs = [ "start-shell" ]; -}