mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Test the template
This commit is contained in:
parent
4944a920d2
commit
985c55dce2
2 changed files with 42 additions and 0 deletions
|
@ -30,5 +30,10 @@
|
|||
# for repl exploration / debug
|
||||
config.config = config;
|
||||
options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };
|
||||
config.effects = withSystem "x86_64-linux" ({ config, pkgs, hci-effects, ... }: {
|
||||
tests = {
|
||||
template = pkgs.callPackage ./tests/template.nix { inherit hci-effects; };
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
37
dev/tests/template.nix
Normal file
37
dev/tests/template.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ hci-effects, nix, git, path }:
|
||||
|
||||
hci-effects.mkEffect {
|
||||
inputs = [ nix git ];
|
||||
effectScript = ''
|
||||
ann() { # announce
|
||||
printf '\n\e[34;1m%s\e[0m\n' "$*"
|
||||
}
|
||||
mkdir -p ~/.config/nix
|
||||
echo 'experimental-features = nix-command flakes' >>~/.config/nix/nix.conf
|
||||
mkdir clean
|
||||
cd clean
|
||||
|
||||
ann nix flake init...
|
||||
nix -v flake init -t ${../..}
|
||||
|
||||
ann pointing to local sources...
|
||||
sed -i flake.nix -e 's^nixpkgs.url = ".*";^nixpkgs.url = "${path}"; flake-parts.url = "${../..}";^'
|
||||
# head flake.nix
|
||||
grep -F ${path} flake.nix >/dev/null
|
||||
|
||||
ann nix flake lock...
|
||||
nix flake lock
|
||||
|
||||
ann nix flake show...
|
||||
nix -v flake show
|
||||
|
||||
ann nix build...
|
||||
nix build .
|
||||
|
||||
ann checking result...
|
||||
readlink ./result | grep hello
|
||||
|
||||
echo
|
||||
printf '\n\e[32;1m%s\e[0m\n' 'All good!'
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue