From 89cef63076288bec850804149e9d95665ae2776c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sat, 15 Jun 2019 16:55:58 +0200 Subject: [PATCH] Use gitignore instead of duplicating it's logic --- default.nix | 33 ++++++--------------------------- nix/sources.json | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/default.nix b/default.nix index 2c29c86..e6d7eec 100644 --- a/default.nix +++ b/default.nix @@ -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 {}; }; diff --git a/nix/sources.json b/nix/sources.json index e0edb8d..b889fcd 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -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///archive/.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///archive/.tar.gz", + "repo": "gitignore", + "sha256": "0358wcmgmc5mx4xfr08fxra4k05zvl2qyaix4gdlm7iwcscz609a", + "description": "Nix source function for gitignore that just works", + "rev": "4064e436313191f11969986e66b81cb6bb61bae6" } -} \ No newline at end of file +}