From 103bbfa52861d226dfd550b0213c75ce00b0ff1f Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 13 Jun 2022 17:39:46 +0200 Subject: [PATCH] flake(goModule): filter out non-pertinent files... ...such as flake files or {shell,default}.nix to reduce the necessity to rebuild (when using `nix build`) after each change, even to non-go files. more files can be added to an exclude list in the future. --- flake.lock | 16 ++++++++++++++++ flake.nix | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index 4fdf50b..5d952ac 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,21 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1653590866, + "narHash": "sha256-E4yKIrt/S//WfW5D9IhQ1dVuaAy8RE7EiCMfnbrOC78=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3e81a637cdf9f6e9b39aeb4d6e6394d1ad158e16", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixgl": { "inputs": { "nixpkgs": [ @@ -55,6 +70,7 @@ "root": { "inputs": { "flake-compat": "flake-compat", + "nix-filter": "nix-filter", "nixgl": "nixgl", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 94d4d02..56d4aad 100644 --- a/flake.nix +++ b/flake.nix @@ -10,9 +10,13 @@ flake = false; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-filter = { + url = "github:numtide/nix-filter"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixgl, nixpkgs, ... }: + outputs = { self, nixgl, nix-filter, nixpkgs, ... }: let # to work with older version of flakes @@ -87,7 +91,15 @@ # In 'nix develop', we don't need a copy of the source tree # in the Nix store. - src = lib.cleanSource ./.; + src = nix-filter.lib.filter { + root = lib.cleanSource ./.; + exclude = [ + ./flake.nix + ./flake.lock + ./default.nix + ./shell.nix + ]; + }; meta = { description = "an offline-capable xkcd webcomic reader written in Go";