Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.pkgs.waitress-django/cudaPackages.saxpy/doc/test-runner: Use lib.fileset #300428

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ in pkgs.stdenv.mkDerivation {
nixos-render-docs
];

src = ./.;
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.difference ./. (pkgs.lib.fileset.unions [ ./common.nix ./default.nix ./shell.nix ]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side notes:

  • I frequently find myself repeating some kind of a fileFilter to discard the nix files. Makes me wonder if we want a shorthand for this...
  • Can unnest e.g. via lib.pipe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned earlier, I'd really recommend explicitly selecting the files to include:

Suggested change
fileset = pkgs.lib.fileset.difference ./. (pkgs.lib.fileset.unions [ ./common.nix ./default.nix ./shell.nix ]);
fileset = pkgs.lib.fileset.unions [ ... ];

That's going to be much more resilient.

};

postPatch = ''
ln -s ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
Expand Down
6 changes: 5 additions & 1 deletion doc/languages-frameworks/agda.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ with (import nixpkgs {});
agdaPackages.mkDerivation {
version = "1.0";
pname = "my-agda-lib";
src = ./.;
# lib.fileset prevents unnecessary rebuilds when default.nix changes
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};
buildInputs = [
agdaPackages.standard-library
];
Expand Down
6 changes: 5 additions & 1 deletion doc/languages-frameworks/dotnet.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ in buildDotnetModule rec {
pname = "someDotnetApplication";
version = "0.1";

src = ./.;
# lib.fileset prevents unnecessary rebuilds when default.nix changes.
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};

projectFile = "src/project.sln";
# File generated with `nix-build -A package.passthru.fetch-deps`.
Expand Down
7 changes: 6 additions & 1 deletion doc/languages-frameworks/maven.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,12 @@ Traditionally the Maven repository is at `~/.m2/repository`. We will override th
stdenv.mkDerivation {
name = "maven-repository";
buildInputs = [ maven ];
src = ./.; # or fetchFromGitHub, cleanSourceWith, etc
# or fetchFromGitHub, cleanSourceWith, etc.
# lib.fileset prevents unnecessary rebuilds when default.nix changes.
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};
buildPhase = ''
mvn package -Dmaven.repo.local=$out
'';
Expand Down
5 changes: 4 additions & 1 deletion nixos/lib/test-driver/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
python3Packages.buildPythonApplication {
pname = "nixos-test-driver";
version = "1.1";
src = ./.;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};
pyproject = true;

propagatedBuildInputs = [
Expand Down
6 changes: 4 additions & 2 deletions pkgs/development/cuda-modules/saxpy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ let
cudaVersion
flags
libcublas
setupCudaHook
;
inherit (lib) getDev getLib getOutput;
in
backendStdenv.mkDerivation {
pname = "saxpy";
version = "unstable-2023-07-11";

src = ./.;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};

strictDeps = true;

Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/python-modules/waitress-django/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ buildPythonPackage {
version = "1.0.0";
format = "setuptools";

src = ./.;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. ./default.nix;
};

pythonPath = [ django waitress ];
doCheck = false;

Expand Down