Skip to content

Instantly share code, notes, and snippets.

@Denommus
Created March 7, 2019 20:15
Show Gist options
  • Save Denommus/0a72f25ce858d6a68a0f53bd825c418d to your computer and use it in GitHub Desktop.
Save Denommus/0a72f25ce858d6a68a0f53bd825c418d to your computer and use it in GitHub Desktop.
This file should be in `~/.config/nixpkgs/overlays`. This will fix nixopsUnstable
self: super: rec {
nixopsUnstable = super.nixopsUnstable.overrideAttrs (oldAttrs: {
preConfigure = ''
find . -iname azure_common.py -exec sed -i 's/NetworkResourceProviderClient/NetworkManagementClient/' {} \;
find . -iname azure_vm.py -exec sed -i 's/from azure.mgmt.network import PublicIpAddress, NetworkInterface, NetworkInterfaceIpConfiguration, IpAllocationMethod, PublicIpAddressDnsSettings, ResourceId/from azure.mgmt.network.models import PublicIPAddress, NetworkInterface, NetworkInterfaceIPConfiguration, IPAllocationMethod, PublicIPAddressDnsSettings\nfrom azure.mgmt.batchai.models import ResourceId/' {} \;
find . -iname azure_availability_set.py -exec sed -i 's/from azure.mgmt.compute import AvailabilitySet/from azure.mgmt.compute.models import AvailabilitySet/' {} \;
find . -iname azure_resource_group.py -exec sed -i 's/from azure.mgmt.resource import ResourceGroup/from azure.mgmt.resource.resources.models import ResourceGroup/' {} \;
find . -iname azure_storage.py -exec sed -i 's/from azure.mgmt.storage import StorageAccountCreateParameters, StorageAccountUpdateParameters, CustomDomain/from azure.mgmt.storage.models import StorageAccountCreateParameters, StorageAccountUpdateParameters, CustomDomain/' {} \;
find . -iname azure_virtual_network.py -exec sed -i 's/from azure.mgmt.network import VirtualNetwork, AddressSpace, Subnet, DhcpOptions/from azure.mgmt.network.models import VirtualNetwork, AddressSpace, Subnet, DhcpOptions/' {} \;
'';
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ self.python27Packages.azure-mgmt-batchai ];
});
python27 = super.python27.override {
packageOverrides = python-self: python-super: {
msrest = python-self.buildPythonPackage rec {
pname = "msrest";
name = "${pname}-${version}";
version = "0.6.4";
propagatedBuildInputs = with python-self; [
requests_oauthlib
typing
isodate
];
src = python-self.fetchPypi {
inherit pname version;
sha256 = "0rnj79fw571hqwj5z8zsraw3aq9lbh0rbc1zykcjrmcqxi5xbbax";
};
};
msrestazure = python-self.buildPythonPackage rec {
pname = "msrestazure";
name = "${pname}-${version}";
version = "0.6.0";
propagatedBuildInputs = with python-self; [
msrest
adal
];
src = python-self.fetchPypi {
inherit pname version;
sha256 = "06s04f6nng4na2663kc12a3skiaqb631nscjfwpsrx4lzkf8bccr";
};
};
azure-mgmt-storage = python-super.azure-mgmt-storage.overridePythonAttrs (oldAttrs: rec {
version = "3.1.0";
name = "${oldAttrs.pname}-${version}";
pname = oldAttrs.pname;
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "0yjwi9xqqw9009h55jvnsxll71xg3ki10lfp0h0zgw4apfdpljw5";
};
postInstall = ''
echo "__import__('pkg_resources').declare_namespace(__name__)" >> $out/lib/${python-self.python.libPrefix}/site-packages/azure/__init__.py
echo "__import__('pkg_resources').declare_namespace(__name__)" >> $out/lib/${python-self.python.libPrefix}/site-packages/azure/mgmt/__init__.py
'';
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python-self.msrestazure ];
});
azure-mgmt-resource = python-super.azure-mgmt-resource.overridePythonAttrs (oldAttrs: rec {
version = "2.0.0";
name = "${oldAttrs.pname}-${version}";
pname = oldAttrs.pname;
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "2e83289369be88d0f06792118db5a7d4ed7150f956aaae64c528808da5518d7f";
};
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python-self.msrestazure ];
});
azure-mgmt-compute = python-super.azure-mgmt-compute.overridePythonAttrs (oldAttrs: rec {
version = "4.3.1";
name = "${oldAttrs.pname}-${version}";
pname = oldAttrs.pname;
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "5b0c2390af3e29d910e3d6e7a72b0be59d6e15933740dd193129217c000e4fed";
};
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python-self.msrestazure ];
});
azure-mgmt-network = python-super.azure-mgmt-network.overridePythonAttrs (oldAttrs: rec {
version = "2.4.0";
name = "${oldAttrs.pname}-${version}";
pname = oldAttrs.pname;
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "19h8fjw5ficbqvz1kzhgf3aqs729hs3haayn2qrg2ny53q9irh9p";
};
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python-self.msrestazure ];
});
azure-mgmt-nspkg = python-super.azure-mgmt-nspkg.overridePythonAttrs (oldAttrs: rec {
version = "3.0.2";
name = "${oldAttrs.pname}-${version}";
pname = oldAttrs.pname;
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "8b2287f671529505b296005e6de9150b074344c2c7d1c805b3f053d081d58c52";
};
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python-self.msrestazure ];
});
azure-mgmt-batchai = python-self.buildPythonPackage rec {
version = "2.0.0";
name = "${pname}-${version}";
pname = "azure-mgmt-batchai";
preConfigure = "";
src = python-self.fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "10x6l8y8z0la4gdvykdk33ns05wpdhimm3i0cvdiq06mjw7hp1zi";
};
propagatedBuildInputs = with python-self; [
msrestazure
azure-common
azure-mgmt-nspkg
];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment