Skip to content

replace shell.nix with Nix Flake #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
name: "Test nix-shell"
name: "Test Nix Flake"
on:
push:
branches:
- master
- ci*
pull_request:
branches:
- master
- ci*
jobs:
nix-shell:
runs-on: ubuntu-latest
nix:
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
name: Nix on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-21.11
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY=
substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/
Expand All @@ -24,4 +28,5 @@ jobs:
# https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions
name: hackage-server
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-shell --pure --run ./.github/workflows/test-nix-shell.sh
- run: nix build
# - run: nix flake check
4 changes: 0 additions & 4 deletions .github/workflows/test-nix-shell.sh

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ tags
*.swp
TAGS
*~
.direnv

result*
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@

[![Build Status](https://travis-ci.org/haskell/hackage-server.png?branch=master)](https://travis-ci.org/haskell/hackage-server)
[![Build status](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml)
[![Build status](https://github.com/haskell/hackage-server/actions/workflows/nix-shell.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/nix-shell.yml)
[![Build status](https://github.com/haskell/hackage-server/actions/workflows/nix-flake.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/nix-flake.yml)

This is the `hackage-server` code. This is what powers <http://hackage.haskell.org>, and many other private hackage instances. The `master` branch is suitable for general usage. Specific policy and documentation for the central hackage instance exists in the `central-server` branch.

## Installing dependencies

`hackage-server` depends on `libgd` and `zlib`. You'll also need `libbrotli-dev` for enabling tests.

### [`nix-shell`](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html)
### [`nix develop`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html)

If you have the [Nix package manager](https://nixos.org/) installed, the easiest way to run `hackage-server` is by using the `nix-shell`. It should be unnecessary to install any dependencies manually. In this repository:
If you have the [Nix package manager](https://nixos.org/) installed, the easiest way to run `hackage-server` is by using `nix develop`. It should be unnecessary to install any dependencies manually. In this repository:

nix-shell --pure
nix develop

[nix-shell]$ cabal v2-run -- hackage-server init
(in develop shell)
$ cabal v2-run -- hackage-server init

[nix-shell]$ cabal v2-run -- hackage-server run --static-dir=datafiles/ --base-uri=http://127.0.0.1:8080
$ cabal v2-run -- hackage-server run --static-dir=datafiles/ --base-uri=http://127.0.0.1:8080
hackage-server: Ready! Point your browser at http://127.0.0.1:8080

`flake.nix` is provided; it uses [`srid/haskell-flake`](https://github.com/srid/haskell-flake).

If you have [direnv](https://direnv.net/), `direnv allow` will load this `nix develop` shell automatically.

`nix build` will build a `hackage-server` executable in `result/`. The Hackage dependencies are provided by the inputs specified in `flake.nix`. Because some of these inputs are unpublished commits on GitHub, this build should not be considered authoritative.

### Manually

You can also install dependencies manually via your operating system's package
Expand Down
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

packages: .


allow-newer: rss:time, rss:base

-- Andreas, 2022-10-28: `Cabal-3.8.1.0` wants `process >= 1.6.14`
Expand Down
290 changes: 290 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading