Skip to content

Commit

Permalink
build: add flake (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
jashandeep-sohi authored Dec 23, 2023
1 parent 3eea875 commit 3a7df21
Show file tree
Hide file tree
Showing 12 changed files with 726 additions and 484 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
nix-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v22
- uses: cachix/cachix-action@v12
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
name: sohi
skipPush: true
- run: nix-build
extra_nix_config: |
accept-flake-config = true
- run: nix build
48 changes: 23 additions & 25 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,36 @@ jobs:
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
extra_nix_config: |
accept-flake-config = true
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
- name: Build
run: |
nix run .#container.copyToDockerDaemon
- name: Docker meta
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
type=ref,event=branch
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Tag & push
run: |
for tag in ${{ steps.meta.outputs.tag }}; do
docker tag webcam-filters:latest $tag
done
11 changes: 7 additions & 4 deletions .github/workflows/update-nix-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v22
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
extra_nix_config: |
accept-flake-config = true
- uses: cachix/cachix-action@v12
with:
name: sohi
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-build
# - run: nix-shell --run "echo OK"
skipAddingSubstituter: true
- run: nix build
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

22 changes: 9 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,19 @@ Nix
The provided Nix_ package bundles all the necessary GStreamer dependencies and
should "just work" on any distro.

Setup the cache. This step is **optional**, but it should speed up
the installation process::

$ nix-env -iA cachix -f https://cachix.org/api/v1/install
$ cachix use sohi

Install a specific release version/tag::

$ nix-env \
--install \
--file https://github.com/jashandeep-sohi/webcam-filters/archive/refs/tags/v0.3.0.tar.gz
$ nix --experimental-features 'nix-command flakes' \
profile
install
github:jashandeep-sohi/webcam-filters/vx.x.x

Install a specific branch (e.g. ``master``)::

$ nix-env \
--install \
--file https://github.com/jashandeep-sohi/webcam-filters/archive/refs/heads/master.tar.gz
$ nix --experimental-features 'nix-command flakes' \
profile
install
github:jashandeep-sohi/webcam-filters/master

Hardware Acceleration
.....................
Expand Down Expand Up @@ -147,7 +143,7 @@ You can retag the image locally if you don't want to refer to the long name::

You may also build the image locally::

$ docker build -t webcam-filters .
$ nix --experimental-features 'nix-command flakes' run .#container.copyToDockerDaemon


.. [#] Zoom desktop client supports background blur as of version 5.7.6. Zoom on web does not.
Expand Down
34 changes: 0 additions & 34 deletions default.nix

This file was deleted.

19 changes: 0 additions & 19 deletions dockerfile.nix

This file was deleted.

Loading

0 comments on commit 3a7df21

Please sign in to comment.