Skip to content

Commit 5a6e38e

Browse files
authored
Merge pull request #73 from expipiplus1/hnix-bump
Bump hnix to 0.16
2 parents becdcf3 + 97038cc commit 5a6e38e

File tree

12 files changed

+486
-451
lines changed

12 files changed

+486
-451
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
os: [ "ubuntu-latest" ]
2121
cabal: [ "latest" ]
22-
ghc: [ "8.8", "8.10" ]
22+
ghc: [ "8.10", "9.0" ]
2323
fail-fast: false
2424

2525
steps:
@@ -62,6 +62,7 @@ jobs:
6262

6363
- name: Build dependencies
6464
run: |
65+
cabal install tasty-discover
6566
cabal build all --only-dependencies $cabalConfig
6667
6768
- name: Build

CHANGELOG.md

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

33
## WIP
44

5+
## [0.2.11] - 2022-12-06
6+
- Changes for hnix-0.16
7+
58
## [0.2.10] - 2022-03-20
69
- Bump github-rest
710

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright Joe Hermaszewski (c) 2016
1+
Copyright Ellie Hermaszewska (c) 2016
22
Copyright David Grayson (c) 2016
33

44
All rights reserved.
@@ -14,7 +14,7 @@ modification, are permitted provided that the following conditions are met:
1414
disclaimer in the documentation and/or other materials provided
1515
with the distribution.
1616

17-
* Neither the name of Joe Hermaszewski nor the names of other
17+
* Neither the name of Ellie Hermaszewska nor the names of other
1818
contributors may be used to endorse or promote products derived
1919
from this software without specific prior written permission.
2020

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
packages: ./*.cabal
22
optimization: 2
3+
allow-newer: all:base, all:ghc-prim, hnix:template-haskell

nixpkgs.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
let
22
nixpkgsSrc = builtins.fetchTarball {
33
url =
4-
"https://github.com/NixOS/nixpkgs/archive/3bde7576132241b83f37d53d09bac5ba8458a1ee.tar.gz"; # haskell-updates
5-
sha256 = "0r83g6wc18cz5fp8dqw836r5aa4jdwlnd9ka4q44q0xzm5mlzw8z";
4+
"https://github.com/NixOS/nixpkgs/archive/d7af8ae032b081ab01461be06838ba5ea89110f1.tar.gz"; # haskell-updates
5+
sha256 = "1n6ky9lczwh2dk2q0ckdv4wm096q1syk2pddrhidj1vy34aigpxd";
66
};
77

88
in import nixpkgsSrc { }

package.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: update-nix-fetchgit
2-
version: "0.2.10"
2+
version: "0.2.11"
33
synopsis: A program to update fetchgit values in Nix expressions
44
description: |
55
This command-line utility is meant to be used by people maintaining Nix
66
expressions that fetch files from Git repositories. It automates the process
77
of keeping such expressions up-to-date with the latest upstream sources.
88
category: Nix
9-
author: Joe Hermaszewski
10-
maintainer: Joe Hermaszewski <[email protected]>
11-
copyright: 2020 Joe Hermaszewski
9+
author: Ellie Hermaszewska
10+
maintainer: Ellie Hermaszewska <[email protected]>
11+
copyright: 2020 Ellie Hermaszewska
1212
github: expipiplus1/update-nix-fetchgit
1313
extra-source-files:
1414
- package.yaml
@@ -46,7 +46,7 @@ library:
4646
- bytestring >= 0.10
4747
- data-fix
4848
- github-rest >= 1.1
49-
- hnix >= 0.14 && < 0.15
49+
- hnix >= 0.16 && < 0.17
5050
- monad-validate
5151
- mtl
5252
- process >= 1.2

src/Nix/Comments.hs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
module Nix.Comments
2-
( annotateWithComments
3-
, Comment
4-
, NExprCommentsF
5-
, NExprComments
6-
) where
7-
8-
import Data.Text ( Text )
9-
import Data.Vector ( (!?)
10-
, Vector
11-
)
12-
import Data.Fix
13-
import Nix.Expr
14-
import qualified Data.Text as T
15-
import Data.Char ( isSpace )
2+
( annotateWithComments,
3+
Comment,
4+
NExprCommentsF,
5+
NExprComments,
6+
)
7+
where
8+
9+
import Data.Char (isSpace)
10+
import Data.Fix
11+
import Data.Text (Text)
12+
import qualified Data.Text as T
13+
import Data.Vector
14+
( Vector,
15+
(!?),
16+
)
17+
import Nix.Expr
1618

1719
type Comment = Text
1820

@@ -38,22 +40,23 @@ type NExprComments = Fix NExprCommentsF
3840
-- [(1 + { a = 2; },Just "baz"),(1,Just "foo"),({ a = 2; },Just "baz"),(2,Just "bar")]
3941
annotateWithComments :: Vector Text -> NExprLoc -> NExprComments
4042
annotateWithComments sourceLines = go
41-
where
42-
go :: NExprLoc -> NExprComments
43-
go = Fix . go' . fmap go . unFix
44-
45-
go' :: NExprLocF f -> NExprCommentsF f
46-
go' e =
47-
let
48-
comment = case spanEnd . annotation . getCompose $ e of
49-
SourcePos _ line col -> do
50-
theLine <- sourceLines !? (unPos line - 1)
51-
theLineAfterExpression <- dropMaybe (unPos col - 1) theLine
52-
let theLineAfterCruft = T.dropWhile (\c -> isSpace c || (c == ';'))
53-
theLineAfterExpression
54-
('#', theComment) <- T.uncons theLineAfterCruft
55-
pure (T.strip theComment)
56-
in Compose (Ann comment e)
43+
where
44+
go :: NExprLoc -> NExprComments
45+
go = Fix . go' . fmap go . unFix
46+
47+
go' :: NExprLocF f -> NExprCommentsF f
48+
go' e =
49+
let comment = case spanEnd . annotation . getCompose $ e of
50+
SourcePos _ line col -> do
51+
theLine <- sourceLines !? (unPos line - 1)
52+
theLineAfterExpression <- dropMaybe (unPos col - 1) theLine
53+
let theLineAfterCruft =
54+
T.dropWhile
55+
(\c -> isSpace c || (c == ';'))
56+
theLineAfterExpression
57+
('#', theComment) <- T.uncons theLineAfterCruft
58+
pure (T.strip theComment)
59+
in Compose (AnnUnit comment e)
5760

5861
----------------------------------------------------------------
5962
-- Utils

0 commit comments

Comments
 (0)