mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
lxd-image-server: init at 0.0.4
This commit is contained in:
parent
1cc3c45064
commit
0cecb3303a
47
pkgs/tools/virtualization/lxd-image-server/default.nix
Normal file
47
pkgs/tools/virtualization/lxd-image-server/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ lib
|
||||
, openssl
|
||||
, rsync
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "lxd-image-server";
|
||||
version = "0.0.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Avature";
|
||||
repo = "lxd-image-server";
|
||||
rev = version;
|
||||
sha256 = "yx8aUmMfSzyWaM6M7+WcL6ouuWwOpqLzODWSdNgwCwo=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./state.patch
|
||||
./run.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
setuptools
|
||||
attrs
|
||||
click
|
||||
inotify
|
||||
cryptography
|
||||
confight
|
||||
python-pidfile
|
||||
];
|
||||
|
||||
makeWrapperArgs = [
|
||||
''--prefix PATH ':' "${lib.makeBinPath [ openssl rsync ]}"''
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Creates and manages a simplestreams lxd image server on top of nginx";
|
||||
homepage = "https://github.com/Avature/lxd-image-server";
|
||||
license = licenses.apsl20;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ mkg20001 ];
|
||||
};
|
||||
}
|
25
pkgs/tools/virtualization/lxd-image-server/run.patch
Normal file
25
pkgs/tools/virtualization/lxd-image-server/run.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From df2ce9fb48a3790407646a388e0d220a75496c52 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= <mkg20001@gmail.com>
|
||||
Date: Wed, 3 Nov 2021 14:23:38 +0100
|
||||
Subject: [PATCH] /var/run -> /run
|
||||
|
||||
---
|
||||
lxd_image_server/tools/config.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lxd_image_server/tools/config.py b/lxd_image_server/tools/config.py
|
||||
index 60e8973..23d392a 100644
|
||||
--- a/lxd_image_server/tools/config.py
|
||||
+++ b/lxd_image_server/tools/config.py
|
||||
@@ -9,7 +9,7 @@ import confight
|
||||
class Config():
|
||||
|
||||
_lock = Lock()
|
||||
- pidfile = Path('/var/run/lxd-image-server/pidfile')
|
||||
+ pidfile = Path('/run/lxd-image-server/pidfile')
|
||||
data = {}
|
||||
|
||||
@classmethod
|
||||
--
|
||||
2.33.0
|
||||
|
49
pkgs/tools/virtualization/lxd-image-server/state.patch
Normal file
49
pkgs/tools/virtualization/lxd-image-server/state.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
From 17a1e09eaf8957174425d05200be9ee3e77229f9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= <mkg20001@gmail.com>
|
||||
Date: Thu, 21 Oct 2021 00:39:08 +0200
|
||||
Subject: [PATCH] Remove system-state changing code
|
||||
|
||||
This is already done by the module on nixOS
|
||||
---
|
||||
lxd_image_server/cli.py | 15 +--------------
|
||||
1 file changed, 1 insertion(+), 14 deletions(-)
|
||||
|
||||
diff --git a/lxd_image_server/cli.py b/lxd_image_server/cli.py
|
||||
index d276e6d..f759bf2 100644
|
||||
--- a/lxd_image_server/cli.py
|
||||
+++ b/lxd_image_server/cli.py
|
||||
@@ -140,30 +140,17 @@ def reload_config():
|
||||
@cli.command()
|
||||
@click.option('--root_dir', default='/var/www/simplestreams',
|
||||
show_default=True)
|
||||
-@click.option('--ssl_dir', default='/etc/nginx/ssl', show_default=True,
|
||||
- callback=lambda ctx, param, val: Path(val))
|
||||
@click.pass_context
|
||||
-def init(ctx, root_dir, ssl_dir):
|
||||
+def init(ctx, root_dir):
|
||||
if not Path(root_dir).exists():
|
||||
logger.error('Root directory does not exists')
|
||||
else:
|
||||
- if not ssl_dir.exists():
|
||||
- os.makedirs(str(ssl_dir))
|
||||
-
|
||||
- if not (ssl_dir / 'nginx.key').exists():
|
||||
- generate_cert(str(ssl_dir))
|
||||
-
|
||||
img_dir = str(Path(root_dir, 'images'))
|
||||
streams_dir = str(Path(root_dir, 'streams/v1'))
|
||||
if not Path(img_dir).exists():
|
||||
os.makedirs(img_dir)
|
||||
if not Path(streams_dir).exists():
|
||||
os.makedirs(streams_dir)
|
||||
- conf_path = Path('/etc/nginx/sites-enabled/simplestreams.conf')
|
||||
- if not conf_path.exists():
|
||||
- conf_path.symlink_to(
|
||||
- '/etc/nginx/sites-available/simplestreams.conf')
|
||||
- os.system('nginx -s reload')
|
||||
|
||||
if not Path(root_dir, 'streams', 'v1', 'images.json').exists():
|
||||
ctx.invoke(update, img_dir=Path(root_dir, 'images'),
|
||||
--
|
||||
2.33.0
|
||||
|
|
@ -7360,6 +7360,8 @@ with pkgs;
|
|||
lxcfs = callPackage ../os-specific/linux/lxcfs { };
|
||||
lxd = callPackage ../tools/admin/lxd { };
|
||||
|
||||
lxd-image-server = callPackage ../tools/virtualization/lxd-image-server { };
|
||||
|
||||
lzfse = callPackage ../tools/compression/lzfse { };
|
||||
|
||||
lzham = callPackage ../tools/compression/lzham { };
|
||||
|
|
Loading…
Reference in a new issue