about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-03-18 03:25:38 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-03-18 03:25:38 +0100
commitec2b45fb836842abb89a14088ea84365a45019ae (patch)
tree6ccceecb4b36d4871bd0056d7772ce1046f95120 /modules
parent187c673adf3c6a9a7afd8934ee41df7941f28cbf (diff)
Move common{-workstation}.nix into profiles.
Both files are specific to my machines only and need to be generalized
in order to be useful for anyone else.

Moving these files has a few other censequences, such that we now need
to automatically import the module-list.nix in callMachine.

Speaking of module-list.nix, the file is now alphabetically sorted.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/module-list.nix4
-rw-r--r--modules/user/aszlig/profiles/base.nix64
-rw-r--r--modules/user/aszlig/profiles/workstation.nix152
3 files changed, 219 insertions, 1 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index 10b42671..7dd714f3 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -1,7 +1,9 @@
 [
+  ./user/aszlig/profiles/base.nix
+  ./user/aszlig/profiles/workstation.nix
   ./user/aszlig/programs/git
+  ./user/aszlig/programs/zsh
   ./user/aszlig/services/i3
   ./user/aszlig/services/slim
   ./user/aszlig/services/vlock
-  ./user/aszlig/programs/zsh
 ]
diff --git a/modules/user/aszlig/profiles/base.nix b/modules/user/aszlig/profiles/base.nix
new file mode 100644
index 00000000..aa984544
--- /dev/null
+++ b/modules/user/aszlig/profiles/base.nix
@@ -0,0 +1,64 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.vuizvui.user.aszlig.profiles.base;
+
+in {
+  options.vuizvui.user.aszlig.profiles.base = {
+    enable = lib.mkEnableOption "Base profile for aszlig";
+  };
+
+  config = lib.mkIf cfg.enable {
+    nix = {
+      package = pkgs.nixUnstable;
+      useChroot = true;
+      readOnlyStore = true;
+      extraOptions = ''
+        build-cores = 0
+        auto-optimise-store = true
+      '';
+    };
+
+    boot.loader.grub = {
+      enable = true;
+      version = 2;
+    };
+
+    hardware.cpu.intel.updateMicrocode = true;
+
+    users.defaultUserShell = "/var/run/current-system/sw/bin/zsh";
+
+    networking.wireless.enable = false;
+    networking.firewall.enable = false;
+    networking.useNetworkd = true;
+
+    i18n.consoleKeyMap = "dvorak";
+
+    programs.ssh.startAgent = false;
+    programs.ssh.extraConfig = ''
+      ServerAliveInterval 60
+    '';
+
+    services.nixosManual.showManual = false;
+
+    environment.systemPackages = with pkgs; [
+      binutils
+      cacert
+      file
+      htop
+      iotop
+      psmisc
+      unrar
+      unzip
+      vim
+      vlock
+      wget
+      xz
+      zsh
+    ];
+
+    nixpkgs.config = import ../../../../nixpkgs/config.nix;
+    system.fsPackages = with pkgs; [ sshfsFuse ];
+    time.timeZone = "Europe/Berlin";
+  };
+}
diff --git a/modules/user/aszlig/profiles/workstation.nix b/modules/user/aszlig/profiles/workstation.nix
new file mode 100644
index 00000000..fb9300a3
--- /dev/null
+++ b/modules/user/aszlig/profiles/workstation.nix
@@ -0,0 +1,152 @@
+{ pkgs, config, lib, ... }:
+
+let
+  cfg = config.vuizvui.user.aszlig.profiles.workstation;
+  randrHeads = config.services.xserver.xrandrHeads;
+
+in {
+  options.vuizvui.user.aszlig.profiles.workstation = {
+    enable = lib.mkEnableOption "Workstation profile for aszlig";
+  };
+
+  imports = [ ../../../../packages.nix ];
+
+  config = lib.mkIf cfg.enable {
+    vuizvui.user.aszlig.profiles.base.enable = true;
+
+    boot.kernelParams = [ "zswap.enabled=1" ];
+    boot.cleanTmpDir = true;
+
+    environment.systemPackages = with lib; let
+      mkRandrConf = acc: name: acc ++ singleton {
+        inherit name;
+        value = "--output '${name}' --preferred"
+              + optionalString (acc != []) " --right-of '${(head acc).name}'";
+      };
+      randrConf = map (getAttr "value") (foldl mkRandrConf [] randrHeads);
+    in singleton (pkgs.writeScriptBin "xreset" ''
+      #!${pkgs.stdenv.shell}
+      ${pkgs.xorg.xrandr}/bin/xrandr ${concatStringsSep " " randrConf}
+    '');
+
+    hardware = {
+      pulseaudio.enable = true;
+      pulseaudio.package = pkgs.pulseaudio.override {
+        useSystemd = true;
+      };
+      opengl = {
+        driSupport32Bit = true;
+        s3tcSupport = true;
+      };
+    };
+
+    fonts = {
+      enableCoreFonts = true;
+      enableFontDir = true;
+      enableGhostscriptFonts = true;
+      fonts = [
+        pkgs.dosemu_fonts
+        pkgs.liberation_ttf
+      ];
+    };
+
+    vuizvui.user.aszlig.services.i3.enable = true;
+    vuizvui.user.aszlig.services.slim.enable = true;
+    vuizvui.user.aszlig.services.vlock.enable = true;
+    vuizvui.user.aszlig.programs.zsh.enable = true;
+
+    vuizvui.user.aszlig.programs.git.enable = true;
+    vuizvui.user.aszlig.programs.git.config = {
+      color.ui = "auto";
+      merge.tool = "vimdiff3";
+      user.email = "aszlig@redmoonstudios.org";
+      user.name = "aszlig";
+      user.signkey = "8C2DC961";
+      gpg.program = "${pkgs.gnupg}/bin/gpg2";
+      push.default = "current";
+      tar."tar.xz".command = "${pkgs.xz}/bin/xz -c";
+      rebase.autosquash = true;
+      rerere.enabled = true;
+      rerere.autoupdate = true;
+      commit.gpgsign = true;
+
+      alias.backport = let
+        release = "14.04";
+        message = "Merge release ${release} into backports.";
+      in "!git fetch upstream release-${release} &&"
+       + " git merge -m \"${message}\" --log FETCH_HEAD";
+    };
+
+    services = {
+      openssh = {
+        enable = true;
+        permitRootLogin = "without-password";
+      };
+
+      xfs.enable = false;
+
+      gpm = {
+        enable = true;
+        protocol = "exps2";
+      };
+
+      printing.enable = true;
+
+      udev.extraRules = ''
+        # aXbo S.P.A.C.
+        SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", \
+          ATTRS{serial}=="0001", OWNER="aszlig", SYMLINK+="axbo"
+        # Enttec DMX device
+        SUBSYSTEM=="usb*|tty", ACTION=="add|change", ATTRS{idVendor}=="0403", \
+          ATTRS{idProduct}=="6001", OWNER="aszlig"
+      '';
+
+      virtualboxHost.enable = true;
+
+      xserver = {
+        enable = true;
+        layout = "dvorak";
+
+        startGnuPGAgent = true;
+
+        displayManager.sessionCommands = ''
+          ${pkgs.redshift}/bin/redshift -l 48.428404:10.866007 &
+          ${pkgs.xorg.xrdb}/bin/xrdb "${pkgs.writeText "xrdb.config" ''
+            Rxvt*font:                 vga
+            Rxvt*background:           black
+            Rxvt*foreground:           grey
+            Rxvt*scrollBar:            false
+            Rxvt*saveLines:            2000
+
+            Rxvt*keysym.Home:          \033[1~
+            Rxvt*keysym.End:           \033[4~
+
+            Rxvt*urgentOnBell:         true
+
+            XTerm*font:                vga
+            XTerm*saveLines:           10000
+            XTerm*bellIsUrgent:        true
+            XTerm*background:          black
+            XTerm*foreground:          grey
+
+            XTerm*backarrowKeyIsErase: true
+            XTerm*ptyInitialErase:     true
+          ''}"
+        '';
+
+        desktopManager.default = "none";
+        desktopManager.xterm.enable = false;
+      };
+    };
+
+    users.extraUsers.aszlig = {
+      uid = 1000;
+      description = "aszlig";
+      group = "users";
+      extraGroups = [ "wheel" "video" ];
+      home = "/home/aszlig";
+      useDefaultShell = true;
+      createHome = true;
+    };
+  };
+}