From d99bbadf37b04cd1f5efb1e04d5996ef7dfd969a Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Sep 2018 02:52:58 +0200 Subject: ma home-manager: init --- makefu/2configs/home-manager/cli.nix | 12 +++++++++ makefu/2configs/home-manager/default.nix | 7 +++++ makefu/2configs/home-manager/desktop.nix | 31 +++++++++++++++++++++ makefu/2configs/home-manager/mail.nix | 46 ++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 makefu/2configs/home-manager/cli.nix create mode 100644 makefu/2configs/home-manager/default.nix create mode 100644 makefu/2configs/home-manager/desktop.nix create mode 100644 makefu/2configs/home-manager/mail.nix (limited to 'makefu') diff --git a/makefu/2configs/home-manager/cli.nix b/makefu/2configs/home-manager/cli.nix new file mode 100644 index 000000000..1efc4d2bf --- /dev/null +++ b/makefu/2configs/home-manager/cli.nix @@ -0,0 +1,12 @@ +{ + home-manager.users.makefu = { + services.gpg-agent = { + defaultCacheTtl = 900; + maxCacheTtl = 7200; + defaultCacheTtlSsh = 3600; + maxCacheTtlSsh = 86400; + enableSshSupport = true; + }; + programs.fzf.enable = true; # alt-c + }; +} diff --git a/makefu/2configs/home-manager/default.nix b/makefu/2configs/home-manager/default.nix new file mode 100644 index 000000000..e75ee6262 --- /dev/null +++ b/makefu/2configs/home-manager/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + + ]; + home-manager.users.makefu = { + }; +} diff --git a/makefu/2configs/home-manager/desktop.nix b/makefu/2configs/home-manager/desktop.nix new file mode 100644 index 000000000..c2f854d47 --- /dev/null +++ b/makefu/2configs/home-manager/desktop.nix @@ -0,0 +1,31 @@ +{pkgs, ... }: { + home-manager.users.makefu = { + programs.browserpass = { browsers = [ "firefox" ] ; enable = true; }; + services.network-manager-applet.enable = true; + services.blueman-applet.enable = true; + services.pasystray.enable = true; + + systemd.user.services.network-manager-applet.Service.Environment = '' + XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache + ''; + systemd.user.services.clipit = { + Unit = { + Description = "clipboard manager"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + Environment = '' + XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache + ''; + ExecStart = "${pkgs.clipit}/bin/clipit"; + Restart = "on-abort"; + }; + }; + }; +} diff --git a/makefu/2configs/home-manager/mail.nix b/makefu/2configs/home-manager/mail.nix new file mode 100644 index 000000000..ce7ae4f4d --- /dev/null +++ b/makefu/2configs/home-manager/mail.nix @@ -0,0 +1,46 @@ +{ + home-manager.users.makefu = { + accounts.email.accounts.syntaxfehler = { + address = "felix.richter@syntax-fehler.de"; + userName = "Felix.Richter@syntax-fehler.de"; + imap = { + host = "syntax-fehler.de"; + tls = { + enable = true; + }; + }; + smtp = { + host = "syntax-fehler.de"; + tls = { + enable = true; + }; + }; + msmtp.enable = true; + notmuch.enable = true; + offlineimap = { + enable = true; + postSyncHookCommand = "notmuch new"; + extraConfig.remote = { + holdconnectionopen = true; + idlefolders = "['INBOX']"; + }; + }; + primary = true; + realName = "Felix Richter"; + passwordCommand = "gpg --use-agent --quiet --batch -d /home/makefu/.mail/syntax-fehler.gpg"; + }; + programs.offlineimap.enable = true; + programs.offlineimap.extraConfig = { + mbnames = { + filename = "~/.mutt/muttrc.mailboxes"; + header = "'mailboxes '"; + peritem = "'+%(accountname)s/%(foldername)s'"; + sep = "' '"; + footer = "'\\n'"; + }; + general = { + ui = "TTY.TTYUI"; + }; + }; + }; +} -- cgit v1.2.3 From ddfce29ec614320ba95d236f45ff67c52e56feb3 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Sep 2018 02:53:18 +0200 Subject: ma x.r: use home-manager --- makefu/1systems/x/config.nix | 4 ++++ makefu/1systems/x/source.nix | 1 + makefu/krops.nix | 11 ++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'makefu') diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 97d11fbd3..66d904512 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -7,6 +7,10 @@ [ # base + + + + diff --git a/makefu/1systems/x/source.nix b/makefu/1systems/x/source.nix index 75af3255b..050fd39f7 100644 --- a/makefu/1systems/x/source.nix +++ b/makefu/1systems/x/source.nix @@ -6,5 +6,6 @@ unstable = true; mic92 = true; clever_kexec = true; + home-manager = true; # torrent = true; } diff --git a/makefu/krops.nix b/makefu/krops.nix index f8ea6f7ef..ddb4afece 100644 --- a/makefu/krops.nix +++ b/makefu/krops.nix @@ -20,12 +20,11 @@ nms = false; arm6 = false; clever_kexec = false; + home-manager = false; } // import (./. + "/1systems/${name}/source.nix"); source = { test }: lib.evalSource [ { - # nixos-18.03 @ 2018-08-06 - # + do_sqlite3 ruby: 55a952be5b5 - # + exfat-nofuse bump: ee6a5296a35 + # nixos-18.09 @ 2018-09-18 # + uhub/sqlite: 5dd7610401747 nixpkgs = if test || host-src.full then { git.ref = nixpkgs-src.rev; @@ -70,6 +69,12 @@ ref = "30fdd53"; }; }) + (lib.mkIf ( host-src.home-manager ) { + home-manager.git = { + url = https://github.com/rycee/home-manager; + ref = "6eea2a4"; + }; + }) ]; in { -- cgit v1.2.3 From 7a372f24920354a25773dc1713d65c1387e45500 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 21 Sep 2018 15:30:25 +0200 Subject: ma pkgs.pavumeter: init not worth it --- makefu/5pkgs/pavumeter/default.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 makefu/5pkgs/pavumeter/default.nix (limited to 'makefu') diff --git a/makefu/5pkgs/pavumeter/default.nix b/makefu/5pkgs/pavumeter/default.nix new file mode 100644 index 000000000..b1822530a --- /dev/null +++ b/makefu/5pkgs/pavumeter/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchurl, libusb, libtool, autoconf, pkgconfig, git, +gettext, automake, libxml2 +, autoreconfHook +, lynx +, gtkmm2 +, libpulseaudio +, gnome2 +, libsigcxx +}: +stdenv.mkDerivation rec { + pname = "pavumeter"; + name = "${pname}-${version}"; + version = "0.9.3"; + + src = fetchurl { + url = "http://0pointer.de/lennart/projects/${pname}/${name}.tar.gz"; + sha256 = "0yq67w8j8l1xsv8pp37bylax22npd6msbavr6pb25yvyq825i3gx"; + }; + + buildInputs = [ gtkmm2 libpulseaudio gnome2.gnome_icon_theme ]; + nativeBuildInputs = [ pkgconfig autoreconfHook lynx ]; + + meta = { + description = "PulseAudio volumene meter"; + homepage = http://0pointer.de/lennart/projects/pavumeter; + license = stdenv.lib.licenses.gpl2; + platforms = stdenv.lib.platforms.linux; + maintainers = with stdenv.lib.maintainers; [ makefu ]; + }; +} -- cgit v1.2.3 From 806dd39bd14119f17a954540195e4aa835527e21 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 23 Sep 2018 20:17:36 +0200 Subject: ma pkgs.airdcpp-webclient: WIP --- makefu/5pkgs/airdcpp-webclient/default.nix | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 makefu/5pkgs/airdcpp-webclient/default.nix (limited to 'makefu') diff --git a/makefu/5pkgs/airdcpp-webclient/default.nix b/makefu/5pkgs/airdcpp-webclient/default.nix new file mode 100644 index 000000000..5e13b2347 --- /dev/null +++ b/makefu/5pkgs/airdcpp-webclient/default.nix @@ -0,0 +1,63 @@ +{ stdenv, fetchFromGitHub +, cmake +, nodejs +, git +, miniupnpc +, boost +, leveldb +, openssl +, geoip +, libmaxminddb +, websocketpp +, libnatpmp +, tbb +, bzip2 +, zlib +, pkgconfig +, python +}: +stdenv.mkDerivation rec { + name = "airdcpp-webclient-${version}"; + version = "2.3.0"; + + src = fetchFromGitHub { + owner = "airdcpp-web"; + repo = "airdcpp-webclient"; + rev = version; + sha256 = "1k07ggfw2vq1cs7smykkgkqd8wayamlw1g1mnijjvza4f3zbvihp"; + }; + + nativeBuildInputs = [ cmake git nodejs pkgconfig python ]; + preConfigure ='' + echo pkgconfig: $PKG_CONFIG_PATH + # sed -i s/find_package/pkg_search_module/ CMakeLists.txt + ''; + buildInput = [ miniupnpc boost leveldb openssl geoip websocketpp libmaxminddb libnatpmp tbb bzip2 zlib]; + cmakeFlags = [ + "-DLIBMAXMINDDB_ROOT_DIR=${libmaxminddb}" + "-DBZIP2_INCLUDE_DIR=${bzip2}/include" + "-DBZIP2_LIBRARIES=${bzip2}/lib" + "-DZLIB_INCLUDE_DIR=${zlib}/include" + "-DZLIB_LIBRARY=${zlib}/lib" + "-DOPENSSL_CRYPTO_LIBRARY=${openssl}/lib" + "-DOPENSSL_INCLUDE_DIR=${openssl}/include" + "-DMINIUPNP_LIBRARY=${miniupnpc}/lib" + "-DMINIUPNP_INCLUDE_DIR=${miniupnpc}/include" + "-DLevelDB_LIBRARY=${leveldb}/lib" + "-DLevelDB_INCLUDE_DIR=${leveldb}/include" + "-DLibNatpmp_INCLUDE_DIR=${libnatpmp}/include" + "-DLibNatpmp_LIBRARY=${libnatpmp}/lib" + "-DBoost_INCLUDE_DIR=${boost.dev}/include" + "-DBoost_LIBRARY=${boost}/lib" + "-DWebsocketpp_INCLUDE_DIR=${websocketpp}/include" + "-DWebsocketpp_LIBRARY=${websocketpp}/lib" + ]; + + meta = with stdenv.lib; { + description = "dcpp client"; + homepage = http://fixme; + license = licenses.gpl3; + maintainers = with maintainers; [ makefu ]; + platforms = with platforms; linux; + }; +} -- cgit v1.2.3 From c7c6b7e504beed811e3d83bda0016412372be670 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 23 Sep 2018 22:32:37 +0200 Subject: ma airdcpp module: init --- makefu/3modules/airdcpp.nix | 118 +++++++++++++++++++++++++++++ makefu/5pkgs/airdcpp-webclient/default.nix | 60 +++------------ 2 files changed, 130 insertions(+), 48 deletions(-) create mode 100644 makefu/3modules/airdcpp.nix (limited to 'makefu') diff --git a/makefu/3modules/airdcpp.nix b/makefu/3modules/airdcpp.nix new file mode 100644 index 000000000..aeb77785e --- /dev/null +++ b/makefu/3modules/airdcpp.nix @@ -0,0 +1,118 @@ +{ config, lib, pkgs, ... }: +with import ; #genid +let + cfg = config.makefu.airdcpp; + + out = { + options.makefu.airdcpp = api; + config = lib.mkIf cfg.enable imp; + }; + + api = with types;{ + enable = mkEnableOption "airdcpp"; + + package = mkOption { + type = package; + default = pkgs.airdcpp-webclient; + }; + + user = mkOption { + description = '' + user which will run udpt. if kept default a new user will be created + ''; + type = str; + default = "airdcpp"; + }; + + stateDir = mkOption { + description = '' + directory for storing state (pid,config) + ''; + type = str; + default = "/var/lib/airdcpp"; + }; + web = mkOption { + type = submodule ( { config, ... }: { + options = { + port = mkOption { + description = ''web-ui port + + NOTE: once the initial config had been written to the state directory it will not be replaced + ''; + type = int; + default = 5600; + }; + # TODO: tlsPort + # TODO: at least one user + users = mkOption { + type = attrsOf (submodule ( { config, ... }: { + options = { + password = mkOption { + description = "password of user"; + type = str; + }; + permissions = mkOption { + description = "user permissions"; + type = str; + default = "admin"; + }; + }; + })); + }; + }; + }); + }; + initialConfigFile = mkOption { + description = '' + path inital configuration if none exists + ''; + type = nullOr path; + default = null; + }; + }; + + imp = let + genUsers = users: concatMapStringsSep "\n" (user: '''' ) + (mapAttrsToList (name: val: val // { inherit name; }) users); + configFile = if (cfg.initialConfigFile == null) then builtins.trace "warning: airdcpp passwords are stored in plain text" pkgs.writeText "initial-config" '' + + + + + + + ${genUsers cfg.web.users} + + + '' else cfg.initialConfigFile; + in { + systemd.services.airdcpp = { + description = "airdcpp webui"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + restartIfChanged = true; + serviceConfig = { + Type = "simple"; + ExecStartPre = pkgs.writeDash "prepare-env" '' + d=${cfg.stateDir}/WebServer.xml + test -e $d || install -m700 -o${cfg.user} ${configFile} $d + ''; + PermissionsStartOnly = true; + ExecStart = "${cfg.package}/bin/airdcppd -c=${cfg.stateDir} -p=${cfg.stateDir}/airdcpp.pid"; + PrivateTmp = true; + WorkingDirectory = cfg.stateDir; + User = "${cfg.user}"; + }; + }; + users = lib.mkIf (cfg.user == "airdcpp") { + users.airdcpp = { + uid = genid "airdcpp"; + home = cfg.stateDir; + createHome = true; + }; + groups.airdcpp.gid = genid "airdcpp"; + }; + }; +in +out + diff --git a/makefu/5pkgs/airdcpp-webclient/default.nix b/makefu/5pkgs/airdcpp-webclient/default.nix index 5e13b2347..361a7da65 100644 --- a/makefu/5pkgs/airdcpp-webclient/default.nix +++ b/makefu/5pkgs/airdcpp-webclient/default.nix @@ -1,60 +1,24 @@ -{ stdenv, fetchFromGitHub -, cmake -, nodejs -, git -, miniupnpc -, boost -, leveldb -, openssl -, geoip -, libmaxminddb -, websocketpp -, libnatpmp -, tbb -, bzip2 -, zlib -, pkgconfig -, python +{ stdenv, fetchurl }: stdenv.mkDerivation rec { name = "airdcpp-webclient-${version}"; version = "2.3.0"; - - src = fetchFromGitHub { - owner = "airdcpp-web"; - repo = "airdcpp-webclient"; - rev = version; - sha256 = "1k07ggfw2vq1cs7smykkgkqd8wayamlw1g1mnijjvza4f3zbvihp"; + + src = fetchurl { + url = http://web-builds.airdcpp.net/stable/airdcpp_2.3.0_webui-2.3.0_64-bit_portable.tar.gz; + sha256 = "0yvcl0nc70fghc7vfsgvbpryi5q97arld8adql4way4qa0mdnyv1"; }; - nativeBuildInputs = [ cmake git nodejs pkgconfig python ]; - preConfigure ='' - echo pkgconfig: $PKG_CONFIG_PATH - # sed -i s/find_package/pkg_search_module/ CMakeLists.txt + phases = [ "unpackPhase" "installPhase" ]; + installPhase = '' + mkdir -p $out/{share,bin} + cp -r * $out/share + ln -s $out/share/airdcppd $out/bin/ ''; - buildInput = [ miniupnpc boost leveldb openssl geoip websocketpp libmaxminddb libnatpmp tbb bzip2 zlib]; - cmakeFlags = [ - "-DLIBMAXMINDDB_ROOT_DIR=${libmaxminddb}" - "-DBZIP2_INCLUDE_DIR=${bzip2}/include" - "-DBZIP2_LIBRARIES=${bzip2}/lib" - "-DZLIB_INCLUDE_DIR=${zlib}/include" - "-DZLIB_LIBRARY=${zlib}/lib" - "-DOPENSSL_CRYPTO_LIBRARY=${openssl}/lib" - "-DOPENSSL_INCLUDE_DIR=${openssl}/include" - "-DMINIUPNP_LIBRARY=${miniupnpc}/lib" - "-DMINIUPNP_INCLUDE_DIR=${miniupnpc}/include" - "-DLevelDB_LIBRARY=${leveldb}/lib" - "-DLevelDB_INCLUDE_DIR=${leveldb}/include" - "-DLibNatpmp_INCLUDE_DIR=${libnatpmp}/include" - "-DLibNatpmp_LIBRARY=${libnatpmp}/lib" - "-DBoost_INCLUDE_DIR=${boost.dev}/include" - "-DBoost_LIBRARY=${boost}/lib" - "-DWebsocketpp_INCLUDE_DIR=${websocketpp}/include" - "-DWebsocketpp_LIBRARY=${websocketpp}/lib" - ]; meta = with stdenv.lib; { - description = "dcpp client"; + # to start it: airdcpp -p= -c= --configure + description = "dcpp client (statically precompiled)"; homepage = http://fixme; license = licenses.gpl3; maintainers = with maintainers; [ makefu ]; -- cgit v1.2.3 From 1996b597480ab45bbd15c0d7095921ced7a9e9ab Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 00:36:56 +0200 Subject: ma airdcpp module: pre-configure shares --- makefu/3modules/airdcpp.nix | 170 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 131 insertions(+), 39 deletions(-) (limited to 'makefu') diff --git a/makefu/3modules/airdcpp.nix b/makefu/3modules/airdcpp.nix index aeb77785e..5250ee67a 100644 --- a/makefu/3modules/airdcpp.nix +++ b/makefu/3modules/airdcpp.nix @@ -23,6 +23,12 @@ let type = str; default = "airdcpp"; }; + extraGroups = mkOption { + description = ''extra groups for the user (only for default user)''; + type = listOf str; + default = []; + example = [ "nginx" ]; + }; stateDir = mkOption { description = '' @@ -31,50 +37,108 @@ let type = str; default = "/var/lib/airdcpp"; }; - web = mkOption { - type = submodule ( { config, ... }: { - options = { - port = mkOption { - description = ''web-ui port - - NOTE: once the initial config had been written to the state directory it will not be replaced - ''; - type = int; - default = 5600; - }; - # TODO: tlsPort - # TODO: at least one user - users = mkOption { - type = attrsOf (submodule ( { config, ... }: { - options = { - password = mkOption { - description = "password of user"; - type = str; - }; - permissions = mkOption { - description = "user permissions"; - type = str; - default = "admin"; - }; - }; - })); + dcpp = { + Nick = mkOption { + description = '' + Nick Name for connection + ''; + type = str; + default = "kevin"; + }; + InPort = mkOption { + description = "Input Port"; + type = int; + default = 16849; + }; + UDPPort = mkOption { + description = "UDP open Port"; + type = int; + default = 16849; + }; + TLSPort = mkOption { + description = "TLS open Port"; + type = int; + default = 16869; + }; + DownloadSpeed = mkOption { + description = "Total Download Speed in Mbps/s"; + type = str; + default = "100"; + }; + UploadSpeed = mkOption { + description = "Total Upload Speed in Mbp/s"; + type = str; + default = "100"; + }; + shares = mkOption { + default = {}; + type = attrsOf (submodule ( { config, ... }: { + options = { + path = mkOption { + description = "path to the share"; + type = str; + }; + incoming = mkOption { + description = "incoming"; + type = bool; + default = false; + }; }; - }; - }); + })); + }; + initialConfigFile = mkOption { + description = '' + path inital DCPlusPlus.xml configuration if none exists + ''; + type = nullOr path; + default = null; + }; }; - initialConfigFile = mkOption { - description = '' - path inital configuration if none exists - ''; - type = nullOr path; - default = null; + web = { + port = mkOption { + description = ''web-ui port + + NOTE: once the initial config had been written to the state directory it will not be replaced + ''; + type = int; + default = 5600; + }; + initialConfigFile = mkOption { + description = '' + path inital WebServer.xml configuration if none exists + ''; + type = nullOr path; + default = null; + }; + # TODO: tlsPort + users = mkOption { + type = attrsOf (submodule ( { config, ... }: { + options = { + password = mkOption { + description = "password of user"; + type = str; + }; + permissions = mkOption { + description = "user permissions"; + type = str; + default = "admin"; + }; + }; + })); + }; }; }; imp = let - genUsers = users: concatMapStringsSep "\n" (user: '''' ) + genUsers = users: concatMapStringsSep "\n" (user: + '''' ) (mapAttrsToList (name: val: val // { inherit name; }) users); - configFile = if (cfg.initialConfigFile == null) then builtins.trace "warning: airdcpp passwords are stored in plain text" pkgs.writeText "initial-config" '' + genShares = shares: concatMapStringsSep "\n" (share: + ''${share.path}'' ) + (mapAttrsToList (name: val: val // { inherit name; }) shares); + webConfigFile = if (cfg.web.initialConfigFile == null) then builtins.trace "warning: airdcpp passwords are stored in plain text" pkgs.writeText "initial-config" '' @@ -84,7 +148,32 @@ let ${genUsers cfg.web.users} - '' else cfg.initialConfigFile; + '' else cfg.web.initialConfigFile; + dcppConfigFile = if (cfg.dcpp.initialConfigFile == null) then pkgs.writeText "initial-config" '' + + + + ${cfg.dcpp.Nick} + ${cfg.package.version} + ${toString cfg.dcpp.InPort} + ${toString cfg.dcpp.UDPPort} + ${toString cfg.dcpp.TLSPort} + 0 + 0 + 1 + 0 + 0 + 1 + ${cfg.dcpp.DownloadSpeed} + ${cfg.dcpp.UploadSpeed} + + + ${genShares cfg.dcpp.shares} + + + + + '' else cfg.dcpp.initialConfigFile; in { systemd.services.airdcpp = { description = "airdcpp webui"; @@ -95,7 +184,9 @@ let Type = "simple"; ExecStartPre = pkgs.writeDash "prepare-env" '' d=${cfg.stateDir}/WebServer.xml - test -e $d || install -m700 -o${cfg.user} ${configFile} $d + test -e $d || install -m700 -o${cfg.user} ${webConfigFile} $d + d=${cfg.stateDir}/DCPlusPlus.xml + test -e $d || install -m700 -o${cfg.user} ${dcppConfigFile} $d ''; PermissionsStartOnly = true; ExecStart = "${cfg.package}/bin/airdcppd -c=${cfg.stateDir} -p=${cfg.stateDir}/airdcpp.pid"; @@ -109,6 +200,7 @@ let uid = genid "airdcpp"; home = cfg.stateDir; createHome = true; + inherit (cfg) extraGroups; }; groups.airdcpp.gid = genid "airdcpp"; }; -- cgit v1.2.3 From 3285aefea4f8cadb389e4cc96c2621dc9b7e8b14 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 11:16:16 +0200 Subject: ma airdcpp module: add hubs --- makefu/3modules/airdcpp.nix | 73 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) (limited to 'makefu') diff --git a/makefu/3modules/airdcpp.nix b/makefu/3modules/airdcpp.nix index 5250ee67a..6709f0238 100644 --- a/makefu/3modules/airdcpp.nix +++ b/makefu/3modules/airdcpp.nix @@ -37,6 +37,51 @@ let type = str; default = "/var/lib/airdcpp"; }; + hubs = mkOption { + type = attrsOf (submodule ( { config, ... }: { + options = { + Nick = mkOption { + description = '' + Nick Name for hub + ''; + type = str; + default = cfg.Nick; + }; + Password = mkOption { + description = '' + Password to be used + + WARNING: will be stored in plain text in /nix/store + ''; + type = str; + default = ""; + }; + Server = mkOption { + description = '' + URL to the hub (must be provided) + ''; + type = str; + }; + AutoConnect = mkOption { + description = '' + automatically connect to the hub + ''; + type = bool; + default = false; + }; + }; + })); + description = "hubs which should be configured via Favorites.xml, + Options are only used if no initial Favorites.xml file is provided and none exists"; + default = {}; + }; + initialFavoritesConfigFile = mkOption { + description = '' + path inital Favorites.xml configuration if none exists + ''; + type = nullOr path; + default = null; + }; dcpp = { Nick = mkOption { description = '' @@ -133,11 +178,6 @@ let genUsers = users: concatMapStringsSep "\n" (user: '''' ) (mapAttrsToList (name: val: val // { inherit name; }) users); - genShares = shares: concatMapStringsSep "\n" (share: - ''${share.path}'' ) - (mapAttrsToList (name: val: val // { inherit name; }) shares); webConfigFile = if (cfg.web.initialConfigFile == null) then builtins.trace "warning: airdcpp passwords are stored in plain text" pkgs.writeText "initial-config" '' @@ -149,16 +189,33 @@ let '' else cfg.web.initialConfigFile; + genHubs = hubs: concatMapStringsSep "\n" (hub: + '''' ) + (mapAttrsToList (name: val: val // { inherit name; }) cfg.hubs); + favoritesConfigFile = if (cfg.initialFavoritesConfigFile == null) then + builtins.trace "warning: airdcpp hub passwords are stored in plain text" pkgs.writeText "initial-config" '' + + + + ${genHubs cfg.hubs} + + + '' else cfg.initialFavoritesConfigFile; + genShares = shares: concatMapStringsSep "\n" (share: + ''${share.path}'' ) + (mapAttrsToList (name: val: val // { inherit name; }) shares); dcppConfigFile = if (cfg.dcpp.initialConfigFile == null) then pkgs.writeText "initial-config" '' ${cfg.dcpp.Nick} - ${cfg.package.version} ${toString cfg.dcpp.InPort} ${toString cfg.dcpp.UDPPort} ${toString cfg.dcpp.TLSPort} - 0 0 1 0 @@ -187,6 +244,8 @@ let test -e $d || install -m700 -o${cfg.user} ${webConfigFile} $d d=${cfg.stateDir}/DCPlusPlus.xml test -e $d || install -m700 -o${cfg.user} ${dcppConfigFile} $d + d=${cfg.stateDir}/Favorites.xml + test -e $d || install -m700 -o${cfg.user} ${favoritesConfigFile} $d ''; PermissionsStartOnly = true; ExecStart = "${cfg.package}/bin/airdcppd -c=${cfg.stateDir} -p=${cfg.stateDir}/airdcpp.pid"; -- cgit v1.2.3 From 7afd90f7452e9936e96910bebbfd32c94308e8eb Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 11:26:53 +0200 Subject: ma secrets: add more dummy secrets --- makefu/0tests/data/secrets/airdcpp-makefu.pw | 0 makefu/0tests/data/secrets/krebshub.pw | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 makefu/0tests/data/secrets/airdcpp-makefu.pw create mode 100644 makefu/0tests/data/secrets/krebshub.pw (limited to 'makefu') diff --git a/makefu/0tests/data/secrets/airdcpp-makefu.pw b/makefu/0tests/data/secrets/airdcpp-makefu.pw new file mode 100644 index 000000000..e69de29bb diff --git a/makefu/0tests/data/secrets/krebshub.pw b/makefu/0tests/data/secrets/krebshub.pw new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From b1c9bcf85c7cb0d3f02554d9a8d7045f1a16bd2c Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 14:15:08 +0200 Subject: ma airdcpp.mod: remove newlines from passwords --- makefu/3modules/airdcpp.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'makefu') diff --git a/makefu/3modules/airdcpp.nix b/makefu/3modules/airdcpp.nix index 6709f0238..342052e70 100644 --- a/makefu/3modules/airdcpp.nix +++ b/makefu/3modules/airdcpp.nix @@ -55,6 +55,7 @@ let ''; type = str; default = ""; + apply = lib.removeSuffix "\n"; }; Server = mkOption { description = '' @@ -162,6 +163,7 @@ let password = mkOption { description = "password of user"; type = str; + apply = lib.removeSuffix "\n"; }; permissions = mkOption { description = "user permissions"; -- cgit v1.2.3 From 31b0fe6f69077b56f167f388df5afe5ae26d0b8f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 14:20:23 +0200 Subject: ma airdcpp: init --- makefu/2configs/dcpp/airdcpp.nix | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 makefu/2configs/dcpp/airdcpp.nix (limited to 'makefu') diff --git a/makefu/2configs/dcpp/airdcpp.nix b/makefu/2configs/dcpp/airdcpp.nix new file mode 100644 index 000000000..44940812d --- /dev/null +++ b/makefu/2configs/dcpp/airdcpp.nix @@ -0,0 +1,48 @@ +{ config, ... }: +{ + makefu.airdcpp = { + enable = true; + extraGroups = [ "download" ]; + web.port = 5600; + web.users.makefu.password = builtins.readFile ; # watch out for newline! + hubs."krebshub" = + { Nick = "makefu-${config.krebs.build.host.name}"; + Password = builtins.readFile ; + Server = "adcs://hub.nsupdate.info:411"; + AutoConnect = true; + }; + dcpp = { + shares = { + # Incoming must be writeable! + incoming = { path = config.makefu.dl-dir + "/dcpp"; incoming = true; }; + audiobooks.path = config.makefu.dl-dir + "/audiobooks"; + }; + Nick = "makefu"; + DownloadSpeed = "1000"; + UploadSpeed = "1000"; + }; + }; + networking.firewall.allowedTCPPorts = + [ config.makefu.airdcpp.dcpp.InPort + config.makefu.airdcpp.dcpp.TLSPort + ]; + networking.firewall.allowedUDPPorts = [ config.makefu.airdcpp.dcpp.UDPPort ]; + + services.nginx.virtualHosts."dcpp.${config.krebs.build.host.name}.r".locations."/" = + { proxyPass = "http://localhost:${toString config.makefu.airdcpp.web.port}/"; + + extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + gzip_types text/plain application/javascript; + + # Proxy websockets + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + ''; + }; + +} -- cgit v1.2.3 From cc9d7b63f23c9383f68420c0c936a0b581850e28 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 14:21:20 +0200 Subject: ma nextgum: enable airdcpp --- makefu/1systems/nextgum/config.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'makefu') diff --git a/makefu/1systems/nextgum/config.nix b/makefu/1systems/nextgum/config.nix index db22cf9b8..64516fa98 100644 --- a/makefu/1systems/nextgum/config.nix +++ b/makefu/1systems/nextgum/config.nix @@ -25,11 +25,12 @@ in { - + # # services + # sharing @@ -73,6 +74,7 @@ in { # # + # @@ -94,6 +96,7 @@ in { + # ## Temporary: -- cgit v1.2.3 From 49e0ae20c9ac96c3f2e12e0faf6d2bd7e9348d61 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 14:34:27 +0200 Subject: ma modules: add airdcpp --- makefu/3modules/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'makefu') diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix index f06ce3d53..963649c63 100644 --- a/makefu/3modules/default.nix +++ b/makefu/3modules/default.nix @@ -2,17 +2,18 @@ _: { imports = [ - ./state.nix - ./populate.nix + ./airdcpp.nix ./awesome-extra.nix ./deluge.nix ./forward-journal.nix ./opentracker.nix ./ps3netsrv.nix ./logging-config.nix + ./populate.nix ./sane-extra.nix ./server-config.nix ./snapraid.nix + ./state.nix ./torrent.nix ./udpt.nix ]; -- cgit v1.2.3 From 796ad2c5c8ed67a4ece5a78e8e9cd5e1fbfe4e9e Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 14:34:50 +0200 Subject: ma state.mod: put activation logic into module --- makefu/3modules/state.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'makefu') diff --git a/makefu/3modules/state.nix b/makefu/3modules/state.nix index 461b90152..a87f438fe 100644 --- a/makefu/3modules/state.nix +++ b/makefu/3modules/state.nix @@ -6,4 +6,11 @@ description = "state which is currently scattered on the machine"; default = []; }; + + config.system.activationScripts.state = lib.optionalString (config.state != []) '' + cat << EOF + This machine is burdened with state: + ${lib.concatMapStringsSep "\n" (d: "* ${d}") config.state} + EOF + ''; } -- cgit v1.2.3 From 20c69c0386df4606af544342d7de6638356572a3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 23:32:28 +0200 Subject: treewide: makefu.airdcpp -> krebs.airdcpp --- makefu/2configs/dcpp/airdcpp.nix | 14 +- makefu/3modules/airdcpp.nix | 271 ----------------------------- makefu/3modules/default.nix | 1 - makefu/5pkgs/airdcpp-webclient/default.nix | 27 --- 4 files changed, 7 insertions(+), 306 deletions(-) delete mode 100644 makefu/3modules/airdcpp.nix delete mode 100644 makefu/5pkgs/airdcpp-webclient/default.nix (limited to 'makefu') diff --git a/makefu/2configs/dcpp/airdcpp.nix b/makefu/2configs/dcpp/airdcpp.nix index 44940812d..fe05effd9 100644 --- a/makefu/2configs/dcpp/airdcpp.nix +++ b/makefu/2configs/dcpp/airdcpp.nix @@ -1,6 +1,6 @@ { config, ... }: { - makefu.airdcpp = { + krebs.airdcpp = { enable = true; extraGroups = [ "download" ]; web.port = 5600; @@ -14,8 +14,8 @@ dcpp = { shares = { # Incoming must be writeable! - incoming = { path = config.makefu.dl-dir + "/dcpp"; incoming = true; }; - audiobooks.path = config.makefu.dl-dir + "/audiobooks"; + incoming = { path = config.makefu.dl-dir + "/finished/dcpp"; incoming = true; }; + audiobooks.path = config.makefu.dl-dir + "/finished/audiobooks"; }; Nick = "makefu"; DownloadSpeed = "1000"; @@ -23,13 +23,13 @@ }; }; networking.firewall.allowedTCPPorts = - [ config.makefu.airdcpp.dcpp.InPort - config.makefu.airdcpp.dcpp.TLSPort + [ config.krebs.airdcpp.dcpp.InPort + config.krebs.airdcpp.dcpp.TLSPort ]; - networking.firewall.allowedUDPPorts = [ config.makefu.airdcpp.dcpp.UDPPort ]; + networking.firewall.allowedUDPPorts = [ config.krebs.airdcpp.dcpp.UDPPort ]; services.nginx.virtualHosts."dcpp.${config.krebs.build.host.name}.r".locations."/" = - { proxyPass = "http://localhost:${toString config.makefu.airdcpp.web.port}/"; + { proxyPass = "http://localhost:${toString config.krebs.airdcpp.web.port}/"; extraConfig = '' proxy_set_header Host $host; diff --git a/makefu/3modules/airdcpp.nix b/makefu/3modules/airdcpp.nix deleted file mode 100644 index 342052e70..000000000 --- a/makefu/3modules/airdcpp.nix +++ /dev/null @@ -1,271 +0,0 @@ -{ config, lib, pkgs, ... }: -with import ; #genid -let - cfg = config.makefu.airdcpp; - - out = { - options.makefu.airdcpp = api; - config = lib.mkIf cfg.enable imp; - }; - - api = with types;{ - enable = mkEnableOption "airdcpp"; - - package = mkOption { - type = package; - default = pkgs.airdcpp-webclient; - }; - - user = mkOption { - description = '' - user which will run udpt. if kept default a new user will be created - ''; - type = str; - default = "airdcpp"; - }; - extraGroups = mkOption { - description = ''extra groups for the user (only for default user)''; - type = listOf str; - default = []; - example = [ "nginx" ]; - }; - - stateDir = mkOption { - description = '' - directory for storing state (pid,config) - ''; - type = str; - default = "/var/lib/airdcpp"; - }; - hubs = mkOption { - type = attrsOf (submodule ( { config, ... }: { - options = { - Nick = mkOption { - description = '' - Nick Name for hub - ''; - type = str; - default = cfg.Nick; - }; - Password = mkOption { - description = '' - Password to be used - - WARNING: will be stored in plain text in /nix/store - ''; - type = str; - default = ""; - apply = lib.removeSuffix "\n"; - }; - Server = mkOption { - description = '' - URL to the hub (must be provided) - ''; - type = str; - }; - AutoConnect = mkOption { - description = '' - automatically connect to the hub - ''; - type = bool; - default = false; - }; - }; - })); - description = "hubs which should be configured via Favorites.xml, - Options are only used if no initial Favorites.xml file is provided and none exists"; - default = {}; - }; - initialFavoritesConfigFile = mkOption { - description = '' - path inital Favorites.xml configuration if none exists - ''; - type = nullOr path; - default = null; - }; - dcpp = { - Nick = mkOption { - description = '' - Nick Name for connection - ''; - type = str; - default = "kevin"; - }; - InPort = mkOption { - description = "Input Port"; - type = int; - default = 16849; - }; - UDPPort = mkOption { - description = "UDP open Port"; - type = int; - default = 16849; - }; - TLSPort = mkOption { - description = "TLS open Port"; - type = int; - default = 16869; - }; - DownloadSpeed = mkOption { - description = "Total Download Speed in Mbps/s"; - type = str; - default = "100"; - }; - UploadSpeed = mkOption { - description = "Total Upload Speed in Mbp/s"; - type = str; - default = "100"; - }; - shares = mkOption { - default = {}; - type = attrsOf (submodule ( { config, ... }: { - options = { - path = mkOption { - description = "path to the share"; - type = str; - }; - incoming = mkOption { - description = "incoming"; - type = bool; - default = false; - }; - }; - })); - }; - initialConfigFile = mkOption { - description = '' - path inital DCPlusPlus.xml configuration if none exists - ''; - type = nullOr path; - default = null; - }; - }; - web = { - port = mkOption { - description = ''web-ui port - - NOTE: once the initial config had been written to the state directory it will not be replaced - ''; - type = int; - default = 5600; - }; - initialConfigFile = mkOption { - description = '' - path inital WebServer.xml configuration if none exists - ''; - type = nullOr path; - default = null; - }; - # TODO: tlsPort - users = mkOption { - type = attrsOf (submodule ( { config, ... }: { - options = { - password = mkOption { - description = "password of user"; - type = str; - apply = lib.removeSuffix "\n"; - }; - permissions = mkOption { - description = "user permissions"; - type = str; - default = "admin"; - }; - }; - })); - }; - }; - }; - - imp = let - genUsers = users: concatMapStringsSep "\n" (user: - '''' ) - (mapAttrsToList (name: val: val // { inherit name; }) users); - webConfigFile = if (cfg.web.initialConfigFile == null) then builtins.trace "warning: airdcpp passwords are stored in plain text" pkgs.writeText "initial-config" '' - - - - - - - ${genUsers cfg.web.users} - - - '' else cfg.web.initialConfigFile; - genHubs = hubs: concatMapStringsSep "\n" (hub: - '''' ) - (mapAttrsToList (name: val: val // { inherit name; }) cfg.hubs); - favoritesConfigFile = if (cfg.initialFavoritesConfigFile == null) then - builtins.trace "warning: airdcpp hub passwords are stored in plain text" pkgs.writeText "initial-config" '' - - - - ${genHubs cfg.hubs} - - - '' else cfg.initialFavoritesConfigFile; - genShares = shares: concatMapStringsSep "\n" (share: - ''${share.path}'' ) - (mapAttrsToList (name: val: val // { inherit name; }) shares); - dcppConfigFile = if (cfg.dcpp.initialConfigFile == null) then pkgs.writeText "initial-config" '' - - - - ${cfg.dcpp.Nick} - ${toString cfg.dcpp.InPort} - ${toString cfg.dcpp.UDPPort} - ${toString cfg.dcpp.TLSPort} - 0 - 1 - 0 - 0 - 1 - ${cfg.dcpp.DownloadSpeed} - ${cfg.dcpp.UploadSpeed} - - - ${genShares cfg.dcpp.shares} - - - - - '' else cfg.dcpp.initialConfigFile; - in { - systemd.services.airdcpp = { - description = "airdcpp webui"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - restartIfChanged = true; - serviceConfig = { - Type = "simple"; - ExecStartPre = pkgs.writeDash "prepare-env" '' - d=${cfg.stateDir}/WebServer.xml - test -e $d || install -m700 -o${cfg.user} ${webConfigFile} $d - d=${cfg.stateDir}/DCPlusPlus.xml - test -e $d || install -m700 -o${cfg.user} ${dcppConfigFile} $d - d=${cfg.stateDir}/Favorites.xml - test -e $d || install -m700 -o${cfg.user} ${favoritesConfigFile} $d - ''; - PermissionsStartOnly = true; - ExecStart = "${cfg.package}/bin/airdcppd -c=${cfg.stateDir} -p=${cfg.stateDir}/airdcpp.pid"; - PrivateTmp = true; - WorkingDirectory = cfg.stateDir; - User = "${cfg.user}"; - }; - }; - users = lib.mkIf (cfg.user == "airdcpp") { - users.airdcpp = { - uid = genid "airdcpp"; - home = cfg.stateDir; - createHome = true; - inherit (cfg) extraGroups; - }; - groups.airdcpp.gid = genid "airdcpp"; - }; - }; -in -out - diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix index 963649c63..7146174fb 100644 --- a/makefu/3modules/default.nix +++ b/makefu/3modules/default.nix @@ -2,7 +2,6 @@ _: { imports = [ - ./airdcpp.nix ./awesome-extra.nix ./deluge.nix ./forward-journal.nix diff --git a/makefu/5pkgs/airdcpp-webclient/default.nix b/makefu/5pkgs/airdcpp-webclient/default.nix deleted file mode 100644 index 361a7da65..000000000 --- a/makefu/5pkgs/airdcpp-webclient/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ stdenv, fetchurl -}: -stdenv.mkDerivation rec { - name = "airdcpp-webclient-${version}"; - version = "2.3.0"; - - src = fetchurl { - url = http://web-builds.airdcpp.net/stable/airdcpp_2.3.0_webui-2.3.0_64-bit_portable.tar.gz; - sha256 = "0yvcl0nc70fghc7vfsgvbpryi5q97arld8adql4way4qa0mdnyv1"; - }; - - phases = [ "unpackPhase" "installPhase" ]; - installPhase = '' - mkdir -p $out/{share,bin} - cp -r * $out/share - ln -s $out/share/airdcppd $out/bin/ - ''; - - meta = with stdenv.lib; { - # to start it: airdcpp -p= -c= --configure - description = "dcpp client (statically precompiled)"; - homepage = http://fixme; - license = licenses.gpl3; - maintainers = with maintainers; [ makefu ]; - platforms = with platforms; linux; - }; -} -- cgit v1.2.3 From c409536433f2b0bcb1b71117387c2f72525c79dd Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Sep 2018 23:34:30 +0200 Subject: ma 2/default: pull out minimal config into minimal.nix --- makefu/2configs/default.nix | 107 ++++++-------------------------------------- makefu/2configs/minimal.nix | 88 ++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 94 deletions(-) create mode 100644 makefu/2configs/minimal.nix (limited to 'makefu') diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index 6192a92a5..61cba86d9 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -10,24 +10,11 @@ with import ; } ./editor/vim.nix ./binary-cache/nixos.nix + ./minimal.nix ]; - boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - - programs.command-not-found.enable = false; - - nix.package = pkgs.nixUnstable; - - nixpkgs.config.allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "unrar-" pkg.name); - krebs = { - enable = true; - - dns.providers.lan = "hosts"; - search-domain = "r"; - build.user = config.krebs.users.makefu; - }; - - users.extraUsers = { + # users are super important + users.users = { root = { openssh.authorizedKeys.keys = [ config.krebs.users.makefu.pubkey ]; }; @@ -37,80 +24,39 @@ with import ; home = "/home/makefu"; createHome = true; useDefaultShell = true; - extraGroups = [ - "wheel" - ]; + extraGroups = [ "wheel" ]; openssh.authorizedKeys.keys = [ config.krebs.users.makefu.pubkey ]; }; }; - networking.hostName = config.krebs.build.host.name; - nix.maxJobs = 2; - nix.buildCores = config.krebs.build.host.cores; + boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - time.timeZone = "Europe/Berlin"; + nixpkgs.config.allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "unrar-" pkg.name); + krebs = { + enable = true; - programs.ssh = { - startAgent = false; + dns.providers.lan = "hosts"; + search-domain = "r"; + build.user = config.krebs.users.makefu; }; - services.openssh.enable = true; - nix.useSandbox = true; - users.mutableUsers = false; - boot.tmpOnTmpfs = true; - networking.firewall.rejectPackets = true; - networking.firewall.allowPing = true; + boot.tmpOnTmpfs = true; systemd.tmpfiles.rules = [ "d /tmp 1777 root root - -" ]; - nix.nixPath = [ "/var/src" ]; - environment.variables = let - ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - in { - NIX_PATH = mkForce "/var/src"; - EDITOR = mkForce "vim"; - CURL_CA_BUNDLE = ca-bundle; - GIT_SSL_CAINFO = ca-bundle; - SSL_CERT_FILE = ca-bundle; - }; environment.systemPackages = with pkgs; [ jq git - get gnumake rxvt_unicode.terminfo htop ]; - programs.bash = { - enableCompletion = true; - interactiveShellInit = '' - HISTCONTROL='erasedups:ignorespace' - HISTSIZE=900001 - HISTFILESIZE=$HISTSIZE - - PYTHONSTARTUP="~/.pythonrc"; - - shopt -s checkhash - shopt -s histappend histreedit histverify - shopt -s no_empty_cmd_completion - ''; - - promptInit = '' - case $UID in - 0) PS1='\[\e[1;31m\]\w\[\e[0m\] ' ;; - 9001) PS1='\[\e[1;32m\]\w\[\e[0m\] ' ;; - *) PS1='\[\e[1;35m\]\u \[\e[1;32m\]\w\[\e[0m\] ' ;; - esac - if test -n "$SSH_CLIENT"; then - PS1='\[\033[35m\]\h'" $PS1" - fi - ''; - }; + programs.bash.enableCompletion = true; environment.shellAliases = { # TODO: see .aliases @@ -126,12 +72,6 @@ with import ; tinc = pkgs.tinc_pre; }; - networking.timeServers = [ - "pool.ntp.org" - "time.windows.com" - "time.apple.com" - "time.nist.gov" - ]; nix.extraOptions = '' auto-optimise-store = true @@ -145,26 +85,5 @@ with import ; SystemMaxUse=1G RuntimeMaxUse=128M ''; - # Enable IPv6 Privacy Extensions - boot.kernel.sysctl = { - "net.ipv6.conf.all.use_tempaddr" = 2; - "net.ipv6.conf.default.use_tempaddr" = 2; - }; - i18n = { - consoleKeyMap = "us"; - defaultLocale = "en_US.UTF-8"; - }; - # suppress chrome autit event messages - security.audit = { - rules = [ - "-a task,never" - ]; - }; - system.activationScripts.state = optionalString (config.state != []) '' - cat << EOF - This machine is burdened with state: - ${concatMapStringsSep "\n" (d: "* ${d}") config.state} - EOF - ''; } diff --git a/makefu/2configs/minimal.nix b/makefu/2configs/minimal.nix new file mode 100644 index 000000000..d764e5624 --- /dev/null +++ b/makefu/2configs/minimal.nix @@ -0,0 +1,88 @@ +{ lib, pkgs, config, ... }: +# minimal subset of sane configuration for stockholm +{ + # nobody needs this + programs.command-not-found.enable = false; + + # the only true timezone (even after the the removal of DST) + time.timeZone = "Europe/Berlin"; + + networking.hostName = config.krebs.build.host.name; + nix.buildCores = config.krebs.build.host.cores; + + # we use gpg if necessary (or nothing at all) + programs.ssh.startAgent = false; + + # all boxes look the same + nix.useSandbox = true; + # we configure users via nix + users.mutableUsers = false; + + # sane firewalling + networking.firewall.rejectPackets = true; + networking.firewall.allowPing = true; + + # openssh all the way down + services.openssh.enable = true; + + # we use stockholm via populate + nix.nixPath = [ "/var/src" ]; + + environment.variables = let + ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; + in { + NIX_PATH = lib.mkForce "/var/src"; + EDITOR = lib.mkForce "vim"; + CURL_CA_BUNDLE = ca-bundle; + GIT_SSL_CAINFO = ca-bundle; + SSL_CERT_FILE = ca-bundle; + }; + + programs.bash = { + interactiveShellInit = '' + HISTCONTROL='erasedups:ignorespace' + HISTSIZE=900001 + HISTFILESIZE=$HISTSIZE + + shopt -s checkhash + shopt -s histappend histreedit histverify + shopt -s no_empty_cmd_completion + ''; + + promptInit = '' + case $UID in + 0) PS1='\[\e[1;31m\]\w\[\e[0m\] ' ;; + 9001) PS1='\[\e[1;32m\]\w\[\e[0m\] ' ;; + *) PS1='\[\e[1;35m\]\u \[\e[1;32m\]\w\[\e[0m\] ' ;; + esac + if test -n "$SSH_CLIENT"; then + PS1='\[\033[35m\]\h'" $PS1" + fi + ''; + }; + + # trust the cool guys + networking.timeServers = [ + "pool.ntp.org" + "time.nist.gov" + ]; + + # the only locale you will ever need + i18n = { + consoleKeyMap = "us"; + defaultLocale = "en_US.UTF-8"; + }; + + # suppress chrome autit event messages + security.audit = { + rules = [ + "-a task,never" + ]; + }; + + # Enable IPv6 Privacy Extensions + boot.kernel.sysctl = { + "net.ipv6.conf.all.use_tempaddr" = 2; + "net.ipv6.conf.default.use_tempaddr" = 2; + }; +} -- cgit v1.2.3 From 7a0d3121be1ae433a612ad77e9bb693a66aed41c Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 26 Sep 2018 00:22:27 +0200 Subject: ma nextgum/hardware-config: dm-raid is required to boot raid1 lvm --- makefu/1systems/nextgum/hardware-config.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'makefu') diff --git a/makefu/1systems/nextgum/hardware-config.nix b/makefu/1systems/nextgum/hardware-config.nix index 944210701..bfe29b46c 100644 --- a/makefu/1systems/nextgum/hardware-config.nix +++ b/makefu/1systems/nextgum/hardware-config.nix @@ -41,11 +41,12 @@ in { boot.loader.grub.enable = true; boot.loader.grub.version = 2; boot.loader.grub.devices = [ main-disk ]; + boot.initrd.kernelModules = [ "dm-raid" ]; boot.initrd.availableKernelModules = [ "ata_piix" "vmw_pvscsi" "virtio_pci" "sd_mod" "ahci" "xhci_pci" "ehci_pci" "ahci" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" "dm-raid" "dm_thin_pool" ]; + boot.kernelModules = [ "kvm-intel" ]; hardware.enableRedistributableFirmware = true; fileSystems."/" = { device = "/dev/mapper/nixos-root"; @@ -59,6 +60,10 @@ in { device = "/dev/mapper/nixos-download"; fsType = "ext4"; }; + fileSystems."/var/lib/borgbackup" = { + device = "/dev/mapper/nixos-backup"; + fsType = "ext4"; + }; fileSystems."/boot" = { device = "/dev/sda2"; fsType = "vfat"; @@ -79,8 +84,12 @@ in { #vgcreate nixos /dev/sda3 /dev/sdb1 #lvcreate -L 120G -m 1 -n root nixos #lvcreate -L 50G -m 1 -n lib nixos - #lvcreate -L 50G -n download nixos + #lvcreate -L 100G -n download nixos + #lvcreate -L 100G -n backup nixos #mkfs.ext4 /dev/mapper/nixos-root + #mkfs.ext4 /dev/mapper/nixos-lib + #mkfs.ext4 /dev/mapper/nixos-download + #mkfs.ext4 /dev/mapper/nixos-borgbackup #mount /dev/mapper/nixos-root /mnt #mkdir /mnt/boot #mount /dev/sda2 /mnt/boot -- cgit v1.2.3 From a86a6761f784fbfa68cd400cd84d08ddfb9aa066 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 29 Sep 2018 23:40:32 +0200 Subject: ma pkgs.4nxci: init --- makefu/5pkgs/4nxci/default.nix | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 makefu/5pkgs/4nxci/default.nix (limited to 'makefu') diff --git a/makefu/5pkgs/4nxci/default.nix b/makefu/5pkgs/4nxci/default.nix new file mode 100644 index 000000000..3aba3be45 --- /dev/null +++ b/makefu/5pkgs/4nxci/default.nix @@ -0,0 +1,52 @@ +{ stdenv, lib, fetchFromGitHub, mbedtls, python2 }: +let + + mymbedtls = lib.overrideDerivation mbedtls (old: rec { + name = "mbedtls-${version}"; + version = "2.13.0"; + src = fetchFromGitHub { + owner = "ARMmbed"; + repo = "mbedtls"; + rev = name; + sha256 = "1257kp7yxkwwbx5v14kmrmgk1f9zagiddg5alm4wbj0pmgbrm14j"; + }; + buildInputs = old.buildInputs ++ [ python2 ]; + postConfigure = '' + perl scripts/config.pl set MBEDTLS_CMAC_C + ''; + doCheck = false; + + }); +in stdenv.mkDerivation rec { + name = "4nxci-${version}"; + version = "1.30"; + + src = fetchFromGitHub { + owner = "The-4n"; + repo = "4NXCI"; + rev = "v${version}"; + sha256 = "0nrd19z88iahxcdx468lzgxlvkl65smwx8f9s19431cszyhvpxyh"; + }; + + buildPhase = '' + cp config.mk.template config.mk + sed -i 's#\(INCLUDE =\).*#\1${mymbedtls}/include#' Makefile + sed -i 's#\(LIBDIR =\).*#\1${mymbedtls}/lib#' Makefile + make 4nxci + ''; + + installPhase = '' + install -m755 -D 4nxci $out/bin/4nxci + ''; + + #preInstall = '' + # mkdir -p $out/bin + #''; + + buildInputs = [ mymbedtls ]; + + meta = { + description = "convert xci to nsp"; + license = lib.licenses.isc; + }; +} -- cgit v1.2.3 From 90b2cb7bd975eadca9356f5bfe446bfac241f87b Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 7 Oct 2018 17:08:01 +0200 Subject: krops: import from submodules --- makefu/krops.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'makefu') diff --git a/makefu/krops.nix b/makefu/krops.nix index ddb4afece..4f55915af 100644 --- a/makefu/krops.nix +++ b/makefu/krops.nix @@ -1,8 +1,5 @@ { config ? config, name, target ? name }: let - krops = builtins.fetchGit { - url = https://cgit.krebsco.de/krops/; - rev = "4e466eaf05861b47365c5ef46a31a188b70f3615"; - }; + krops = ../submodules/krops; nixpkgs-src = lib.importJSON ./nixpkgs.json; lib = import "${krops}/lib"; -- cgit v1.2.3 From 84e8732832fb21e248b100b53c0d5d7df45d0d91 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 9 Oct 2018 13:48:52 +0200 Subject: force test in krops.nix --- makefu/krops.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu') diff --git a/makefu/krops.nix b/makefu/krops.nix index 4f55915af..27b7b04ef 100644 --- a/makefu/krops.nix +++ b/makefu/krops.nix @@ -83,6 +83,7 @@ in { # usage: $(nix-build --no-out-link --argstr name HOSTNAME --argstr target PATH -A test) test = { target ? target }: pkgs.krops.writeTest "${name}-test" { + force = true; inherit target; source = source { test = true; }; }; -- cgit v1.2.3