summaryrefslogtreecommitdiff
path: root/tools/sops-inventory
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2023-04-09 19:57:41 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2023-04-09 19:57:41 +0200
commit24207674f36e900fd2aa51787cb70756413962c2 (patch)
treef254d40b32d918783ae7698b902792963464269d /tools/sops-inventory
parent9c67ce4623ae1f2bf9a9d71de781c12054c1001c (diff)
downloadnixos-24207674f36e900fd2aa51787cb70756413962c2.tar
nixos-24207674f36e900fd2aa51787cb70756413962c2.tar.gz
nixos-24207674f36e900fd2aa51787cb70756413962c2.tar.bz2
nixos-24207674f36e900fd2aa51787cb70756413962c2.tar.xz
nixos-24207674f36e900fd2aa51787cb70756413962c2.zip
deprecate mach_nix
Diffstat (limited to 'tools/sops-inventory')
-rw-r--r--tools/sops-inventory/default.nix17
-rw-r--r--tools/sops-inventory/poetry.lock56
-rw-r--r--tools/sops-inventory/pyproject.toml17
-rw-r--r--tools/sops-inventory/setup.py11
-rw-r--r--tools/sops-inventory/sops_inventory/__main__.py4
5 files changed, 83 insertions, 22 deletions
diff --git a/tools/sops-inventory/default.nix b/tools/sops-inventory/default.nix
index 938d99ce..32972ba9 100644
--- a/tools/sops-inventory/default.nix
+++ b/tools/sops-inventory/default.nix
@@ -1,16 +1,13 @@
1{ system, self, mach-nix, ... }: 1{ system, self, ... }:
2
2let 3let
3 pkgs = self.legacyPackages.${system}; 4 pkgs = self.legacyPackages.${system};
4in mach-nix.lib.${system}.buildPythonPackage { 5in
5 pname = "sops-inventory"; 6with pkgs.poetry2nix;
6 version = "0.0.0"; 7mkPoetryApplication {
7 8 projectDir = cleanPythonSources { src = ./.; };
8 src = pkgs.lib.sourceByRegex ./. ["^setup\.py$" "^sops_inventory(/[^/]+.*)?$"];
9 9
10 ignoreDataOutdated = true; 10 nativeBuildInputs = with pkgs; [ makeWrapper ];
11 requirements = ''
12 pyyaml
13 '';
14 11
15 postInstall = '' 12 postInstall = ''
16 wrapProgram $out/bin/sops-inventory \ 13 wrapProgram $out/bin/sops-inventory \
diff --git a/tools/sops-inventory/poetry.lock b/tools/sops-inventory/poetry.lock
new file mode 100644
index 00000000..93fa96de
--- /dev/null
+++ b/tools/sops-inventory/poetry.lock
@@ -0,0 +1,56 @@
1# This file is automatically @generated by Poetry and should not be changed by hand.
2
3[[package]]
4name = "pyyaml"
5version = "6.0"
6description = "YAML parser and emitter for Python"
7category = "main"
8optional = false
9python-versions = ">=3.6"
10files = [
11 {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"},
12 {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"},
13 {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"},
14 {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"},
15 {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"},
16 {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"},
17 {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"},
18 {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"},
19 {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"},
20 {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"},
21 {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"},
22 {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"},
23 {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"},
24 {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"},
25 {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"},
26 {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"},
27 {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"},
28 {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"},
29 {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"},
30 {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"},
31 {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"},
32 {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"},
33 {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"},
34 {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"},
35 {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"},
36 {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"},
37 {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"},
38 {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"},
39 {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"},
40 {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"},
41 {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"},
42 {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"},
43 {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"},
44 {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"},
45 {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"},
46 {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"},
47 {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"},
48 {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"},
49 {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"},
50 {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"},
51]
52
53[metadata]
54lock-version = "2.0"
55python-versions = "^3.10"
56content-hash = "9fc7d221b15352d2ee668151f2c2c9d2eb7b7c6eb4a5d4ddcabb94e71f6b9fb7"
diff --git a/tools/sops-inventory/pyproject.toml b/tools/sops-inventory/pyproject.toml
new file mode 100644
index 00000000..c78588fc
--- /dev/null
+++ b/tools/sops-inventory/pyproject.toml
@@ -0,0 +1,17 @@
1[tool.poetry]
2name = "sops_inventory"
3version = "0.0.0"
4description = ""
5authors = ["Gregor Kleen <gkleen@yggdrasil.li>"]
6
7[tool.poetry.dependencies]
8python = "^3.10"
9pyyaml = "^6.0"
10
11
12[tool.poetry.scripts]
13sops-inventory = 'sops_inventory.__main__:main'
14
15[build-system]
16requires = ["poetry-core"]
17build-backend = "poetry.core.masonry.api"
diff --git a/tools/sops-inventory/setup.py b/tools/sops-inventory/setup.py
deleted file mode 100644
index 3ea2a5d1..00000000
--- a/tools/sops-inventory/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
1from setuptools import setup
2
3setup(
4 name='sops-inventory',
5 packages=['sops_inventory'],
6 entry_points={
7 'console_scripts': [
8 'sops-inventory=sops_inventory.__main__:main'
9 ],
10 },
11)
diff --git a/tools/sops-inventory/sops_inventory/__main__.py b/tools/sops-inventory/sops_inventory/__main__.py
index aaddda8c..f43b7c2f 100644
--- a/tools/sops-inventory/sops_inventory/__main__.py
+++ b/tools/sops-inventory/sops_inventory/__main__.py
@@ -20,12 +20,14 @@ except ImportError:
20 20
21SOPS_TYPES = frozenset({'kms', 'gcp_kms', 'azure_kv', 'hc_vault', 'age', 'pgp'}) 21SOPS_TYPES = frozenset({'kms', 'gcp_kms', 'azure_kv', 'hc_vault', 'age', 'pgp'})
22 22
23BUFFER_SIZE = os.sysconf('SC_PAGESIZE')
24
23 25
24def readnull(fh): 26def readnull(fh):
25 buffer = b'' 27 buffer = b''
26 28
27 while True: 29 while True:
28 chunk = fh.read(4096) 30 chunk = fh.read(BUFFER_SIZE)
29 buffer += chunk 31 buffer += chunk
30 if not buffer: 32 if not buffer:
31 break 33 break