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

Fix lockfile usage and updating #2817

Closed
CSVdB opened this issue May 13, 2019 · 0 comments
Closed

Fix lockfile usage and updating #2817

CSVdB opened this issue May 13, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@CSVdB
Copy link
Contributor

CSVdB commented May 13, 2019

resolveFlake must be able to handle 6 use cases for what to do with the lockfile:

  1. prim_getFlake while pure: In this case, everything is handled purely, so no registries, no updating LockFile, no writing LockFile to file.
  2. nix build dwarffs: Update LockFile before usage
  3. nix build ~/nix/dwarffs: Update LockFile before usage, and save it to file. This is only if the installable is a FlakeRef with IsPath.
  4. nix build ~/nix/dwarffs --no-save-lock-file: Update LockFile before usage, and don't save it to file
  5. nix build X --recreate-lock-file: Same as above (depending on what X is), but recreate the LockFile from scratch
  6. nix flake update: Same as case 5

In order to implement this, I will create an enum

enum HandleLockFile { AllPure, UpdateLockFile, UseUpdatedLockFile, RecreateLockFile, UseNewLockFile};

with two helper functions

bool allowedToWrite (HandleLockFile handle);
bool recreateLockFile (HandleLockFile handle);

resolveFlake now gets an argument HandleLockFile.

@CSVdB CSVdB self-assigned this May 13, 2019
@grahamc grahamc transferred this issue from another repository May 16, 2019
@grahamc grahamc added this to the flakes-v2 milestone May 16, 2019
@grahamc grahamc added the flakes label May 16, 2019
@CSVdB CSVdB mentioned this issue May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants