revamp build files & pin nixpkgs

closes #111
This commit is contained in:
Ryan Mulligan 2019-03-31 13:54:29 -07:00
parent 218c1a41df
commit 21b1b4808e
4 changed files with 73 additions and 4 deletions

1
.gitignore vendored
View File

@ -4,5 +4,4 @@
dist/
dist-newstyle/
/nixpkgs-update.cabal
/shell.nix
.ghc*

View File

@ -69,19 +69,24 @@ test a package with one command.
# Instructions
1. Clone this repo and build the tool:
1. Clone this repo:
```
git clone https://github.com/ryantm/nixpkgs-update && cd nixpkgs-update
nix run nixpkgs.haskellPackages.hpack -c hpack && nix run nixpkgs.cabal2nix -c cabal2nix --shell . > shell.nix && nix-build shell.nix
```
2. Get a list of oudated packages and place them in a `packages-to-update.txt` file in the root directory of this repository.
```
git clone https://github.com/ryantm/repology-api.git && cd repology-api
nix run nixpkgs.cabal2nix -c cabal2nix --shell --hpack . > shell.nix && nix-build shell.nix && result/bin/repology-api > ../packages-to-update.txt
```
3. Return back `cd ..` and run the tool `nix run -f '<nixpkgs>' gitAndTools.hub gist jq tree -c result/bin/nixpkgs-update --update`
3. Return back `cd ..` and run the tool `nix-shell --run "nixpkgs-update --update"`
# Adding new dependencies / updating Cabal file
```
nix run nixpkgs.haskellPackages.hpack -c hpack && nix run nixpkgs.cabal2nix -c cabal2nix --hpack . > nixpkgs-update.nix
```
# Prior work
* https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/scripts/update-source-version

35
default.nix Normal file
View File

@ -0,0 +1,35 @@
{ nixpkgs-tarball ? builtins.fetchTarball {
name = "nixpkgs-unstable";
url = "https://releases.nixos.org/nixpkgs/nixpkgs-19.09pre173445.796a8764ab8/nixexprs.tar.xz";
sha256 = "04frhzc74xx2zsq7gbbnnh2d24hnl58i2sd24hdbwx8kyyh386xd";
}, nixpkgs ? import nixpkgs-tarball {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = import ./nixpkgs-update.nix;
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
nixpkgs-update = variant (haskellPackages.callPackage f {});
parts = with pkgs; [ nixpkgs-update gitAndTools.hub jq tree gist ];
drv = pkgs.buildEnv {
name = "nixpkgs-update-env";
paths = parts;
};
sh = pkgs.mkShell {
name = "nixpkgs-update-shell";
buildInputs = [ drv ];
};
in
if pkgs.lib.inNixShell then sh else drv

30
nixpkgs-update.nix Normal file
View File

@ -0,0 +1,30 @@
{ mkDerivation, base, bytestring, containers, directory, doctest
, errors, filepath, github, hpack, lifted-base, mtl
, neat-interpolation, optparse-applicative, parsec, parsers
, regex-applicative-text, shelly, stdenv, template-haskell, text
, time, transformers, typed-process, unix, vector, xdg-basedir
}:
mkDerivation {
pname = "nixpkgs-update";
version = "0.2.0";
src = ./.;
isLibrary = false;
isExecutable = true;
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
base bytestring containers directory errors filepath github
lifted-base mtl neat-interpolation optparse-applicative parsec
parsers regex-applicative-text shelly template-haskell text time
transformers typed-process unix vector xdg-basedir
];
testHaskellDepends = [
base bytestring containers directory doctest errors filepath github
lifted-base mtl neat-interpolation optparse-applicative parsec
parsers regex-applicative-text shelly template-haskell text time
transformers typed-process unix vector xdg-basedir
];
preConfigure = "hpack";
homepage = "https://github.com/ryantm/nixpkgs-update#readme";
description = "Tool for semi-automatic updating of nixpkgs repository";
license = stdenv.lib.licenses.publicDomain;
}