diff options
55 files changed, 1672 insertions, 2181 deletions
diff --git a/krebs/3modules/os-release.nix b/krebs/3modules/os-release.nix index 8f71a357f..5fbfe6614 100644 --- a/krebs/3modules/os-release.nix +++ b/krebs/3modules/os-release.nix @@ -1,8 +1,11 @@ { config, ... }: with import <stockholm/lib>; let - nixos-version-id = "${config.system.nixosVersion}"; - nixos-version = "${nixos-version-id} (${config.system.nixosCodeName})"; + nixos-version-id = if (hasAttr "nixos" config.system) then + "${config.system.nixos.version}" else "${config.system.nixosVersion}"; + nixos-codeName = if (hasAttr "nixos" config.system) then + "${config.system.nixos.codeName}" else "${config.system.nixosCodeName}"; + nixos-version = "${nixos-version-id} (${nixos-codeName})"; nixos-pretty-name = "NixOS ${nixos-version}"; stockholm-version-id = let diff --git a/krebs/5pkgs/haskell/nix-diff/default.nix b/krebs/5pkgs/haskell/nix-diff/default.nix deleted file mode 100644 index df0315048..000000000 --- a/krebs/5pkgs/haskell/nix-diff/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ mkDerivation, attoparsec, base, containers, Diff, fetchgit, mtl -, nix-derivation, optparse-generic, stdenv, system-filepath, text -, unix, vector -}: -mkDerivation { - pname = "nix-diff"; - version = "1.0.0-krebs1"; - src = fetchgit { - url = "https://github.com/Gabriel439/nix-diff"; - sha256 = "1k00nx8pannqmpzadkwfrs6bf79yk22ynhd033z5rsyw0m8fcz9k"; - rev = "e32ffa2c7f38b47a71325a042c1d887fb46cdf7d"; - }; - patches = [ - ./nixos-system.patch - ]; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = [ - attoparsec base containers Diff mtl nix-derivation optparse-generic - system-filepath text unix vector - ]; - homepage = "https://github.com/Gabriel439/nix-diff"; - description = "Explain why two Nix derivations differ"; - license = stdenv.lib.licenses.bsd3; -} diff --git a/krebs/5pkgs/haskell/nix-diff/nixos-system.patch b/krebs/5pkgs/haskell/nix-diff/nixos-system.patch deleted file mode 100644 index 03e186aa9..000000000 --- a/krebs/5pkgs/haskell/nix-diff/nixos-system.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/Main.hs b/src/Main.hs -index 959ab8e..d3b6077 100644 ---- a/src/Main.hs -+++ b/src/Main.hs -@@ -95,7 +95,12 @@ pathToText path = - underneath `/nix/store`, but this is the overwhelmingly common use case - -} - derivationName :: FilePath -> Text --derivationName = Data.Text.dropEnd 4 . Data.Text.drop 44 . pathToText -+derivationName p = -+ if Data.Text.isPrefixOf "nixos-system" s -+ then "nixos-system" -+ else s -+ where -+ s = Data.Text.dropEnd 4 . Data.Text.drop 44 . pathToText $ p - - -- | Group input derivations by their name - groupByName :: Map FilePath (Set Text) -> Map Text (Map FilePath (Set Text)) diff --git a/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py b/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py index da8e2f726..51ac7a071 100644 --- a/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py +++ b/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py @@ -18,20 +18,27 @@ def is_regex(line): myre = re.compile(r'^s/(?:\\/|[^/])+/(?:\\/|[^/])*/[ig]?$') return myre.match(line) + line = argv[1] if is_regex(line): last = d.get(usr, None) if last: from subprocess import Popen, PIPE - p = Popen(['sed', line], stdin=PIPE, stdout=PIPE) + p = Popen(['sed', line], stdin=PIPE, stdout=PIPE, stderr=PIPE) so, se = p.communicate(bytes("{}\n".format(last), "UTF-8")) if p.returncode: - print("something went wrong when trying to process your regex: {}".format(se.decode())) + print("something went wrong when trying to process your regex: {}".format(line.strip())) ret = so.decode() - print("\x1b[1m{}\x1b[0m meant: {}".format(usr, ret.strip())) - if ret: - d[usr] = ret + if len(ret) > 512: + print('message to long, skipped') + elif len(ret.split('\n')) > 5: + print('to many lines, skipped') + else: + if last.strip() != ret.strip(): + print("\x1b[1m{}\x1b[0m meant: {}".format(usr, ret.strip())) + if ret: + d[usr] = ret else: print("no last message") diff --git a/krebs/5pkgs/simple/buildbot-classic/default.nix b/krebs/5pkgs/simple/buildbot-classic/default.nix index 9eeccee64..3cb691f53 100644 --- a/krebs/5pkgs/simple/buildbot-classic/default.nix +++ b/krebs/5pkgs/simple/buildbot-classic/default.nix @@ -2,16 +2,15 @@ python2Packages.buildPythonApplication rec { name = "buildbot-classic-${version}"; - version = "0.8.14"; + version = "0.8.16"; namePrefix = ""; patches = []; src = fetchFromGitHub { owner = "krebscode"; repo = "buildbot-classic"; - # rev = "v${version}"; - rev = "843463911"; - sha256 = "1ybl52ybjw5p09yik6bck9i1pvnvg94i0d32zqrwy67s77yx1mfd"; + rev = version; + sha256 = "0g686n6m0cjfyympl0ksansllx503gby3hx9gmc8hiyx6x5fkjha"; }; postUnpack = "sourceRoot=\${sourceRoot}/master"; diff --git a/krebs/5pkgs/simple/ejabberd/default.nix b/krebs/5pkgs/simple/ejabberd/default.nix new file mode 100644 index 000000000..2799241fa --- /dev/null +++ b/krebs/5pkgs/simple/ejabberd/default.nix @@ -0,0 +1,118 @@ +{ stdenv, writeScriptBin, lib, fetchurl, git, cacert +, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, utillinux, procps +, withMysql ? false +, withPgsql ? false +, withSqlite ? false, sqlite +, withPam ? false, pam +, withZlib ? true, zlib +, withRiak ? false +, withElixir ? false, elixir +, withIconv ? true +, withTools ? false +, withRedis ? false +}: + +let + fakegit = writeScriptBin "git" '' + #! ${stdenv.shell} -e + if [ "$1" = "describe" ]; then + [ -r .rev ] && cat .rev || true + fi + ''; + + ctlpath = lib.makeBinPath [ bash gnused gnugrep coreutils utillinux procps ]; + +in stdenv.mkDerivation rec { + version = "17.07"; + name = "ejabberd-${version}"; + + src = fetchurl { + url = "http://www.process-one.net/downloads/ejabberd/${version}/${name}.tgz"; + sha256 = "1p8ppp2czjgnq8xnhyksd82npvvx99fwr0g3rrq1wvnwh2vgb8km"; + }; + + nativeBuildInputs = [ fakegit ]; + + buildInputs = [ erlang openssl expat libyaml ] + ++ lib.optional withSqlite sqlite + ++ lib.optional withPam pam + ++ lib.optional withZlib zlib + ++ lib.optional withElixir elixir + ; + + # Apparently needed for Elixir + LANG = "en_US.UTF-8"; + + deps = stdenv.mkDerivation { + name = "ejabberd-deps-${version}"; + + inherit src; + + configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ]; + + buildInputs = [ git erlang openssl expat libyaml sqlite pam zlib elixir ]; + + GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + + makeFlags = [ "deps" ]; + + phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ]; + + installPhase = '' + for i in deps/*; do + ( cd $i + git reset --hard + git clean -ffdx + git describe --always --tags > .rev + rm -rf .git + ) + done + rm deps/.got + + cp -r deps $out + ''; + + outputHashMode = "recursive"; + outputHashAlgo = "sha256"; + outputHash = "1q9yzccn4zf5i4hibq1r0i34q4986a93ph4792l1ph07aiisc8p7"; + }; + + configureFlags = + [ (lib.enableFeature withMysql "mysql") + (lib.enableFeature withPgsql "pgsql") + (lib.enableFeature withSqlite "sqlite") + (lib.enableFeature withPam "pam") + (lib.enableFeature withZlib "zlib") + (lib.enableFeature withRiak "riak") + (lib.enableFeature withElixir "elixir") + (lib.enableFeature withIconv "iconv") + (lib.enableFeature withTools "tools") + (lib.enableFeature withRedis "redis") + ] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}"; + + enableParallelBuilding = true; + + preBuild = '' + cp -r $deps deps + chmod -R +w deps + patchShebangs deps + ''; + + postInstall = '' + sed -i \ + -e '2iexport PATH=${ctlpath}:$PATH' \ + -e 's,\(^ *FLOCK=\).*,\1${utillinux}/bin/flock,' \ + -e 's,\(^ *JOT=\).*,\1,' \ + -e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \ + $out/sbin/ejabberdctl + ''; + + meta = { + description = "Open-source XMPP application server written in Erlang"; + license = lib.licenses.gpl2; + homepage = http://www.ejabberd.im; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.sander lib.maintainers.abbradar ]; + broken = withElixir; + }; +} diff --git a/krebs/5pkgs/simple/go-shortener/default.nix b/krebs/5pkgs/simple/go-shortener/default.nix index 996f7072a..4d1bef2be 100644 --- a/krebs/5pkgs/simple/go-shortener/default.nix +++ b/krebs/5pkgs/simple/go-shortener/default.nix @@ -1,25 +1,26 @@ -{ stdenv, makeWrapper, callPackage, lib, buildEnv, fetchgit, nodePackages, nodejs }: +{ stdenv, makeWrapper, lib, buildEnv, fetchgit, nodejs-8_x, pkgs }: with lib; let - np = (callPackage <nixpkgs/pkgs/top-level/node-packages.nix>) { - generated = ./packages.nix; - self = np; + nodeEnv = import <nixpkgs/pkgs/development/node-packages/node-env.nix> { + inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; + nodejs = nodejs-8_x; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; - node_env = buildEnv { - name = "node_env"; - paths = [ - np.redis - np."formidable" - ]; - pathsToLink = [ "/lib" ]; - ignoreCollisions = true; + node_env = pkgs.buildEnv { + name = "go-node_env"; + paths = attrValues (import ./node-packages.nix { + inherit (pkgs) fetchurl fetchgit; + inherit nodeEnv; + }); }; -in np.buildNodePackage { +in stdenv.mkDerivation { + packageName = "go"; name = "go-shortener"; + version = "0.0.0"; src = fetchgit { url = "http://cgit.lassul.us/go/"; @@ -32,10 +33,8 @@ in np.buildNodePackage { "installPhase" ]; - deps = (filter (v: nixType v == "derivation") (attrValues np)); - buildInputs = [ - nodejs + nodejs-8_x makeWrapper ]; @@ -44,14 +43,14 @@ in np.buildNodePackage { cp index.js $out/ cat > $out/go << EOF - ${nodejs}/bin/node $out/index.js + ${nodejs-8_x}/bin/node $out/index.js EOF chmod +x $out/go wrapProgram $out/go \ --prefix NODE_PATH : ${node_env}/lib/node_modules - ln -s $out/go /$out/bin/go + ln -s $out/go /$out/bin/go ''; } diff --git a/krebs/5pkgs/simple/go-shortener/node-packages.nix b/krebs/5pkgs/simple/go-shortener/node-packages.nix new file mode 100644 index 000000000..526cd5a11 --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/node-packages.nix @@ -0,0 +1,76 @@ +# This file has been generated by node2nix 1.5.3. Do not edit! + +{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}: + +let + sources = { + "double-ended-queue-2.1.0-0" = { + name = "double-ended-queue"; + packageName = "double-ended-queue"; + version = "2.1.0-0"; + src = fetchurl { + url = "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz"; + sha1 = "103d3527fd31528f40188130c841efdd78264e5c"; + }; + }; + "redis-commands-1.3.5" = { + name = "redis-commands"; + packageName = "redis-commands"; + version = "1.3.5"; + src = fetchurl { + url = "https://registry.npmjs.org/redis-commands/-/redis-commands-1.3.5.tgz"; + sha512 = "2q8pai3gf0dczb03jjig3mpaz4j2kvw8icpgf8hp4fryr3d6c0mjkvxxdmlyhainybx4zhgqsw9ghc9p986alzdzd2n2p4cxvr8b0by"; + }; + }; + "redis-parser-2.6.0" = { + name = "redis-parser"; + packageName = "redis-parser"; + version = "2.6.0"; + src = fetchurl { + url = "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz"; + sha1 = "52ed09dacac108f1a631c07e9b69941e7a19504b"; + }; + }; + }; +in +{ + formidable = nodeEnv.buildNodePackage { + name = "formidable"; + packageName = "formidable"; + version = "1.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz"; + sha512 = "1x0n2rfaiasdjbw1mm7s29z84f68c7iji7lb1gkxvpknvv6q7bwns7z55ijcf4vkh4kvis12rbgaaih49jf9lj53s30mllb1d35bkqn"; + }; + buildInputs = globalBuildInputs; + meta = { + description = "A node.js module for parsing form data, especially file uploads."; + homepage = https://github.com/felixge/node-formidable; + license = "MIT"; + }; + production = true; + bypassCache = true; + }; + redis = nodeEnv.buildNodePackage { + name = "redis"; + packageName = "redis"; + version = "2.8.0"; + src = fetchurl { + url = "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz"; + sha512 = "3a3044ax6qdvss83xgjfx10h5q91ls0mwgs3wpsnxcdsiipq3cnmqzsh6glyq0r7vsmpw49jp84c2jnfrhi2bgycrkd9hhhf6ia8lrk"; + }; + dependencies = [ + sources."double-ended-queue-2.1.0-0" + sources."redis-commands-1.3.5" + sources."redis-parser-2.6.0" + ]; + buildInputs = globalBuildInputs; + meta = { + description = "Redis client library"; + homepage = https://github.com/NodeRedis/node_redis; + license = "MIT"; + }; + production = true; + bypassCache = true; + }; +}
\ No newline at end of file diff --git a/krebs/5pkgs/simple/go-shortener/packages.nix b/krebs/5pkgs/simple/go-shortener/packages.nix deleted file mode 100644 index 9acfd7658..000000000 --- a/krebs/5pkgs/simple/go-shortener/packages.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ self, fetchurl, fetchgit ? null, lib }: - -{ - by-spec."formidable"."*" = - self.by-version."formidable"."1.0.17"; - by-version."formidable"."1.0.17" = self.buildNodePackage { - name = "formidable-1.0.17"; - version = "1.0.17"; - bin = false; - src = fetchurl { - url = "http://registry.npmjs.org/formidable/-/formidable-1.0.17.tgz"; - name = "formidable-1.0.17.tgz"; - sha1 = "ef5491490f9433b705faa77249c99029ae348559"; - }; - deps = { - }; - optionalDependencies = { - }; - peerDependencies = []; - os = [ ]; - cpu = [ ]; - }; - "formidable" = self.by-version."formidable"."1.0.17"; - by-spec."redis"."*" = - self.by-version."redis"."2.1.0"; - by-version."redis"."2.1.0" = self.buildNodePackage { - name = "redis-2.1.0"; - version = "2.1.0"; - bin = false; - src = fetchurl { - url = "http://registry.npmjs.org/redis/-/redis-2.1.0.tgz"; - name = "redis-2.1.0.tgz"; - sha1 = "38acb208f90750250f9451219b73ff08ae907f94"; - }; - deps = { - }; - optionalDependencies = { - }; - peerDependencies = []; - os = [ ]; - cpu = [ ]; - }; - "redis" = self.by-version."redis"."2.1.0"; -} diff --git a/krebs/5pkgs/simple/go-shortener/pkgs.json b/krebs/5pkgs/simple/go-shortener/pkgs.json new file mode 100644 index 000000000..f53ce3745 --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/pkgs.json @@ -0,0 +1,4 @@ +[ + "formidable", + "redis" +] diff --git a/krebs/5pkgs/simple/go-shortener/update.sh b/krebs/5pkgs/simple/go-shortener/update.sh new file mode 100755 index 000000000..0c1ecc58c --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/update.sh @@ -0,0 +1,2 @@ +node2nix -8 -i pkgs.json -c combine.nix +rm node-env.nix combine.nix diff --git a/krebs/5pkgs/simple/hashPassword/default.nix b/krebs/5pkgs/simple/hashPassword/default.nix index 3da65ad79..3c604be80 100644 --- a/krebs/5pkgs/simple/hashPassword/default.nix +++ b/krebs/5pkgs/simple/hashPassword/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: pkgs.writeDashBin "hashPassword" '' - # usage: hashPassword + # usage: hashPassword [...] set -euf export PATH=${lib.makeBinPath (with pkgs; [ @@ -11,5 +11,5 @@ pkgs.writeDashBin "hashPassword" '' ])} salt=$(openssl rand -base64 16 | tr -d '+=' | head -c 16) - exec mkpasswd -m sha-512 -S "$salt" + exec mkpasswd -m sha-512 -S "$salt" "$@" '' diff --git a/krebs/5pkgs/simple/kops.nix b/krebs/5pkgs/simple/kops.nix new file mode 100644 index 000000000..a6c82f3ca --- /dev/null +++ b/krebs/5pkgs/simple/kops.nix @@ -0,0 +1,7 @@ +{ fetchgit, ... }: + +fetchgit { + url = https://cgit.krebsco.de/kops; + rev = "refs/tags/v1.0.0"; + sha256 = "0wg8d80sxa46z4i7ir79sci2hwmv3qskzqdg0si64p6vazy8vckb"; +} diff --git a/krebs/5pkgs/simple/newsbot-js/default.nix b/krebs/5pkgs/simple/newsbot-js/default.nix index fa39823d3..cc362b86a 100644 --- a/krebs/5pkgs/simple/newsbot-js/default.nix +++ b/krebs/5pkgs/simple/newsbot-js/default.nix @@ -1,27 +1,27 @@ -{ stdenv, makeWrapper, callPackage, lib, buildEnv, fetchgit, nodePackages, nodejs }: +{ stdenv, makeWrapper, lib, buildEnv, fetchgit, nodejs-8_x, pkgs, icu }: with lib; let - np = (callPackage <nixpkgs/pkgs/top-level/node-packages.nix>) { - generated = ./packages.nix; - self = np; + nodeEnv = import <nixpkgs/pkgs/development/node-packages/node-env.nix> { + inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; + nodejs = nodejs-8_x; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; - node_env = buildEnv { - name = "node_env"; - paths = [ - np.feedparser - np.form-data - np.irc - np.request - np.shell-quote - ]; - pathsToLink = [ "/lib" ]; - ignoreCollisions = true; + node_env = pkgs.buildEnv { + name = "go-node_env"; + paths = attrValues (import ./node-packages.nix { + inherit (pkgs) fetchurl fetchgit; + inherit nodeEnv; + globalBuildInputs = [ + icu.dev + ]; + }); }; -in np.buildNodePackage { + +in stdenv.mkDerivation { name = "newsbot-js"; src = fetchgit { @@ -32,14 +32,11 @@ in np.buildNodePackage { phases = [ "unpackPhase" - "patchPhase" "installPhase" ]; - deps = (filter (v: nixType v == "derivation") (attrValues np)); - buildInputs = [ - nodejs + nodejs-8_x makeWrapper ]; @@ -48,7 +45,7 @@ in np.buildNodePackage { cp newsbot.js $out/ cat > $out/newsbot << EOF - ${nodejs}/bin/node $out/newsbot.js + ${nodejs-8_x}/bin/node $out/newsbot.js EOF chmod +x $out/newsbot diff --git a/krebs/5pkgs/simple/newsbot-js/node-packages.nix b/krebs/5pkgs/simple/newsbot-js/node-packages.nix new file mode 100644 index 000000000..d6b2a06dd --- /dev/null +++ b/krebs/5pkgs/simple/newsbot-js/node-packages.nix @@ -0,0 +1,844 @@ +# This file has been generated by node2nix 1.5.3. Do not edit! + +{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}: + +let + sources = { + "addressparser-1.0.1" = { + name = "addressparser"; + packageName = "addressparser"; + version = "1.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz"; + sha1 = "47afbe1a2a9262191db6838e4fd1d39b40821746"; + }; + }; + "ajv-5.5.2" = { + name = "ajv"; + packageName = "ajv"; + version = "5.5.2"; + src = fetchurl { + url = "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz"; + sha1 = "73b5eeca3fab653e3d3f9422b341ad42205dc965"; + }; + }; + "array-filter-0.0.1" = { + name = "array-filter"; + packageName = "array-filter"; + version = "0.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz"; + sha1 = "7da8cf2e26628ed732803581fd21f67cacd2eeec"; + }; + }; + "array-indexofobject-0.0.1" = { + name = "array-indexofobject"; + packageName = "array-indexofobject"; + version = "0.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/array-indexofobject/-/array-indexofobject-0.0.1.tgz"; + sha1 = "aaa128e62c9b3c358094568c219ff64fe489d42a"; + }; + }; + "array-map-0.0.0" = { + |