[nixos]
+type = channel
channel_url = https://channels.nixos.org/nixos-20.03
git_repo = https://github.com/NixOS/nixpkgs.git
git_ref = nixos-20.03
[nixos-hardware]
+type = git
git_repo = https://github.com/NixOS/nixos-hardware.git
git_ref = master
({ lib, buildPythonPackage, nix, git, autopep8, mypy, pylint, }:
buildPythonPackage rec {
pname = "pinch";
- version = "1.5.1";
+ version = "2.0.0-pre";
src = lib.cleanSource ./.;
checkInputs = [ nix git mypy ] ++ lib.optionals lint [ autopep8 pylint ];
doCheck = true;
Dict,
Iterable,
List,
+ Mapping,
NamedTuple,
NewType,
Tuple,
+ Type,
Union,
)
def read_search_path(conf: configparser.SectionProxy) -> SearchPath:
- if 'alias_of' in conf:
- return AliasSearchPath(**dict(conf.items()))
- if 'channel_url' in conf:
- return ChannelSearchPath(**dict(conf.items()))
- return GitSearchPath(**dict(conf.items()))
+ mapping: Mapping[str, Type[SearchPath]] = {
+ 'alias': AliasSearchPath,
+ 'channel': ChannelSearchPath,
+ 'git': GitSearchPath,
+ }
+ return mapping[conf['type']](**dict(conf.items()))
def read_config(filename: str) -> configparser.ConfigParser: