diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-02-22 17:46:58 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-22 17:46:58 +0000 |
commit | 136428bf5b46f69ee85d579531b92299f964ba52 (patch) | |
tree | 56f38cba0fb65416ef7aaeb2a260469d0f546c60 | |
parent | 9b3db875f97723ff46bf895a65469cfd1cded4c8 (diff) | |
download | spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar.gz spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar.bz2 spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar.lz spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar.xz spectrum-136428bf5b46f69ee85d579531b92299f964ba52.tar.zst spectrum-136428bf5b46f69ee85d579531b92299f964ba52.zip |
nix: inline source finding in eval-config.nix
Originally, I was thinking every file that needed to operate on the Spectrum sources would need to import src.nix, but I ended up making it a global instead. I think that's nicer to use, but also avoids re-evaluating the sources for every component in a full build, which I don't think Nix would memoize due to it being wrapped in a function to get access to lib (but I didn't test). Since src.nix therefore shouldn't be accessed anywhere else, it's best to inline its contents into eval-config.nix, so that it _can't_ be accessed anywhere else. Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r-- | nix/eval-config.nix | 10 | ||||
-rw-r--r-- | nix/src.nix | 14 |
2 files changed, 9 insertions, 15 deletions
diff --git a/nix/eval-config.nix b/nix/eval-config.nix index 5f4c3fd..78cdeae 100644 --- a/nix/eval-config.nix +++ b/nix/eval-config.nix @@ -18,5 +18,13 @@ callback (args // rec { else if builtins.pathExists ../config.nix then import ../config.nix else {}); - src = import ./src.nix { inherit (config.pkgs) lib; }; + src = with config.pkgs.lib; cleanSourceWith { + filter = path: type: + path != toString ../Documentation/_site && + path != toString ../Documentation/.jekyll-cache && + path != toString ../Documentation/diagrams/stack.svg && + (type == "file" -> !hasSuffix ".nix" path) && + (type == "directory" -> builtins.baseNameOf path != "build"); + src = cleanSource ../.; + }; }) diff --git a/nix/src.nix b/nix/src.nix deleted file mode 100644 index 9c0be2c..0000000 --- a/nix/src.nix +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: MIT -# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is> - -{ lib }: - -lib.cleanSourceWith { - filter = path: type: - path != toString ../Documentation/_site && - path != toString ../Documentation/.jekyll-cache && - path != toString ../Documentation/diagrams/stack.svg && - (type == "file" -> !lib.hasSuffix ".nix" path) && - (type == "directory" -> builtins.baseNameOf path != "build"); - src = lib.cleanSource ../.; -} |