File tree Expand file tree Collapse file tree 4 files changed +23
-27
lines changed
Expand file tree Collapse file tree 4 files changed +23
-27
lines changed Original file line number Diff line number Diff line change 1010 in rec {
1111 lib = forAllSystems ( system : nixpkgs . legacyPackages . "${ system } " . callPackage ./default.nix { } ) ;
1212
13+ packages = forAllSystems ( system : {
14+ readme = nixpkgs . legacyPackages . "${ system } " . callPackage ./readme.nix { } ;
15+ } ) ;
16+
1317 # Useful when composing with other flakes:
1418 overlay = import ./overlay.nix ;
1519
Original file line number Diff line number Diff line change 11# This script is used to test & generate `README.md`.
2+ { pkgs } :
23
34let
4- sources = import ./nix/sources.nix ;
5-
6- pkgs = import ./nix {
7- system = builtins . currentSystem ;
8- nixpkgs = "nixpkgs" ;
9- } ;
105
116 naersk = pkgs . callPackage ./default.nix {
127 inherit ( pkgs . rustPackages ) cargo rustc ;
2621 } ;
2722
2823in
29- rec {
30- body = pkgs . runCommand "readme-body" {
31- buildInputs = [ docparse ] ;
32- } ''
33- cat ${ ./README.tpl.md } > $out
34- docparse ${ ./config.nix } >> gen
35- sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
36- '' ;
37-
38- test = pkgs . runCommand "readme-test" { } ''
39- diff ${ ./README.md } ${ body }
40- touch $out
41- '' ;
42- }
24+ pkgs . runCommand "readme"
25+ {
26+ buildInputs = [ docparse ] ;
27+ } ''
28+ cat ${ ./README.tpl.md } > $out
29+ docparse ${ ./config.nix } >> gen
30+ sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
31+ ''
Original file line number Diff line number Diff line change 1- #!/usr/bin/env nix-shell
2- #!nix-shell -i bash
3- #!nix-shell -I nixpkgs=./nix
4- #!nix-shell -p nix
1+ #! /usr/bin/env bash
52
63set -euo pipefail
74
85echo " Updating README"
96
10- cat $(nix- build ./ readme.nix -A body ) > README.md
7+ cat $( nix build .# readme --print-out-paths ) > README.md
118
129echo done
Original file line number Diff line number Diff line change 1- { ... } :
2- ( import ../../../readme.nix ) . test
1+ { pkgs , ... } :
2+ let
3+ readme = pkgs . callPackage ../../../readme.nix { } ;
4+ in
5+ pkgs . runCommand "readme-test" { } ''
6+ diff ${ ../../../README.md } ${ readme }
7+ touch $out
8+ ''
You can’t perform that action at this time.
0 commit comments