Skip to content

Commit d8ff909

Browse files
committed
Add top-level documentation and CI action to upload it
1 parent d204f77 commit d8ff909

File tree

7 files changed

+292
-83
lines changed

7 files changed

+292
-83
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Handle push to master"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
tests:
9+
strategy:
10+
matrix:
11+
ghc: [ghc984, ghc9102, ghc9122]
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Fetch repo
15+
uses: actions/checkout@v4
16+
17+
- name: Install nix
18+
uses: cachix/install-nix-action@v26
19+
with:
20+
nix_path: nixpkgs=channel:nixos-unstable
21+
22+
# Build and run
23+
- name: Build tests runner
24+
run: nix build .#packages.x86_64-linux.${{ matrix.ghc }}.webcolor-labels
25+
26+
handle-push-to-master:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Fetch repo
30+
uses: actions/checkout@v4
31+
32+
- name: Install nix
33+
uses: cachix/install-nix-action@v26
34+
with:
35+
nix_path: nixpkgs=channel:nixos-unstable
36+
37+
- name: Build webcolor-labels-dist
38+
run: nix build .#webcolor-labels-dist
39+
40+
- name: Deploy webcolor-labels release candidate
41+
uses: haskell-actions/hackage-publish@v1
42+
with:
43+
hackageToken: ${{ secrets.HACKAGE_API_KEY }}
44+
packagesPath: result/packages
45+
docsPath: result/docs
46+
publish: false

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Zero-dependency, plug-and-play library that enables #hex-color syntax for your own types!
44

5+
![Demo image](images/demo.png)
6+
57
## Motivation
68

79
[Unrestricted OverloadedLabels syntax](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst) was implemented in GHC 9.6.1. It isn't hard to notice

flake.nix

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,39 @@
1313
outputs = { self, nixpkgs, flake-utils }:
1414
flake-utils.lib.eachDefaultSystem (system:
1515
let
16-
pkgs = nixpkgs.legacyPackages.${system};
16+
pkgs = import nixpkgs {
17+
inherit system;
18+
overlays = [overlay];
19+
};
20+
21+
overlay = _: prev: {
22+
haskell = prev.haskell // {
23+
packages = pkgs.lib.mapAttrs overrideHaskellPackages prev.haskell.packages;
24+
};
25+
};
26+
27+
overrideHaskellPackages = _: hp: hp.override {
28+
overrides = _: _: {
29+
"${packageName}" = hp.callCabal2nix packageName self {};
30+
};
31+
};
1732

1833
haskellPackages = pkgs.haskellPackages;
1934

2035
packageName = "webcolor-labels";
36+
37+
mkPackage = _: hp: { "${packageName}" = hp."${packageName}";};
2138
in {
22-
packages.${packageName} =
23-
haskellPackages.callCabal2nix packageName self {
24-
# Dependency overrides go here
25-
};
2639

27-
packages."${packageName}-dist" =
40+
41+
42+
packages = pkgs.lib.mapAttrs mkPackage pkgs.haskell.packages // {
43+
44+
"${packageName}" = haskellPackages."${packageName}";
45+
46+
default = self.packages.${system}."${packageName}";
47+
48+
"${packageName}-dist" =
2849
with pkgs.haskell.lib;
2950
let distPackage = self.packages.${system}.default;
3051
in pkgs.runCommand "pack-${packageName}-dist" {} ''
@@ -33,8 +54,8 @@
3354
cp -r ${sdistTarball distPackage}/${distPackage.name}.tar.gz $out/packages
3455
cp -r ${documentationTarball distPackage}/${distPackage.name}-docs.tar.gz $out/docs
3556
'';
57+
};
3658

37-
packages.default = self.packages.${system}.${packageName};
3859
defaultPackage = self.packages.${system}.default;
3960

4061
devShells.default = pkgs.mkShell {
@@ -44,7 +65,7 @@
4465
cabal-install
4566
haskellPackages.cabal-fmt
4667
];
47-
inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system});
68+
inputsFrom = [ self.defaultPackage.${system}.env ];
4869
};
4970
devShell = self.devShells.${system}.default;
5071
});

images/demo.png

83.4 KB
Loading

0 commit comments

Comments
 (0)