From 3b3e6bb1e50fae42ab509b0e3910c93b83dc84cc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 7 Jul 2021 10:02:55 +0200 Subject: [PATCH] Style tweaks --- src/libfetchers/registry.cc | 2 +- src/libfetchers/registry.hh | 2 +- src/nix/registry-pin.md | 2 +- src/nix/registry.cc | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libfetchers/registry.cc b/src/libfetchers/registry.cc index c2dfa9dc6..f35359d4b 100644 --- a/src/libfetchers/registry.cc +++ b/src/libfetchers/registry.cc @@ -124,7 +124,7 @@ std::shared_ptr getUserRegistry() return userRegistry; } -std::shared_ptr getCustomRegistry(Path p) +std::shared_ptr getCustomRegistry(const Path & p) { static auto customRegistry = Registry::read(p, Registry::Custom); diff --git a/src/libfetchers/registry.hh b/src/libfetchers/registry.hh index cde22dff6..260a2c460 100644 --- a/src/libfetchers/registry.hh +++ b/src/libfetchers/registry.hh @@ -49,7 +49,7 @@ typedef std::vector> Registries; std::shared_ptr getUserRegistry(); -std::shared_ptr getCustomRegistry(Path p); +std::shared_ptr getCustomRegistry(const Path & p); Path getUserRegistryPath(); diff --git a/src/nix/registry-pin.md b/src/nix/registry-pin.md index 7b163c463..ebc0e3eff 100644 --- a/src/nix/registry-pin.md +++ b/src/nix/registry-pin.md @@ -24,7 +24,7 @@ R""( … ``` -* Pin `nixpkgs` in a custom registry to its most recent Git revision +* Pin `nixpkgs` in a custom registry to its most recent Git revision: ```console # nix registry pin --registry ./custom-flake-registry.json nixpkgs diff --git a/src/nix/registry.cc b/src/nix/registry.cc index ec80dc0bc..6a92576c7 100644 --- a/src/nix/registry.cc +++ b/src/nix/registry.cc @@ -11,13 +11,12 @@ using namespace nix; using namespace nix::flake; -class RegistryCommand: virtual Args +class RegistryCommand : virtual Args { std::string registry_path; std::shared_ptr registry; - public: RegistryCommand() @@ -30,7 +29,8 @@ public: }); } - std::shared_ptr getRegistry() { + std::shared_ptr getRegistry() + { if (registry) return registry; if (registry_path.empty()) { registry = fetchers::getUserRegistry(); @@ -40,7 +40,8 @@ public: return registry; } - Path getRegistryPath() { + Path getRegistryPath() + { if (registry_path.empty()) { return fetchers::getUserRegistryPath(); } else { @@ -156,7 +157,7 @@ struct CmdRegistryPin : RegistryCommand, EvalCommand std::string description() override { - return "pin a flake to its current version in user flake registry or to the current version of a flake URI"; + return "pin a flake to its current version or to the current version of a flake URL"; } std::string doc() override