Also expose a nixpkgs overlay (#3)

This commit is contained in:
Utku Demir 2020-07-02 09:24:45 +12:00 committed by GitHub
parent 2ded853b45
commit b1e09cbd12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 39 deletions

View File

@ -7,7 +7,19 @@ Interactively browse the dependency graph of your Nix derivations.
## Installation
```
nix-env -iA exe -f https://github.com/utdemir/nixdu/archive/master.tar.gz
nix-env -iA nixdu -f https://github.com/utdemir/nixdu/archive/master.tar.gz
```
A nixpkgs overlay is also provided via `overlay.nix`, that can be used
with tools like [home-manager][]:
```nix
nixpkgs.overlays = [
(let url = https://github.com/utdemir/nixdu/archive/master.tar.gz;
in import "${builtins.fetchTarball url}/overlay.nix" {})
];
home.packages = [ pkgs.nixdu ];
```
## Usage
@ -24,3 +36,5 @@ Keybindings:
i : Toggle modeline
? : Show help
```
[home-manager]: https://github.com/rycee/home-manager

View File

@ -1,46 +1,25 @@
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs { };
gitignore = extra:
pkgs.nix-gitignore.gitignoreSourcePure ([ ./.gitignore ] ++ extra);
myHaskellPackages = pkgs.haskellPackages.override {
overrides = hself: hsuper: {
"nixdu" =
hself.callCabal2nix
"nixdu"
(gitignore [ "asciicast.sh" ] ./.) { };
};
pkgs = import sources.nixpkgs {
overlays = [ (import ./overlay.nix) ];
};
shell = myHaskellPackages.shellFor {
shell = pkgs.haskellPackages.shellFor {
packages = p: [
p."nixdu"
];
buildInputs = with pkgs.haskellPackages; [
myHaskellPackages.cabal-install
cabal-install
ghcid
ormolu
hlint
steeloverseer
(import sources.niv { }).niv
pkgs.nixpkgs-fmt
];
withHoogle = true;
};
exe = pkgs.haskell.lib.justStaticExecutables (myHaskellPackages."nixdu");
docker = pkgs.dockerTools.buildImage {
name = "nixdu";
config.Cmd = [ "${exe}/bin/nixdu" ];
};
in
{
inherit shell;
inherit exe;
inherit docker;
inherit myHaskellPackages;
"nixdu" = myHaskellPackages."nixdu";
inherit (pkgs) nixdu;
}

View File

@ -1,16 +1,4 @@
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "f73bf8d584148677b01859677a63191c31911eae",
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixpkgs-unstable",
"description": "Nix Packages collection",

18
overlay.nix Normal file
View File

@ -0,0 +1,18 @@
self: super: {
haskellPackages =
super.haskellPackages.override {
overrides = hself: hsuper: {
nixdu =
hself.callCabal2nix
"nixdu"
(self.nix-gitignore.gitignoreSourcePure
[ ./.gitignore "asciicast.sh" "*.nix" ]
./.
) { };
};
};
nixdu =
self.haskell.lib.justStaticExecutables
self.haskellPackages.nixdu;
}