Skip to content

Commit

Permalink
nix: fix target OS for add-nix-gcroots.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
Pedro Pombeiro authored and jakubgs committed Jul 25, 2019
1 parent 07dfc95 commit 5f49138
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 34 deletions.
69 changes: 38 additions & 31 deletions Makefile
@@ -1,5 +1,6 @@
.PHONY: add-gcroots clean clean-nix disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-perms
.PHONY: nix-add-gcroots clean nix-clean disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms

help: SHELL := /bin/sh
help: ##@other Show this help
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)

Expand Down Expand Up @@ -39,56 +40,62 @@ else
SHELL := ./nix/shell.sh
endif

# Main targets
shell: ##@prepare Enter into a pre-configured shell
ifndef IN_NIX_SHELL
@ENTER_NIX_SHELL
else
@echo "${YELLOW}Nix shell is already active$(RESET)"
endif

#----------------
# General targets
#----------------

_fix-perms: SHELL := /bin/sh
_fix-perms: ##@prepare Fix permissions so that directory can be cleaned
_fix-node-perms: SHELL := /bin/sh
_fix-node-perms: ##@prepare Fix permissions so that directory can be cleaned
$(shell test -d node_modules && chmod -R 744 node_modules)
$(shell test -d node_modules.tmp && chmod -R 744 node_modules.tmp)

clean: SHELL := /bin/sh
clean: _fix-perms ##@prepare Remove all output folders
clean: _fix-node-perms ##@prepare Remove all output folders
git clean -dxf -f

watchman-clean: export _NIX_ATTR := targets.watchman.shell
watchman-clean:
watchman-clean: ##@prepare Delete repo directory from watchman
watchman watch-del $${STATUS_REACT_HOME}

shell: ##@prepare Enter into a pre-configured shell
ifndef IN_NIX_SHELL
@ENTER_NIX_SHELL
else
@echo "${YELLOW}Nix shell is already active$(RESET)"
endif
disable-githooks: SHELL := /bin/sh
disable-githooks: ##@prepare Disables lein githooks
@rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \
sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \
-e 's|:githooks|;; :githooks|' \
-e 's|:pre-commit|;; :pre-commit|' project.clj; \
rm project.clj~

add-gcroots: SHELL := /bin/sh
add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected
scripts/add-gcroots.sh
#----------------
# Nix targets
#----------------

clean-nix: SHELL := /bin/sh
clean-nix: ##@nix Remove complete nix setup
nix-clean: SHELL := /bin/sh
nix-clean: ##@nix Remove complete nix setup
sudo rm -rf /nix ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots

update-npm-nix: SHELL := /bin/sh
update-npm-nix: ##@nix Update node2nix expressions based on current package.json
nix-add-gcroots: SHELL := /bin/sh
nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected
scripts/add-nix-gcroots.sh

nix-update-npm: SHELL := /bin/sh
nix-update-npm: ##@nix Update node2nix expressions based on current package.json
nix/desktop/realm-node/generate-nix.sh

update-gradle-nix: SHELL := /bin/sh
update-gradle-nix: ##@nix Update maven nix expressions based on current gradle setup
nix-update-gradle: SHELL := /bin/sh
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh

update-lein-nix: SHELL := /bin/sh
update-lein-nix: ##@nix Update maven nix expressions based on current lein setup
nix-update-lein: SHELL := /bin/sh
nix-update-lein: ##@nix Update maven nix expressions based on current lein setup
nix/tools/lein/generate-nix.sh nix/lein

disable-githooks: SHELL := /bin/sh
disable-githooks:
@rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \
sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \
-e 's|:githooks|;; :githooks|' \
-e 's|:pre-commit|;; :pre-commit|' project.clj; \
rm project.clj~

#----------------
# Release builds
#----------------
Expand Down
2 changes: 1 addition & 1 deletion ci/Jenkinsfile.android
Expand Up @@ -122,6 +122,6 @@ pipeline {
post {
success { script { load('ci/github.groovy').notifyPR(true) } }
failure { script { load('ci/github.groovy').notifyPR(false) } }
always { sh 'make _fix-perms' }
always { sh 'make _fix-node-perms' }
}
}
2 changes: 1 addition & 1 deletion ci/Jenkinsfile.ios
Expand Up @@ -105,6 +105,6 @@ pipeline {
post {
success { script { load('ci/github.groovy').notifyPR(true) } }
failure { script { load('ci/github.groovy').notifyPR(false) } }
always { sh 'make _fix-perms' }
always { sh 'make _fix-node-perms' }
}
}
2 changes: 1 addition & 1 deletion scripts/add-gcroots.sh → scripts/add-nix-gcroots.sh
Expand Up @@ -9,6 +9,6 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
rm -rf .nix-gcroots
mkdir .nix-gcroots

drv=$(nix-instantiate ${GIT_ROOT}/shell.nix)
drv=$(nix-instantiate --argstr target-os all --add-root ${GIT_ROOT}/shell.nix)
refs=$(nix-store --query --references $drv)
nix-store -r $refs --indirect --add-root $GIT_ROOT/.nix-gcroots/shell.dep

0 comments on commit 5f49138

Please sign in to comment.