switch to flake

This commit is contained in:
Amy de Buitléir 2025-09-16 13:26:31 +01:00
parent 4becd0f543
commit 2f81f94db5
6 changed files with 171 additions and 21 deletions

2
.envrc
View file

@ -1 +1 @@
use nix
use flake

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*-generated.adoc
*.BAK
.direnv

View file

@ -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 ./$@ < $<

128
flake.lock generated Normal file
View file

@ -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
}

30
flake.nix Normal file
View file

@ -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
];
};
};
}
);
}

View file

@ -1,17 +0,0 @@
with (import <nixpkgs> {});
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" ];
}