diff options
-rw-r--r-- | machines/default.nix | 3 | ||||
-rw-r--r-- | machines/labnet/labtop.nix | 134 | ||||
-rw-r--r-- | modules/module-list.nix | 1 | ||||
-rw-r--r-- | modules/user/openlab/labtops.nix | 116 |
4 files changed, 161 insertions, 93 deletions
diff --git a/machines/default.nix b/machines/default.nix index f3cb8d60..0f972829 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -2,6 +2,7 @@ let callMachine = import ../lib/call-machine.nix; + nixpkgs = import (import ../nixpkgs-path.nix) {}; in { aszlig = { dnyarri = callMachine ./aszlig/dnyarri.nix {}; @@ -15,7 +16,7 @@ in { }; }; labnet = { - labtop = callMachine ./labnet/labtop.nix {}; + labtops = import ./labnet/labtop.nix { inherit (nixpkgs) lib; }; }; profpatsch = { katara = callMachine ./profpatsch/katara.nix {}; diff --git a/machines/labnet/labtop.nix b/machines/labnet/labtop.nix index a206f93c..7cc90db7 100644 --- a/machines/labnet/labtop.nix +++ b/machines/labnet/labtop.nix @@ -1,105 +1,55 @@ -{ pkgs, lib, ... }: - +{ lib }: let - modulesPath = "${import ../../nixpkgs-path.nix}/nixos/modules"; - -in { - imports = [ "${modulesPath}/installer/scan/not-detected.nix" ]; - - boot.loader.grub.device = "/dev/disk/by-id/ata-HITACHI_HTS722010K9SA00_080711DP0270DPGLVMPC"; - - boot.kernelModules = [ "kvm-intel" ]; - boot.initrd.availableKernelModules = [ - "uhci_hcd" "ehci_pci" "ata_piix" "firewire_ohci" "usb_storage" - ]; - - i18n = { - consoleFont = "lat9w-16"; - consoleKeyMap = "us"; - defaultLocale = "de_DE.UTF-8"; - }; + compose = f: g: x: f (g x); + callMachine = import ../../lib/call-machine.nix; + mkLabtop = hostname: config: { + vuizvui.user.openlab.labtops.enable = true; + networking.hostName = hostname; + } // config; + mkLabtops = lib.mapAttrs (name: cfg: callMachine (mkLabtop name cfg) {}); - fileSystems."/" = { - device = "/dev/disk/by-uuid/754fd3e3-2e04-4028-9363-0c6bb4c54367"; - fsType = "ext4"; - }; + labtop = { + boot.loader.grub.device = "/dev/disk/by-id/ata-HITACHI_HTS722010K9SA00_080711DP0270DPGLVMPC"; - vuizvui.hardware.thinkpad.enable = true; + boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ + "uhci_hcd" "ehci_pci" "ata_piix" "firewire_ohci" "usb_storage" + ]; - hardware.trackpoint.enable = false; + fileSystems."/" = { + device = "/dev/disk/by-uuid/754fd3e3-2e04-4028-9363-0c6bb4c54367"; + fsType = "ext4"; + }; - environment.systemPackages = with pkgs; [ - #repetierhost <- TODO - ack - antimony - blender - filezilla - firefox - fish - freecad - gcc - gnome3.gedit - gimp - git - gmpc - inkscape - ino - (libreoffice.overrideDerivation (lib.const { doCheck = false; })) - netcat-openbsd - openscad - printrun - python3 - screen - slic3r - tmux - vim - vlc - wget - ]; + vuizvui.hardware.thinkpad.enable = true; - services.xserver = { - enable = true; - layout = "us"; - xkbOptions = "eurosign:e"; + hardware.trackpoint.enable = false; - displayManager.auto.enable = true; - displayManager.auto.user = "openlab"; - desktopManager.gnome3.enable = true; - synaptics.enable = true; - synaptics.minSpeed = "0.5"; - synaptics.accelFactor = "0.01"; - }; + networking.enableIntel3945ABGFirmware = true; - services.openssh.enable = true; - - networking.networkmanager.enable = true; - networking.enableIntel3945ABGFirmware = true; - networking.hostName = "labtop"; - networking.firewall = { - allowedTCPPorts = [ 1337 2342 ]; - allowedTCPPortRanges = [ { from = 8000; to = 8005; } ]; - allowPing = true; }; - nix.maxJobs = 2; - - users.mutableUsers = false; - users.users.openlab = { - uid = 1000; - isNormalUser = true; - password = "openlab"; - extraGroups = [ "wheel" "networkmanager" "dialout"]; - openssh.authorizedKeys.keys = lib.singleton (lib.concatStrings [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJhthfk38lzDvoI7lPqRneI0yBpZEhLD" - "GRBpcXzpPSu+V0YlgrDix5fHhBl+EKfw4aeQNvQNuAky3pDtX+BDK1b7idbz9ZMCExy2a1" - "kBKDVJz/onLSQxiiZMuHlAljVj9iU4uoTOxX3vB85Ok9aZtMP1rByRIWR9e81/km4HdfZT" - "CjFVRLWfvo0s29H7l0fnbG9bb2E6kydlvjnXJnZFXX+KUM16X11lK53ilPdPJdm87VtxeS" - "KZ7GOiBz6q7FHzEd2Zc3CnzgupQiXGSblXrlN22IY3IWfm5S/8RTeQbMLVoH0TncgCeenX" - "H7FU/sXD79ypqQV/WaVVDYMOirsnh/ philip@nyx" - ]); + labhanns = { + nixpkgs.system = "i686-linux"; + boot.loader.grub.device = "/dev/sda"; + + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; + + networking.wireless = { + interfaces = [ "wlp2s0" ]; + }; + environment.etc."wpa_supplicant.conf".text = '' + network={ + ssid="Labor 2.0" + #psk="nerdhoehle2" + psk=5d925de5243d3a77a86e803ff6ac1f02ce7e1606f23bdb3d8ca60d90f26e8684 + } + ''; }; - # fix for emacs - programs.bash.promptInit = "PS=\"# \""; -} +in + mkLabtops { inherit labtop labhanns; } diff --git a/modules/module-list.nix b/modules/module-list.nix index 3b6bff9c..4eb8dc54 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -25,5 +25,6 @@ ./user/aszlig/services/slim ./user/aszlig/services/vlock ./user/aszlig/system/kernel.nix + ./user/openlab/labtops.nix ./user/profpatsch/programs/scanning.nix ] diff --git a/modules/user/openlab/labtops.nix b/modules/user/openlab/labtops.nix new file mode 100644 index 00000000..26a08a22 --- /dev/null +++ b/modules/user/openlab/labtops.nix @@ -0,0 +1,116 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.vuizvui.user.openlab.labtops; + +in +{ + + options.vuizvui.user.openlab.labtops = { + enable = mkEnableOption "basic shared functionality of labtops"; + + }; + + + + config = mkIf cfg.enable { + + i18n = { + consoleFont = "lat9w-16"; + consoleKeyMap = "us"; + defaultLocale = "de_DE.UTF-8"; + }; + + # TODO: filesystems + + # TODO: a way to modularly specify usage patterns (e.g. 3d-printing, arduino &c.) + environment.systemPackages = with pkgs; let + base = [ + ack + fish + git + netcat-openbsd + python3 + tmux + screen + vim + wget + ]; + baseGUI = [ + filezilla + chromium + gnome3.gedit + gmpc + libreoffice + vlc + ]; + image = [ + gimp + inkscape + ]; + three-d = [ + # TODO doesn’t build on i686 + # TODO add a “packageset” mechanism + # blender + antimony + ]; + three-d-printing = [ + freecad + openscad + printrun + slic3r + ]; + arduino = [ + ino + ]; + in base ++ baseGUI ++ image ++ three-d ++ three-d-printing ++ arduino; + + services.xserver = { + enable = true; + layout = "us"; + xkbOptions = "eurosign:e"; + + displayManager.auto.enable = true; + displayManager.auto.user = "openlab"; + desktopManager.xfce.enable = true; + synaptics = { + enable = true; + minSpeed = "0.5"; + accelFactor = "0.01"; + }; + }; + + services.openssh.enable = true; + + networking.networkmanager.enable = true; + networking.firewall.enable = false; + + # TODO: an argument that tells about hardware capability + nix.maxJobs = 2; + hardware.enableAllFirmware = true; + + users.mutableUsers = false; + users.users.openlab = { + uid = 1000; + isNormalUser = true; + password = "openlab"; + extraGroups = [ "wheel" "networkmanager" "dialout"]; + openssh.authorizedKeys.keys = lib.singleton (lib.concatStrings [ + + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJhthfk38lzDvoI7lPqRneI0yBpZEhLD" + "GRBpcXzpPSu+V0YlgrDix5fHhBl+EKfw4aeQNvQNuAky3pDtX+BDK1b7idbz9ZMCExy2a1" + "kBKDVJz/onLSQxiiZMuHlAljVj9iU4uoTOxX3vB85Ok9aZtMP1rByRIWR9e81/km4HdfZT" + "CjFVRLWfvo0s29H7l0fnbG9bb2E6kydlvjnXJnZFXX+KUM16X11lK53ilPdPJdm87VtxeS" + "KZ7GOiBz6q7FHzEd2Zc3CnzgupQiXGSblXrlN22IY3IWfm5S/8RTeQbMLVoH0TncgCeenX" + "H7FU/sXD79ypqQV/WaVVDYMOirsnh/ philip@nyx" + ]); + }; + + # fix for emacs + programs.bash.promptInit = "PS=\"# \""; + + }; + +} |