Commit e4f7e4ff7001

Vincent Demeester <vincent@sbr.pm>
2018-11-23 18:12:27
modules: add a base enabled by default…
… and clean some duplicated imports Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 23cb09f
machine/carthage.nix
@@ -1,8 +1,8 @@
-{ config, pkgs, ... }: {
+{ config, pkgs, ... }:
+
+{
   imports = [
-    ../hardware-configuration.nix
     ../networking.nix # generated at runtime by nixos-infect
-    ../profiles/server.nix
   ];
 
   profiles.ssh.enable = true;
machine/honshu.nix
@@ -2,12 +2,10 @@
 
 {
   imports =
-    [ # Include the results of the hardware scan.
-    ../hardware-configuration.nix
+    [
     ../hardware/dell-latitude-e6540.nix
-    ../profiles/server.nix
     ../location/home.nix
-  ];
+    ];
 
   profiles.ssh.enable = true;
   profiles.dev.enable = true;
machine/kerkouane.nix
@@ -1,8 +1,8 @@
-{ config, pkgs, ... }: {
+{ config, pkgs, ... }:
+
+{
   imports = [
-    ../hardware-configuration.nix
     ../networking.nix # generated at runtime by nixos-infect
-    ../profiles/server.nix
     ../profiles/wireguard.server.nix
   ];
 
machine/massimo.nix
@@ -1,9 +1,6 @@
-{ config, pkgs, ... }: {
-  imports = [
-    ../hardware-configuration.nix
-    ../profiles/server.ni
-  ];
+{ config, pkgs, ... }:
 
+{
   profiles.ssh.enable = true;
   profiles.git.enable = true;
 
machine/shikoku.nix
@@ -1,8 +1,7 @@
 { config, pkgs, ... }:
 
 {
-  imports = [ # Include the results of the hardware scan.
-    ../hardware-configuration.nix
+  imports = [
     ../profiles/gaming.nix
     ../location/home.nix
   ];
machine/vm.nix
@@ -1,25 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  imports =
-    [ # Include the results of the hardware scan.
-    ../hardware-configuration.nix
-    ../profiles/desktop.nix
-    ../profiles/ssh.nix
-    ../profiles/dockerization.nix
-  ];
-
-  boot = {
-    loader = {
-      grub = {
-        enable = true;
-        device = "/dev/sda";
-      };
-    };
-    initrd = {
-      checkJournalingFS = false;
-    };
-  };
-
-  virtualisation.virtualbox.guest.enable = true;
-}
machine/wakasu.nix
@@ -2,11 +2,10 @@
 
 {
   imports =
-    [ # Include the results of the hardware scan.
-    ../hardware-configuration.nix
-    ../location/home.nix
-    ../hardware/lenovo-p50.nix
-  ];
+    [
+      ../location/home.nix
+      ../hardware/lenovo-p50.nix
+    ];
 
   profiles.laptop.enable = true;
   profiles.docker.enable = true;
modules/profiles/base.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.base;
+in
+{
+  options = {
+    profiles.base = {
+      enable = mkOption {
+        default = true;
+        description = "Enable base profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    boot.loader.systemd-boot.enable = true;
+    environment = {
+      variables = {
+        EDITOR = pkgs.lib.mkOverride 0 "vim";
+      };
+      systemPackages = with pkgs; [
+        cachix
+        direnv
+        file
+        htop
+        iotop
+        lsof
+        netcat
+        psmisc
+        pv
+        tmux
+        tree
+        vim
+        vrsync
+        wget
+      ];
+    };
+  };
+}
modules/profiles/nix-config.nix
@@ -51,6 +51,9 @@ in
       trustedUsers = [ "root" "vincent" ];
     };
     nixpkgs = {
+      overlays = [
+        (import ../../overlays/sbr.overlay.nix)
+      ];
       config = {
         allowUnfree = true;
         packageOverrides = pkgs: {
modules/module-list.nix
@@ -3,6 +3,7 @@
 {
   imports = [
     ./profiles/avahi.nix
+    ./profiles/base.nix
     ./profiles/buildkit.nix
     ./profiles/fish.nix
     ./profiles/containerd.nix
profiles/default.nix
@@ -1,29 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  imports = [
-    ./overlays.nix
-  ];
-  boot.loader.systemd-boot.enable = true;
-  environment = {
-    variables = {
-      EDITOR = pkgs.lib.mkOverride 0 "vim";
-    };
-    systemPackages = with pkgs; [
-      cachix
-      direnv
-      file
-      htop
-      iotop
-      lsof
-      netcat
-      psmisc
-      pv
-      tmux
-      tree
-      vim
-      vrsync
-      wget
-    ];
-  };
-}
profiles/overlays.nix
@@ -1,9 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  nixpkgs = {
-    overlays = [
-      (import ../overlays/sbr.overlay.nix)
-      ];
-  };
-}
profiles/server.nix
@@ -1,9 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  imports = [
-    ./default.nix
-    ./ssh.nix
-  ];
-  boot.loader.efi.canTouchEfiVariables = true;
-}
profiles/synergy-server.nix
@@ -1,20 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  imports = [
-    ./synergy.nix
-  ];
-  systemd.user.services.synergy = {
-    description = "Synergy sharing server";
-    wantedBy = [ "multi-user.target" ];
-    serviceConfig = {
-      RestartSec = 10;
-      Restart = "on-failure";
-      ExecStart = "${pkgs.synergy}/bin/synergys -c /etc/synergy-server.conf -f -a 0.0.0.0";
-      Environment = "PATH=/run/current-system/sw/bin/";
-    };
-  };
-  systemd.user.services.synergy.enable = true;
-
-  networking.firewall.allowedTCPPorts = [ 24800 ];
-}
profiles/synergy.nix
@@ -1,9 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment = {
-    systemPackages = with pkgs; [
-      synergy
-    ];
-  };
-}
configuration.nix
@@ -13,7 +13,6 @@ rec {
     ./hardware-configuration.nix
     # Default profile with default configuration
     ./modules/module-list.nix
-    ./profiles/default.nix
     # Machine specific configuration files
     (./machine + "/${hostName}.nix")
   ];