nix: fix target OS for add-nix-gcroots.sh

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Pedro Pombeiro 2019-07-23 08:19:48 +02:00 committed by Jakub Sokołowski
parent 07dfc95658
commit 2ac0630ef8
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 43 additions and 36 deletions

View File

@ -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 help: ##@other Show this help
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
@ -39,21 +40,6 @@ else
SHELL := ./nix/shell.sh SHELL := ./nix/shell.sh
endif endif
# Main targets
_fix-perms: SHELL := /bin/sh
_fix-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
git clean -dxf -f
watchman-clean: export _NIX_ATTR := targets.watchman.shell
watchman-clean:
watchman watch-del $${STATUS_REACT_HOME}
shell: ##@prepare Enter into a pre-configured shell shell: ##@prepare Enter into a pre-configured shell
ifndef IN_NIX_SHELL ifndef IN_NIX_SHELL
@ENTER_NIX_SHELL @ENTER_NIX_SHELL
@ -61,34 +47,55 @@ else
@echo "${YELLOW}Nix shell is already active$(RESET)" @echo "${YELLOW}Nix shell is already active$(RESET)"
endif endif
add-gcroots: SHELL := /bin/sh #----------------
add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected # General targets
scripts/add-gcroots.sh #----------------
clean-nix: SHELL := /bin/sh _fix-node-perms: SHELL := /bin/sh
clean-nix: ##@nix Remove complete nix setup _fix-node-perms: ##@prepare Fix permissions so that directory can be cleaned
sudo rm -rf /nix ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots $(shell test -d node_modules && chmod -R 744 node_modules)
$(shell test -d node_modules.tmp && chmod -R 744 node_modules.tmp)
update-npm-nix: SHELL := /bin/sh clean: SHELL := /bin/sh
update-npm-nix: ##@nix Update node2nix expressions based on current package.json clean: _fix-node-perms ##@prepare Remove all output folders
nix/desktop/realm-node/generate-nix.sh git clean -dxf -f
update-gradle-nix: SHELL := /bin/sh watchman-clean: export _NIX_ATTR := targets.watchman.shell
update-gradle-nix: ##@nix Update maven nix expressions based on current gradle setup watchman-clean: ##@prepare Delete repo directory from watchman
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh watchman watch-del $${STATUS_REACT_HOME}
update-lein-nix: SHELL := /bin/sh
update-lein-nix: ##@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: SHELL := /bin/sh
disable-githooks: disable-githooks: ##@prepare Disables lein githooks
@rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \ @rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \
sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \ sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \
-e 's|:githooks|;; :githooks|' \ -e 's|:githooks|;; :githooks|' \
-e 's|:pre-commit|;; :pre-commit|' project.clj; \ -e 's|:pre-commit|;; :pre-commit|' project.clj; \
rm project.clj~ rm project.clj~
#----------------
# Nix targets
#----------------
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
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
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
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
#---------------- #----------------
# Release builds # Release builds
#---------------- #----------------

View File

@ -122,6 +122,6 @@ pipeline {
post { post {
success { script { load('ci/github.groovy').notifyPR(true) } } success { script { load('ci/github.groovy').notifyPR(true) } }
failure { script { load('ci/github.groovy').notifyPR(false) } } failure { script { load('ci/github.groovy').notifyPR(false) } }
always { sh 'make _fix-perms' } always { sh 'make _fix-node-perms' }
} }
} }

View File

@ -105,6 +105,6 @@ pipeline {
post { post {
success { script { load('ci/github.groovy').notifyPR(true) } } success { script { load('ci/github.groovy').notifyPR(true) } }
failure { script { load('ci/github.groovy').notifyPR(false) } } failure { script { load('ci/github.groovy').notifyPR(false) } }
always { sh 'make _fix-perms' } always { sh 'make _fix-node-perms' }
} }
} }

View File

@ -9,6 +9,6 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
rm -rf .nix-gcroots rm -rf .nix-gcroots
mkdir .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) refs=$(nix-store --query --references $drv)
nix-store -r $refs --indirect --add-root $GIT_ROOT/.nix-gcroots/shell.dep nix-store -r $refs --indirect --add-root $GIT_ROOT/.nix-gcroots/shell.dep