From 207c451d7d9c816270803a5c8d4e8b4a6e6ec0c7 Mon Sep 17 00:00:00 2001 From: nin Date: Wed, 22 Feb 2017 21:35:38 +0100 Subject: n 2 nixpkgs: d2cd8a0 -> 6651c72 --- nin/2configs/nixpkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nin/2configs/nixpkgs.nix b/nin/2configs/nixpkgs.nix index 27a845bd5..ad39848b6 100644 --- a/nin/2configs/nixpkgs.nix +++ b/nin/2configs/nixpkgs.nix @@ -3,6 +3,6 @@ { krebs.build.source.nixpkgs.git = { url = https://github.com/nixos/nixpkgs; - ref = "d2cd8a0"; + ref = "6651c72"; }; } -- cgit v1.2.3 From 95a178a5dfafc0e06548cd005f99e5abd8dc8c78 Mon Sep 17 00:00:00 2001 From: nin Date: Fri, 3 Mar 2017 14:09:53 +0100 Subject: n 1 hiawatha: add git + git config --- nin/1systems/hiawatha.nix | 5 ++++- nin/2configs/git.nix | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nin/1systems/hiawatha.nix b/nin/1systems/hiawatha.nix index af865497e..12f2718bc 100644 --- a/nin/1systems/hiawatha.nix +++ b/nin/1systems/hiawatha.nix @@ -10,8 +10,11 @@ with lib; imports = [ ../. - ../2configs/retiolum.nix + ../2configs/copyq.nix + ../2configs/games.nix ../2configs/git.nix + ../2configs/retiolum.nix + ../2configs/termite.nix ]; krebs.build.host = config.krebs.hosts.hiawatha; diff --git a/nin/2configs/git.nix b/nin/2configs/git.nix index 39f919e79..6bdc857d8 100644 --- a/nin/2configs/git.nix +++ b/nin/2configs/git.nix @@ -5,6 +5,7 @@ with import ; let out = { + services.nginx.enable = true; krebs.git = { enable = true; cgit = { -- cgit v1.2.3 From 23314b0aca248d234c122dab4eaaaaf2c9286677 Mon Sep 17 00:00:00 2001 From: nin Date: Fri, 3 Mar 2017 14:11:07 +0100 Subject: n 2: add copyq --- nin/2configs/copyq.nix | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 nin/2configs/copyq.nix diff --git a/nin/2configs/copyq.nix b/nin/2configs/copyq.nix new file mode 100644 index 000000000..0616c4025 --- /dev/null +++ b/nin/2configs/copyq.nix @@ -0,0 +1,38 @@ +{ config, pkgs, ... }: +with import ; +let + copyqConfig = pkgs.writeDash "copyq-config" '' + ${pkgs.copyq}/bin/copyq config check_clipboard true + ${pkgs.copyq}/bin/copyq config check_selection true + ${pkgs.copyq}/bin/copyq config copy_clipboard true + ${pkgs.copyq}/bin/copyq config copy_selection true + + ${pkgs.copyq}/bin/copyq config activate_closes true + ${pkgs.copyq}/bin/copyq config clipboard_notification_lines 0 + ${pkgs.copyq}/bin/copyq config clipboard_tab clipboard + ${pkgs.copyq}/bin/copyq config disable_tray true + ${pkgs.copyq}/bin/copyq config hide_tabs true + ${pkgs.copyq}/bin/copyq config hide_toolbar true + ${pkgs.copyq}/bin/copyq config item_popup_interval true + ${pkgs.copyq}/bin/copyq config maxitems 1000 + ${pkgs.copyq}/bin/copyq config move true + ${pkgs.copyq}/bin/copyq config text_wrap true + ''; +in { + systemd.user.services.copyq = { + after = [ "graphical.target" ]; + wants = [ "graphical.target" ]; + wantedBy = [ "default.target" ]; + environment = { + DISPLAY = ":0"; + }; + serviceConfig = { + SyslogIdentifier = "copyq"; + ExecStart = "${pkgs.copyq}/bin/copyq"; + ExecStartPost = copyqConfig; + Restart = "always"; + RestartSec = "2s"; + StartLimitBurst = 0; + }; + }; +} -- cgit v1.2.3 From 953046f7218f9752b5164b45301d87ed1995e351 Mon Sep 17 00:00:00 2001 From: nin Date: Fri, 3 Mar 2017 14:11:40 +0100 Subject: n 2: steal games from lass --- nin/2configs/games.nix | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 nin/2configs/games.nix diff --git a/nin/2configs/games.nix b/nin/2configs/games.nix new file mode 100644 index 000000000..a7edae078 --- /dev/null +++ b/nin/2configs/games.nix @@ -0,0 +1,70 @@ +{ config, pkgs, ... }: + +let + mainUser = config.users.extraUsers.mainUser; + vdoom = pkgs.writeDash "vdoom" '' + ${pkgs.zandronum-bin}/bin/zandronum \ + -fov 120 \ + "$@" + ''; + doom = pkgs.writeDash "doom" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + ${vdoom} \ + -file $DOOM_DIR/lib/brutalv20.pk3 \ + "$@" + ''; + doom1 = pkgs.writeDashBin "doom1" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + ${doom} -iwad $DOOM_DIR/wads/stock/doom.wad "$@" + ''; + doom2 = pkgs.writeDashBin "doom2" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + ${doom} -iwad $DOOM_DIR/wads/stock/doom2.wad "$@" + ''; + vdoom1 = pkgs.writeDashBin "vdoom1" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + ${vdoom} -iwad $DOOM_DIR/wads/stock/doom.wad "$@" + ''; + vdoom2 = pkgs.writeDashBin "vdoom2" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + ${vdoom} -iwad $DOOM_DIR/wads/stock/doom2.wad "$@" + ''; + + doomservercfg = pkgs.writeText "doomserver.cfg" '' + skill 7 + #survival true + #sv_maxlives 4 + #sv_norespawn true + #sv_weapondrop true + no_jump true + #sv_noweaponspawn true + sv_sharekeys true + sv_survivalcountdowntime 1 + sv_noteamselect true + sv_updatemaster false + #sv_coop_loseinventory true + #cl_startasspectator false + #lms_spectatorview false + ''; + + vdoomserver = pkgs.writeDashBin "vdoomserver" '' + DOOM_DIR=''${DOOM_DIR:-~/doom/} + + ${pkgs.zandronum-bin}/bin/zandronum-server \ + +exec ${doomservercfg} \ + "$@" + ''; + +in { + environment.systemPackages = with pkgs; [ + dwarf_fortress + doom1 + doom2 + vdoom1 + vdoom2 + vdoomserver + ]; + + hardware.pulseaudio.support32Bit = true; + +} -- cgit v1.2.3 From 01868340e25ffb05ea8b784c5cdf47c251157dfb Mon Sep 17 00:00:00 2001 From: nin Date: Fri, 3 Mar 2017 14:12:15 +0100 Subject: n 2: add termite terminal --- nin/2configs/termite.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 nin/2configs/termite.nix diff --git a/nin/2configs/termite.nix b/nin/2configs/termite.nix new file mode 100644 index 000000000..942446b01 --- /dev/null +++ b/nin/2configs/termite.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = [ + pkgs.termite + ]; + + krebs.per-user.nin.packages = let + termitecfg = pkgs.writeTextFile { + name = "termite-config"; + destination = "/etc/xdg/termite/config"; + text = '' + [colors] + foreground = #d0d7d0 + background = #000000 + ''; + }; + in [ + termitecfg + ]; + +} -- cgit v1.2.3 From fd6c056a720544319f02cf02b64fa8dd2b657aa8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 5 Mar 2017 01:02:19 +0100 Subject: l 2 programs: remove obsolete livestreamer --- lass/2configs/programs.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lass/2configs/programs.nix b/lass/2configs/programs.nix index 6cf23deaf..241d263f8 100644 --- a/lass/2configs/programs.nix +++ b/lass/2configs/programs.nix @@ -12,7 +12,6 @@ pavucontrol pv pwgen - python34Packages.livestreamer remmina silver-searcher wget -- cgit v1.2.3 From ea303cfd559599463eab912277faed072ba82a0f Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 6 Mar 2017 12:45:56 +0100 Subject: tv q: respect terminal width when printing calenders --- tv/5pkgs/q/default.nix | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/tv/5pkgs/q/default.nix b/tv/5pkgs/q/default.nix index a3a7cd739..2e7aa5cf2 100644 --- a/tv/5pkgs/q/default.nix +++ b/tv/5pkgs/q/default.nix @@ -1,7 +1,19 @@ { pkgs, ... }: +with import ; let q-cal = let - # XXX 23 is the longest line of cal's output + + # Maximum width of cal's output. + calwidth = 23; + + # Number of space characters between two calendars. + hspace = 2; + + # Return number of columns required to print n calenders side by side. + need_width = n: + assert n >= 1; + n * calwidth + (n - 1) * hspace; + pad = ''{ ${pkgs.gnused}/bin/sed ' # rtrim @@ -10,7 +22,7 @@ let # delete last empty line ''${/^$/d} ' \ - | ${pkgs.gawk}/bin/awk '{printf "%-23s\n", $0}' \ + | ${pkgs.gawk}/bin/awk '{printf "%-${toString calwidth}s\n", $0}' \ | ${pkgs.gnused}/bin/sed ' # colorize header 1,2s/.*/&/ @@ -20,23 +32,31 @@ let ' }''; in '' + cols=$(${pkgs.ncurses}/bin/tput cols) ${pkgs.coreutils}/bin/paste \ - <(${pkgs.utillinux}/bin/cal -mw \ + <(if test $cols -ge ${toString (need_width 3)}; then + ${pkgs.utillinux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \ | ${pad} - ) \ - <(${pkgs.utillinux}/bin/cal -mw \ + fi) \ + <(if test $cols -ge ${toString (need_width 1)}; then + ${pkgs.utillinux}/bin/cal -mw \ | ${pkgs.gnused}/bin/sed ' # colorize day of month s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/&/ ' \ | ${pad} - ) \ - <(${pkgs.utillinux}/bin/cal -mw \ + fi) \ + <(if test $cols -ge ${toString (need_width 2)}; then + ${pkgs.utillinux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \ | ${pad} - ) \ - | ${pkgs.gnused}/bin/sed 's/\t/ /g' + fi) \ + | ${pkgs.gnused}/bin/sed ' + s/^\t// + s/\t$// + s/\t/${lpad hspace " " ""}/g + ' ''; q-isodate = '' -- cgit v1.2.3 From 0953240b832117aef4d2ee3cc9cb1ff0e606242e Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 6 Mar 2017 13:11:21 +0100 Subject: tv pulse: talk about hijacking audio devices --- tv/2configs/pulse.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 2a3b5cbc1..418551213 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -76,6 +76,9 @@ in }; }; + # TODO assert that pulse is the only user with "audio" in group/extraGroups + # otherwise the audio device can be hijacked while the pulse service restarts + # (e.g. when mpv is running) and then the service will fail. users = { groups.pulse.gid = config.users.users.pulse.uid; users.pulse = { -- cgit v1.2.3 From c05db2409061f721ba454f4bf79e635ee13a6f11 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 15:32:31 +0100 Subject: Revert "cd: hart eingeCACt" This reverts commit 3607bd0832d0f47a4bf56cae7e4cb14f6e257bc9. --- krebs/3modules/tv/default.nix | 2 +- tv/1systems/cd.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix index 1220143a7..d44c322aa 100644 --- a/krebs/3modules/tv/default.nix +++ b/krebs/3modules/tv/default.nix @@ -85,7 +85,7 @@ with import ; }; nets = { internet = { - ip4.addr = "64.137.177.226"; + ip4.addr = "45.62.237.203"; aliases = [ "cd.i" "cd.krebsco.de" diff --git a/tv/1systems/cd.nix b/tv/1systems/cd.nix index b718d19b8..108006f34 100644 --- a/tv/1systems/cd.nix +++ b/tv/1systems/cd.nix @@ -16,11 +16,11 @@ with import ; networking = { interfaces.enp2s1.ip4 = singleton { address = let - addr = "64.137.177.226"; + addr = "45.62.237.203"; in assert config.krebs.build.host.nets.internet.ip4.addr == addr; addr; prefixLength = 24; }; - defaultGateway = "64.137.177.1"; + defaultGateway = "45.62.237.1"; nameservers = ["8.8.8.8"]; }; -- cgit v1.2.3 From c04b08ab7e7967038e5ce9b494aafbbfc206d307 Mon Sep 17 00:00:00 2001 From: nin Date: Tue, 7 Mar 2017 17:38:03 +0100 Subject: n 2 nixpackages: 6651c72 -> 5b0c9d4 --- nin/2configs/nixpkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nin/2configs/nixpkgs.nix b/nin/2configs/nixpkgs.nix index ad39848b6..9c3eafffd 100644 --- a/nin/2configs/nixpkgs.nix +++ b/nin/2configs/nixpkgs.nix @@ -3,6 +3,6 @@ { krebs.build.source.nixpkgs.git = { url = https://github.com/nixos/nixpkgs; - ref = "6651c72"; + ref = "5b0c9d4"; }; } -- cgit v1.2.3 From 5fe56a99b806335698354c2c6c5a6cd9c3f28749 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 19:25:03 +0100 Subject: k 3 monit: allow path or str for alarms & test --- krebs/3modules/monit.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/3modules/monit.nix b/krebs/3modules/monit.nix index 4d4066ae4..cc4a1b208 100644 --- a/krebs/3modules/monit.nix +++ b/krebs/3modules/monit.nix @@ -49,10 +49,10 @@ let type = with types; attrsOf (submodule { options = { test = mkOption { - type = path; + type = either path str; }; alarm = mkOption { - type = path; + type = either path str; }; interval = mkOption { type = str; -- cgit v1.2.3 From ed8a05bf44a57da17c396c655217b16c2c472d6a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 19:36:57 +0100 Subject: l 2 websites domsen: style --- lass/2configs/websites/domsen.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 0b75425c4..daecdcd2f 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -25,15 +25,10 @@ in { imports = [ ./sqlBackup.nix (servePage [ "reich-gebaeudereinigung.de" "www.reich-gebaeudereinigung.de" ]) - (servePage [ "karlaskop.de" "www.karlaskop.de" ]) - (servePage [ "makeup.apanowicz.de" "www.makeup.apanowicz.de" ]) - (servePage [ "pixelpocket.de" ]) - (serveOwncloud [ "o.ubikmedia.de" ]) - (serveWordpress [ "ubikmedia.de" "apanowicz.de" -- cgit v1.2.3 From e1045698d6e563ec9ad10cb1b0036252a34a010a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 19:41:25 +0100 Subject: l 5 xmonad: use correct wallpaper path --- lass/5pkgs/xmonad-lass.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/5pkgs/xmonad-lass.nix b/lass/5pkgs/xmonad-lass.nix index bc70417f5..82f507138 100644 --- a/lass/5pkgs/xmonad-lass.nix +++ b/lass/5pkgs/xmonad-lass.nix @@ -95,7 +95,7 @@ displaySomeException = displayException myKeyMap :: [([Char], X ())] myKeyMap = - [ ("M4-", spawn "${pkgs.i3lock}/bin/i3lock -i $HOME/wallpaper -f") + [ ("M4-", spawn "${pkgs.i3lock}/bin/i3lock -i $HOME/wallpaper/wallpaper -f") , ("M4-C-p", spawn "${pkgs.scrot}/bin/scrot ~/public_html/scrot.png") , ("M4-p", spawn "${pkgs.pass}/bin/passmenu --type") , ("", spawn "${pkgs.pulseaudioLight.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4%") -- cgit v1.2.3 From c48e40e2877789fcda17b494e637e9d99d33ba18 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 20:16:28 +0100 Subject: l 2 baseX: activate rtkit for pulseaudio --- lass/2configs/baseX.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 275b93f26..af5092ef8 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -15,6 +15,7 @@ in { enable = true; systemWide = true; }; + security.rtkit.enable = true; } { krebs.per-user.lass.packages = [ -- cgit v1.2.3 From b311628ee2819136f8a7adda608645d9a7d8712a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 20:17:23 +0100 Subject: l 2 baseX: disable OSS emulation --- lass/2configs/baseX.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index af5092ef8..3032e244f 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -16,6 +16,7 @@ in { systemWide = true; }; security.rtkit.enable = true; + sound.enableOSSEmulation = false; } { krebs.per-user.lass.packages = [ -- cgit v1.2.3 From 484dc992f83bd7d6aadd6d7621f973ab824777d8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 20:18:07 +0100 Subject: l 2 nixpkgs: 5b0c9d4 -> c0ecd31 --- lass/2configs/nixpkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/nixpkgs.nix b/lass/2configs/nixpkgs.nix index 9c3eafffd..59851f25a 100644 --- a/lass/2configs/nixpkgs.nix +++ b/lass/2configs/nixpkgs.nix @@ -3,6 +3,6 @@ { krebs.build.source.nixpkgs.git = { url = https://github.com/nixos/nixpkgs; - ref = "5b0c9d4"; + ref = "c0ecd31"; }; } -- cgit v1.2.3 From 0edb13f3fc16e6456e5deb4e006595491a6b197e Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 21:48:25 +0100 Subject: concat: init --- krebs/5pkgs/writers.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix index 65ee14485..e1dbed5c7 100644 --- a/krebs/5pkgs/writers.nix +++ b/krebs/5pkgs/writers.nix @@ -2,6 +2,32 @@ with import ; { nixpkgs.config.packageOverrides = _: { + + # Combine a list of derivations using symlinks. Paths in later derivations + # take precedence over earlier ones. + # + # Example: create wrapper but retain all other files (man pages etc.) + # + # { + # nixpkgs.config.packageOverrides = super: { + # hello = pkgs.concat "hello" [ + # super.hello + # (pkgs.writeDashBin "hello" '' + # echo OMG + # echo exec ${super.hello}/bin/hello "$@" + # '') + # ]; + # }; + # } + # + concat = name: xs: pkgs.runCommand name {} '' + mkdir $out + ${flip concatMapStrings xs (x: '' + cp --remove-destination -vrs ${x}/* $out + find $out -type d -exec chmod -v u+rwx {} + + '')} + ''; + execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let in pkgs.writeC name { inherit destination; } /* c */ '' #include -- cgit v1.2.3 From 218c58ef333e6968caa846612bdee162517b3b53 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 22:26:07 +0100 Subject: writers.link: mkdir when path is absolute --- krebs/5pkgs/writers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix index e1dbed5c7..d14090323 100644 --- a/krebs/5pkgs/writers.nix +++ b/krebs/5pkgs/writers.nix @@ -122,7 +122,7 @@ with import ; assert types.package.check link; { install = /* sh */ '' - ${optionalString (dirOf path != "/") /* sh */ '' + ${optionalString (path != "") /* sh */ '' ${pkgs.coreutils}/bin/mkdir -p $out${dirOf path} ''} ${pkgs.coreutils}/bin/ln -s ${link} $out${path} -- cgit v1.2.3 From 653d023c2bd02e9d2eac0c8e76b316ab0c6871e7 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 22:40:36 +0100 Subject: tv htop: init --- tv/2configs/default.nix | 1 + tv/2configs/htop.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tv/2configs/htop.nix diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 33fb7e492..e170156a4 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -28,6 +28,7 @@ with import ; ./audit.nix ./backup.nix ./bash.nix + ./htop.nix ./nginx ./ssh.nix ./sshd.nix diff --git a/tv/2configs/htop.nix b/tv/2configs/htop.nix new file mode 100644 index 000000000..409df2516 --- /dev/null +++ b/tv/2configs/htop.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +with import ; + +{ + nixpkgs.config.packageOverrides = super: { + htop = pkgs.concat "htop" [ + super.htop + (pkgs.writeDashBin "htop" '' + export HTOPRC=${pkgs.writeText "htoprc" '' + fields=0 48 17 18 38 39 40 2 46 47 49 1 + sort_key=46 + sort_direction=1 + hide_threads=0 + hide_kernel_threads=1 + hide_userland_threads=0 + shadow_other_users=1 + show_thread_names=1 + show_program_path=1 + highlight_base_name=1 + highlight_megabytes=1 + highlight_threads=1 + tree_view=1 + header_margin=1 + detailed_cpu_time=0 + cpu_count_from_zero=0 + update_process_names=0 + account_guest_in_cpu_meter=1 + color_scheme=0 + delay=15 + left_meters=LeftCPUs2 RightCPUs2 Memory Swap + left_meter_modes=1 1 1 1 + right_meters=Uptime Tasks LoadAverage Battery + right_meter_modes=2 2 2 2 + ''} + exec ${super.htop}/bin/htop "$@" + '') + ]; + }; +} -- cgit v1.2.3 From 8e490fa31dfb7c1401ab486784cf99bfe4f01b7d Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 22:56:25 +0100 Subject: l 2 mc: use concat --- lass/2configs/mc.nix | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lass/2configs/mc.nix b/lass/2configs/mc.nix index b7d5a4ceb..fc347ba3c 100644 --- a/lass/2configs/mc.nix +++ b/lass/2configs/mc.nix @@ -322,13 +322,19 @@ let in { environment.systemPackages = [ - (pkgs.lib.overrideDerivation pkgs.mc (original : { - postInstall = '' - rm -f $out/etc/mc/mc.ext - ln -s ${mcExt} $out/etc/mc/mc.ext - cp $out/share/mc/skins/nicedark.ini $out/share/mc/skins/default.ini - ''; - })) + (pkgs.concat "mc" [ + pkgs.mc + (pkgs.writeDashBin "mc" '' + export MC_DATADIR=${pkgs.concat "mc-datadir" [ + (pkgs.writeOut "mc-ext" { + "/mc.ext".link = mcExt; + "/sfs.ini".text = ""; + }) + ]} + export TERM=xterm-256color + exec ${pkgs.mc}/bin/mc -S xoria256 "$@" + '') + ]) ]; } -- cgit v1.2.3 From 6a9ff979548fdc28193569b0e514353838c87896 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 22:57:02 +0100 Subject: l 2 vim: use concat --- lass/2configs/vim.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lass/2configs/vim.nix b/lass/2configs/vim.nix index 4e0af0dc7..e6cf8d101 100644 --- a/lass/2configs/vim.nix +++ b/lass/2configs/vim.nix @@ -207,11 +207,14 @@ let alldirs = attrValues dirs ++ map dirOf (attrValues files); in unique (sort lessThan alldirs); - vim = pkgs.writeDashBin "vim" '' - set -efu - (umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString mkdirs}) - exec ${pkgs.vim}/bin/vim "$@" - ''; + vim = pkgs.concat "vim" [ + pkgs.vim + (pkgs.writeDashBin "vim" '' + set -efu + (umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString mkdirs}) + exec ${pkgs.vim}/bin/vim "$@" + '') + ]; hs.vim = pkgs.writeText "hs.vim" '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ -- cgit v1.2.3 From f66d7f4d4720d1166520eae6a552245bc92e6a2d Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Mar 2017 22:57:21 +0100 Subject: l 2: add htop.nix --- lass/2configs/default.nix | 1 + lass/2configs/htop.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lass/2configs/htop.nix diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 3e7881fb4..96f70d312 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -9,6 +9,7 @@ with import ; ../2configs/nixpkgs.nix ../2configs/vim.nix ../2configs/monitoring/client.nix + ./htop.nix ./backups.nix ./security-workarounds.nix { diff --git a/lass/2configs/htop.nix b/lass/2configs/htop.nix new file mode 100644 index 000000000..0296101ac --- /dev/null +++ b/lass/2configs/htop.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +with import ; + +{ + nixpkgs.config.packageOverrides = super: { + htop = pkgs.concat "htop" [ + super.htop + (pkgs.writeDashBin "htop" '' + export HTOPRC=${pkgs.writeText "htoprc" '' + fields=0 48 17 18 38 39 40 2 46 47 49 1 + sort_key=46 + sort_direction=1 + hide_threads=0 + hide_kernel_threads=1 + hide_userland_threads=0 + shadow_other_users=1 + show_thread_names=1 + show_program_path=1 + highlight_base_name=1 + highlight_megabytes=1 + highlight_threads=1 + tree_view=1 + header_margin=1 + detailed_cpu_time=0 + cpu_count_from_zero=0 + update_process_names=0 + account_guest_in_cpu_meter=1 + color_scheme=6 + delay=15 + left_meters=LeftCPUs2 RightCPUs2 Memory Swap + left_meter_modes=1 1 1 1 + right_meters=Uptime Tasks LoadAverage Battery + right_meter_modes=2 2 2 2 + ''} + exec ${super.htop}/bin/htop "$@" + '') + ]; + }; +} -- cgit v1.2.3 From 8464ebbf6954a5940b9dce8927639e128434b9d7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 00:47:43 +0100 Subject: k 3 repo-sync: better types, add repo timer --- krebs/3modules/repo-sync.nix | 114 +++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 43 deletions(-) diff --git a/krebs/3modules/repo-sync.nix b/krebs/3modules/repo-sync.nix index 7705635f0..0211b31ba 100644 --- a/krebs/3modules/repo-sync.nix +++ b/krebs/3modules/repo-sync.nix @@ -12,7 +12,34 @@ let api = { enable = mkEnableOption "repo-sync"; repos = mkOption { - type = with types;attrsOf (attrsOf (attrsOf (attrsOf str))); + type = types.attrsOf (types.submodule { + options = { + branches = mkOption { + type = types.attrsOf (types.submodule ({ config, ... }: { + options = { + origin = mkOption { + type = types.git-source; + }; + mirror = mkOption { + type = types.git-source; + }; + }; + config = { + origin.ref = mkDefault "heads/master"; + mirror.ref = mkDefault "heads/${config._module.args.name}"; + }; + })); + }; + latest = mkOption { + type = types.nullOr types.git-source; + default = null; + }; + timerConfig = mkOption { + type = types.attrsOf types.str; + default = cfg.timerConfig; + }; + }; + }); example = literalExample '' # see `repo-sync --help` # `ref` provides sane defaults and can be omitted @@ -23,53 +50,53 @@ let # each attrset defines a group of repos for syncing { nxpkgs = { - makefu = { - origin = { - url = http://github.com/makefu/nixpkgs; - ref = "heads/dev" ; + branches = { + makefu = { + origin = { + url = http://github.com/makefu/nixpkgs; + ref = "heads/dev" ; + }; + mirror = { + url = "git@internal:nixpkgs-mirror" ; + ref = "heads/github-mirror-dev" ; + }; }; - mirror = { - url = "git@internal:nixpkgs-mirror" ; - ref = "heads/github-mirror-dev" ; + lass = { + origin = { + url = http://github.com/lass/nixpkgs; + }; + mirror = { + url = "git@internal:nixpkgs-mirror" ; + }; }; }; - lass = { - origin = { - url = http://github.com/lass/nixpkgs; - }; - mirror = { - url = "git@internal:nixpkgs-mirror" ; - }; - }; - "@latest" = { - mirror = { - url = "git@internal:nixpkgs-mirror"; - ref = "heads/master"; - }; + latest = { + url = "git@internal:nixpkgs-mirror"; + ref = "heads/master"; }; }; stockholm = { - lass = { - origin = { - url = http://cgit.prism.r/stockholm; + branches = { + lass = { + origin = { + url = http://cgit.prism.r/stockholm; + }; + mirror = { + url = "git@internal:stockholm-mirror" ; + }; }; - mirror = { - url = "git@internal:stockholm-mirror" ; + makefu = { + origin = { + url = http://gum.krebsco.de/stockholm; + }; + mirror = { + url = "git@internal:stockholm-mirror" ; + }; }; }; - makefu = { - origin = { - url = http://gum.krebsco.de/stockholm; - }; - mirror = { - url = "git@internal:stockholm-mirror" ; - }; - }; - "@latest" = { - mirror = { - url = "git@internal:stockholm-mirror"; - ref = "heads/master"; - }; + latest = { + url = "git@internal:stockholm-mirror"; + ref = "heads/master"; }; }; }; @@ -127,15 +154,16 @@ let nameValuePair "repo-sync-${name}" { description = "repo-sync timer"; wantedBy = [ "timers.target" ]; - - timerConfig = cfg.timerConfig; + timerConfig = repo.timerConfig; } ) cfg.repos; systemd.services = mapAttrs' (name: repo: let - repo-sync-config = pkgs.writeText "repo-sync-config-${name}.json" - (builtins.toJSON repo); + repo-sync-config = pkgs.writeJSON "repo-sync-config-${name}.json" + (repo.branches // optionalAttrs (repo.latest != null) { + "@latest".mirror = repo.latest; + }); in nameValuePair "repo-sync-${name}" { description = "repo-sync"; after = [ "network.target" "secret.service" ]; -- cgit v1.2.3 From d7b71cdb91943aa0db6337da66e353a92956d499 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 00:49:13 +0100 Subject: l 2 repo-sync: use new api --- lass/2configs/repo-sync.nix | 55 ++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/lass/2configs/repo-sync.nix b/lass/2configs/repo-sync.nix index 83f646130..dfea637ed 100644 --- a/lass/2configs/repo-sync.nix +++ b/lass/2configs/repo-sync.nix @@ -36,25 +36,27 @@ let sync-retiolum = name: { krebs.repo-sync.repos.${name} = { - makefu = { - origin.url = "http://cgit.gum/${name}"; - mirror.url = "${mirror}${name}"; + branches = { + makefu = { + origin.url = "http://cgit.gum/${name}"; + mirror.url = "${mirror}${name}"; + }; + tv = { + origin.url = "http://cgit.ni.r/${name}"; + mirror.url = "${mirror}${name}"; + }; + nin = { + origin.url = "http://cgit.onondaga.r/${name}"; + mirror.url = "${mirror}${name}"; + }; + lassulus = { + origin.url = "http://cgit.lassul.us/${name}"; + mirror.url = "${mirror}${name}"; + }; }; - tv = { - origin.url = "http://cgit.ni.r/${name}"; - mirror.url = "${mirror}${name}"; - }; - nin = { - origin.url = "http://cgit.onondaga.r/${name}"; - mirror.url = "${mirror}${name}"; - }; - lassulus = { - origin.url = "http://cgit.lassul.us/${name}"; - mirror.url = "${mirror}${name}"; - }; - "@latest" = { - mirror.url = "${mirror}${name}"; - mirror.ref = "heads/newest"; + latest = { + url = "${mirror}${name}"; + ref = "heads/newest"; }; }; krebs.git = defineRepo name (config.networking.hostName == "prism"); @@ -63,9 +65,11 @@ let sync-remote = name: url: { krebs.repo-sync.repos.${name} = { - remote = { - origin.url = url; - mirror.url = "${mirror}${name}"; + branches = { + remote = { + origin.url = url; + mirror.url = "${mirror}${name}"; + }; }; }; krebs.git = defineRepo name (config.networking.hostName == "prism"); @@ -74,9 +78,11 @@ let sync-remote-silent = name: url: { krebs.repo-sync.repos.${name} = { - remote = { - origin.url = url; - mirror.url = "${mirror}${name}"; + branches = { + remote = { + origin.url = url; + mirror.url = "${mirror}${name}"; + }; }; }; krebs.git = defineRepo name false; @@ -109,4 +115,3 @@ in { (sync-retiolum "xmonad-stockholm") ]; } - -- cgit v1.2.3 From c6654de563efb4e4afcb53a6760ab6767693389f Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 00:52:31 +0100 Subject: s 2 repo-sync: use new api --- shared/2configs/repo-sync.nix | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/shared/2configs/repo-sync.nix b/shared/2configs/repo-sync.nix index 4219e5d01..004ea5942 100644 --- a/shared/2configs/repo-sync.nix +++ b/shared/2configs/repo-sync.nix @@ -8,19 +8,21 @@ with lib; in { enable = true; repos.stockholm = { - makefu = { - origin.url = http://cgit.gum/stockholm ; - mirror.url = mirror; - }; - tv = { - origin.url = http://cgit.ni.r/stockholm; - mirror.url = mirror; - }; - lassulus = { - origin.url = http://cgit.prism/stockholm ; - mirror.url = mirror; + branches = { + makefu = { + origin.url = http://cgit.gum/stockholm ; + mirror.url = mirror; + }; + tv = { + origin.url = http://cgit.ni.r/stockholm; + mirror.url = mirror; + }; + lassulus = { + origin.url = http://cgit.prism/stockholm ; + mirror.url = mirror; + }; }; - "@latest" = { + latest = { mirror.url = mirror; }; }; -- cgit v1.2.3 From 9a50ea0143161746f9be9dc99abb87c384b9cc27 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 00:58:09 +0100 Subject: l 2: add logf.nix --- lass/1systems/mors.nix | 2 +- lass/2configs/logf.nix | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 lass/2configs/logf.nix diff --git a/lass/1systems/mors.nix b/lass/1systems/mors.nix index bffb08ad3..223e16bae 100644 --- a/lass/1systems/mors.nix +++ b/lass/1systems/mors.nix @@ -24,6 +24,7 @@ with import ; ../2configs/krebs-pass.nix ../2configs/repo-sync.nix ../2configs/ircd.nix + ../2configs/logf.nix { #risk of rain port krebs.iptables.tables.filter.INPUT.rules = [ @@ -192,7 +193,6 @@ with import ; remmina thunderbird - logf iodine macchanger diff --git a/lass/2configs/logf.nix b/lass/2configs/logf.nix new file mode 100644 index 000000000..3c4948db1 --- /dev/null +++ b/lass/2configs/logf.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: +with import ; +let + host-colors = { + mors = "131"; + prism = "95"; + uriel = "61"; + shodan = "51"; + icarus = "53"; + echelon = "197"; + helios = "199"; + cloudkrebs = "119"; + }; +in { + environment.systemPackages = [ + (pkgs.writeDashBin "logf" '' + export LOGF_HOST_COLORS=${pkgs.writeJSON "host-colors" host-colors} + ${pkgs.logf}/bin/logf ${concatMapStringsSep " " (name: "root@${name}") (attrNames config.lass.hosts)} + '') + ]; +} -- cgit v1.2.3 From 9d1653fe7526922680f93b0990de85619d9a9dca Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 01:06:04 +0100 Subject: l 1 prism: saner repo-sync timers --- lass/1systems/prism.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lass/1systems/prism.nix b/lass/1systems/prism.nix index b55732f65..a7a7f6129 100644 --- a/lass/1systems/prism.nix +++ b/lass/1systems/prism.nix @@ -215,8 +215,13 @@ in { } { krebs.repo-sync.timerConfig = { + OnBootSec = "15min"; + OnUnitInactiveSec = "90min"; + RandomizedDelaySec = "30min"; + }; + krebs.repo-sync.repos.stockholm.timerConfig = { OnBootSec = "5min"; - OnUnitInactiveSec = "3min"; + OnUnitInactiveSec = "2min"; RandomizedDelaySec = "2min"; }; } -- cgit v1.2.3 From 3374fe9566a366451ea59f325ecb1e2da7046322 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Mar 2017 01:06:31 +0100 Subject: l 2 nixpkgs: use cgit.lassul.us as gitserver --- lass/2configs/nixpkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/nixpkgs.nix b/lass/2configs/nixpkgs.nix index 59851f25a..a6409b7db 100644 --- a/lass/2configs/nixpkgs.nix +++ b/lass/2configs/nixpkgs.nix @@ -2,7 +2,7 @@ { krebs.build.source.nixpkgs.git = { - url = https://github.com/nixos/nixpkgs; + url = https://cgit.lassul.us/nixpkgs; ref = "c0ecd31"; }; } -- cgit v1.2.3