refactor(dotfiles): derive names from Nix paths
This commit is contained in:
@@ -275,7 +275,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
names = map (path: util.removeNixSuffix (builtins.baseNameOf path)) files;
|
||||
names = map util.removeNixSuffix files;
|
||||
in
|
||||
{
|
||||
imports = files ++ map mkGuest names;
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
}:
|
||||
let
|
||||
definitions = lib.listToAttrs (
|
||||
map (path: lib.nameValuePair (registryName (builtins.baseNameOf path)) (mkRegistry path)) (
|
||||
util.collectNixFiles root
|
||||
)
|
||||
map (path: lib.nameValuePair (registryName path) (mkRegistry path)) (util.collectNixFiles root)
|
||||
);
|
||||
|
||||
registryName = util.removeNixSuffix;
|
||||
|
||||
@@ -20,7 +20,7 @@ in
|
||||
{
|
||||
inherit collectNixFiles;
|
||||
|
||||
removeNixSuffix = fileName: lib.removeSuffix ".nix" fileName;
|
||||
removeNixSuffix = path: lib.removeSuffix ".nix" (builtins.baseNameOf path);
|
||||
|
||||
bridgeName = id: "br-vlan${toString id}";
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ Repository Nix code uses one implementation.
|
||||
|
||||
### Rule
|
||||
|
||||
Use `util.removeNixSuffix` to remove a `.nix` suffix from a file name.
|
||||
Do not call `lib.removeSuffix ".nix"` outside the utility definition.
|
||||
Use `util.removeNixSuffix` to remove a `.nix` suffix from a path.
|
||||
Do not call `builtins.baseNameOf` or `lib.removeSuffix ".nix"` outside the utility definition.
|
||||
|
||||
### Rationale
|
||||
|
||||
|
||||
Reference in New Issue
Block a user