Merge branch 'prism/master' into HEAD

This commit is contained in:
lassulus 2017-12-05 18:46:48 +01:00
commit 8030352c45
21 changed files with 307 additions and 173 deletions

View File

@ -7,6 +7,9 @@
services.charybdis = { services.charybdis = {
enable = true; enable = true;
motd = ''
hello
'';
config = '' config = ''
serverinfo { serverinfo {
name = "${config.krebs.build.host.name}.irc.retiolum"; name = "${config.krebs.build.host.name}.irc.retiolum";

View File

@ -27,7 +27,7 @@ let
}; };
display = mkOption { display = mkOption {
type = types.str; type = types.str;
default = ":0"; default = ":${toString config.services.xserver.display}";
}; };
unitConfig = mkOption { unitConfig = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;

View File

@ -449,8 +449,6 @@ with import <stockholm/lib>;
retiolum = rec { retiolum = rec {
via = internet; via = internet;
addrs = [ addrs = [
# edinburgh university
"129.215.0.0/16"
ip4.addr ip4.addr
ip6.addr ip6.addr
]; ];
@ -472,6 +470,10 @@ with import <stockholm/lib>;
lyK301Jb42wGEsVWxu3Eo/PLtp8OdD+Wdh6o/ELcc0k/YCUGFMujUM8CAwEAAQ== lyK301Jb42wGEsVWxu3Eo/PLtp8OdD+Wdh6o/ELcc0k/YCUGFMujUM8CAwEAAQ==
-----END RSA PUBLIC KEY----- -----END RSA PUBLIC KEY-----
''; '';
tinc.subnets = [
# edinburgh university
"129.215.0.0/16"
];
}; };
}; };
}; };

View File

@ -14,6 +14,8 @@ with import <stockholm/lib>;
#<stockholm/lass/2configs/git.nix> #<stockholm/lass/2configs/git.nix>
<stockholm/lass/2configs/dcso-vpn.nix> <stockholm/lass/2configs/dcso-vpn.nix>
<stockholm/lass/2configs/virtualbox.nix> <stockholm/lass/2configs/virtualbox.nix>
<stockholm/lass/2configs/dcso-dev.nix>
<stockholm/lass/2configs/steam.nix>
{ # automatic hardware detection { # automatic hardware detection
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
@ -61,6 +63,13 @@ with import <stockholm/lib>;
maxTime = 9001; maxTime = 9001;
}; };
} }
{
#urban terror port
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p tcp --dport 27960"; target = "ACCEPT"; }
{ predicate = "-p udp --dport 27960"; target = "ACCEPT"; }
];
}
]; ];
krebs.build.host = config.krebs.hosts.helios; krebs.build.host = config.krebs.hosts.helios;
@ -92,7 +101,6 @@ with import <stockholm/lib>;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ag ag
vim vim
rxvt_unicode
git git
rsync rsync
hashPassword hashPassword

View File

@ -286,6 +286,7 @@ in {
]; ];
} }
<stockholm/krebs/2configs/reaktor-krebs.nix> <stockholm/krebs/2configs/reaktor-krebs.nix>
<stockholm/lass/2configs/dcso-dev.nix>
]; ];
krebs.build.host = config.krebs.hosts.prism; krebs.build.host = config.krebs.hosts.prism;

View File

