Skip to content

Commit

Permalink
Remove nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanfei Shen committed Feb 23, 2021
1 parent fdd7721 commit 441978e
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 1,017 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ ENV/
*.egg-info
.coverage
.pytest_cache

# nix stuff
result
result-*
/MANIFEST
/build/
/dist/

# Editor
*.sw[po]
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
sudo: required
services:
- docker
language: nix
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
install: pip install -r requirements_plus_development_frozen.txt
script: pytest
deploy:
provider: script
script: make dockerize && make docker-push VERSION="$TRAVIS_BRANCH"
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.9-slim

RUN apt-get update && apt-get install -y \
git-core \
&& \
rm -rf /var/lib/apt/lists/*

WORKDIR /src

ADD requirements_frozen.txt ./
RUN pip install -r ./requirements_frozen.txt

ADD version ./
ADD setup.py ./
ADD marge.app ./
ADD marge/ ./marge/
RUN python ./setup.py install

ENTRYPOINT ["marge.app"]
25 changes: 8 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
VERSION?=$$(git rev-parse --abbrev-ref HEAD)

.PHONY: all
all: requirements_frozen.txt requirements.nix requirements_override.nix marge-bot dockerize

.PHONY: marge-bot
marge-bot:
nix-build --keep-failed --attr marge-bot default.nix

.PHONY: clean
clean:
rm -rf .cache result result-* requirements_frozen.txt
all: dockerize

.PHONY: bump
bump: bump-requirements bump-sources

.PHONY: bump-sources
bump-sources:
nix-shell --run niv update
bump: bump-requirements

.PHONY: bump-requirements
bump-requirements: clean requirements_frozen.txt

requirements_frozen.txt requirements.nix requirements_override.nix: requirements.txt
pypi2nix -V 3.6 -r $^
requirements_frozen.txt: requirements.txt
pip freeze -r $^ > $@

requirements_plus_development_frozen.txt: requirements_frozen.txt
pip freeze -r $^ -r requirements_development.txt > $@

.PHONY: dockerize
dockerize:
docker load --input $$(nix-build --attr docker-image default.nix)
docker build --tag smarkets/marge-bot:$$(cat version) .

.PHONY: docker-push
docker-push:
Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,8 @@ configs:
### Running marge-bot as a plain python app
#### Installing marge-bot with nix
Alternatively, if you prefer not to use docker, you can also directly run marge.
If you use [nix](https://nixos.org/nix/) do `nix-env --install -f default.nix`.
The nix install should be fully reproducible on any version of linux (and also
work on OS X, although this is not something we properly test). If you don't
want to use docker we recommend you give nix a try.
#### Installing marge-bot the old-fashioned way
Finally, although this is our least preferred alternative, you can always do
`python3 setup.py install` (note that you will need python3.6).
You need to install the requirements first `pip install -r requirements_frozen.txt`,
and then install Marge itself `python3 setup.py install` (note that you will need python3.6+).
Afterwards, the minimal way to run marge is as follows.
Expand Down
6 changes: 0 additions & 6 deletions default.nix

This file was deleted.

39 changes: 0 additions & 39 deletions dockerize.nix

This file was deleted.

40 changes: 0 additions & 40 deletions marge.nix

This file was deleted.

25 changes: 0 additions & 25 deletions nix/sources.json

This file was deleted.

11 changes: 0 additions & 11 deletions nix/sources.nix

This file was deleted.

Loading

0 comments on commit 441978e

Please sign in to comment.