summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krebs/3modules/backup.nix8
-rw-r--r--krebs/3modules/default.nix1
-rw-r--r--krebs/3modules/htgen.nix7
-rw-r--r--krebs/3modules/repo-sync.nix2
-rw-r--r--krebs/3modules/tv/default.nix25
-rw-r--r--krebs/3modules/upstream/default.nix10
-rw-r--r--krebs/3modules/upstream/desktop-managers/coma.nix21
-rw-r--r--krebs/3modules/upstream/desktop-managers/default.nix6
-rw-r--r--krebs/3modules/upstream/desktop-managers/none.nix11
-rw-r--r--krebs/3modules/upstream/window-managers/default.nix22
-rw-r--r--krebs/3modules/upstream/window-managers/xmonad.nix189
-rw-r--r--krebs/5pkgs/override/default.nix9
-rw-r--r--tv/2configs/hw/AO753.nix4
-rw-r--r--tv/2configs/ppp.nix6
-rw-r--r--tv/2configs/repo-sync/wiki.nix41
-rw-r--r--tv/2configs/vim.nix5
-rw-r--r--tv/5pkgs/default.nix8
17 files changed, 365 insertions, 10 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index c0b218c15..910324f3c 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -226,10 +226,14 @@ let
# XXX Is one ping enough to determine fastest address?
fastest-address = host: ''
- { ${pkgs.fping}/bin/fping </dev/null -a \
+ { ${pkgs.fping}/bin/fping </dev/null -a -e \
${concatMapStringsSep " " shell.escape
(mapAttrsToList (_: net: head net.aliases) host.nets)} \
- | ${pkgs.coreutils}/bin/head -1; }
+ | ${pkgs.gnused}/bin/sed -r 's/^(\S+) \(([0-9.]+) ms\)$/\2\t\1/' \
+ | ${pkgs.coreutils}/bin/sort -n \
+ | ${pkgs.coreutils}/bin/cut -f2 \
+ | ${pkgs.coreutils}/bin/head -n 1
+ }
'';
in out
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index e7d04ead8..85d27459b 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -55,6 +55,7 @@ let
./sync-containers.nix
./tinc.nix
./tinc_graphs.nix
+ ./upstream
./urlwatch.nix
./repo-sync.nix
./xresources.nix
diff --git a/krebs/3modules/htgen.nix b/krebs/3modules/htgen.nix
index 0dddca6c8..70c4fcd2b 100644
--- a/krebs/3modules/htgen.nix
+++ b/krebs/3modules/htgen.nix
@@ -20,6 +20,11 @@ let
default = config._module.args.name;
};
+ package = mkOption {
+ default = pkgs.htgen;
+ type = types.package;
+ };
+
port = mkOption {
type = types.uint;
};
@@ -52,7 +57,7 @@ let
User = htgen.user.name;
PrivateTmp = true;
Restart = "always";
- ExecStart = "${pkgs.htgen}/bin/htgen --serve";
+ ExecStart = "${htgen.package}/bin/htgen --serve";
};
}
) cfg;
diff --git a/krebs/3modules/repo-sync.nix b/krebs/3modules/repo-sync.nix
index 91111f3eb..f9877c0f8 100644
--- a/krebs/3modules/repo-sync.nix
+++ b/krebs/3modules/repo-sync.nix
@@ -176,7 +176,7 @@ let
];
environment = {
- GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.stateDir}/ssh.priv";
+ GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.privateKeyFile.path}";
REPONAME = "${name}.git";
};
diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix
index 6a09cc834..92f1a5bcd 100644
--- a/krebs/3modules/tv/default.nix
+++ b/krebs/3modules/tv/default.nix
@@ -82,6 +82,31 @@ in {
ssh.privkey.path = config.krebs.secret.file "ssh.id_ed25519";
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsqDuhGJpjpqNv4QmjoOhcODObrPyY3GHLvtVkgXV0g root@au";
};
+ hu = {
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.13.41";
+ aliases = [
+ "hu.r"
+ ];
+ tinc.pubkey = ''
+ -----BEGIN RSA PUBLIC KEY-----
+ MIIBCgKCAQEAwj5T9Rejp8zGVrHjqA+OeMvcVpax4VazssnRPSUznUEOdVEeSJL5
+ 8gDBJPtIfxF8iunXr5K7CW036tKvYaGMDwYMOPJZXhFCmU2yUF2g4BcqEhuDdIfO
+ +D2Pfr4lc9xO90SKOgwJ53qhf5yqeU/WQ3dpCF/n8k4SUmdafTsvh00UrxYpHuTU
+ C22BRXIKR4r/sCJUitWQSWNdSQUxh3lu7sUPr+6sZyJov+eu8oBVlPgYOv6u9nZe
+ YhrbCPDKMGPfnQTAtWfHIxNt70Ec5AG6ddQzLeVcM2gP5qi957Fert+C2RNtbz5s
+ Brbw1bqZ3P+CGzvxVJZtirvR2f3HkidGPQIDAQAB
+ -----END RSA PUBLIC KEY-----
+ '';
+ tinc.pubkey_ed25519 =
+ "Ed25519PublicKey = PV8Dz9ni2cPXyJGiG5oU0XWdJkUPgrMzDuzHj7kpMzO";
+ };
+ };
+ secure = true;
+ ssh.privkey.path = config.krebs.secret.file "ssh.id_ed25519";
+ ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+Rrf9tvuusYlnSZwUiHS4O+AhrpVZ/6n7peSRKojTc root@hu";
+ };
mu = {
ci = true;
cores = 2;
diff --git a/krebs/3modules/upstream/default.nix b/krebs/3modules/upstream/default.nix
new file mode 100644
index 000000000..ce7bd1644
--- /dev/null
+++ b/krebs/3modules/upstream/default.nix
@@ -0,0 +1,10 @@
+with import <stockholm/lib>;
+
+{
+ imports =
+ map
+ (name: ./. + "/${name}")
+ (filter
+ (name: name != "default.nix" && !hasPrefix "." name)
+ (attrNames (readDir ./.)));
+}
diff --git a/krebs/3modules/upstream/desktop-managers/coma.nix b/krebs/3modules/upstream/desktop-managers/coma.nix
new file mode 100644
index 000000000..95db7fb5c
--- /dev/null
+++ b/krebs/3modules/upstream/desktop-managers/coma.nix
@@ -0,0 +1,21 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: {
+ options = {
+ services.xserver.desktopManager.coma = {
+ enable = mkEnableOption "sleep as a desktop manager";
+ };
+ };
+ config = mkIf config.services.xserver.desktopManager.coma.enable {
+ services.xserver.desktopManager.session = singleton {
+ name = "coma";
+ bgSupport = true;
+ start = /* sh */ ''
+ if test -n "$waitPID"; then
+ ${pkgs.uutils-coreutils}/bin/uutils-sleep 1s && kill $waitPID &
+ wait $waitPID
+ fi
+ exec -a sleep ${pkgs.uutils-coreutils}/bin/uutils-sleep infinity
+ '';
+ };
+ };
+}
diff --git a/krebs/3modules/upstream/desktop-managers/default.nix b/krebs/3modules/upstream/desktop-managers/default.nix
new file mode 100644
index 000000000..22e75439d
--- /dev/null
+++ b/krebs/3modules/upstream/desktop-managers/default.nix
@@ -0,0 +1,6 @@
+{
+ imports = [
+ ./coma.nix
+ ./none.nix
+ ];
+}
diff --git a/krebs/3modules/upstream/desktop-managers/none.nix b/krebs/3modules/upstream/desktop-managers/none.nix
new file mode 100644
index 000000000..892def985
--- /dev/null
+++ b/krebs/3modules/upstream/desktop-managers/none.nix
@@ -0,0 +1,11 @@
+# Replace upstream none desktop-manager by a real none, that doesn't pull in
+# any dependencies.
+with import <stockholm/lib>;
+{
+ disabledModules = singleton "services/x11/desktop-managers/none.nix";
+ config.services.xserver.desktopManager.session = singleton {
+ name = "none";
+ bgSupport = true;
+ start = "";
+ };
+}
diff --git a/krebs/3modules/upstream/window-managers/default.nix b/krebs/3modules/upstream/window-managers/default.nix
new file mode 100644
index 000000000..eecadca7e
--- /dev/null
+++ b/krebs/3modules/upstream/window-managers/default.nix
@@ -0,0 +1,22 @@
+{
+ imports = [
+ # Replace upstream xmonad module with one that will be reloaded if changed.
+ #
+ # This module is intended to be upstreamed once fully tested.
+ # The patch to be committed can be obtained using:
+ #
+ # diff -u <nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix> \
+ # <stockholm/tv/3modules/window-managers/xmonad.nix>
+ #
+ {
+ disabledModules = [ "services/x11/window-managers/xmonad.nix" ];
+ imports = [ ./xmonad.nix ];
+ nixpkgs.overlays = [(self: super: {
+ writers = super.writers // {
+ writeHaskellBin = name: spec: with import <stockholm/lib>;
+ super.writers.writeHaskellBin name (removeAttrs spec ["ghcArgs"]);
+ };
+ })];
+ }
+ ];
+}
diff --git a/krebs/3modules/upstream/window-managers/xmonad.nix b/krebs/3modules/upstream/window-managers/xmonad.nix
new file mode 100644
index 000000000..356fa46bf
--- /dev/null
+++ b/krebs/3modules/upstream/window-managers/xmonad.nix
@@ -0,0 +1,189 @@
+{pkgs, lib, config, ...}:
+
+with lib;
+let
+ inherit (lib) mkOption mkIf optionals literalExample;
+ cfg = config.services.xserver.windowManager.xmonad;
+
+ ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
+ packages = self: cfg.extraPackages self ++
+ optionals cfg.enableContribAndExtras
+ [ self.xmonad-contrib self.xmonad-extras ];
+
+ xmonad-vanilla = pkgs.xmonad-with-packages.override {
+ inherit ghcWithPackages packages;
+ };
+
+ xmonad-config =
+ let
+ xmonadAndPackages = self: [ self.xmonad ] ++ packages self;
+ xmonadEnv = ghcWithPackages xmonadAndPackages;
+ configured = pkgs.writers.writeHaskellBin "xmonad" {
+ ghc = cfg.haskellPackages.ghc;
+ libraries = xmonadAndPackages cfg.haskellPackages;
+ inherit (cfg) ghcArgs;
+ } cfg.config;
+ in
+ pkgs.runCommandLocal "xmonad" {
+ nativeBuildInputs = [ pkgs.makeWrapper ];
+ } ''
+ install -D ${xmonadEnv}/share/man/man1/xmonad.1.gz $out/share/man/man1/xmonad.1.gz
+ makeWrapper ${configured}/bin/xmonad $out/bin/xmonad \
+ --set NIX_GHC "${xmonadEnv}/bin/ghc" \
+ --set XMONAD_XMESSAGE "${pkgs.xorg.xmessage}/bin/xmessage"
+ '';
+
+ xmonad = if (cfg.config != null) then xmonad-config else xmonad-vanilla;
+in {
+ meta.maintainers = with maintainers; [ lassulus xaverdh ivanbrennan ];
+
+ options = {
+ services.xserver.windowManager.xmonad = {
+ enable = mkEnableOption "xmonad";
+ haskellPackages = mkOption {
+ default = pkgs.haskellPackages;
+ defaultText = "pkgs.haskellPackages";
+ example = literalExample "pkgs.haskell.packages.ghc784";
+ description = ''
+ haskellPackages used to build Xmonad and other packages.
+ This can be used to change the GHC version used to build
+ Xmonad and the packages listed in
+ <varname>extraPackages</varname>.
+ '';
+ };
+
+ extraPackages = mkOption {
+ default = self: [];
+ defaultText = "self: []";
+ example = literalExample ''
+ haskellPackages: [
+ haskellPackages.xmonad-contrib
+ haskellPackages.monad-logger
+ ]
+ '';
+ description = ''
+ Extra packages available to ghc when rebuilding Xmonad. The
+ value must be a function which receives the attrset defined
+ in <varname>haskellPackages</varname> as the sole argument.
+ '';
+ };
+
+ enableContribAndExtras = mkOption {
+ default = false;
+ type = lib.types.bool;
+ description = "Enable xmonad-{contrib,extras} in Xmonad.";
+ };
+
+ config = mkOption {
+ default = null;
+ type = with lib.types; nullOr (either path str);
+ description = ''
+ Configuration from which XMonad gets compiled. If no value is
+ specified, a vanilla xmonad binary is put in PATH, which will
+ attempt to recompile and exec your xmonad config from $HOME/.xmonad.
+ This setup is then analogous to other (non-NixOS) linux distributions.
+
+ If you do set this option, you likely want to use "launch" as your
+ entry point for xmonad (as in the example), to avoid xmonad's
+ recompilation logic on startup. Doing so will render the default
+ "mod+q" restart key binding dysfunctional though, because that attempts
+ to call your binary with the "--restart" command line option, unless
+ you implement that yourself. You way mant to bind "mod+q" to
+ <literal>(restart "xmonad" True)</literal> instead, which will just restart
+ xmonad from PATH. This allows e.g. switching to the new xmonad binary
+ after rebuilding your system with nixos-rebuild.
+
+ If you actually want to run xmonad with a config specified here, but
+ also be able to recompile and restart it from a copy of that source in
+ $HOME/.xmonad on the fly, you will have to implement that yourself
+ using something like "compileRestart" from the example.
+ This should allow you to switch at will between the local xmonad and
+ the one NixOS puts in your PATH.
+ '';
+ example = ''
+ import XMonad
+ import XMonad.Util.EZConfig (additionalKeys)
+ import Control.Monad (when)
+ import Text.Printf (printf)
+ import System.Posix.Process (executeFile)
+ import System.Info (arch,os)
+ import System.Environment (getArgs)
+ import System.FilePath ((</>))
+
+ compiledConfig = printf "xmonad-%s-%s" arch os
+
+ compileRestart resume =
+ whenX (recompile True) $
+ when resume writeStateToFile
+ *> catchIO
+ ( do
+ dir <- getXMonadDataDir
+ args <- getArgs
+ executeFile (dir </> compiledConfig) False args Nothing
+ )
+
+ main = launch defaultConfig
+ { modMask = mod4Mask -- Use Super instead of Alt
+ , terminal = "urxvt" }
+ `additionalKeys`
+ [ ( (mod4Mask,xK_r), compileRestart True)
+ , ( (mod4Mask,xK_q), restart "xmonad" True ) ]
+ '';
+ };
+
+ xmonadCliArgs = mkOption {
+ default = [];
+ type = with lib.types; listOf str;
+ description = ''
+ Command line arguments passed to the xmonad binary.
+ '';
+ };
+
+ ghcArgs = mkOption {
+ default = [];
+ type = with lib.types; listOf str;
+ description = ''
+ Command line arguments passed to the compiler (ghc)
+ invocation when xmonad.config is set.
+ '';
+ };
+
+ };
+ };
+ config = mkIf cfg.enable {
+ services.xserver.windowManager = {
+ session = [{
+ name = "xmonad";
+ start = ''
+ systemctl --user start --wait xmonad.service &
+ waitPID=$!
+ '';
+ }];
+ };
+
+ system.userActivationScripts.xmonad-reload = /* sh */ ''
+ if ${pkgs.systemd}/bin/systemctl --user is-active --quiet xmonad.service; then
+ if [ "$(readlink -f "$XDG_RUNTIME_DIR"/xmonad/xmonad)" != ${xmonad}/bin/xmonad ]; then
+ ${pkgs.systemd}/bin/systemctl --user reload xmonad.service
+ fi
+ fi
+ '';
+
+ systemd.user.services.xmonad = {
+ requisite = [ "graphical-session.target" ];
+ after = [ "graphical-session.target" ];
+ environment.PATH = mkForce "%t/xmonad";
+ environment.XMONAD_DATA_DIR = "%t/xmonad";
+ serviceConfig = rec {
+ ExecStartPre = [
+ "${pkgs.coreutils}/bin/mkdir -p %t/xmonad"
+ "${pkgs.coreutils}/bin/ln -fns ${xmonad}/bin/xmonad %t/xmonad/xmonad"
+ ];
+ ExecStart = "%t/xmonad/xmonad ${lib.escapeShellArgs cfg.xmonadCliArgs}";
+ ExecReload = ExecStartPre ++ [ "${xmonad-vanilla}/bin/xmonad --restart" ];
+ };
+ };
+
+ environment.systemPackages = [ xmonad ];
+ };
+}
diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix
index 7a7b979c4..926e9dccd 100644
--- a/krebs/5pkgs/override/default.nix
+++ b/krebs/5pkgs/override/default.nix
@@ -1,6 +1,15 @@
with import <stockholm/lib>;
self: super: {
+ bitlbee-facebook = super.bitlbee-facebook.overrideAttrs (old: {
+ src = self.fetchFromGitHub {
+ owner = "bitlbee";
+ repo = "bitlbee-facebook";
+ rev = "49ea312d98b0578b9b2c1ff759e2cfa820a41f4d";
+ sha256 = "0zg1p9pyfsdbfqac2qmyzcr6zjibwdn2907qgc808gljfx8bfnmk";
+ };
+ });
+
flameshot = super.flameshot.overrideAttrs (old: rec {
patches = old.patches or [] ++ [
(self.writeText "flameshot-imgur.patch" /* diff */ ''
diff --git a/tv/2configs/hw/AO753.nix b/tv/2configs/hw/AO753.nix
index d5b755cef..a91a5e518 100644
--- a/tv/2configs/hw/AO753.nix
+++ b/tv/2configs/hw/AO753.nix
@@ -21,6 +21,10 @@ with import <stockholm/lib>;
"wl"
];
+ # broadcom_sta is marked as broken for 5.9+
+ # pkgs.linuxPackages_latest ist 5.9
+ boot.kernelPackages = pkgs.linuxPackages_5_8;
+
boot.extraModulePackages = [
config.boot.kernelPackages.broadcom_sta
];
diff --git a/tv/2configs/ppp.nix b/tv/2configs/ppp.nix
index ff61f943f..c801401b2 100644
--- a/tv/2configs/ppp.nix
+++ b/tv/2configs/ppp.nix
@@ -8,8 +8,10 @@
in {
assertions = [
{
- assertion = config.networking.resolvconf.enable;
- message = "ppp configuration needs resolvconf";
+ assertion =
+ config.networking.resolvconf.enable ||
+ config.networking.useNetworkd;
+ message = "ppp configuration needs resolvconf or networkd";
}
];
environment.etc."ppp/ip-up".source = pkgs.writeDash "ppp.ip-up" ''
diff --git a/tv/2configs/repo-sync/wiki.nix b/tv/2configs/repo-sync/wiki.nix
new file mode 100644
index 000000000..913439906
--- /dev/null
+++ b/tv/2configs/repo-sync/wiki.nix
@@ -0,0 +1,41 @@
+{ config, pkgs, ... }: let
+ lib = import <stockholm/lib>;
+in {
+ krebs.repo-sync.enable = true;
+ krebs.repo-sync.repos.wiki.branches.hotdog = {
+ origin.url = "http://cgit.hotdog.r/wiki";
+ mirror.url = "git@${config.krebs.build.host.name}.r:wiki";
+ };
+ krebs.git.repos.wiki = {
+ public = true;
+ name = "wiki";
+ cgit.desc = toString [
+ "mirror of"
+ config.krebs.repo-sync.repos.wiki.branches.hotdog.origin.url
+ ];
+ cgit.section = "7. mirrors";
+ hooks.post-receive = /* sh */ ''
+ ${pkgs.git-hooks.irc-announce {
+ channel = "#xxx";
+ nick = config.krebs.build.host.name;
+ server = "irc.r";
+ }}
+ ${pkgs.cgit-clear-cache.override {
+ inherit (config.krebs.git.cgit.settings) cache-root;
+ }}/bin/cgit-clear-cache
+ '';
+ };
+ krebs.git.rules = lib.singleton {
+ user = lib.singleton config.krebs.users.repo-sync;
+ repo = lib.singleton config.krebs.git.repos.wiki;
+ perm = lib.git.push "refs/*" [
+ lib.git.create
+ lib.git.delete
+ lib.git.merge
+ lib.git.non-fast-forward
+ ];
+ };
+ krebs.users.${config.krebs.repo-sync.user.name}.pubkey = {
+ ni = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK9U0Ob9/O0kxg3trhZY/vDnbqfN+R5cASGiClRr4IM";
+ }.${config.krebs.build.host.name};
+}
diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix
index f8d599f7e..c0125ecfa 100644
--- a/tv/2configs/vim.nix
+++ b/tv/2configs/vim.nix
@@ -72,7 +72,7 @@ let {
set mouse=a
set noruler
set pastetoggle=<INS>
- set runtimepath=$VIMRUNTIME,${extra-runtimepath}
+ set runtimepath=${extra-runtimepath},$VIMRUNTIME
set shortmess+=I
set showcmd
set showmatch
@@ -133,7 +133,8 @@ let {
vnoremap u <nop>
" fzf
- nnoremap <esc>q :Files<cr>
+ nnoremap <esc>q :Buffers<cr>
+ nnoremap <esc>f :Files<cr>
nnoremap <esc>w :Rg<cr>
" edit alternate buffer
diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix
index fd3d2f32a..cae5da112 100644
--- a/tv/5pkgs/default.nix
+++ b/tv/5pkgs/default.nix
@@ -13,13 +13,17 @@ foldl' mergeAttrs {}
//
{
- # TODO use XDG_RUNTIME_DIR?
cr = self.writeDashBin "cr" ''
set -efu
+ if test -n "''${XDG_RUNTIME_DIR-}"; then
+ cache_dir=$XDG_RUNTIME_DIR/chromium-disk-cache
+ else
+ cache_dir=/tmp/chromium-disk-cache_$LOGNAME
+ fi
export LC_TIME=de_DE.utf8
exec ${self.chromium}/bin/chromium \
--ssl-version-min=tls1 \
- --disk-cache-dir=/tmp/chromium-disk-cache_"$LOGNAME" \
+ --disk-cache-dir="$cache_dir" \
--disk-cache-size=50000000 \
"$@"
'';