@ -7,9 +7,9 @@ in {
./mpv.nix ./mpv.nix
./power-action.nix ./power-action.nix
./copyq.nix ./copyq.nix
./xresources.nix
./livestream.nix ./livestream.nix
./dns-stuff.nix ./dns-stuff.nix
./urxvt.nix
{ {
hardware.pulseaudio = { hardware.pulseaudio = {
enable = true; enable = true;
@ -41,6 +41,11 @@ in {
default = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1"; default = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1";
}; };
}; };
config.services.xresources.resources.X = ''
*.font: ${config.lass.fonts.regular}
*.boldFont: ${config.lass.fonts.bold}
*.italicFont: ${config.lass.fonts.italic}
'';
} }
]; ];
@ -64,9 +69,11 @@ in {
dic dic
dmenu dmenu
gi gi
git-preview
gitAndTools.qgit gitAndTools.qgit
lm_sensors
haskellPackages.hledger haskellPackages.hledger
lm_sensors
mpv-poll
much much
ncdu ncdu
nix-repl nix-repl
@ -74,7 +81,7 @@ in {
pavucontrol pavucontrol
powertop powertop
push push
rxvt_unicode rxvt_unicode_with-plugins
screengrab screengrab
slock slock
sxiv sxiv
@ -97,26 +104,8 @@ in {
xlibs.fontschumachermisc xlibs.fontschumachermisc
]; ];
lass.xserver.enable = true;
services.xserver = { services.xserver = {
enable = true;
desktopManager.xterm.enable = false;
desktopManager.default = "none";
displayManager.lightdm.enable = true;
displayManager.lightdm.autoLogin = {
enable = true;
user = "lass";
};
windowManager.default = "xmonad";
windowManager.session = [{
name = "xmonad";
start = ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL:
${pkgs.xmonad-lass}/bin/xmonad &
waitPID=$!
'';
}];
layout = "us"; layout = "us";
xkbModel = "evdev"; xkbModel = "evdev";
xkbVariant = "altgr-intl"; xkbVariant = "altgr-intl";
@ -127,12 +116,7 @@ in {
HandleLidSwitch=ignore HandleLidSwitch=ignore
''; '';
services.xserver.synaptics = {
enable = true;
twoFingerScroll = true;
accelFactor = "0.035";
};
services.urxvtd.enable = true; services.urxvtd.enable = true;
services.xresources.enable = true;
lass.screenlock.enable = true; lass.screenlock.enable = true;
} }

View File

@ -21,9 +21,9 @@ let
in { in {
systemd.services.copyq = { systemd.services.copyq = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
requires = [ "display-manager.service" ]; requires = [ "xserver.service" ];
environment = { environment = {
DISPLAY = ":0"; DISPLAY = ":${toString config.services.xserver.display}";
}; };
path = with pkgs; [ path = with pkgs; [
qt5.full qt5.full

View File

@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }:
let
mainUser = config.users.extraUsers.mainUser;
inherit (import <stockholm/lib>) genid;
in {
users.extraUsers = {
dev = {
name = "dev";
uid = genid "dev";
description = "user for collaborative development";
home = "/home/dev";
useDefaultShell = true;
createHome = true;
openssh.authorizedKeys.keys = [
config.krebs.users.lass.pubkey
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDhQdDQFMxXOjbC+Avx3mlcFHqQpFUk/q9sO6ATA65jCV3YzN11vhZDDv54hABVS2h8TPXs7Lu3PCvK9qouASd2h4Ie9cExUmn50G/iwgFIODsCugVYBzVt1iwaAdwz1Hb9DKYXbVXanzVJjimmrrlQNvsyZg85lcnfyedpPX5ad+4FdSP68LHqEHC18LTitldR6V4P1omaKHlOtVpDgR/72tDgbtNZDBn3EU+TPk9OLTzjc6PinPw4iIvjEfiu14APwXpFDIqT7P7SjOEFpa0v/1z7dhxIy/Z9XbqyEdUfhv3PjZR5K2C+VzR7g6jVEVR2xFId51MpLv/Un4/lalbphBEw3I90Rr8tatOJiFhyrXbaKTcLqp1sIu05OxdPkm3hzfmLIhoKxhaIlXH7WQ9sAqxL1NAQ7O+J6yT4DMnwKzvpkkJjBaGtV84Pp1cccfNRH8XXID3FkWkrUpdgXWBpyLnRq4ilUJTajkU0GSdXkq8kLL3mWg9LPRTg3dmDj61ZB/qhjM61ppwHJvDRN9WI5HruXIU6nOQjh5yE2C/JZfLcsZD4Y1UDBy5/JSZrCVT2sQjFopkkYEkRCbX7oITHOH4iyRdxZkKWLUPboFrcmBpXO+owCEhO4JZrtfFWMC6qM++nrmiZWOrdIOIvdYHWluhKR2shlkisEKQP5pUqkw== markus.hihn@dcso.de"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1T5+2epslFARSnETdr4wdolA6ocJaD4H9tmz6BZFQKXlwIq+OMp+sSEdwYwW3Lu9+mNbBHPxVVJDWg/We9DXB0ezXPM5Bs1+FcehmkoGwkmgKaFCDt0sL+CfSnog/3wEkN21O/rQxVFqMmiJ7WUDGci6IKCFZ5ZjOsmmfHg5p3LYxU9xv33fNr2v+XauhrGbFtQ7eDz4kSywxN/aw73LN4d8em0V0UV8VPI3Qkw7MamDFwefA+K1TfK8pBzMeruU6N7HLuNkpkAp7kS+K4Zzd72aQtR37a5qMiFUbOxQ9B7iFypuPx0iu6ZwY1s/sM8t3kLmcDJ9O4FOTzlbpneet3as6iJ+Ckr/TlfKor2Tl5pWcXh2FXHoG8VUu5bYmIViJBrKihAlAQfQN0mJ9fdFTnCXVTtbYTy11s4eEVHgUlb7oSpgBnx5bnBONgApbsOX9zyoo8wz8KkZBcf1SQpkV5br8uUAHCcZtHuY6I3kKlv+8lJmgUipiYzMdTi7+dHa49gVEcEKL4ZnJ0msQkl4XT7JjKETLvumC4/TIqVuRu48wuYalkCR9OzxCsTXQ/msBJBztPdYLrEOXVb2HfzuCT+43UuMQ5rP/EoPy0TWQO9BaqfEXqvbOvWjVxj/GMvglQ2ChZTwHxwwTKB8qRVvJLnbZQwizQiSrkzjb6hRJfQ== u0_a165@localhost"
];
packages = with pkgs; [
emacs25-nox
(pkgs.symlinkJoin {
name = "tmux";
paths = [
(pkgs.writeDashBin "tmux" ''
exec ${pkgs.tmux}/bin/tmux -f ${pkgs.writeText "tmux.conf" ''
set-option -g default-terminal screen-256color
#use session instead of windows
bind-key c new-session
bind-key p switch-client -p
bind-key n switch-client -n
bind-key C-s switch-client -l
''} "$@"
'')
pkgs.tmux
];
})
];
};
};
security.sudo.extraConfig = ''
${mainUser.name} ALL=(dev) NOPASSWD: ALL
'';
}

View File

@ -22,7 +22,8 @@ let
}); });
}; };
in { in {
rules = with git; singleton { rules = with git; [
{
user = with config.krebs.users; [ user = with config.krebs.users; [
config.krebs.users."${config.networking.hostName}-repo-sync" config.krebs.users."${config.networking.hostName}-repo-sync"
lass lass
@ -30,7 +31,13 @@ let
]; ];
repo = [ repo ]; repo = [ repo ];
perm = push ''refs/*'' [ non-fast-forward create delete merge ]; perm = push ''refs/*'' [ non-fast-forward create delete merge ];
}; }
{
user = attrValues config.krebs.users;
repo = [ repo ];
perm = fetch;
}
];
repos."${name}" = repo; repos."${name}" = repo;
}; };

View File

@ -1,29 +1,19 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with import <stockholm/lib>;
let
inherit (config.users.extraUsers) mainUser;
in
{ {
imports = [ services.urxvtd.enable = true;
../3modules/urxvtd.nix
../3modules/xresources.nix
];
services.urxvtd = {
enable = true;
users = [ mainUser.name ];
urxvtPackage = pkgs.rxvt_unicode_with-plugins;
};
services.xresources.enable = true;
services.xresources.resources.urxvt = '' services.xresources.resources.urxvt = ''
URxvt*SaveLines: 4096
URxvt*scrollBar: false URxvt*scrollBar: false
URxvt*urgentOnBell: true URxvt*urgentOnBell: true
URxvt*font: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-*
URxvt*boldFont: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-*
URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
URxvt.url-select.launcher: browser-select
${optionalString (hasAttr "browser" config.lass)
"URxvt.url-select.launcher: ${config.lass.browser.select}/bin/browser-select"
}
URxvt.url-select.underline: true URxvt.url-select.underline: true
URxvt.keysym.M-u: perl:url-select:select_next URxvt.keysym.M-u: perl:url-select:select_next
URxvt.keysym.M-Escape: perl:keyboard-select:activate URxvt.keysym.M-Escape: perl:keyboard-select:activate
@ -36,5 +26,7 @@ in
!change unreadable blue !change unreadable blue
URxvt*color4: #268bd2 URxvt*color4: #268bd2
URxvt*color0: #232342
''; '';
} }

View File

@ -4,10 +4,6 @@ let
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
in { in {
krebs.per-user.wine.packages = with pkgs; [
wine
#(wineFull.override { wineBuild = "wine64"; })
];
users.users= { users.users= {
wine = { wine = {
name = "wine"; name = "wine";
@ -19,9 +15,27 @@ in {
"video" "video"
]; ];
createHome = true; createHome = true;
packages = [
pkgs.wine
];
};
wine64 = {
name = "wine64";
description = "user for running wine in 64bit";
home = "/home/wine64";
useDefaultShell = true;
extraGroups = [
"audio"
"video"
];
createHome = true;
packages = [
(pkgs.wine.override { wineBuild = "wineWow"; })
];
}; };
}; };
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
${mainUser.name} ALL=(wine) NOPASSWD: ALL ${mainUser.name} ALL=(wine) NOPASSWD: ALL
${mainUser.name} ALL=(wine64) NOPASSWD: ALL
''; '';
} }

View File

@ -1,63 +0,0 @@
{ config, pkgs, ... }:
with import <stockholm/lib>;
let
xresources = pkgs.writeText "Xresources" ''
URxvt*scrollBar: false
URxvt*urgentOnBell: true
URxvt*SaveLines: 4096
URxvt.font: ${config.lass.fonts.regular}
URxvt.boldFont: ${config.lass.fonts.bold}
URxvt.italicFont: ${config.lass.fonts.italic}
! ref https://github.com/muennich/urxvt-perls
URxvt.perl-lib: ${pkgs.urxvt_perls}/lib/urxvt/perl
URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
${optionalString (hasAttr "browser" config.lass)
"URxvt.url-select.launcher: ${config.lass.browser.select}/bin/browser-select"
}
URxvt.url-select.underline: true
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.intensityStyles: false
URxvt*background: #000000
URxvt*foreground: #d0d7d0
URxvt*cursorColor: #f042b0
URxvt*cursorColor2: #f0b000
URxvt*cursorBlink: off
URxvt*.pointerBlank: true
URxvt*.pointerBlankDelay: 987654321
URxvt*.pointerColor: #f042b0
URxvt*.pointerColor2: #050505
URxvt*color0: #232342
'';
in {
systemd.services.xresources = {
description = "xresources";
wantedBy = [ "multi-user.target" ];
after = [ "display-manager.service" ];
environment = {
DISPLAY = ":0";
};
restartIfChanged = true;
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${xresources}";
Restart = "on-failure";
User = "lass";
};
};
}

View File

@ -11,6 +11,7 @@ _:
./screenlock.nix ./screenlock.nix
./umts.nix ./umts.nix
./usershadow.nix ./usershadow.nix
./xserver
./xresources.nix ./xresources.nix
]; ];
} }

View File

@ -23,7 +23,7 @@ let
before = [ "sleep.target" ]; before = [ "sleep.target" ];
wantedBy = [ "sleep.target" ]; wantedBy = [ "sleep.target" ];
environment = { environment = {
DISPLAY = ":0"; DISPLAY = ":${toString config.services.xserver.display}";
}; };
serviceConfig = { serviceConfig = {
SyslogIdentifier = "screenlock"; SyslogIdentifier = "screenlock";

View File

@ -4,16 +4,13 @@
#prefix with Attribute Name #prefix with Attribute Name
#ex: urxvt #ex: urxvt
#
#
with builtins; with builtins;
with lib; with lib;
let let
inherit (import ../../tv/4lib { inherit pkgs lib; }) shell-escape; inherit (pkgs) writeScript writeText;
inherit (pkgs) writeScript;
in in
@ -46,12 +43,16 @@ in
config = config =
let let
cfg = config.services.xresources; cfg = config.services.xresources;
xres = concatStringsSep "\n" (attrValues cfg.resources); xres = writeText "xresources" (concatStringsSep "\n" (attrValues cfg.resources));
in mkIf cfg.enable { in mkIf cfg.enable {
services.xserver.displayManager.sessionCommands = '' services.xserver.displayManager.sessionCommands = ''
echo ${shell-escape xres} | xrdb -merge ${pkgs.xorg.xrdb}/bin/xrdb -merge ${xres}
''; '';
environment.systemPackages = [
(pkgs.writeDashBin "updateXresources" ''
${pkgs.xorg.xrdb}/bin/xrdb -merge ${xres}
'')
];
}; };
} }

View File

@ -0,0 +1,101 @@
{ config, pkgs, ... }@args:
with import <stockholm/lib>;
let
out = {
options.lass.xserver = api;
config = mkIf cfg.enable imp;
};
user = config.krebs.build.user;
cfg = config.lass.xserver;
xcfg = config.services.xserver;
api = {
enable = mkEnableOption "lass xserver";
};
imp = {
services.xserver = {
# Don't install feh into systemPackages
# refs <nixpkgs/nixos/modules/services/x11/desktop-managers>
desktopManager.session = mkForce [];
enable = true;
display = 11;
tty = 11;
};
systemd.services.display-manager.enable = false;
systemd.services.xmonad = {
wantedBy = [ "multi-user.target" ];
requires = [ "xserver.service" ];
environment = {
DISPLAY = ":${toString xcfg.display}";
XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
${xcfg.displayManager.sessionCommands}
wait
'';
XMONAD_DATA_DIR = "/tmp";
};
serviceConfig = {
SyslogIdentifier = "xmonad";
ExecStart = "${pkgs.xmonad-lass}/bin/xmonad";
ExecStop = "${pkgs.xmonad-lass}/bin/xmonad --shutdown";
User = user.name;
WorkingDirectory = user.home;
};
};
systemd.services.xserver = {
after = [
"systemd-udev-settle.service"
"local-fs.target"
"acpid.service"
];
reloadIfChanged = true;
environment = {
XKB_BINDIR = "${pkgs.xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
LD_LIBRARY_PATH = concatStringsSep ":" (
[ "${pkgs.xorg.libX11}/lib" "${pkgs.xorg.libXext}/lib" ]
++ concatLists (catAttrs "libPath" xcfg.drivers));
};
serviceConfig = {
SyslogIdentifier = "xserver";
ExecReload = "${pkgs.coreutils}/bin/echo NOP";
ExecStart = toString [
"${pkgs.xorg.xorgserver}/bin/X"
":${toString xcfg.display}"
"vt${toString xcfg.tty}"
"-config ${import ./xserver.conf.nix args}"
"-logfile /dev/null -logverbose 0 -verbose 3"
"-nolisten tcp"
"-xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb"
(optional (xcfg.dpi != null) "-dpi ${toString xcfg.dpi}")
];
};
};
services.xresources.resources.dpi = ''
${optionalString (xcfg.dpi != null) "Xft.dpi: ${toString xcfg.dpi}"}
'';
systemd.services.urxvtd = {
wantedBy = [ "multi-user.target" ];
reloadIfChanged = true;
serviceConfig = {
SyslogIdentifier = "urxvtd";
ExecReload = "${pkgs.coreutils}/bin/echo NOP";
ExecStart = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtd";
Restart = "always";
RestartSec = "2s";
StartLimitBurst = 0;
User = user.name;
};
};
};
in out

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let
cfg = config.services.xserver;
in
pkgs.stdenv.mkDerivation {
name = "xserver.conf";
xfs = optionalString (cfg.useXFS != false)
''FontPath "${toString cfg.useXFS}"'';
inherit (cfg) config;
buildCommand =
''
echo 'Section "Files"' >> $out
echo $xfs >> $out
for i in ${toString config.fonts.fonts}; do
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
for j in $(find $i -name fonts.dir); do
echo " FontPath \"$(dirname $j)\"" >> $out
done
fi
done
for i in $(find ${toString cfg.modules} -type d); do
if test $(echo $i/*.so* | wc -w) -ne 0; then
echo " ModulePath \"$i\"" >> $out
fi
done
echo 'EndSection' >> $out
echo "$config" >> $out
'';
}

View File

@ -21,6 +21,9 @@
xmonad-lass = import ./xmonad-lass.nix { inherit config pkgs; }; xmonad-lass = import ./xmonad-lass.nix { inherit config pkgs; };
yt-next = pkgs.callPackage ./yt-next/default.nix {}; yt-next = pkgs.callPackage ./yt-next/default.nix {};
screengrab = pkgs.writeDashBin "screengrab" "${pkgs.ffmpeg}/bin/ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0 -c:v huffyuv $1"; screengrab = pkgs.writeDashBin "screengrab" ''
resolution="$(${pkgs.xorg.xrandr}/bin/xrandr | ${pkgs.gnugrep}/bin/grep '*' | ${pkgs.gawk}/bin/awk '{print $1}')"
${pkgs.ffmpeg}/bin/ffmpeg -f x11grab -r 25 -i :0.0 -s $resolution -c:v huffyuv $1
'';
}; };
} }

View File

@ -3,6 +3,7 @@ pkgs.writeHaskell "xmonad-lass" {
executables.xmonad = { executables.xmonad = {
extra-depends = [ extra-depends = [
"containers" "containers"
"extra"
"unix" "unix"
"X11" "X11"
"xmonad" "xmonad"
@ -20,17 +21,15 @@ module Main where
import XMonad import XMonad
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import Control.Exception import Control.Monad.Extra (whenJustM)
import Data.List (isInfixOf) import Data.List (isInfixOf)
import System.Environment (getArgs, withArgs) import System.Environment (getArgs, lookupEnv)
import System.IO (hPutStrLn, stderr)
import System.Posix.Process (executeFile) import System.Posix.Process (executeFile)
import XMonad.Actions.CopyWindow (copy, kill1) import XMonad.Actions.CopyWindow (copy, kill1)
import XMonad.Actions.CycleWS (toggleWS) import XMonad.Actions.CycleWS (toggleWS)
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace) import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace)
import XMonad.Actions.DynamicWorkspaces (withWorkspace) import XMonad.Actions.DynamicWorkspaces (withWorkspace)
import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch) import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch)
import XMonad.Actions.UpdatePointer (updatePointer)
import XMonad.Hooks.FloatNext (floatNext) import XMonad.Hooks.FloatNext (floatNext)
import XMonad.Hooks.FloatNext (floatNextHook) import XMonad.Hooks.FloatNext (floatNextHook)
import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts)) import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts))
@ -48,7 +47,7 @@ import XMonad.Layout.SimpleFloat (simpleFloat)
import XMonad.Stockholm.Shutdown import XMonad.Stockholm.Shutdown
myTerm :: FilePath myTerm :: FilePath
myTerm = "${pkgs.rxvt_unicode}/bin/urxvtc" myTerm = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc"
myFont :: String myFont :: String
myFont = "${config.lass.fonts.regular}" myFont = "${config.lass.fonts.regular}"
@ -56,20 +55,22 @@ myFont = "${config.lass.fonts.regular}"
main :: IO () main :: IO ()
main = getArgs >>= \case main = getArgs >>= \case
["--shutdown"] -> sendShutdownEvent ["--shutdown"] -> sendShutdownEvent
_ -> mainNoArgs _ -> main'
mainNoArgs :: IO () main' :: IO ()
mainNoArgs = do main' = do
xmonad' xmonad
$ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
$ def $ def
{ terminal = myTerm { terminal = myTerm
, modMask = mod4Mask , modMask = mod4Mask
, layoutHook = smartBorders $ myLayoutHook , layoutHook = smartBorders $ myLayoutHook
, logHook = updatePointer (0.25, 0.25) (0.25, 0.25)
, manageHook = placeHook (smart (1,0)) <+> floatNextHook , manageHook = placeHook (smart (1,0)) <+> floatNextHook
, startupHook =
whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK"))
(\path -> forkFile path [] Nothing)
, normalBorderColor = "#1c1c1c" , normalBorderColor = "#1c1c1c"
, focusedBorderColor = "#f000b0" , focusedBorderColor = "#ff0000"
, handleEventHook = handleShutdownEvent , handleEventHook = handleShutdownEvent
, workspaces = [ "dashboard", "sys", "wp" ] , workspaces = [ "dashboard", "sys", "wp" ]
} `additionalKeysP` myKeyMap } `additionalKeysP` myKeyMap
@ -78,22 +79,6 @@ myLayoutHook = defLayout
where where
defLayout = minimize $ ((avoidStruts $ Tall 1 (3/100) (1/2) ||| Full ||| Mirror (Tall 1 (3/100) (1/2))) ||| FixedColumn 2 80 80 1) ||| simpleFloat defLayout = minimize $ ((avoidStruts $ Tall 1 (3/100) (1/2) ||| Full ||| Mirror (Tall 1 (3/100) (1/2))) ||| FixedColumn 2 80 80 1) ||| simpleFloat
xmonad' :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO ()
xmonad' conf = do
let path = "/tmp/xmonad.state"
try (readFile path) >>= \case
Right content -> do
hPutStrLn stderr ("resuming from " ++ path)
withArgs ("--resume" : lines content) (xmonad conf)
Left e -> do
hPutStrLn stderr (displaySomeException e)
xmonad conf
displaySomeException :: SomeException -> String
displaySomeException = displayException
myKeyMap :: [([Char], X ())] myKeyMap :: [([Char], X ())]
myKeyMap = myKeyMap =
[ ("M4-<F11>", spawn "${config.lass.screenlock.command}") [ ("M4-<F11>", spawn "${config.lass.screenlock.command}")

View File

@ -10,7 +10,7 @@ in
nixos-config.symlink = "stockholm/lass/1systems/${name}/config.nix"; nixos-config.symlink = "stockholm/lass/1systems/${name}/config.nix";
nixpkgs.git = { nixpkgs.git = {
url = https://github.com/nixos/nixpkgs; url = https://github.com/nixos/nixpkgs;
ref = "7f6f0c4"; ref = "f9390d6";
}; };
secrets.file = getAttr builder { secrets.file = getAttr builder {
buildbot = toString <stockholm/lass/2configs/tests/dummy-secrets>; buildbot = toString <stockholm/lass/2configs/tests/dummy-secrets>;

View File

@ -92,7 +92,7 @@ rec {
default = null; default = null;
}; };
addrs = mkOption { addrs = mkOption {
type = listOf cidr; type = listOf addr;
default = default =
optional (config.ip4 != null) config.ip4.addr ++ optional (config.ip4 != null) config.ip4.addr ++
optional (config.ip6 != null) config.ip6.addr; optional (config.ip6 != null) config.ip6.addr;
@ -155,6 +155,8 @@ rec {
++ ++
(map (a: "Subnet = ${a}") net.addrs) (map (a: "Subnet = ${a}") net.addrs)
++ ++
(map (a: "Subnet = ${a}") config.subnets)
++
[config.extraConfig] [config.extraConfig]
++ ++
[config.pubkey] [config.pubkey]
@ -173,6 +175,11 @@ rec {
description = "tinc port to use to connect to host"; description = "tinc port to use to connect to host";
default = 655; default = 655;
}; };
subnets = mkOption {
type = listOf cidr;
description = "tinc subnets";
default = [];
};
}; };
})); }));
default = null; default = null;