home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8a3255be40e4af5eb6f60173e9c4d864c8430339
parent 5ca886785b312e38672a7b51d5f333929320a660
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Thu,  1 Nov 2018 13:29:41 +0100

profiles: add bash, fish and ssh…

… and enable them by default.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Dbash.nix | 8--------
Mdesktop.nix | 2+-
Mdev.go.nix | 2+-
Dfish.nix | 26--------------------------
Mgit.nix | 2+-
Mmodules/module-list.nix | 5++++-
Raliases.nix -> modules/profiles/aliases.shell.nix | 0
Rfish/a_nix_run.fish -> modules/profiles/assets/fish/a_nix_run.fish | 0
Rfish/fish_prompt.fish -> modules/profiles/assets/fish/fish_prompt.fish | 0
Rfish/fish_right_prompt.fish -> modules/profiles/assets/fish/fish_right_prompt.fish | 0
Rfish/git.fish -> modules/profiles/assets/fish/git.fish | 0
Rfish/go.fish -> modules/profiles/assets/fish/go.fish | 0
Rfish/nix-aliases.fish -> modules/profiles/assets/fish/nix-aliases.fish | 0
Rfish/sudope.fish -> modules/profiles/assets/fish/sudope.fish | 0
Rfish/sudope.function.fish -> modules/profiles/assets/fish/sudope.function.fish | 0
Amodules/profiles/bash.nix | 23+++++++++++++++++++++++
Amodules/profiles/fish.nix | 41+++++++++++++++++++++++++++++++++++++++++
Amodules/profiles/ssh.nix | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver.nix | 2+-
Dssh.nix | 38--------------------------------------
20 files changed, 125 insertions(+), 77 deletions(-)

