1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-05 20:15:26 +03:00

Use gitignore instead of duplicating it's logic

This commit is contained in:
Domen Kožar 2019-06-15 16:55:58 +02:00
parent 312300cca8
commit 89cef63076
No known key found for this signature in database
GPG Key ID: C2FFBCAFD2C24246
2 changed files with 20 additions and 31 deletions

View File

@ -1,32 +1,11 @@
{ pkgs ? import ./nix {} }:
{ sources ? import ./nix/sources.nix
, pkgs ? import ./nix { inherit sources; }
}:
with rec
{ files = pkgs.callPackage ./nix/files.nix {};
sourceByRegex = name: src: regexes:
builtins.path
{ filter = (path: type:
let
relPath = pkgs.lib.removePrefix (toString src + "/") (toString path);
accept = pkgs.lib.any (re: builtins.match re relPath != null) regexes;
in accept);
inherit name;
path = src;
};
niv-source = sourceByRegex "niv" ./.
[ "^package.yaml$"
"^README.md$"
"^LICENSE$"
"^app$"
"^app.*.hs$"
"^src$"
"^src/Niv$"
"^src/Niv/GitHub$"
"^src/Niv/Update$"
"^src.*.hs$"
"^README.md$"
"^nix$"
"^nix.sources.nix$"
];
gitignoreSource = (pkgs.callPackage sources.gitignore {}).gitignoreSource;
niv-source = gitignoreSource ./.;
haskellPackages = pkgs.haskellPackages.override
{ overrides = _: haskellPackages:
{ niv = haskellPackages.callCabal2nix "niv" niv-source {}; };

View File

@ -1,12 +1,22 @@
{
"nixpkgs": {
"url": "https://github.com/NixOS/nixpkgs-channels/archive/8e70d4bd7d5e1c137006fe483d8d116311694bc2.tar.gz",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/cb1d0c44e99f174fe415040c4566017f83010546.tar.gz",
"owner": "NixOS",
"branch": "nixos-18.09",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"repo": "nixpkgs-channels",
"sha256": "14vl7qlb48v9fdwdlz0cj6h83kj6zlc7qg3n6sbiabr52y2bhmkh",
"sha256": "1kb3glpr08bpifpvc1fqqanqm35gwc1maclvpfdd9dywmdgaf9di",
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",
"rev": "8e70d4bd7d5e1c137006fe483d8d116311694bc2"
"rev": "cb1d0c44e99f174fe415040c4566017f83010546"
},
"gitignore": {
"url": "https://github.com/hercules-ci/gitignore/archive/4064e436313191f11969986e66b81cb6bb61bae6.tar.gz",
"owner": "hercules-ci",
"branch": "master",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"repo": "gitignore",
"sha256": "0358wcmgmc5mx4xfr08fxra4k05zvl2qyaix4gdlm7iwcscz609a",
"description": "Nix source function for gitignore that just works",
"rev": "4064e436313191f11969986e66b81cb6bb61bae6"
}
}
}