aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-05-30 22:47:31 -0300
committerEuAndreh <eu@euandre.org>2019-05-30 22:47:31 -0300
commit657c872b0c3dc40e5abef38812f285b69509c236 (patch)
tree5e26c348937e30a28fcac1d910d96770577c387e
parentFormat all Nix code with nixfmt (diff)
downloaddotfiles-657c872b0c3dc40e5abef38812f285b69509c236.tar.gz
dotfiles-657c872b0c3dc40e5abef38812f285b69509c236.tar.xz
Move shellCheck derivation to utils.nix
-rw-r--r--TODOs.org1
-rw-r--r--bash/agents.sh1
-rw-r--r--bash/aliases.sh1
-rw-r--r--bash/bash_profile.sh1
-rw-r--r--bash/bashrc.sh1
-rw-r--r--bash/facepalm/rotten-apple.sh3
-rw-r--r--default.nix30
-rw-r--r--nixos/utils.nix7
8 files changed, 20 insertions, 25 deletions
diff --git a/TODOs.org b/TODOs.org
index c590c51..ba7329d 100644
--- a/TODOs.org
+++ b/TODOs.org
@@ -31,5 +31,6 @@ Add =publishScript= derivation and run it in builds.sr.ht.
Profile =bash/bashrc.sh=.
** TODO Improve README.org
** TODO Automate backup.sh
+** TODO Remove =shellcheck disable= directives
* Nice to have
** TODO Test elfeed
diff --git a/bash/agents.sh b/bash/agents.sh
index 698d1ac..9a26567 100644
--- a/bash/agents.sh
+++ b/bash/agents.sh
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# shellcheck disable=SC2015
+# shellcheck disable=SC1090
eval "$(thefuck --alias f)"
diff --git a/bash/aliases.sh b/bash/aliases.sh
index 6a06af9..8e8c3b2 100644
--- a/bash/aliases.sh
+++ b/bash/aliases.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC2139
unalias -a
diff --git a/bash/bash_profile.sh b/bash/bash_profile.sh
index 0383eaa..b6e2254 100644
--- a/bash/bash_profile.sh
+++ b/bash/bash_profile.sh
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1090
source ~/dev/libre/dotfiles/bash/bashrc.sh
diff --git a/bash/bashrc.sh b/bash/bashrc.sh
index fd67d30..f6fae35 100644
--- a/bash/bashrc.sh
+++ b/bash/bashrc.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1090
export DOTFILES=~/dev/libre/dotfiles
diff --git a/bash/facepalm/rotten-apple.sh b/bash/facepalm/rotten-apple.sh
index 222a2b0..b42bf21 100644
--- a/bash/facepalm/rotten-apple.sh
+++ b/bash/facepalm/rotten-apple.sh
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1090
+# shellcheck disable=SC1091
+# shellcheck disable=SC2139
isMac && {
unalias open
diff --git a/default.nix b/default.nix
index 268ff9d..7b6e001 100644
--- a/default.nix
+++ b/default.nix
@@ -1,30 +1,18 @@
let
pkgs = import <nixpkgs> { };
rootSrc = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
-
+in with pkgs;
+with pkgs.stdenv; rec {
utils = import ./nixos/utils.nix {
pkgs = pkgs;
rootSrc = rootSrc; # FIXME: remove the need for this
baseName = "dotfiles";
};
-in with pkgs;
-with pkgs.stdenv; rec {
- test = utils.baseTask.overrideAttrs (baseAttrs: rec {
- name = "${baseAttrs.name}-test";
- buildInputs = [
- utils.formatNix
- # subtasks.shellcheck
- # subtasks.fixme
- # subtasks.uniqueFeeds
- # subtasks.formatNix
- ];
- buildPhase = ''
- echo "Ran tests for:"
- for d in ${builtins.toString buildInputs}; do
- echo " $d"
- done
- echo "All tests passed!"
- touch $out
- '';
- });
+ test = utils.test [
+ utils.formatNix
+ (utils.shellcheck ".*(encrypted|os-installation.sh).*")
+ # subtasks.fixme
+ # subtasks.uniqueFeeds
+ # subtasks.formatNix
+ ];
}
diff --git a/nixos/utils.nix b/nixos/utils.nix
index f809dd9..30110a4 100644
--- a/nixos/utils.nix
+++ b/nixos/utils.nix
@@ -14,13 +14,12 @@ in rec {
exit 1
'';
};
- shellcheck = baseTask.overrideAttrs (baseAttrs: {
+ shellcheck = ignoredFindPattern:
+ baseTask.overrideAttrs (baseAttrs: {
name = "${baseAttrs.name}-shellcheck";
buildInputs = baseAttrs.buildInputs ++ [ pkgs.shellcheck ];
buildPhase = ''
- export SHELLCHECK_OPTS="-e SC1090 -e SC1091 -e SC2139"
- ignored='(encrypted|os-installation.sh|notmuch-post.sh)'
- find . -type f -name '*.sh' | grep -E -v $ignored | xargs shellcheck
+ find . -type f \( -name '*.sh' -and -regextype egrep ! -regex '${ignoredFindPattern}' \) -print0 | xargs -0 shellcheck
touch $out
'';
});