diff --git a/bash.nix b/bash.nix @@ -1,8 +0,0 @@ -{ pkgs, config, lib, ...}: - -{ - programs.bash = { - enable = true; - shellAliases = import ./aliases.nix - }; -} diff --git a/desktop.nix b/desktop.nix @@ -1,7 +1,7 @@ { pkgs, prefix, ... }: { - imports = [ ./fish.nix ./ssh.nix ./base.nix ]; + imports = [ ./base.nix ]; services = { gpg-agent = { enable = true; diff --git a/dev.go.nix b/dev.go.nix @@ -2,7 +2,7 @@ { imports = [ ./dev.nix ]; - xdg.configFile."fish/conf.d/go.fish".source = ./fish/go.fish; + xdg.configFile."fish/conf.d/go.fish".source = ./modules/profiles/assets/fish/go.fish; programs.fish.shellAbbrs = { got = "go test -v"; gob = "go build -v"; diff --git a/fish.nix b/fish.nix @@ -1,26 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - programs.fish = { - enable = true; - shellAliases = import ./aliases.nix; - shellInit = '' - eval (${pkgs.direnv}/bin/direnv hook fish) - # emacs ansi-term support - if test -n "$EMACS" - set -x TERM eterm-color - - # this function may be required - function fish_title - true - end - end - ''; - }; - xdg.configFile."fish/conf.d/a_nix_run.fish".source = ./fish/a_nix_run.fish; - xdg.configFile."fish/conf.d/nix-aliases.fish".source = ./fish/nix-aliases.fish; - xdg.configFile."fish/conf.d/sudope.fish".source = ./fish/sudope.fish; - xdg.configFile."fish/functions/sudope.fish".source = ./fish/sudope.function.fish; - xdg.configFile."fish/functions/fish_prompt.fish".source = ./fish/fish_prompt.fish; - xdg.configFile."fish/functions/fish_right_prompt.fish".source = ./fish/fish_right_prompt.fish; -} diff --git a/git.nix b/git.nix @@ -11,7 +11,7 @@ rec { gitAndTools.tig prm ]; - xdg.configFile."fish/conf.d/git.fish".source = ./fish/git.fish; + xdg.configFile."fish/conf.d/git.fish".source = ./modules/profiles/assets/fish/git.fish; programs.fish.shellAbbrs = { gs = "git status"; gb = "git b"; diff --git a/modules/module-list.nix b/modules/module-list.nix @@ -2,8 +2,11 @@ { imports = [ - ./profiles/i3.nix + ./profiles/bash.nix ./profiles/desktop.nix + ./profiles/ssh.nix + ./profiles/fish.nix + ./profiles/i3.nix ./services/shairport-sync.nix ]; } diff --git a/aliases.nix b/modules/profiles/aliases.shell.nix diff --git a/fish/a_nix_run.fish b/modules/profiles/assets/fish/a_nix_run.fish diff --git a/fish/fish_prompt.fish b/modules/profiles/assets/fish/fish_prompt.fish diff --git a/fish/fish_right_prompt.fish b/modules/profiles/assets/fish/fish_right_prompt.fish diff --git a/fish/git.fish b/modules/profiles/assets/fish/git.fish diff --git a/fish/go.fish b/modules/profiles/assets/fish/go.fish diff --git a/fish/nix-aliases.fish b/modules/profiles/assets/fish/nix-aliases.fish diff --git a/fish/sudope.fish b/modules/profiles/assets/fish/sudope.fish diff --git a/fish/sudope.function.fish b/modules/profiles/assets/fish/sudope.function.fish diff --git a/modules/profiles/bash.nix b/modules/profiles/bash.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.profiles.bash; +in +{ + options = { + profiles.bash = { + enable = mkOption { + default = true; + description = "Enable bash profile and configuration"; + type = types.bool; + }; + }; + }; + config = mkIf cfg.enable { + programs.bash = { + enable = true; + shellAliases = import ./aliases.shell.nix; + }; + }; +} diff --git a/modules/profiles/fish.nix b/modules/profiles/fish.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.profiles.fish; +in +{ + options = { + profiles.fish = { + enable = mkOption { + default = true; + description = "Enable fish program and configurations"; + type = types.bool; + }; + }; + }; + config = mkIf cfg.enable { + programs.fish = { + enable = true; + shellAliases = import ./aliases.shell.nix; + shellInit = '' + eval (${pkgs.direnv}/bin/direnv hook fish) + # emacs ansi-term support + if test -n "$EMACS" + set -x TERM eterm-color + + # this function may be required + function fish_title + true + end + end + ''; + }; + xdg.configFile."fish/conf.d/a_nix_run.fish".source = ./assets/fish/a_nix_run.fish; + xdg.configFile."fish/conf.d/nix-aliases.fish".source = ./assets/fish/nix-aliases.fish; + xdg.configFile."fish/conf.d/sudope.fish".source = ./assets/fish/sudope.fish; + xdg.configFile."fish/functions/sudope.fish".source = ./assets/fish/sudope.function.fish; + xdg.configFile."fish/functions/fish_prompt.fish".source = ./assets/fish/fish_prompt.fish; + xdg.configFile."fish/functions/fish_right_prompt.fish".source = ./assets/fish/fish_right_prompt.fish; + }; +} diff --git a/modules/profiles/ssh.nix b/modules/profiles/ssh.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.profiles.ssh; +in +{ + options = { + profiles.ssh = { + enable = mkOption { + default = true; + description = "Enable ssh profile and configuration"; + type = types.bool; + }; + }; + }; + config = mkIf cfg.enable { + home.file.".ssh/sockets/.placeholder".text = ''''; + programs.ssh = { + enable = true; + + serverAliveInterval = 60; + hashKnownHosts = true; + userKnownHostsFile = "~/.config/ssh/known_hosts"; + controlPath = "~/.ssh/sockets/%u-%l-%r@%h:%p"; + + matchBlocks = rec { + "github.com" = { + hostname = "github.com"; + user = "git"; + extraOptions = { + controlMaster = "auto"; + controlPersist = "360"; + }; + }; + "gitlab.com" = { + hostname = "gitlab.com"; + user = "git"; + extraOptions = { + controlMaster = "auto"; + controlPersist = "360"; + }; + }; + "*.local" = { + extraOptions = { + controlMaster = "auto"; + controlPersist = "360"; + }; + }; + }; + }; + }; +} diff --git a/server.nix b/server.nix @@ -1,5 +1,5 @@ { pkgs, prefix, ... }: { - imports = [ ./fish.nix ./base.nix ]; + imports = [ ./base.nix ]; } diff --git a/ssh.nix b/ssh.nix @@ -1,38 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - home.file.".ssh/sockets/.placeholder".text = ''''; - programs.ssh = { - enable = true; - - serverAliveInterval = 60; - hashKnownHosts = true; - userKnownHostsFile = "~/.config/ssh/known_hosts"; - controlPath = "~/.ssh/sockets/%u-%l-%r@%h:%p"; - - matchBlocks = rec { - "github.com" = { - hostname = "github.com"; - user = "git"; - extraOptions = { - controlMaster = "auto"; - controlPersist = "360"; - }; - }; - "gitlab.com" = { - hostname = "gitlab.com"; - user = "git"; - extraOptions = { - controlMaster = "auto"; - controlPersist = "360"; - }; - }; - "*.local" = { - extraOptions = { - controlMaster = "auto"; - controlPersist = "360"; - }; - }; - }; - }; -}