summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-13 10:41:48 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-13 10:41:48 -0400
commit9b0220f68fa95b8f2b1d6d3ee3466798a134f57e (patch)
treedfc7c89341976113345e42e013bd3dad28359b5a
parent5ffdf367cdf06666e45973d6aeb3862289b27334 (diff)
Add refactored nixos configuration for laptop pincer.
-rw-r--r--config/common.nix33
-rw-r--r--config/desktop.nix84
-rw-r--r--config/thinkpad.nix33
-rw-r--r--config/users.nix12
-rw-r--r--machines/x1-pincer.nix45
5 files changed, 207 insertions, 0 deletions
diff --git a/config/common.nix b/config/common.nix
new file mode 100644
index 0000000..b23619a
--- /dev/null
+++ b/config/common.nix
@@ -0,0 +1,33 @@
+{ config, lib, pkgs, ... }:
+{
+ site = {
+ ports = {
+ };
+ };
+
+ programs.fish.enable = true;
+
+ environment.shellAliases = {
+ vim = "nvim";
+ };
+ environment.systemPackages = with pkgs; [
+ dnsutils
+ gnupg
+ haskellPackages.hledger
+ mosh
+ neovim
+ nix-repl
+ nox
+ silver-searcher
+ whois
+ ];
+ time.timeZone = "America/New_York";
+
+ nix = {
+ useSandbox = true;
+ maxJobs = 8;
+ buildCores = 0; # auto configure
+ };
+
+ boot.cleanTmpDir = true;
+}
diff --git a/config/desktop.nix b/config/desktop.nix
new file mode 100644
index 0000000..a5c5885
--- /dev/null
+++ b/config/desktop.nix
@@ -0,0 +1,84 @@
+{ config, lib, pkgs, ... }:
+{
+ imports = [ ./common.nix ./users.nix ];
+
+ hardware = {
+ opengl.driSupport32Bit = true;
+
+ bluetooth.enable = true;
+ pulseaudio.enable = true;
+
+ loader = {
+ systemd-boot.enable = true;
+ timeout = 0;
+ efi.canTouchEfiVariables = true;
+ };
+ };
+
+ boot = {
+ earlyVconsoleSetup = true;
+ };
+
+ networking = {
+ networkmanager.enable = true;
+ firewall.enable = true;
+ };
+
+ fonts = {
+ fonts = [ pkgs.fira-code ];
+ };
+
+ environment.systemPackages = with pkgs; [
+ chromium
+ dmenu2
+ emacs25
+ firefox
+ haskellPackages.xmobar
+ sshfsFuse
+ xbindkeys
+ xorg.xbacklight
+ xorg.xev
+ xscreensaver
+ xss-lock
+ ];
+
+ services = {
+ avahi.enable = true;
+
+ xserver = {
+ enable = true;
+ layout = "us";
+ variant = "dvorak";
+
+ windowManager.xmonad = {
+ enable = true;
+ enableContribAndExtras = true;
+ extraPackages = hpkgs: [ hpkgs.xmobar ];
+ };
+
+ displayManager.slim = {
+ enable = true;
+ autoLogin = true;
+ defaultUser = "orbekk";
+ };
+
+ synaptics = {
+ enable = true;
+ twoFingerScroll = true;
+ };
+ };
+
+ redshift = {
+ enable = true;
+ latitude = "40";
+ longitude = "-74";
+ extraOptions = ["-r"];
+ };
+ };
+
+ i18n = {
+ consoleFont = "ter-132n";
+ consoleKeyMap = "dvorak";
+ consolePackages = [ pkgs.terminus_font ];
+ };
+}
diff --git a/config/thinkpad.nix b/config/thinkpad.nix
new file mode 100644
index 0000000..ff832b1
--- /dev/null
+++ b/config/thinkpad.nix
@@ -0,0 +1,33 @@
+{ config, lib, pkgs, ... }:
+{
+ services = {
+ tlp = {
+ enable = true;
+ extraConfig = ''
+ # Needed for either SSD or btrfs.
+ SATA_LINKPWR_ON_BAT=max_performance
+ '';
+ };
+ xserver.xkbModel = "thinkpad60";
+ };
+
+ boot = {
+ kernelModules = [ "tp_smapi" "thinkpad_acpi" "fbcon" "i915" "acpi_call" ];
+ extraModulePackages = with config.boot.kernelPackages [ tp_smapi acpi_call ];
+ }
+
+ systemd.services = {
+ battery_threshold = {
+ description = "Set battery charging thresholds.";
+ path = [ pkgs.tpacpi-bat ];
+ after = [ "basic.target" ];
+ wantedBy = [ "multi-user.target" ];
+ script = ''
+ tpacpi-bat -s ST 1 39
+ tpacpi-bat -s ST 2 39
+ tpacpi-bat -s SP 1 80
+ tpacpi-bat -s SP 2 80
+ '';
+ };
+ };
+}
diff --git a/config/users.nix b/config/users.nix
new file mode 100644
index 0000000..4e0901f
--- /dev/null
+++ b/config/users.nix
@@ -0,0 +1,12 @@
+{ config, lib, pkgs, ... }:
+{
+ users.extraUsers = {
+ orbekk = {
+ isNormalUser = true;
+ home = "/home/orbekk";
+ uid = 1000;
+ description = "KJ";
+ extragroups = ["wheel" "networkmanager" "dialout" "uucp" "audio"];
+ };
+ };
+}
diff --git a/machines/x1-pincer.nix b/machines/x1-pincer.nix
new file mode 100644
index 0000000..940cd91
--- /dev/null
+++ b/machines/x1-pincer.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, ... }:
+{
+ imports = [
+ ../config/desktop.nix
+ ../config/thinkpad.nix
+ ];
+
+ networking = {
+ hostName = "pincer";
+ };
+
+ boot = {
+ initrd.luks.devices = [
+ {
+ device = "/dev/sda6";
+ name = "cryptroot";
+ allowDiscards = true;
+ };
+ ];
+
+ extraModprobeConfig = ''
+ option iwlwifi swcrypto=1
+ '';
+ };
+
+ fileSystems = {
+ "/boot" = {
+ mountPoint = "/boot";
+ device = "/dev/sda1";
+ fsType = "vfat";
+ };
+ "/" = {
+ mountPoint = "/";
+ device = "/dev/mapper/cryptroot";
+ fsType = "btrfs";
+ options = ["subvol=active/nixos-root" "discard" "compress=lzo"];
+ };
+ "/btrfs" = {
+ mountPoint = "/btrfs";
+ device = "/dev/mapper/cryptroot";
+ fsType = "btrfs";
+ options = ["discard" "compress=lzo"];
+ };
+ };
+}