Commit 52ba373240d6

Vincent Demeester <vincent@sbr.pm>
2018-11-23 17:57:06
modules: add git and dev
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent e4ab9ec
Changed files (4)
modules/profiles/dev.nix
@@ -0,0 +1,27 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.dev;
+in
+{
+  options = {
+    profiles.dev = {
+      enable = mkOption {
+        default = false;
+        description = "Enable dev profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    profiles.git.enable = true;
+    environment.systemPackages = with pkgs; [
+      git
+      tig
+      grc
+      ripgrep
+      gnumake
+    ];
+  };
+}
modules/profiles/git.nix
@@ -0,0 +1,72 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.git;
+in
+{
+  options = {
+    profiles.git = {
+      enable = mkOption {
+        default = false;
+        description = "Enable git profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    environment.systemPackages = with pkgs; [
+      git
+      gitAndTools.git-extras
+    ];
+    environment.etc."gitconfig" = rec { text = ''
+  [alias]
+      co = checkout
+      st = status
+      ci = commit --signoff
+      ca = commit --amend
+      b = branc --color -v
+      br = branch
+      unstage = reset HEAD
+      lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
+      lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --branches --remotes
+      lol = log --pretty=oneline --abbrev-commit --graph --decorate
+      conflicts = !git ls-files --unmerged | cut -c51- | sort -u | xargs $EDITOR
+      resolve = !git ls-files --unmerged | cut -c51- | sort -u | xargs git add
+  [color]
+  	branch = auto
+  	diff = auto
+  	status = auto
+  [color "branch"]
+  	current = cyan reverse
+  	local = cyan
+  	remote = green
+  [color "diff"]
+  	meta = white reverse
+  	frag = magenta reverse
+  	old = red 
+  	new = green 
+  [color "status"]
+  	added = green
+  	changed = yellow
+  	untracked = red
+  [core]
+  	excludesfile = ~/.gitignore.global
+  [push]
+  	default = matching
+  [merge]
+      tool = vimdiff
+  
+  [user]
+      name = Vincent Demeester
+      email = vincent@sbr.pm
+  
+  [http]
+          cookiefile = /home/vincent/.gitcookies
+  	
+  [url "git@github.com:"]
+      pushInsteadOf = git://github.com/
+    '';
+    };
+  };
+}
profiles/dev.nix
@@ -1,16 +0,0 @@
-# Common configuration for any machine to do dev
-
-{ configs, pkgs, ...}:
-
-{
-  imports = [
-    ./gitconfig.nix
-  ];
-  environment.systemPackages = with pkgs; [
-    git
-    tig
-    grc
-    ripgrep
-    gnumake
-  ];
-}
profiles/gitconfig.nix
@@ -1,57 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  environment.systemPackages = with pkgs; [
-    git
-    gitAndTools.git-extras
-  ];
-  environment.etc."gitconfig" = rec { text = ''
-[alias]
-    co = checkout
-    st = status
-    ci = commit --signoff
-    ca = commit --amend
-    b = branc --color -v
-    br = branch
-    unstage = reset HEAD
-    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
-    lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --branches --remotes
-    lol = log --pretty=oneline --abbrev-commit --graph --decorate
-    conflicts = !git ls-files --unmerged | cut -c51- | sort -u | xargs $EDITOR
-    resolve = !git ls-files --unmerged | cut -c51- | sort -u | xargs git add
-[color]
-	branch = auto
-	diff = auto
-	status = auto
-[color "branch"]
-	current = cyan reverse
-	local = cyan
-	remote = green
-[color "diff"]
-	meta = white reverse
-	frag = magenta reverse
-	old = red 
-	new = green 
-[color "status"]
-	added = green
-	changed = yellow
-	untracked = red
-[core]
-	excludesfile = ~/.gitignore.global
-[push]
-	default = matching
-[merge]
-    tool = vimdiff
-
-[user]
-    name = Vincent Demeester
-    email = vincent@sbr.pm
-
-[http]
-        cookiefile = /home/vincent/.gitcookies
-	
-[url "git@github.com:"]
-    pushInsteadOf = git://github.com/
-  '';
-  };
-}