simplify default.nix; update readme instructions

This commit is contained in:
Ryan Mulligan 2019-03-31 17:32:33 -07:00
parent 21b1b4808e
commit d1bd9d44e1
2 changed files with 10 additions and 19 deletions

View File

@ -78,7 +78,7 @@ test a package with one command.
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-shell --run "nixpkgs-update --update"`
3. Return back `cd ..` and run the tool `nix run -c "nixpkgs-update --update"`
# Adding new dependencies / updating Cabal file

View File

@ -2,34 +2,25 @@
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 }:
}, pkgs ? import nixpkgs-tarball {} }:
let
inherit (nixpkgs) pkgs;
hp = pkgs.haskellPackages.extend (pkgs.haskellPackages.packageSourceOverrides {
nixpkgs-update = ./.;
});
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 ];
runtimeDeps = with pkgs; [ gitAndTools.hub jq tree gist ];
drv = pkgs.buildEnv {
name = "nixpkgs-update-env";
paths = parts;
paths = [ hp.nixpkgs-update ] ++ runtimeDeps;
};
sh = pkgs.mkShell {
name = "nixpkgs-update-shell";
buildInputs = [ drv ];
sh = hp.shellFor {
packages = p: [p.nixpkgs-update];
buildInputs = [ hp.ghcid ] ++ runtimeDeps;
};
in
if pkgs.lib.inNixShell then sh else drv