Skip to content

Commit

Permalink
Merge pull request #66 from expipiplus1/unstable-version
Browse files Browse the repository at this point in the history
Add `unstable-` prefix to versions when using dates
  • Loading branch information
expipiplus1 authored Jul 19, 2021
2 parents 6d38dca + 3ba97cb commit 51966fe
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## WIP

## [0.2.8] - 2021-07-19
- Add `unstable-` prefix to versions when using dates

## [0.2.7] - 2021-05-23

- `hnix-0.13` support
Expand Down
10 changes: 1 addition & 9 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ let
in hp.developPackage {
name = "update-nix-fetchgit";
root = nix-gitignore.gitignoreSource [ ] ./.;
overrides = self: super: {
hnix = pkgs.haskell.lib.dontCheck (self.callHackageDirect {
pkg = "hnix";
ver = "0.13.1";
sha256 = "0v3r33azlv050fv8y5vw0pahdnch7vqq94viwrp9vlw8hpiys8qn";
} { });
relude = self.relude_1_0_0_1;
semialign = self.semialign_1_2;
};
overrides = self: super: { };
modifier = drv: haskell.lib.addBuildTools drv [ git nix nix-prefetch-git ];
returnShellEnv = forShell;
}
Expand Down
4 changes: 2 additions & 2 deletions nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let
nixpkgsSrc = builtins.fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/d42cd445dde587e9a993cd9434cb43da07c4c5de.tar.gz"; # nixos-unstable
sha256 = "0dzrn97srxyw5a3g7hf8chwccxns5z3aij23hc0fch7ygc8w0gq0";
"https://github.com/NixOS/nixpkgs/archive/c6c4a3d45ab200f17805d2d86a1ff1cc7ca2b186.tar.gz"; # nixos-unstable
sha256 = "1f6q98vx3sqxcn6qp5vpy00223r9hy93w9pxq65h9gdwzy3w4qxv";
};

in import nixpkgsSrc { }
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: update-nix-fetchgit
version: "0.2.7"
version: "0.2.8"
synopsis: A program to update fetchgit values in Nix expressions
description: |
This command-line utility is meant to be used by people maintaining Nix
Expand Down
5 changes: 3 additions & 2 deletions src/Update/Nix/FetchGit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ evalUpdates = fmap snd . go
let latestDate = maximumMay (catMaybes ds)
pure
( latestDate
, [ SpanUpdate (exprSpan v) (quoteString . pack . show $ d)
, [ SpanUpdate (exprSpan v)
(quoteString . ("unstable-" <>) . pack . show $ d)
| Just d <- pure latestDate
, Just v <- pure versionExpr
]
<> concat ss
<> concat ss
)

----------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions src/Update/Nix/FetchGit/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ import Data.Time ( Day
)
import Nix.Atoms ( NAtom(NBool) )
import Nix.Expr hiding ( SourcePos )
import Nix.Parser ( Result
, parseNixFileLoc
import Nix.Parser ( parseNixFileLoc
, parseNixTextLoc
)
import Update.Nix.FetchGit.Types
Expand Down Expand Up @@ -92,7 +91,6 @@ exprBool = \case
-- | Get the 'SrcSpan' covering a particular expression.
exprSpan :: NExprLoc -> SrcSpan
exprSpan (AnnE s _) = s
exprSpan _ = error "unreachable" -- TODO: Add pattern completeness to hnix

-- | Given an expression that is supposed to represent a function,
-- extracts the name of the function. If we cannot figure out the
Expand Down
2 changes: 2 additions & 0 deletions tests/fakeRepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export GIT_COMMITTER_NAME='joe'
export GIT_AUTHOR_NAME='joe'
export GIT_COMMITTER_EMAIL='[email protected]'
export GIT_AUTHOR_EMAIL='[email protected]'
export XDG_CONFIG_DIRS=
export HOME=

git init repo1
cd repo1
Expand Down
2 changes: 1 addition & 1 deletion tests/networked/test_readme_examples.expected.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a = { stdenv, fetchgit }:
stdenv.mkDerivation rec {
name = "foo-${version}";
version = "2016-06-26";
version = "unstable-2016-06-26";
# ^ version will be updated to the date of the new revision
src = fetchgit {
url = "/tmp/nix-update-fetchgit-test/repo1";
Expand Down
2 changes: 1 addition & 1 deletion tests/networked/test_readme_examples.out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a = { stdenv, fetchgit }:
stdenv.mkDerivation rec {
name = "foo-${version}";
version = "2016-06-26";
version = "unstable-2016-06-26";
# ^ version will be updated to the date of the new revision
src = fetchgit {
url = "/tmp/nix-update-fetchgit-test/repo1";
Expand Down
8 changes: 4 additions & 4 deletions tests/test_max_version.expected.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
version = "2016-07-08";
version = "unstable-2016-07-08";
repos = {
version = "2016-07-08";
version = "unstable-2016-07-08";
repo1 = {
version = "2016-06-26";
version = "unstable-2016-06-26";
src = fetchgit {
url = "/tmp/nix-update-fetchgit-test/repo1";
rev = "1c60ae07b5740aab02e32b4f64600f002112e6fd";
sha256 = "008xwkjfsv3rj50x9fqj0vvggl1zwrbqh7bkvnga94krmij63hib";
};
};
repo2 = {
version = "2016-07-08";
version = "unstable-2016-07-08";
src = fetchgit {
url = "/tmp/nix-update-fetchgit-test/repo2";
rev = "1ac598e1fd0ec3556f1349bb5fd8d08d89580c8a";
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rec_sets.expected.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rec {
name = "foobar-${version}";
version = "2016-06-26";
version = "unstable-2016-06-26";
src = fetchgit rec {
url = "/tmp/nix-update-fetchgit-test/repo1";
rev = "1c60ae07b5740aab02e32b4f64600f002112e6fd";
Expand Down
2 changes: 1 addition & 1 deletion tests/test_updates_with_other_errors.expected.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
version = "2016-06-26";
version = "unstable-2016-06-26";

should-error = fetchgit rec {
url = "/tmp/nix-update-fetchgit-test/missingRepo";
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version_update.expected.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
version = "2016-06-26";
version = "unstable-2016-06-26";
src = fetchgit {
url = "/tmp/nix-update-fetchgit-test/repo1";
rev = "1c60ae07b5740aab02e32b4f64600f002112e6fd";
Expand Down
2 changes: 1 addition & 1 deletion update-nix-fetchgit.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: update-nix-fetchgit
version: 0.2.7
version: 0.2.8
synopsis: A program to update fetchgit values in Nix expressions
description: This command-line utility is meant to be used by people maintaining Nix
expressions that fetch files from Git repositories. It automates the process
Expand Down

0 comments on commit 51966fe

Please sign in to comment.