-
Notifications
You must be signed in to change notification settings - Fork 69
A way to exclude directory from watch? #6
Comments
If it is inside your project, you can use https://github.com/siers/nix-gitignore (which went into nixpkgs master a month or so ago) or https://github.com/Profpatsch/nixperiments/blob/master/filterSourceGitignore.nix (which is a bit more restrictive but should have less corner cases). If it is from a transitive dependency lorri picks up, we’ll have to think of something and this is likely a bug. |
No, it is the problem with source-less nix-shells
In my case something like EDIT: wait, this works just fine. I have still to extract the problem |
I've just tried lorri with my small Haskell project. It uses nixpkgs' {
soph = (self.callCabal2nix "soph" (lib.sourceByRegex ./. [
"^\\src.*$"
"^.*\\.cabal$"
"^LICENSE$"
]) {}).overrideAttrs (/** ... **/);
} However this ends up including probably every file in that directory, as seen from the debug output:
|
Some more info:
|
I have the same problem as @infinisil with the added detail that every time the git lockfile |
@anka-213 Yeah I'm having that problem as well :( |
@infinisil, your problem stems from the first line in your
Because it imports "the current directory", that directory ends up being watched recursively by
you can bypass the issue. |
I have noticed two other cases that make
(Arguably using 1. and 2. are not good practice, but we should document these corner cases for users and in case the logging in nix changes which could cause changes in behavior) |
Created #21 to document my findings. |
One case I think I've discovered: I'm working on a Rubygem, and |
Update: we have implemented the If you can, please try out the #146 branch (you can clone, switch to branch and then use There are still more issues with watching the minimal amount of files necessary, so please report any inconsistencies that you see. |
@dudebout The README currently suggests a workaround for 2. Is there a workaround for 1? I'm using niv to manage my nixpkgs checkout, and lorri seems to be in an infinite loop:
|
I am not aware of such a workaround. I have a feeling that in most cases
this should not be a problem though, since working on nixpkgs or working on
the project backed by lorri are fairly distinct operations. If I remember
correctly, I noticed 1) while investigating this issue, but this was not
something that was in the way.
Are you sure niv is using a git checkout of nixpkgs? From what niv does,
and from reading its README, it does not seem to be the case, at least in
its default mode of operation.
…On Sat, Nov 30, 2019 at 12:19 AM Asad Saeeduddin ***@***.***> wrote:
@dudebout <https://github.com/dudebout> The README currently suggests a
workaround for 2. Is there a workaround for 1?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6?email_source=notifications&email_token=AAC5LGSKQDW2NYHERXBEW2TQWHZXHA5CNFSM4HCHAFNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFPZW4Y#issuecomment-559913843>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC5LGTKJRZ6KS4WAIXP6H3QWHZXHANCNFSM4HCHAFNA>
.
|
@dudebout You're right, it looks like niv uses a tarball. The |
Note regarding the issue where let
# ... elided
haskellPkgs = pkgs.haskell.packages.${compiler};
in haskellPkgs.developPackage rec {
root = ./.;
# ... elided
} If you look at the source it's because root eventually gets passed to Likewise, this can be fixed with However, in that case the name has to be provided (e.g. Here is the full (fixed) { compiler ? "ghc865"
, doBenchmark ? false
, doProfiling ? false
, doStrict ? false
}:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {
config.allowUnfree = true;
config.allowBroken = false;
overlays = [
(self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
${compiler} = super.haskell.packages.${compiler} // rec {
ghc = super.haskell.packages.${compiler}.ghc // {
withPackages =
super.haskell.packages.${compiler}.ghc.withHoogle;
};
ghcWithPackages = ghc.withPackages;
};
};
};
})
];
};
haskellPkgs = pkgs.haskell.packages.${compiler};
in haskellPkgs.developPackage rec {
name = builtins.baseNameOf ./.;
# Must filter root otherwise `src = ./.` and lorri will get its known issue
# where it rebuilds on any file change
# (https://github.com/target/lorri/issues/6). When the root is filtered we
# must provide a name (above) because the default implementation uses:
# `builtins.baseNameOf root` which results in a name that refers to a store
# path and end up with the error: "is not allowed to refer to a store path".
root = pkgs.nix-gitignore.gitignoreSource [] ./.;
modifier = drv:
pkgs.haskell.lib.overrideCabal drv (attrs: {
buildTools = (attrs.buildTools or [ ]) ++ [ haskellPkgs.cabal-install haskellPkgs.ghc ];
enableLibraryProfiling = doProfiling;
enableExecutableProfiling = doProfiling;
testHaskellDepends = (attrs.testHaskellDepends or [ ])
++ [ haskellPkgs.criterion ];
inherit doBenchmark;
configureFlags =
pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror";
passthru = {
nixpkgs = pkgs;
inherit haskellPkgs;
};
});
returnShellEnv = false;
} |
I have a little postgresql state dir inside my project's dot files, and when PG is running, it does changes some files regularly
It causes regular direnv reloads, like every 10 seconds and direnv debug log on each trivial command.
Is there way to exclude files from watching, probably even use
.gitignore
?The text was updated successfully, but these errors were encountered: