1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-07 22:36:53 +03:00

Test that README is up-to-date

This commit is contained in:
Nicolas Mattia 2019-02-01 15:51:40 +01:00
parent 4664e3b402
commit 2fc0566571
6 changed files with 23 additions and 7 deletions

View File

@ -12,6 +12,7 @@ jobs:
sudo chown circleci /nix
bash <(curl https://nixos.org/nix/install)
echo '. /home/circleci/.nix-profile/etc/profile.d/nix.sh' >> $BASH_ENV
sudo mkdir -p /etc/nix && echo "sandbox = true" | sudo tee -a /etc/nix/nix.conf
- checkout
- restore_cache:
# Match on the latest cache for this branch
@ -35,8 +36,7 @@ jobs:
- run:
name: Nix build
command: |
nix-build --no-out-link --option sandbox true
command: ./script/test
- run:
name: Create cache

View File

@ -1,2 +1,2 @@
with { pkgs = import ./nix; };
{ inherit (pkgs) niv readme ; }
with { pkgs = import ./nix {}; };
{ inherit (pkgs) niv readme readme-test ; }

View File

@ -1,3 +1,3 @@
with { sources = import ./sources.nix; };
{ sources ? import ./sources.nix }:
import sources.nixpkgs
{ overlays = import ./overlay.nix { inherit sources; } ; config = {}; }

View File

@ -16,7 +16,7 @@
# README generation
(self: super:
{ readme = self.writeText "README.md"
rec { readme = self.writeText "README.md"
(with
{ template = builtins.readFile ../README.tpl.md;
niv_help = builtins.readFile
@ -46,6 +46,8 @@
[ niv_help niv_add_help niv_update_help niv_drop_help ]
template
);
readme-test = self.runCommand "README-test" {}
"diff ${../README.md} ${readme} && echo dummy > $out";
}
)
]

View File

@ -10,10 +10,13 @@ with
builtins.fetchTarball { inherit url; }
else
builtins.fetchTarball { inherit url sha256; };
mapAttrs = builtins.mapAttrs or
(f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)));
};
# NOTE: spec must _not_ have an "outPath" attribute
builtins.mapAttrs (_: spec:
mapAttrs (_: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in versions.json should not have an 'outPath' attribute"

11
script/test Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash
#!nix-shell -I nixpkgs=./nix
#!nix-shell -p nix
#!nix-shell --pure
echo "Building"
nix build --no-link
echo "all good"