From e421a67919a187345a0af5fe0ea2b44ae801fb83 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sun, 28 Mar 2021 09:40:39 +0200 Subject: [PATCH] sternchen update --- assets/nginx-show-config.sh | 39 ++++++++++++++++++++++++++++++++++ configs/sternchen/packages.nix | 16 +++++++++----- configs/sterni/packages.nix | 14 +++++++++++- pkgs/default.nix | 18 +--------------- 4 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 assets/nginx-show-config.sh diff --git a/assets/nginx-show-config.sh b/assets/nginx-show-config.sh new file mode 100644 index 0000000..3ac4699 --- /dev/null +++ b/assets/nginx-show-config.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p nginx-config-formatter python3 -i python3 + +import os +import re +import shutil +import subprocess +import sys +from tempfile import TemporaryDirectory + + +def nginx_config() -> str: + reload_config ="/etc/nginx/nginx.conf" + if os.path.exists(reload_config): + return reload_config + out = subprocess.check_output(["systemctl", "cat", "nginx"]) + match = re.search(r"-c '(\S+-nginx\.conf)", out.decode("utf-8")) + if not match: + print("Could not find nginx.conf in nginx.service", file=sys.stderr) + sys.exit(1) + + return match.group(1) + + +def main(): + config_path = nginx_config() + with TemporaryDirectory() as temp_dir: + temp_path = os.path.join(temp_dir, "nginx.conf") + with open(temp_path, "wb+") as temp_file, \ + open(config_path, "rb") as config_file: + shutil.copyfileobj(config_file, temp_file) + temp_file.flush() + subprocess.check_call(["nginxfmt", temp_file.name]) + editor = os.environ.get("EDITOR", "cat") + subprocess.check_call([editor, temp_file.name] + sys.argv[1:]) + + +if __name__ == "__main__": + main() diff --git a/configs/sternchen/packages.nix b/configs/sternchen/packages.nix index cf8210b..7b4f22a 100644 --- a/configs/sternchen/packages.nix +++ b/configs/sternchen/packages.nix @@ -15,9 +15,12 @@ in { keepass firefox google-chrome - tor-browser-bundle-bin + # graphic krita + gthumb + digikam + shotwell # kde programs okular @@ -25,12 +28,15 @@ in { gwenview skanlite - #(tor-browser-bundle-bin.overrideAttrs (old: { - # #version = "10.0.13"; + # + #tor-browser-bundle-bin + #(tor-browser-bundle-bin.overrideAttrs (old: rec { + # version = "10.0.15"; + # name = "tor-browser-bundle-${version}"; # src = pkgs.fetchurl { # url = - # "https://dist.torproject.org/torbrowser/10.0.13/tor-browser-linux64-10.0.13_en-US.tar.xz"; - # sha256 = "1ncxacj1fprz2xlisd2w9qzajaqdq4yigk5qy0h40vm6zi5ll4ib"; + # "https://dist.torproject.org/torbrowser/10.0.15/tor-browser-linux64-10.0.15_en-US.tar.xz"; + # sha256 = "1ah69jmfgik063f9gkvyv9d4k706pqihmzc4k7cc95zyd17v8wrs"; # }; #})) ]; diff --git a/configs/sterni/packages.nix b/configs/sterni/packages.nix index 7ea57c1..97ca0d5 100644 --- a/configs/sterni/packages.nix +++ b/configs/sterni/packages.nix @@ -7,7 +7,6 @@ in { environment.systemPackages = with pkgs; [ - tor-browser-bundle-bin # bluetooth gui blueberry @@ -34,6 +33,19 @@ in { # foto #fuji-cam-wifi-tool + + + tor-browser-bundle-bin + #(tor-browser-bundle-bin.overrideAttrs (old: rec { + # version = "10.0.15"; + # name = "tor-browser-bundle-${version}"; + # src = pkgs.fetchurl { + # url = + # "https://dist.torproject.org/torbrowser/10.0.15/tor-browser-linux64-10.0.15_en-US.tar.xz"; + # sha256 = "1ah69jmfgik063f9gkvyv9d4k706pqihmzc4k7cc95zyd17v8wrs"; + # }; + #})) + ]; environment.variables.RECIPE_HOME = "$HOME/mahlzeit"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 897ccfe..c58fc79 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -52,33 +52,17 @@ in { terminal-tools = callPackage ./terminal-tools { }; - # use upstream only for package tests - # memo = callPackage ./memo {}; - sononym = callPackage ./sononym { }; sononym-crawler = callPackage ./sononym-crawler { }; castget = callPackage ./castget { }; - #nixos-generators = callPackage (super.fetchgit { - # url = "https://github.com/nix-community/nixos-generators.git"; - # # before flakes - # #rev = "5eb0cbe93bd1bcf134ec330c06b6f1e645de64c6"; - # #sha256 = "0ghwy0xh7x7hwym8hzx95fj9yw8gxb4ffh56dn0p8a6scnlffci6"; - # # with flaks - # #rev = "450f39121c45b93951c52874fe233455d007d3bc"; - # #sha256 = "1iwc39hzvzzyndxwbnl3fck7phxnjpnhy8zn4nyp8is1fiw0648v"; - #}) { }; - radio-dj = callPackage (super.fetchgit { url = "https://git.ingolf-wagner.de/crashburn_radio/radio_dj.git"; rev = "0.1.5"; sha256 = "04j6gcb6ayrcf7rxr0bkgd48zppiryhdyv7mvp0q12ngdkf2yagd"; }) { }; - #lektor = let - # python = import ./lektor-with-plugins/requirements.nix { pkgs = super.pkgs; }; - #in - # python.packages.Lektor; + }