Commit 1db73a97db02

Vincent Demeester <vincent@sbr.pm>
2016-12-25 12:27:58
Re-add a configuration.nix that load from the hostname
This means, no more link required, just a `hostname` file. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 45fced7
configuration/common.nix
@@ -11,17 +11,10 @@
                         ./acpi.nix
 			./network.nix
 			./network-gui.nix
-			./audio.nix
 			./gui.nix
 			./virtualisation.nix
 			./security.nix
 			./users.nix
 			./packages.nix
 		];
-	i18n = {
-		consoleFont = "Lat2-Terminus16";
-		consoleKeyMap = "fr";
-		defaultLocale = "en_US.UTF-8";
-		# supportedLocales = [ "en_US/ISO-8859-1" "fr_FR/ISO-8859-1" "fr_FR@euro/ISO-8859-15" ];
-	};
 }
configuration/gui.nix
@@ -1,6 +1,10 @@
 { config, pkgs, ... }:
 
 {
+  imports =
+    [
+      <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
+    ];
 	environment = {
 	systemPackages = with pkgs; [
 		dmenu2
@@ -25,7 +29,18 @@
 	};
 
 	hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
+	hardware.sane = {
+		enable = true;
+		brscan4.enable = true;
+		brscan4.netDevices = {
+      			docker = { model = "MFC-9330CDW"; ip = "192.168.1.57"; };
+    		};
+	};
 	services = {
+		printing = {
+			enable = true;
+			drivers = [ pkgs.gutenprint ];
+		};
 		xserver = {
 			enable = true;
 			enableTCP = false;
@@ -42,7 +57,7 @@
 					defaultUser = "vincent";
 				};
 				sessionCommands = ''
-${pkgs.xss-lock}/bin/xss-lock i3lock -- -i $HOME/.background-image 
+${pkgs.xss-lock}/bin/xss-lock i3lock -- -i $HOME/.background-image &
 ${pkgs.xlibs.xmodmap}/bin/xmodmap ~/.Xmodmap &
 ${pkgs.networkmanagerapplet}/bin/nm-applet &
 ${pkgs.pythonPackages.udiskie}/bin/udiskie -a -t -n -F &
configuration/users.nix
@@ -10,7 +10,7 @@
 				isNormalUser = true;
 				uid = 1000;
 				createHome = true;
-				extraGroups = [ "networkmanager" "wheel" "docker" "vboxusers" "input" "audio" "video" ];
+				extraGroups = [ "networkmanager" "wheel" "docker" "vboxusers" "input" "audio" "video" "scanner" ];
 				shell = "/run/current-system/sw/bin/zsh";
 				initialPassword = "changeMe";
 				openssh.authorizedKeys.keys =
machine/carthage.nix
@@ -7,7 +7,6 @@
   ];
 
   boot.cleanTmpDir = true;
-  networking.hostName = "carthage";
   networking.firewall.allowPing = true;
   services.openssh.enable = true;
   users.users.root.openssh.authorizedKeys.keys = [
machine/hokkaido.nix
@@ -6,12 +6,11 @@
 			../hardware-configuration.nix
 			../configuration/custom-packages.nix
 			../configuration/common.nix
+			../profiles/audio.nix
 			../hardware/thinkpad-x220.nix
 			../service/ssh-tunnel.nix
 		];
 
-	networking.hostName = "hokkaido";
-
 	services.openssh.enable = true;
 	services.openssh.forwardX11 = true;
 
machine/honshu.nix
@@ -6,11 +6,10 @@
 			../hardware-configuration.nix
 			../configuration/custom-packages.nix
 			../configuration/common.nix
+			../profiles/audio.nix
 			../hardware/dell-latitude-e6540.nix
 		];
 
-	networking.hostName = "honshu";
-
 	services = {
 		xserver = {
 			enable = true;
machine/kobe.nix
@@ -28,6 +28,4 @@
 		remoteUser = "vincent";
 		bindPort = 2222;
 	};
-	networking.hostName = "kobe";
-
 }
machine/wakasu.nix
@@ -6,11 +6,10 @@
 			../hardware-configuration.nix
 			../configuration/custom-packages.nix
 			../configuration/common.nix
+			../profiles/audio.nix
 			../hardware/thinkpad-t460s.nix
 		];
 
-	networking.hostName = "wakasu";
-
 	services.xserver.displayManager.slim.theme = pkgs.fetchurl {
 						url = "https://github.com/vdemeester/slim-themes/raw/master/docker-key-theme-0.1.tar.xz";
 						sha256 = "127893l1nzqya0g68k8841g5lm3hlnx7b3b3h06axvplc54a1jd8";
configuration/audio.nix → profiles/audio.nix
@@ -10,9 +10,11 @@
 	sound.enableMediaKeys = true;
 
 	environment.systemPackages = with pkgs; [
-		pavucontrol
-		pasystray
+		apulse       # allow alsa application to use pulse
+		pavucontrol  # pulseaudio volume control
+		pasystray    # systray application
 	];
 
+	# We assume xserver runs when pulseaudio does
 	services.xserver.displayManager.sessionCommands = "${pkgs.pasystray}/bin/pasystray &";
 }
profiles/default.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, ... }:
+
+{
+	i18n = {
+		consoleFont = "Lat2-Terminus16";
+		consoleKeyMap = "fr";
+		defaultLocale = "en_US.UTF-8";
+		# supportedLocales = [ "en_US/ISO-8859-1" "fr_FR/ISO-8859-1" "fr_FR@euro/ISO-8859-15" ];
+	};
+}
.gitignore
@@ -1,5 +1,4 @@
 hardware-configuration.nix
-configuration.nix
 result
 .tramp*
 *~
configuration.nix
@@ -0,0 +1,21 @@
+# This configuration file simply determines the hostname and then import both
+# the default configuration (common for all machine) and specific machine
+# configuration.
+
+{ config, pkgs, ... }:
+
+let
+	hostName = "${builtins.readFile ./hostname}";
+in
+rec {
+	imports = [
+		# Generated hardware configuration
+		./hardware-configuration.nix
+		# Default profile with default configuration
+		./profiles/default.nix
+		# Machine specific configuration files
+		(./machine + "/${hostName}.nix")
+	];
+
+	networking.hostName = "${hostName}";
+}
README.md
@@ -10,7 +10,7 @@ Thanks to @FaustXVI 👼
 When installing nixos:
 
 - clone this repository in `/etc/nixos`
-- create a `configuration.nix` either by linking it from a known
-  machine (in `machine/`) or by doing your own.
+- create a `hostname` with the hostname you want
+- create a `machine/${hostname}.nix` file with the thing you want (look at other ones)
 - run `nixos-generate-configuration` to have the
   `hardware-configuration.nix` generated.