diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-05-05 18:59:33 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-05-05 18:59:33 +0200 |
commit | 6f3244ce4517cc51ef3ffd39025152aa7046ef69 (patch) | |
tree | 588f8deb7406821d2d1157c310e15adde4001a61 /src/nix/installables.cc | |
parent | 941f95284ab57e9baa317791327cf1715d8564b5 (diff) | |
parent | 909b4a882057a92ae8b40b8afdab3c4ac30da915 (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r-- | src/nix/installables.cc | 116 |
1 files changed, 62 insertions, 54 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc index c2e2a6573..ab938281f 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -19,65 +19,73 @@ namespace nix { MixFlakeOptions::MixFlakeOptions() { - mkFlag() - .longName("recreate-lock-file") - .description("recreate lock file from scratch") - .set(&lockFlags.recreateLockFile, true); - - mkFlag() - .longName("no-update-lock-file") - .description("do not allow any updates to the lock file") - .set(&lockFlags.updateLockFile, false); - - mkFlag() - .longName("no-write-lock-file") - .description("do not write the newly generated lock file") - .set(&lockFlags.writeLockFile, false); - - mkFlag() - .longName("no-registries") - .description("don't use flake registries") - .set(&lockFlags.useRegistries, false); - - mkFlag() - .longName("commit-lock-file") - .description("commit changes to the lock file") - .set(&lockFlags.commitLockFile, true); - - mkFlag() - .longName("update-input") - .description("update a specific flake input") - .label("input-path") - .handler([&](std::vector<std::string> ss) { - lockFlags.inputUpdates.insert(flake::parseInputPath(ss[0])); - }); - - mkFlag() - .longName("override-input") - .description("override a specific flake input (e.g. 'dwarffs/nixpkgs')") - .arity(2) - .labels({"input-path", "flake-url"}) - .handler([&](std::vector<std::string> ss) { + addFlag({ + .longName = "recreate-lock-file", + .description = "recreate lock file from scratch", + .handler = {&lockFlags.recreateLockFile, true} + }); + + addFlag({ + .longName = "no-update-lock-file", + .description = "do not allow any updates to the lock file", + .handler = {&lockFlags.updateLockFile, false} + }); + + addFlag({ + .longName = "no-write-lock-file", + .description = "do not write the newly generated lock file", + .handler = {&lockFlags.writeLockFile, false} + }); + + addFlag({ + .longName = "no-registries", + .description = "don't use flake registries", + .handler = {&lockFlags.useRegistries, false} + }); + + addFlag({ + .longName = "commit-lock-file", + .description = "commit changes to the lock file", + .handler = {&lockFlags.commitLockFile, true} + }); + + addFlag({ + .longName = "update-input", + .description = "update a specific flake input", + .labels = {"input-path"}, + .handler = {[&](std::string s) { + lockFlags.inputUpdates.insert(flake::parseInputPath(s)); + }} + }); + + addFlag({ + .longName = "override-input", + .description = "override a specific flake input (e.g. 'dwarffs/nixpkgs')", + .labels = {"input-path", "flake-url"}, + .handler = {[&](std::string inputPath, std::string flakeRef) { lockFlags.inputOverrides.insert_or_assign( - flake::parseInputPath(ss[0]), - parseFlakeRef(ss[1], absPath("."))); - }); + flake::parseInputPath(inputPath), + parseFlakeRef(flakeRef, absPath("."))); + }} + }); } SourceExprCommand::SourceExprCommand() { - mkFlag() - .shortName('f') - .longName("file") - .label("file") - .description("evaluate attributes from FILE") - .dest(&file); - - mkFlag() - .longName("expr") - .label("expr") - .description("evaluate attributes from EXPR") - .dest(&expr); + addFlag({ + .longName = "file", + .shortName = 'f', + .description = "evaluate FILE rather than the default", + .labels = {"file"}, + .handler = {&file} + }); + + addFlag({ + .longName ="expr", + .description = "evaluate attributes from EXPR", + .labels = {"expr"}, + .handler = {&expr} + }); } Strings SourceExprCommand::getDefaultFlakeAttrPaths() |