summary refs log tree commit diff stats
path: root/system/modules
diff options
context:
space:
mode:
Diffstat (limited to 'system/modules')
-rw-r--r--system/modules/base.nix13
-rw-r--r--system/modules/configuration/berlin.nix8
-rw-r--r--system/modules/configuration/british-english.nix4
-rw-r--r--system/modules/configuration/england.nix8
-rw-r--r--system/modules/configuration/nix.nix38
-rw-r--r--system/modules/configuration/user.nix11
-rw-r--r--system/modules/development/base.nix32
-rw-r--r--system/modules/development/javascript.nix50
-rw-r--r--system/modules/development/kubernetes.nix21
-rw-r--r--system/modules/development/lisp.nix13
-rw-r--r--system/modules/gaming.nix67
-rw-r--r--system/modules/hardware/adb.nix9
-rw-r--r--system/modules/hardware/audio.nix20
-rw-r--r--system/modules/hardware/bare-metal.nix29
-rw-r--r--system/modules/hardware/connman.nix14
-rw-r--r--system/modules/hardware/grub2.nix13
-rw-r--r--system/modules/hardware/hidpi.nix9
-rw-r--r--system/modules/hardware/intel-gpu.nix15
-rw-r--r--system/modules/hardware/keyboardio-model01.nix13
-rw-r--r--system/modules/hardware/laptop.nix87
-rw-r--r--system/modules/hardware/mouse.nix12
-rw-r--r--system/modules/hardware/network-manager.nix12
-rw-r--r--system/modules/hardware/nitrokey.nix13
-rw-r--r--system/modules/hardware/nvidia-gpu.nix5
-rw-r--r--system/modules/hardware/printing.nix19
-rw-r--r--system/modules/hardware/qwerty.nix16
-rw-r--r--system/modules/hardware/synaptics.nix27
-rw-r--r--system/modules/hardware/systemd-boot.nix10
-rw-r--r--system/modules/hardware/thinkpad.nix26
-rw-r--r--system/modules/hardware/trackball.nix13
-rw-r--r--system/modules/hardware/trezor.nix13
-rw-r--r--system/modules/machines/t470s.nix59
-rw-r--r--system/modules/machines/x250.nix33
-rw-r--r--system/modules/programs/accounting.nix10
-rw-r--r--system/modules/programs/barrier.nix7
-rw-r--r--system/modules/programs/dotfiles.nix14
-rw-r--r--system/modules/programs/gnome.nix24
-rw-r--r--system/modules/programs/gnupg.nix10
-rw-r--r--system/modules/programs/i3.nix21
-rw-r--r--system/modules/programs/infrastructure.nix8
-rw-r--r--system/modules/programs/kde.nix20
-rw-r--r--system/modules/programs/keybase.nix11
-rw-r--r--system/modules/programs/passwords.nix9
-rw-r--r--system/modules/programs/shell.nix34
-rw-r--r--system/modules/programs/tor.nix22
-rw-r--r--system/modules/programs/window-manager.nix47
-rw-r--r--system/modules/programs/wine.nix6
-rw-r--r--system/modules/satoshipay.nix96
-rw-r--r--system/modules/services/syncthing.nix11
-rw-r--r--system/modules/services/xserver.nix78
-rw-r--r--system/modules/services/zeroconf.nix16
-rw-r--r--system/modules/user-interface.nix144
52 files changed, 1320 insertions, 0 deletions
diff --git a/system/modules/base.nix b/system/modules/base.nix
new file mode 100644
index 00000000..9e94a5a2
--- /dev/null
+++ b/system/modules/base.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{ boot.loader.timeout = 1;
+
+  environment.systemPackages = with pkgs; [
+    nix-index
+  ];
+
+  networking.extraHosts = ''
+    127.0.0.1 ${config.networking.hostName}
+    ::1 ${config.networking.hostName}
+  '';
+}
diff --git a/system/modules/configuration/berlin.nix b/system/modules/configuration/berlin.nix
new file mode 100644
index 00000000..246510c4
--- /dev/null
+++ b/system/modules/configuration/berlin.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{ time.timeZone = "Europe/Berlin";
+  services.redshift = {
+    latitude = "52.586";
+    longitude = "13.300";
+  };
+}
diff --git a/system/modules/configuration/british-english.nix b/system/modules/configuration/british-english.nix
new file mode 100644
index 00000000..3ff93678
--- /dev/null
+++ b/system/modules/configuration/british-english.nix
@@ -0,0 +1,4 @@
+{ config, pkgs, ... }:
+
+{ i18n.defaultLocale = "en_GB.UTF-8";
+}
diff --git a/system/modules/configuration/england.nix b/system/modules/configuration/england.nix
new file mode 100644
index 00000000..b2f799cd
--- /dev/null
+++ b/system/modules/configuration/england.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{ time.timeZone = "Europe/London";
+  services.redshift = {
+    latitude = "52.2394";
+    longitude = "-0.9416";
+  };
+}
diff --git a/system/modules/configuration/nix.nix b/system/modules/configuration/nix.nix
new file mode 100644
index 00000000..9aa83435
--- /dev/null
+++ b/system/modules/configuration/nix.nix
@@ -0,0 +1,38 @@
+{ config, pkgs, ... }:
+
+{ nix = {
+    buildCores = 0;
+
+    daemonNiceLevel = 19;
+    daemonIONiceLevel = 7;
+
+    autoOptimiseStore = true;
+    gc = {
+      automatic = true;
+      options = "--delete-older-than 14d";
+    };
+  };
+
+  nixpkgs.config = {
+    packageOverrides = pkgs: {
+      unstable = import <nixos-unstable> {
+        config = config.nixpkgs.config;
+      };
+    };
+  };
+
+  environment.systemPackages = with pkgs; [
+    cachix
+  ];
+
+  system.autoUpgrade = {
+    enable = true;
+    flags = [ "--max-jobs" "1" ];
+  };
+  systemd.services.nixos-upgrade = {
+    script = pkgs.lib.mkForce ''
+      ${pkgs.nix}/bin/nix-channel --update nixos-unstable
+      ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --no-build-output --upgrade ${toString config.system.autoUpgrade.flags}
+    '';
+  };
+}
diff --git a/system/modules/configuration/user.nix b/system/modules/configuration/user.nix
new file mode 100644
index 00000000..e7362bce
--- /dev/null
+++ b/system/modules/configuration/user.nix
@@ -0,0 +1,11 @@
+{ config, pkgs, ... }:
+
+{ users.extraUsers.alan = {
+    description = "Alan Pearce";
+    isNormalUser = true;
+    extraGroups = [ "audio" "wheel" "lp" "adbusers" "docker" "nitrokey" "dialout" "networkmanager" ];
+    shell = "/run/current-system/sw/bin/zsh";
+    home = "/home/alan";
+    uid = 1000;
+  };
+}
diff --git a/system/modules/development/base.nix b/system/modules/development/base.nix
new file mode 100644
index 00000000..2beed5b3
--- /dev/null
+++ b/system/modules/development/base.nix
@@ -0,0 +1,32 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    gitAndTools.gitFull
+    gitAndTools.git-extras
+    git-lfs
+
+    checkbashisms
+    editorconfig-core-c
+    go
+
+    wrk
+
+    ag
+    (ripgrep.override { withPCRE2 = true; })
+
+    httpie
+    jq
+
+    discount
+  ] ++ (
+    if !stdenv.isDarwin
+    then [
+      whois
+      ldns
+      httping
+      http-prompt
+      firefox-devedition-bin
+    ] else [
+    ]
+  );
+}
diff --git a/system/modules/development/javascript.nix b/system/modules/development/javascript.nix
new file mode 100644
index 00000000..1bdd4a4c
--- /dev/null
+++ b/system/modules/development/javascript.nix
@@ -0,0 +1,50 @@
+{ config, pkgs, ... }:
+
+let
+  node = pkgs.unstable.nodejs-10_x;
+  npmPackages = pkgs.unstable.nodePackages_10_x;
+  node2nixPackages = import ../../packages/node2nix/default.nix {
+    pkgs = pkgs.unstable;
+    nodejs = node;
+  };
+in
+{ environment.systemPackages = (with pkgs.unstable; [
+    node
+  ] ++ (
+    if stdenv.isDarwin
+    then
+    [
+    ]
+    else
+    [
+    # npm install may use any of these
+    binutils
+    gcc
+    gnumake
+    python2
+    ]
+  )) ++ (with npmPackages; [
+    node-gyp
+    node-gyp-build
+    node-pre-gyp
+
+    tern
+    node2nix
+    nodemon
+    javascript-typescript-langserver
+    typescript-language-server
+    vscode-css-languageserver-bin
+    vscode-html-languageserver-bin
+    csslint
+    eslint_d
+    prettier
+    typescript
+
+    node2nixPackages.bunyan
+    node2nixPackages.pino-pretty
+    node2nixPackages."pnpm-3.6.2"
+    node2nixPackages.prettier_d
+    node2nixPackages.dockerfile-language-server-nodejs
+    node2nixPackages.yaml-language-server
+  ]);
+}
diff --git a/system/modules/development/kubernetes.nix b/system/modules/development/kubernetes.nix
new file mode 100644
index 00000000..692e46d6
--- /dev/null
+++ b/system/modules/development/kubernetes.nix
@@ -0,0 +1,21 @@
+{ config, pkgs, ... }:
+
+{
+  networking.bridges = {
+    cbr0.interfaces = [];
+  };
+  networking.interfaces = {
+    cbr0 = {
+      ipv4.addresses = [
+      { address = "10.10.0.1";
+        prefixLength = 24;
+      }
+      ];
+    };
+  };
+  services.kubernetes.roles = ["master" "node"];
+  services.kubernetes.kubelet.extraOpts = "--fail-swap-on=false";
+  virtualisation.docker.extraOptions = ''
+    --iptables=false --ip-masq=false -b cbr0
+  '';
+}
diff --git a/system/modules/development/lisp.nix b/system/modules/development/lisp.nix
new file mode 100644
index 00000000..dc521feb
--- /dev/null
+++ b/system/modules/development/lisp.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    ccl
+    sbcl
+    lispPackages.quicklisp
+    asdf
+    cl-launch
+
+    dust
+    pixie
+  ];
+}
diff --git a/system/modules/gaming.nix b/system/modules/gaming.nix
new file mode 100644
index 00000000..44b937a8
--- /dev/null
+++ b/system/modules/gaming.nix
@@ -0,0 +1,67 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    unstable.steam
+    (
+      unstable.winePackages.unstable.override {
+        pngSupport = true;
+        jpegSupport = true;
+        tiffSupport = true;
+        gettextSupport = true;
+        fontconfigSupport = true;
+        alsaSupport = true;
+        gtkSupport = true;
+        openglSupport = true;
+        tlsSupport = true;
+        gstreamerSupport = true;
+        cupsSupport = true;
+        colorManagementSupport = true;
+        dbusSupport = true;
+        mpg123Support = true;
+        openalSupport = true;
+        openclSupport = true;
+        cairoSupport = true;
+        odbcSupport = true;
+        netapiSupport = true;
+        cursesSupport = true;
+        vaSupport = true;
+        pcapSupport = true;
+        v4lSupport = true;
+        saneSupport = true;
+        gsmSupport = true;
+        gphoto2Support = true;
+        ldapSupport = true;
+        pulseaudioSupport = true;
+        udevSupport = true;
+        xineramaSupport = true;
+        xmlSupport = true;
+        vulkanSupport = true;
+        sdlSupport = true;
+      }
+    )
+    unstable.lutris
+  ];
+  hardware.steam-hardware.enable = true;
+  hardware.opengl.driSupport32Bit = true;
+  hardware.pulseaudio.support32Bit = true;
+
+  systemd = {
+    extraConfig = ''
+      DefaultLimitNOFILE=524288
+    '';
+    user.extraConfig = ''
+      DefaultLimitNOFILE=524288
+    '';
+  };
+
+  networking.firewall = {
+    allowedUDPPorts = [
+      27031
+      27036
+    ];
+    allowedTCPPorts = [
+      27036
+      27037
+    ];
+  };
+}
diff --git a/system/modules/hardware/adb.nix b/system/modules/hardware/adb.nix
new file mode 100644
index 00000000..8b511f55
--- /dev/null
+++ b/system/modules/hardware/adb.nix
@@ -0,0 +1,9 @@
+{ config, pkgs, ... }:
+
+{ programs.adb.enable = true;
+  users.groups.adbusers = {};
+
+  services.udev = {
+   packages = [ pkgs.android-udev-rules ];
+  };
+}
diff --git a/system/modules/hardware/audio.nix b/system/modules/hardware/audio.nix
new file mode 100644
index 00000000..ed956919
--- /dev/null
+++ b/system/modules/hardware/audio.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, ... }:
+
+{ hardware.pulseaudio = {
+    enable = true;
+    support32Bit = true;
+    daemon.config = {
+      flat-volumes = "no";
+    };
+    package = if config.hardware.bluetooth.enable
+      then pkgs.pulseaudioFull
+      else pkgs.pulseaudio;
+  };
+
+  sound.enable = true;
+
+  environment.systemPackages = with pkgs; [
+    pamixer
+    pavucontrol
+  ];
+}
diff --git a/system/modules/hardware/bare-metal.nix b/system/modules/hardware/bare-metal.nix
new file mode 100644
index 00000000..0a61790a
--- /dev/null
+++ b/system/modules/hardware/bare-metal.nix
@@ -0,0 +1,29 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    fuse_exfat
+    cryptsetup
+    dmidecode
+    hdparm
+    pciutils
+    usbutils
+  ];
+
+  hardware.cpu.intel.updateMicrocode = true;
+
+  boot.kernel.sysctl = {
+    "net.ipv4.tcp_allowed_congestion_control" = "illinois reno lp";
+    "net.ipv4.tcp_congestion_control" = "illinois";
+  };
+
+  zramSwap = {
+    enable = true;
+    algorithm = "zstd";
+  };
+  boot.tmpOnTmpfs = true;
+
+  boot.kernelModules = [ "bfq" ];
+
+  fileSystems."/".options = [ "noatime" "nodiratime" ];
+  fileSystems."/home".options = [ "noatime" "nodiratime" ];
+}
diff --git a/system/modules/hardware/connman.nix b/system/modules/hardware/connman.nix
new file mode 100644
index 00000000..0361f9cb
--- /dev/null
+++ b/system/modules/hardware/connman.nix
@@ -0,0 +1,14 @@
+{ config, pkgs, ... }:
+
+{ networking.connman = {
+    enable = true;
+    enableVPN = false;
+  };
+  networking.wireless.enable = true;
+
+  environment.systemPackages = with pkgs; [
+    cmst
+    connman-notify
+    connman_dmenu
+  ];
+}
diff --git a/system/modules/hardware/grub2.nix b/system/modules/hardware/grub2.nix
new file mode 100644
index 00000000..70e86e71
--- /dev/null
+++ b/system/modules/hardware/grub2.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{ boot.loader = {
+    grub = {
+      enable = true;
+      splashImage = null;
+      version = 2;
+      device = "nodev";
+      efiSupport = true;
+    };
+    efi.canTouchEfiVariables = true;
+  };
+}
diff --git a/system/modules/hardware/hidpi.nix b/system/modules/hardware/hidpi.nix
new file mode 100644
index 00000000..1f4644c5
--- /dev/null
+++ b/system/modules/hardware/hidpi.nix
@@ -0,0 +1,9 @@
+{ config, pkgs, ... }:
+
+{ i18n = {
+    consoleFont = "ter-v24b";
+    consolePackages = with pkgs; [
+      terminus_font
+    ];
+  };
+}
diff --git a/system/modules/hardware/intel-gpu.nix b/system/modules/hardware/intel-gpu.nix
new file mode 100644
index 00000000..fc6b6fa3
--- /dev/null
+++ b/system/modules/hardware/intel-gpu.nix
@@ -0,0 +1,15 @@
+{ config, pkgs, ... }:
+
+{ hardware.opengl.extraPackages = with pkgs; [
+    vaapiIntel
+    vaapiVdpau
+    libvdpau-va-gl
+  ];
+
+  services.xserver.videoDrivers = [ "intel" "modesetting" ];
+
+  boot.earlyVconsoleSetup = true;
+  boot.initrd.kernelModules = [
+    "i915"
+  ];
+}
diff --git a/system/modules/hardware/keyboardio-model01.nix b/system/modules/hardware/keyboardio-model01.nix
new file mode 100644
index 00000000..7a624f56
--- /dev/null
+++ b/system/modules/hardware/keyboardio-model01.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{ services.udev.extraRules = ''
+    SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2300", SYMLINK+="model01", ENV{ID_MM_DEVICE_IGNORE}:="1", ENV{ID_MM_CANDIDATE}:="0"
+    SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2301", SYMLINK+="model01", ENV{ID_MM_DEVICE_IGNORE}:="1", ENV{ID_MM_CANDIDATE}:="0"
+  '';
+
+  environment.systemPackages = with pkgs; [
+    arduino_core
+  ];
+
+  environment.variables.ARDUINO_PATH = "${pkgs.arduino_core}/share/arduino";
+}
diff --git a/system/modules/hardware/laptop.nix b/system/modules/hardware/laptop.nix
new file mode 100644
index 00000000..17e27b63
--- /dev/null
+++ b/system/modules/hardware/laptop.nix
@@ -0,0 +1,87 @@
+{ config, pkgs, lib, ... }:
+
+{ boot.kernelModules = [ "coretemp" ];
+  boot.extraModulePackages = with config.boot.kernelPackages; [
+    x86_energy_perf_policy
+  ];
+
+  hardware = {
+    bluetooth = {
+      enable = true;
+      powerOnBoot = false;
+      package = pkgs.bluezFull;
+    };
+    pulseaudio = {
+      extraModules = with pkgs; [
+        pulseaudio-modules-bt
+      ];
+    };
+  };
+  systemd.services.bluetooth.wantedBy = lib.mkForce [];
+  systemd.timers.bluetooth = {
+    description = "Delayed startup of Bluetooth";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
+  };
+
+  environment.systemPackages = with pkgs; [
+    blueman
+    bluez-tools
+
+    powerstat
+    powertop
+
+    arandr
+    autorandr
+    disper
+  ];
+
+  programs.light.enable = true;
+
+  services.autorandr.enable = true;
+
+  services.logind.extraConfig = ''
+    IdleAction=suspend
+    IdleActionSec=600
+  '';
+
+  services.acpid = {
+    enable = true;
+    lidEventCommands = ''
+      ${pkgs.autorandr}/bin/autorandr --batch --change
+    '';
+  };
+
+  services.tlp = {
+    enable = true;
+    extraConfig = ''
+      CPU_SCALING_GOVERNOR_ON_BAT=powersave
+      ENERGY_PERF_POLICY_ON_BAT="balance_power"
+
+      SOUND_POWER_SAVE_ON_AC=60
+      DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wwan"
+    '';
+  };
+
+  services.xserver = {
+    libinput = {
+      enable = lib.mkDefault true;
+      naturalScrolling = true;
+      disableWhileTyping = true;
+    };
+    displayManager.sessionCommands = ''
+      ${pkgs.autorandr}/bin/autorandr --change --force
+      ${pkgs.blueman}/bin/blueman-applet &
+    '';
+  };
+
+  systemd.services.nixos-upgrade.unitConfig.ConditionACPower = true;
+  systemd.services.nix-gc.unitConfig.ConditionACPower = true;
+  systemd.services.docker-prune.unitConfig.ConditionACPower = true;
+
+  imports = [
+    ../user-interface.nix
+  ];
+}
diff --git a/system/modules/hardware/mouse.nix b/system/modules/hardware/mouse.nix
new file mode 100644
index 00000000..b30d4124
--- /dev/null
+++ b/system/modules/hardware/mouse.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, ... }:
+
+{ services.xserver.config = ''
+    Section "InputClass"
+        Identifier "Mouse (No Acceleration)"
+        MatchIsPointer "yes"
+        MatchIsTouchpad "no"
+        Option "AccelerationProfile" "-1"
+        Option "AccelerationScheme" "none"
+    EndSection
+  '';
+}
diff --git a/system/modules/hardware/network-manager.nix b/system/modules/hardware/network-manager.nix
new file mode 100644
index 00000000..f28548a1
--- /dev/null
+++ b/system/modules/hardware/network-manager.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, ... }:
+
+{ networking.networkmanager = {
+    enable = true;
+    dns = "unbound";
+  };
+
+  environment.systemPackages = with pkgs; [
+    networkmanagerapplet
+    networkmanager_dmenu
+  ];
+}
diff --git a/system/modules/hardware/nitrokey.nix b/system/modules/hardware/nitrokey.nix
new file mode 100644
index 00000000..a77ce00c
--- /dev/null
+++ b/system/modules/hardware/nitrokey.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, lib, ... }:
+
+{
+  hardware.nitrokey = {
+    enable = true;
+  };
+
+  services.pcscd.enable = true;
+
+  environment.systemPackages = with pkgs; [
+    nitrokey-app
+  ];
+}
diff --git a/system/modules/hardware/nvidia-gpu.nix b/system/modules/hardware/nvidia-gpu.nix
new file mode 100644
index 00000000..9fc34169
--- /dev/null
+++ b/system/modules/hardware/nvidia-gpu.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, ... }:
+
+{ services.xserver.videoDrivers = [ "nvidia" ];
+  nixpkgs.config.allowUnfree = true;
+}
diff --git a/system/modules/hardware/printing.nix b/system/modules/hardware/printing.nix
new file mode 100644
index 00000000..96d3a959
--- /dev/null
+++ b/system/modules/hardware/printing.nix
@@ -0,0 +1,19 @@
+{ config, pkgs, lib, ... }:
+
+{ services.printing.enable = true;
+  systemd.services.cups.wantedBy = lib.mkForce [];
+  systemd.sockets.cups.wantedBy = [ "sockets.target" ];
+  systemd.services.cups-browsed.wantedBy = lib.mkForce [];
+
+  systemd.timers.cups-browsed = {
+    description = "Delayed startup of CUPS Remote Printer Discovery";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "2 min";
+    };
+  };
+
+  imports = [
+    ../services/zeroconf.nix
+  ];
+}
diff --git a/system/modules/hardware/qwerty.nix b/system/modules/hardware/qwerty.nix
new file mode 100644
index 00000000..d220cb27
--- /dev/null
+++ b/system/modules/hardware/qwerty.nix
@@ -0,0 +1,16 @@
+{ config, pkgs, ... }:
+
+{ services.kmscon = {
+    extraConfig = ''
+      xkb-model=pc104
+      xkb-layout=us
+      xkb-variant=intl-unicode
+      xkb-options="altwin:prtsc_rwin"
+    '';
+  };
+  services.xserver = {
+    layout = "us";
+    xkbVariant = "intl-unicode";
+    xkbOptions = "altwin:prtsc_rwin";
+  };
+}
diff --git a/system/modules/hardware/synaptics.nix b/system/modules/hardware/synaptics.nix
new file mode 100644
index 00000000..9f075cce
--- /dev/null
+++ b/system/modules/hardware/synaptics.nix
@@ -0,0 +1,27 @@
+{ config, pkgs, ... }:
+
+{ services.xserver = {
+    libinput.enable = false;
+    synaptics = {
+      enable = true;
+
+      accelFactor = "0.04";
+
+      minSpeed = "0.3";
+      maxSpeed = "0.6";
+
+      palmDetect = true;
+      palmMinWidth = 5;
+      palmMinZ = 20;
+
+      twoFingerScroll = true;
+      vertTwoFingerScroll = true;
+      horizTwoFingerScroll = true;
+      additionalOptions = ''
+        Option "RBCornerButton" "3"
+        Option "VertScrollDelta" "-111"
+        Option "HorizScrollDelta" "-111"
+      '';
+    };
+  };
+}
diff --git a/system/modules/hardware/systemd-boot.nix b/system/modules/hardware/systemd-boot.nix
new file mode 100644
index 00000000..80e79fdc
--- /dev/null
+++ b/system/modules/hardware/systemd-boot.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, ... }:
+
+{ boot.loader.systemd-boot = {
+    enable = true;
+    editor = false; # Don't allow modification
+  };
+  boot.loader.efi.canTouchEfiVariables = true;
+  boot.vesa = true;
+  boot.earlyVconsoleSetup = true;
+}
diff --git a/system/modules/hardware/thinkpad.nix b/system/modules/hardware/thinkpad.nix
new file mode 100644
index 00000000..903e819b
--- /dev/null
+++ b/system/modules/hardware/thinkpad.nix
@@ -0,0 +1,26 @@
+{ config, pkgs, ... }:
+
+{ boot.kernelModules = [ ];
+  boot.blacklistedKernelModules = [ "thinkpad_ec" ];
+  boot.extraModulePackages = with config.boot.kernelPackages; [
+    acpi_call
+  ];
+
+  hardware.trackpoint = {
+    enable = true;
+    emulateWheel = true;
+  };
+
+  services.thinkfan = {
+    enable = true;
+  };
+
+  services.tlp = {
+    enable = true;
+  };
+
+  imports = [
+    ./bare-metal.nix
+    ./laptop.nix
+  ];
+}
diff --git a/system/modules/hardware/trackball.nix b/system/modules/hardware/trackball.nix
new file mode 100644
index 00000000..9aa5abc0
--- /dev/null
+++ b/system/modules/hardware/trackball.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{ services.xserver.config = ''
+    Section "InputClass"
+        Identifier "Trackball (No Acceleration)"
+        MatchIsPointer "yes"
+        MatchIsTouchpad "no"
+        MatchProduct "Trackball"
+        Option "AccelerationProfile" "-1"
+        Option "AccelerationScheme" "none"
+    EndSection
+  '';
+}
diff --git a/system/modules/hardware/trezor.nix b/system/modules/hardware/trezor.nix
new file mode 100644
index 00000000..33cc6f25
--- /dev/null
+++ b/system/modules/hardware/trezor.nix
@@ -0,0 +1,13 @@
+{ config, lib, pkgs, ... }:
+
+{ services.trezord.enable = true;
+  environment.systemPackages = with pkgs; [
+    gnupg
+    pinentry
+    (python3.withPackages(ps: with ps; [ trezor_agent wheel ]))
+  ];
+  programs.gnupg.agent = {
+    enable = lib.mkForce false;
+    enableSSHSupport = lib.mkForce false;
+  };
+}
diff --git a/system/modules/machines/t470s.nix b/system/modules/machines/t470s.nix
new file mode 100644
index 00000000..4ee6c2ac
--- /dev/null
+++ b/system/modules/machines/t470s.nix
@@ -0,0 +1,59 @@
+{ config, pkgs, ... }:
+
+{ hardware.usbWwan.enable = false; # unused
+  systemd.services.ModemManager.enable = false;
+
+  hardware.firmware = with pkgs; [
+    firmwareLinuxNonfree
+  ];
+
+  services.thinkfan.sensors = ''
+    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp3_input
+    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp1_input
+    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input
+  '';
+  services.thinkfan.levels = ''
+    (0,     0,      48)
+    (1,     45,     52)
+    (2,     50,     57)
+    (3,     55,     63)
+    (6,     60,     65)
+    (7,     60,     85)
+    (127,   80,     32767)
+  '';
+
+  boot.kernelParams = [
+    "i915.enable_guc=2"
+    "i915.enable_psr=1"
+  ];
+
+  boot.postBootCommands = ''
+    echo bfq > /sys/block/nvme0n1/queue/scheduler
+  '';
+
+  hardware.pulseaudio.extraConfig = ''
+    load-module module-alsa-sink device=hw:0,7
+  '';
+
+  services.tlp.extraConfig = ''
+    DISK_DEVICES="nvme0n1"
+    DISK_IOSCHED="keep"
+  '';
+
+  services.xserver = {
+    dpi = 109;
+    monitorSection = ''
+      DisplaySize 310 176
+    '';
+  };
+
+  environment.systemPackages = with pkgs; [
+    nvme-cli
+  ];
+
+  imports = [
+    ../hardware/intel-gpu.nix
+    ../hardware/hidpi.nix
+    ../hardware/thinkpad.nix
+  ];
+}
diff --git a/system/modules/machines/x250.nix b/system/modules/machines/x250.nix
new file mode 100644
index 00000000..0e8ac04e
--- /dev/null
+++ b/system/modules/machines/x250.nix
@@ -0,0 +1,33 @@
+{ config, pkgs, ... }:
+
+{ boot.extraModulePackages = with config.boot.kernelPackages; [
+    acpi_call
+  ];
+
+  hardware.firmware = with pkgs; [
+    firmwareLinuxNonfree
+  ];
+
+  services.tlp.extraConfig = ''
+    # Newer Thinkpads have a battery firmware
+    # it conflicts with TLP if stop thresholds are set
+    START_CHARGE_THRESH_BAT0=70
+    # STOP_CHARGE_THRESH_BAT0=80
+    START_CHARGE_THRESH_BAT1=70
+    # STOP_CHARGE_THRESH_BAT1=80
+
+    DISK_APM_LEVEL_ON_AC="254 254"
+    DISK_APM_LEVEL_ON_BAT="128 128"
+
+    # One or both of these lines stops disk corruption
+    # when re-attaching to AC whilst on.
+    SATA_LINKPWR_ON_BAT=medium_power
+    SATA_LINKPWR_BLACKLIST="host1"
+  '';
+
+  imports = [
+    ../hardware/synaptics.nix
+    ../hardware/intel-gpu.nix
+    ../hardware/thinkpad.nix
+  ];
+}
diff --git a/system/modules/programs/accounting.nix b/system/modules/programs/accounting.nix
new file mode 100644
index 00000000..e98c3e7e
--- /dev/null
+++ b/system/modules/programs/accounting.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    ledger
+    bean-add
+    beancount
+    fava
+    reckon
+  ];
+}
diff --git a/system/modules/programs/barrier.nix b/system/modules/programs/barrier.nix
new file mode 100644
index 00000000..9a73620d
--- /dev/null
+++ b/system/modules/programs/barrier.nix
@@ -0,0 +1,7 @@
+{ config, pkgs, ... }: {
+  environment.systemPackages = with pkgs; [
+    barrier
+  ];
+
+  networking.firewall.allowedTCPPorts = [ 24800 ];
+}
diff --git a/system/modules/programs/dotfiles.nix b/system/modules/programs/dotfiles.nix
new file mode 100644
index 00000000..2e3f44aa
--- /dev/null
+++ b/system/modules/programs/dotfiles.nix
@@ -0,0 +1,14 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    stow
+    fzf
+    ghq
+  ] ++ (
+    if stdenv.isDarwin
+    then [
+    ] else [
+      git
+    ]
+  );
+}
diff --git a/system/modules/programs/gnome.nix b/system/modules/programs/gnome.nix
new file mode 100644
index 00000000..bd785453
--- /dev/null
+++ b/system/modules/programs/gnome.nix
@@ -0,0 +1,24 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+{ services = {
+    gnome3 = {
+      gnome-documents.enable = false;
+      gnome-user-share.enable = false;
+      gnome-online-accounts.enable = false;
+      seahorse.enable = false;
+      tracker.enable = false;
+    };
+    telepathy.enable = false;
+
+    xserver = {
+      desktopManager.gnome3 = {
+        enable = true;
+        extraGSettingsOverrides = ''
+          [org.gnome.desktop.input-sources]
+          sources=[('xkb','${config.services.xserver.layout + (optionalString (config.services.xserver.xkbVariant != "") ("+" + config.services.xserver.xkbVariant))}')]
+        '';
+      };
+    };
+  };
+}
diff --git a/system/modules/programs/gnupg.nix b/system/modules/programs/gnupg.nix
new file mode 100644
index 00000000..663bcb3c
--- /dev/null
+++ b/system/modules/programs/gnupg.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, lib, ... }:
+
+{
+  environment.systemPackages = with pkgs; [
+    gnupg
+    pinentry
+    (python3.withPackages(ps: with ps; [ trezor_agent wheel ]))
+  ];
+  environment.variables.GNUPGHOME = "$HOME/.gnupg/trezor/";
+}
diff --git a/system/modules/programs/i3.nix b/system/modules/programs/i3.nix
new file mode 100644
index 00000000..017f393e
--- /dev/null
+++ b/system/modules/programs/i3.nix
@@ -0,0 +1,21 @@
+{ config, pkgs, ... }:
+
+{ services.xserver.windowManager = {
+    default = "i3";
+    i3 = {
+      enable = true;
+      extraSessionCommands = ''
+        ${pkgs.dunst}/bin/dunst &
+        ${pkgs.sxhkd}/bin/sxhkd &
+      '';
+    };
+  };
+
+  environment.systemPackages = with pkgs; [
+    i3status
+  ];
+
+  imports = [
+    ./window-manager.nix
+  ];
+}
diff --git a/system/modules/programs/infrastructure.nix b/system/modules/programs/infrastructure.nix
new file mode 100644
index 00000000..5e68bc8a
--- /dev/null
+++ b/system/modules/programs/infrastructure.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    hugo
+
+    nixops
+  ];
+}
diff --git a/system/modules/programs/kde.nix b/system/modules/programs/kde.nix
new file mode 100644
index 00000000..652eb2a6
--- /dev/null
+++ b/system/modules/programs/kde.nix
@@ -0,0 +1,20 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+{ services = {
+    xserver = {
+      desktopManager = {
+        plasma5.enable = true;
+      };
+      displayManager = {
+        sddm.enable = true;
+      };
+    };
+
+    physlock.enable = lib.mkForce false;
+  };
+
+  environment.systemPackages = with pkgs; [
+    kde-gtk-config
+  ];
+}
diff --git a/system/modules/programs/keybase.nix b/system/modules/programs/keybase.nix
new file mode 100644
index 00000000..39a16b27
--- /dev/null
+++ b/system/modules/programs/keybase.nix
@@ -0,0 +1,11 @@
+{ config, pkgs, lib, ... }:
+
+{
+  services.keybase.enable = true;
+  services.kbfs.enable = true;
+  environment.variables.NIX_SKIP_KEYBASE_CHECKS = "1";
+
+  environment.systemPackages = with pkgs; [
+    keybase-gui
+  ];
+}
diff --git a/system/modules/programs/passwords.nix b/system/modules/programs/passwords.nix
new file mode 100644
index 00000000..094ad29e
--- /dev/null
+++ b/system/modules/programs/passwords.nix
@@ -0,0 +1,9 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs.unstable; [
+    keepassx-community
+    rofi-pass
+    pass
+    pwgen
+  ];
+}
diff --git a/system/modules/programs/shell.nix b/system/modules/programs/shell.nix
new file mode 100644
index 00000000..cf36a115
--- /dev/null
+++ b/system/modules/programs/shell.nix
@@ -0,0 +1,34 @@
+{ config, pkgs, ... }:
+
+{ programs.zsh = {
+    enable = true;
+    promptInit = "";
+  };
+  programs.bash.enableCompletion = true;
+  programs.vim = pkgs.lib.attrsets.optionalAttrs pkgs.stdenv.isDarwin {
+    enable = true;
+  };
+
+  environment.systemPackages = with pkgs; [
+    pv
+    fd
+    unstable.sd
+    entr
+    file
+    htop
+    lsof
+    iftop
+    nmap
+    moreutils
+    mtr
+    tree
+    zip
+    telnet
+  ] ++ (
+  if !stdenv.isDarwin
+  then [
+    vim
+    unar
+  ] else [
+  ]);
+}
diff --git a/system/modules/programs/tor.nix b/system/modules/programs/tor.nix
new file mode 100644
index 00000000..5524aede
--- /dev/null
+++ b/system/modules/programs/tor.nix
@@ -0,0 +1,22 @@
+{ config, pkgs, lib, ... }:
+
+{
+  services.tor = {
+    enable = true;
+    client = {
+      enable = true;
+      socksListenAddress = "9050 IPv6Traffic";
+    };
+    torsocks = {
+      enable = true;
+    };
+  };
+  systemd.services.tor.wantedBy = lib.mkForce [];
+  systemd.timers.tor = {
+    description = "Delayed startup of Tor";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
+  };
+}
diff --git a/system/modules/programs/window-manager.nix b/system/modules/programs/window-manager.nix
new file mode 100644
index 00000000..ee6877d8
--- /dev/null
+++ b/system/modules/programs/window-manager.nix
@@ -0,0 +1,47 @@
+{ config, pkgs, ... }:
+
+{ services.xserver = {
+   desktopManager.xterm.enable = false;
+
+   displayManager = {
+     lightdm = {
+       enable = true;
+       greeters.mini = {
+         enable = true;
+         user = "alan";
+       };
+     };
+     sessionCommands = ''
+       ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.xresources/main
+       ${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr -solid '#4d4d4c'
+     '';
+   };
+    xautolock = {
+      enable = true;
+      locker = "${pkgs.i3lock}/bin/i3lock -n";
+      enableNotifier = true;
+      notifier = "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"";
+      time = 5;
+    };
+  };
+
+  services.xserver.displayManager.setupCommands = ''
+    ${pkgs.redshift}/bin/redshift \
+      -l ${toString config.services.redshift.latitude}:${toString config.services.redshift.longitude} \
+      -t ${toString config.services.redshift.temperature.day}:${toString config.services.redshift.temperature.night} \
+      -b 1:1 \
+      -o \
+      -r \
+  '';
+
+  environment.systemPackages = with pkgs; [
+    dmenu
+    dunst
+    libnotify # for notify-send
+    rofi
+    sxhkd
+    maim
+
+    perlPackages.FileMimeInfo # xdg-utils uses this when no DE
+  ];
+}
diff --git a/system/modules/programs/wine.nix b/system/modules/programs/wine.nix
new file mode 100644
index 00000000..98dd60a2
--- /dev/null
+++ b/system/modules/programs/wine.nix
@@ -0,0 +1,6 @@
+{ config, pkgs, ... }:
+
+{ environment.systemPackages = with pkgs; [
+    wineStable
+  ];
+}
diff --git a/system/modules/satoshipay.nix b/system/modules/satoshipay.nix
new file mode 100644
index 00000000..4b648740
--- /dev/null
+++ b/system/modules/satoshipay.nix
@@ -0,0 +1,96 @@
+{ config, pkgs, fetchurl, lib, ... }:
+
+{ virtualisation = {
+  docker = let
+    daemonConfig = {
+      ipv6 = true;
+      fixed-cidr-v6 = "fd69:2074:9fcd:b0fd::/64";
+      features = {
+        buildkit = true;
+      };
+    };
+    in {
+      enable = true;
+      enableOnBoot = false;
+      liveRestore = false;
+
+      extraOptions = "--config-file=${pkgs.writeText "daemon.json" (builtins.toJSON daemonConfig)}";
+
+      autoPrune = {
+        enable = true;
+      };
+    };
+  };
+
+  nixpkgs.config.allowUnfree = true;
+
+  environment.variables = {
+    KUBECTX_IGNORE_FZF = "1";
+  };
+  environment.systemPackages = with pkgs; [
+    caddy
+    openssl
+    mongodb-tools
+    pgadmin
+    pgcli
+    s3cmd
+    sops
+    unstable.mkcert
+    unstable.google-cloud-sdk
+    unstable.docker_compose
+    unstable.kubernetes
+    unstable.kubectx
+    unstable.redis-desktop-manager
+    unstable.kubernetes-helm
+    unstable.helmfile
+    unstable.robo3t
+    unstable.slack
+  ];
+
+  services.mongodb = {
+    enable = true;
+    replSetName = "rs0";
+    dbpath = "/tmp/mongodb";
+  };
+  systemd.services.mongodb.wantedBy = lib.mkForce  [];
+  systemd.timers.mongodb = {
+    description = "Delayed startup of MongoDB";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
+  };
+  systemd.services.mongodb-init = {
+    description = "Init mongodb replicaset";
+    requires = [ "mongodb.service" ];
+    script = "${pkgs.mongodb}/bin/mongo --eval 'rs.initiate()'";
+  };
+  systemd.timers.mongodb-init = {
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "2 min";
+    };
+  };
+
+  services.redis = {
+    enable = true;
+  };
+  systemd.services.redis.wantedBy = lib.mkForce [];
+  systemd.timers.redis = {
+    description = "Delayed startup of Redis";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
+  };
+
+
+  services.printing.drivers = with pkgs; [
+  ];
+
+  networking.domain = "satoshipay.io";
+
+  networking.extraHosts = ''
+    127.0.0.1 blogger.local wallet.satoshipay.local api.satoshipay.local ws.satoshipay.local
+  '';
+}
diff --git a/system/modules/services/syncthing.nix b/system/modules/services/syncthing.nix
new file mode 100644
index 00000000..b6a12861
--- /dev/null
+++ b/system/modules/services/syncthing.nix
@@ -0,0 +1,11 @@
+{ config, pkgs, ... }:
+
+{ services.syncthing = {
+    enable = true;
+    user = "alan";
+    group = "users";
+    openDefaultPorts = true;
+    systemService = true;
+    dataDir = "/home/alan/.config/syncthing";
+  };
+}
diff --git a/system/modules/services/xserver.nix b/system/modules/services/xserver.nix
new file mode 100644
index 00000000..80ed6a3a
--- /dev/null
+++ b/system/modules/services/xserver.nix
@@ -0,0 +1,78 @@
+{ config, pkgs, ... }:
+
+{ services.xserver = {
+    enable = true;
+    enableCtrlAltBackspace = true;
+    exportConfiguration = true;
+  };
+
+  environment.systemPackages = with pkgs; [
+    xorg.xmodmap
+    xorg.xinit
+    xorg.xev
+    xorg.xdpyinfo
+    xclip
+    xfontsel
+
+    vanilla-dmz
+    capitaine-cursors
+    bibata-cursors
+
+    arc-theme
+    hicolor_icon_theme
+    paper-gtk-theme
+    paper-icon-theme
+
+    arc-icon-theme
+    tango-icon-theme
+
+    gtk-engine-murrine
+    gtk_engines
+  ];
+
+  fonts = {
+    enableFontDir = true;
+    enableDefaultFonts = false;
+    fontconfig = {
+      defaultFonts = {
+        monospace = [ "Liberation Mono" ];
+        sansSerif = [ "Liberation Sans" ];
+        serif = [ "Liberation Serif" ];
+      };
+      penultimate = {
+        enable = true;
+      };
+      ultimate = {
+        enable = false;
+        preset = "osx";
+      };
+    };
+    fonts = with pkgs; [
+      dina-font
+      envypn-font
+      profont
+      proggyfonts
+      terminus_font
+
+      fantasque-sans-mono
+      emacs-all-the-icons-fonts
+      fira
+      fira-code
+      fira-mono
+      go-font
+      font-awesome_5
+      ibm-plex
+      liberation_ttf
+      mononoki
+      roboto
+      roboto-mono
+      roboto-slab
+      source-code-pro
+      source-sans-pro
+      source-serif-pro
+      xorg.fontmiscmisc
+      xorg.fontcursormisc
+      xorg.fontbhlucidatypewriter100dpi
+    ];
+  };
+}
diff --git a/system/modules/services/zeroconf.nix b/system/modules/services/zeroconf.nix
new file mode 100644
index 00000000..0b428c54
--- /dev/null
+++ b/system/modules/services/zeroconf.nix
@@ -0,0 +1,16 @@
+{ config, pkgs, lib, ... }:
+
+{ services.avahi = {
+    enable = true;
+    nssmdns = true;
+    ipv6 = true;
+  };
+  systemd.services.avahi-daemon.wantedBy = lib.mkForce [];
+  systemd.timers.avahi-daemon = {
+    description = "Delayed startup of Avahi";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
+  };
+}
diff --git a/system/modules/user-interface.nix b/system/modules/user-interface.nix
new file mode 100644
index 00000000..7c98d291
--- /dev/null
+++ b/system/modules/user-interface.nix
@@ -0,0 +1,144 @@
+{ config, pkgs, lib, makeDesktopItem, ... }:
+
+let
+  emacsPackage = import ../packages/emacs.nix {
+    pkgs = pkgs.unstable;
+    emacs = pkgs.unstable.emacs.override {
+      withGTK3 = false;
+    };
+  };
+  editorScript = pkgs.writeScriptBin "edit" ''
+    #!${pkgs.runtimeShell}
+    if [ -z "$1" ]; then
+      exec ${emacsPackage}/bin/emacsclient --create-frame --alternate-editor ${emacsPackage}/bin/emacs
+    else
+      exec ${emacsPackage}/bin/emacsclient --alternate-editor ${emacsPackage}/bin/emacs "$@"
+    fi
+  '';
+  desktopApplicationFile = makeDesktopItem {
+    name = "emacsclient.desktop";
+    destination = "/share/applications/emacsclient.desktop";
+    text = ''
+      [Desktop Entry]
+      Name=Emacsclient
+      GenericName=Text Editor
+      Comment=Edit text
+      MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+      Exec=${editorScript}/bin/edit %F
+      Icon=emacs
+      Type=Application
+      Terminal=false
+      Categories=Development;TextEditor;
+      StartupWMClass=Emacs
+      Keywords=Text;Editor;
+    '';
+  };
+in
+{ documentation.info.enable = true;
+  nixpkgs.config.firefox.enableOfficialBranding = true;
+
+  nixpkgs.config.packageOverrides = pkgs: {
+    myEmacs = emacsPackage;
+  };
+  environment.systemPackages = with pkgs; [
+    aria2
+    firefox
+    pcmanfm
+
+    epdfview
+    geeqie
+
+    cmus
+
+    fish # for emacs-fish-completion
+    myEmacs
+    editorScript
+
+    unstable.xst # st, but with support for XResources
+
+    lxappearance
+    lxrandr
+    lxtask
+
+    python3Packages.keyring
+    isync
+    msmtp
+    html2text
+
+    weechat
+
+    unstable.pass-otp
+
+    mpv
+
+    mosh
+    aspell
+    aspellDicts.en
+
+    cifs-utils
+    hexchat
+    signal-desktop
+    wire-desktop
+
+    trash-cli
+  ] ++ (if !stdenv.isDarwin
+  then [
+    unstable.mu
+  ]
+  else []);
+
+  nixpkgs.config.allowUnfree = true;
+
+  services.compton = {
+    enable = true;
+  };
+
+  services.devmon.enable = true;
+
+  environment.sessionVariables.TERMINAL = "st";
+
+  systemd.user.services.trash-clean = {
+    path = with pkgs; [ trash-cli ];
+    description = "Remove old files from FreeDesktop.org trash";
+
+    serviceConfig = {
+      Type = "oneshot";
+    };
+    script = "trash-empty 30";
+  };
+  systemd.user.timers.trash-clean = {
+    wantedBy = [ "default.target" ];
+    timerConfig = {
+      OnCalendar = "weekly";
+      Persistent = true;
+    };
+  };
+
+  environment.variables = {
+    # This is required so that GTK applications launched from Emacs
+    # get properly themed:
+    GTK_DATA_PREFIX = "${config.system.path}";
+    EDITOR = lib.mkOverride 900 "${editorScript}/bin/edit";
+  };
+
+  services.redshift = {
+    enable = true;
+    temperature = {
+      day = 6500;
+      night = 3600;
+    };
+  };
+
+  programs.ssh.startAgent = true;
+
+  programs.dconf.enable = true;
+  services.gnome3 = {
+    gnome-keyring.enable = true;
+    seahorse.enable = true;
+    at-spi2-core.enable = true;
+  };
+
+  imports = [
+    ./services/xserver.nix
+  ];
+}