Skip to content

Commit 0a53ded

Browse files
authored
replace shell.nix with Nix Flake (#1154)
* `flake.nix` Squashed commit of the following: commit fae5c89 Author: Peter Becich <peterbecich@gmail.com> Date: Sun Mar 12 21:43:23 2023 -0700 `nix develop` and `nix build` work commit 9c3d54e Author: Peter Becich <peterbecich@gmail.com> Date: Sun Mar 5 13:24:29 2023 -0800 use https://github.com/srid/haskell-flake commit a56bcee Author: Peter Becich <peterbecich@gmail.com> Date: Fri Mar 3 22:21:27 2023 -0800 update sources commit b013302 Author: Peter Becich <peterbecich@gmail.com> Date: Tue Feb 28 18:06:28 2023 -0800 update Cabal in both NixPkgs and hackage.nix commit aaff29c Author: Peter Becich <peterbecich@gmail.com> Date: Mon Feb 27 18:55:48 2023 -0800 attempt to fix `doctest-parallel` by updating Cabal input-output-hk/haskell.nix#1829 commit ccc9ced Author: Peter Becich <peterbecich@gmail.com> Date: Sun Feb 26 23:16:28 2023 -0800 investigate `gd` build error in `nix develop` shell input-output-hk/haskell.nix#1865 commit efd9de5 Author: Peter Becich <peterbecich@gmail.com> Date: Sun Feb 26 01:49:08 2023 -0800 more dependencies commit fb94055 Author: Peter Becich <peterbecich@gmail.com> Date: Sun Feb 26 01:19:33 2023 -0800 work on `develop` shell commit 495a54e Author: Peter Becich <peterbecich@gmail.com> Date: Sat Feb 4 16:28:05 2023 -0800 replace `shell.nix` with `haskell.nix` Flake commit e0e8f41 Author: Peter Becich <peterbecich@gmail.com> Date: Sun Feb 5 17:56:04 2023 -0800 ignore `incomplete-uni-patterns` warning commit e4747e9 Author: Peter Becich <peterbecich@gmail.com> Date: Sat Feb 4 15:31:06 2023 -0800 fix `incomplete-uni-patterns` warning, ignore some others the `flake.nix` build fails on these warnings: #1154 * Mac support in `flake.nix` * disable `nix flake check` in CI
1 parent 7168298 commit 0a53ded

File tree

11 files changed

+469
-55
lines changed

11 files changed

+469
-55
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
name: "Test nix-shell"
1+
name: "Test Nix Flake"
22
on:
33
push:
44
branches:
55
- master
6-
- ci*
76
pull_request:
87
branches:
98
- master
10-
- ci*
119
jobs:
12-
nix-shell:
13-
runs-on: ubuntu-latest
10+
nix:
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
- macos-latest
17+
name: Nix on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
1419
steps:
1520
- uses: actions/checkout@v3.1.0
16-
- uses: cachix/install-nix-action@v18
21+
- uses: cachix/install-nix-action@v20
1722
with:
18-
nix_path: nixpkgs=channel:nixos-21.11
1923
extra_nix_config: |
2024
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=
2125
substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/
@@ -24,4 +28,5 @@ jobs:
2428
# https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions
2529
name: hackage-server
2630
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
27-
- run: nix-shell --pure --run ./.github/workflows/test-nix-shell.sh
31+
- run: nix build
32+
# - run: nix flake check

.github/workflows/test-nix-shell.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ tags
1515
*.swp
1616
TAGS
1717
*~
18+
.direnv
19+
20+
result*

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@
22

33
[![Build Status](https://travis-ci.org/haskell/hackage-server.png?branch=master)](https://travis-ci.org/haskell/hackage-server)
44
[![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)
5-
[![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)
5+
[![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)
66

77
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.
88

99
## Installing dependencies
1010

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

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

15-
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:
15+
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:
1616

17-
nix-shell --pure
17+
nix develop
1818

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

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

25+
`flake.nix` is provided; it uses [`srid/haskell-flake`](https://github.com/srid/haskell-flake).
26+
27+
If you have [direnv](https://direnv.net/), `direnv allow` will load this `nix develop` shell automatically.
28+
29+
`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.
30+
2431
### Manually
2532

2633
You can also install dependencies manually via your operating system's package

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
packages: .
1010

11-
1211
allow-newer: rss:time, rss:base
1312

1413
-- Andreas, 2022-10-28: `Cabal-3.8.1.0` wants `process >= 1.6.14`

flake.lock

Lines changed: 290 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)