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

nixos/locate: don't create /var/cache #79022

Merged
merged 1 commit into from Feb 1, 2020
Merged

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Feb 1, 2020

This is already handled by the default systemd tmpfiles.

fixes #78941

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This is already handled by the default systemd tmpfiles.

fixes NixOS#78941
Copy link
Contributor

@mudrii mudrii left a comment

Choose a reason for hiding this comment

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

change looks ok

@lheckemann lheckemann merged commit 9bc90bf into NixOS:master Feb 1, 2020
anna328p pushed a commit to anna328p/nixpkgs that referenced this pull request Feb 2, 2020
nixos/locate: don't create /var/cache
@Mic92 Mic92 deleted the locate branch February 4, 2020 10:44
@mudrii
Copy link
Contributor

mudrii commented Feb 10, 2020

I am still getting the warning
[/etc/tmpfiles.d/var.conf:19] Duplicate line for path "/var/cache", ignoring.
even merged to master and using unstable.mlocate

@Mic92
Copy link
Member Author

Mic92 commented Feb 10, 2020

Are you sure you have updated the nixpkgs version used by NixOS? I don't see where this conflict should originate.

@mudrii
Copy link
Contributor

mudrii commented Feb 11, 2020

Yes I did update.

 sudo nix-channel --update ; sudo nixos-rebuild switch --show-trace                                                                                                                                       10.8s
unpacking channels...
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for mudrii...
setting up tmpfiles
[/etc/tmpfiles.d/var.conf:19] Duplicate line for path "/var/cache", ignoring.
 nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.06 MiB download, 0.31 MiB unpacked):
  /nix/store/5h35s50503spks8gkxdv3kk4szz8vx9g-bash-interactive-4.4-p23-dev
  /nix/store/qghrkvk86f9llfkcr1bxsypqbw1a4qmw-stdenv-linux
copying path '/nix/store/5h35s50503spks8gkxdv3kk4szz8vx9g-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/qghrkvk86f9llfkcr1bxsypqbw1a4qmw-stdenv-linux' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.17, NixOS, 19.09.2036.c49da6435f3 (Loris)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.2`
 - channels(root): `"home-manager-19.09, nixos-19.09.2036.c49da6435f3, unstable-20.03pre212208.8130f3c1c2b"`
 - channels(mudrii): `"home-manager, unstable-20.03pre196836.1c40ee6fc44"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

@Mic92
Copy link
Member Author

Mic92 commented Feb 11, 2020

This looks indeed weird. Can you have a look where /var/cache exactly appears in /etc/tmpfiles.d:

$ grep -R /var/cache /etc/tmpfiles.d

@mudrii
Copy link
Contributor

mudrii commented Feb 11, 2020

@Mic92

grep -R /var/cache /etc/tmpfiles.d
                                                                                                                                                                            
/etc/tmpfiles.d/var.conf:d /var/cache 0755 - - -
/etc/tmpfiles.d/nixos.conf:d /var/cache/lightdm 0711 root lightdm -
/etc/tmpfiles.d/nixos.conf:d /var/cache 0755 root root -
/etc/tmpfiles.d/systemd.conf:d /var/cache/private 0700 root root -

@Mic92
Copy link
Member Author

Mic92 commented Feb 11, 2020

I see what is happening here. The patch actually needs to be backported to 19.09, since this is the channel you are using.

Mic92 added a commit to Mic92/nixpkgs that referenced this pull request Feb 11, 2020
We already create /var/cache as part of systemd default rules.

Continuation of:
NixOS@c9d6dee

Reported in:
NixOS#79022 (comment)
@Mic92
Copy link
Member Author

Mic92 commented Feb 11, 2020

Have a look at #79820

@mudrii
Copy link
Contributor

mudrii commented Feb 11, 2020

Thank you @Mic92 for checking on this

The issue is still mysterious as I am using unstable for mlocate

let
  unstable = import <unstable> {
    config.allowUnfree = true;
  };
in
{
    services.locate = {
      enable = true;
      locate = unstable.pkgs.mlocate;
      localuser = null; # mlocate does not support this option so it must be null
      # interval = "daily";
      interval = "hourly";
      pruneNames = [
        ".git"
        "cache"
        ".cache"
        ".cpcache"
        ".aot_cache"
        ".boot"
        "node_modules"
        "USB"
      ];

      prunePaths = options.services.locate.prunePaths.default ++ [
        "/dev"
        "/lost+found"
        "/nix/var"
        "/proc"
        "/run"
        "/sys"
        "/usr/tmp"
      ];
    };
}

@Mic92
Copy link
Member Author

Mic92 commented Feb 11, 2020

According to nix-shell -p nix-info --run "nix-info -m" you are on the 19.09 nixos channel. You are only using the mlocate package from unstable however the locate module comes from NixOS 19.09.

@mudrii
Copy link
Contributor

mudrii commented Feb 11, 2020

Yes, I did assume this.

Is any way to cherry-pick in module from diff channels?

@Mic92
Copy link
Member Author

Mic92 commented Feb 11, 2020

Only if you have your own fork i.e. if you build from git. You a also use your github fork as a channel. However you can wait for the next channel update of 19.09 which includes a fix (it might been already out).

pull bot pushed a commit to Frostman/nixpkgs that referenced this pull request Feb 16, 2020
We already create /var/cache as part of systemd default rules.

Continuation of:
NixOS@c9d6dee

Reported in:
NixOS#79022 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[/etc/tmpfiles.d/var.conf:19] Duplicate line for path "/var/cache", ignoring.
3 participants