From ec2b45fb836842abb89a14088ea84365a45019ae Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 18 Mar 2015 03:25:38 +0100 Subject: 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 --- common-workstation.nix | 145 ------------------------- common.nix | 57 ---------- machines/aszlig/arilou.nix | 6 +- machines/aszlig/dnyarri.nix | 2 +- machines/aszlig/kzerza.nix | 2 +- machines/aszlig/mmrnmhrm.nix | 2 +- machines/aszlig/tishtushi.nix | 2 +- machines/default.nix | 2 +- modules/module-list.nix | 4 +- modules/user/aszlig/profiles/base.nix | 64 +++++++++++ modules/user/aszlig/profiles/workstation.nix | 152 +++++++++++++++++++++++++++ 11 files changed, 226 insertions(+), 212 deletions(-) delete mode 100644 common-workstation.nix delete mode 100644 common.nix create mode 100644 modules/user/aszlig/profiles/base.nix create mode 100644 modules/user/aszlig/profiles/workstation.nix diff --git a/common-workstation.nix b/common-workstation.nix deleted file mode 100644 index c3dd7555..00000000 --- a/common-workstation.nix +++ /dev/null @@ -1,145 +0,0 @@ -{ pkgs, config, lib, ... }: - -let - randrHeads = config.services.xserver.xrandrHeads; -in { - imports = [ - ./common.nix - ./packages.nix - ]; - - 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; - }; -} diff --git a/common.nix b/common.nix deleted file mode 100644 index 111b5c6c..00000000 --- a/common.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = import ./modules/module-list.nix; - - 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/machines/aszlig/arilou.nix b/machines/aszlig/arilou.nix index 093934b5..94efda36 100644 --- a/machines/aszlig/arilou.nix +++ b/machines/aszlig/arilou.nix @@ -7,10 +7,8 @@ let swapUUID = "4d172959-5cfd-4164-a46e-fa7be0dfd03a"; diskID = "usb-Lexar_USB_Flash_Drive_201303211246293590E4-0:0"; in { - imports = [ - ../../common-workstation.nix - - ]; + vuizvui.user.aszlig.profiles.workstation.enable = true; + imports = [ ]; boot = { kernelPackages = pkgs.linuxPackages_latest; diff --git a/machines/aszlig/dnyarri.nix b/machines/aszlig/dnyarri.nix index 57a8a92d..89753820 100644 --- a/machines/aszlig/dnyarri.nix +++ b/machines/aszlig/dnyarri.nix @@ -4,7 +4,7 @@ with pkgs.lib; with import ../../lib; { - imports = singleton ../../common-workstation.nix; + vuizvui.user.aszlig.profiles.workstation.enable = true; nix.maxJobs = 8; diff --git a/machines/aszlig/kzerza.nix b/machines/aszlig/kzerza.nix index a0ca1e5d..31ca9852 100644 --- a/machines/aszlig/kzerza.nix +++ b/machines/aszlig/kzerza.nix @@ -6,7 +6,7 @@ let rootUUID = "ad41f848-d14a-4a89-9d04-3e48bd73dc5c"; diskID = "usb-0000_Removable_Drive_23372707080836980013-0:0"; in { - imports = singleton ../../common.nix; + vuizvui.user.aszlig.profiles.base.enable = true; services.xserver.enable = mkForce false; diff --git a/machines/aszlig/mmrnmhrm.nix b/machines/aszlig/mmrnmhrm.nix index 3e3cc641..dbc6793b 100644 --- a/machines/aszlig/mmrnmhrm.nix +++ b/machines/aszlig/mmrnmhrm.nix @@ -4,7 +4,7 @@ with pkgs.lib; with import ../../lib; { - imports = singleton ../../common-workstation.nix; + vuizvui.user.aszlig.profiles.workstation.enable = true; nix.maxJobs = 2; diff --git a/machines/aszlig/tishtushi.nix b/machines/aszlig/tishtushi.nix index 305c4952..cb12ae72 100644 --- a/machines/aszlig/tishtushi.nix +++ b/machines/aszlig/tishtushi.nix @@ -8,7 +8,7 @@ let storeUUID = "ce1db87b-d717-450d-a212-3685a224f626"; diskID = "ata-Hitachi_HTS543232A7A384_E2P31243FGB6PJ"; in { - imports = singleton ../../common-workstation.nix; + vuizvui.user.aszlig.profiles.workstation.enable = true; boot = rec { kernelPackages = with pkgs; let diff --git a/machines/default.nix b/machines/default.nix index 10c4fdb6..baceb647 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -5,7 +5,7 @@ let config = import path; build = import { inherit system; - modules = [ config ]; + modules = [ config ] ++ import ../modules/module-list.nix; }; }; 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; + }; + }; +} -- cgit 1.4.1