diff options
author | EuAndreh <eu@euandre.org> | 2020-10-23 08:41:58 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-10-23 08:42:35 -0300 |
commit | 137a5e4a1631d69f6844c8dab0b5d629db01c11c (patch) | |
tree | 27804edbb12769e62f729c6305de6fc583f1ecc6 /default.nix | |
parent | Remove utils.nix (diff) | |
download | toph-137a5e4a1631d69f6844c8dab0b5d629db01c11c.tar.gz toph-137a5e4a1631d69f6844c8dab0b5d629db01c11c.tar.xz |
Add bash scripts for tests instead of Nix
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/default.nix b/default.nix index 039119f..ae37a1f 100644 --- a/default.nix +++ b/default.nix @@ -1,37 +1,23 @@ -let pkgs = import <nixpkgs> { }; -in rec { - utils = import ./utils.nix { - pkgs = pkgs; - src = pkgs.nix-gitignore.gitignoreSource [ ] ./.; - baseName = "vps"; +let + niv-sources = import ./nix/sources.nix; + pkgs = import niv-sources.nixpkgs { }; + src = pkgs.nix-gitignore.gitignoreSource [ "!.git" ] ./.; + projectBuildInputs = with pkgs; [ + ]; +in { + test = pkgs.stdenv.mkDerivation { + inherit src; + name = "vps-test"; + phases = [ "unpackPhase" "buildPhase" ]; + buildInputs = projectBuildInputs; + buildPhase = '' + patchShebangs . + ./tests.sh + touch $out + ''; }; - subtasks = rec { - formatTerraform = utils.baseTask.overrideAttrs (baseAttrs: { - name = "${baseAttrs.name}-format-terraform"; - buildInputs = baseAttrs.buildInputs ++ [ pkgs.terraform ]; - buildPhase = '' - terraform fmt -check=true -diff=true || { - echo "Terraform files are unformatted. To fix it, run:" - echo " terraform fmt" - exit 1 - } - touch $out - ''; - }); - shellBuildInputs = with pkgs; [ - gitMinimal - git-crypt - gettext - terraform-providers.vultr - terraform - ]; + shell = pkgs.mkShell { + name = "vps-shell"; + buildInputs = projectBuildInputs; }; - test = utils.test [ - (utils.shellcheck null) - (utils.fixme null) - (utils.shellEnvironmentBuild subtasks.shellBuildInputs) - (utils.formatNix null) - subtasks.formatTerraform - ]; - shell = utils.shellEnvironment subtasks.shellBuildInputs; } |