summaryrefslogtreecommitdiff
path: root/home/environ
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-12-03 21:19:39 -0600
committerAlejandro Soto <alejandro@34project.org>2024-12-03 21:49:54 -0600
commit61f3db56410f41d5249c88e44db60d9713dae26d (patch)
tree49c2d5d5e4da331d139cfdc6034c0dba5980271b /home/environ
parent854f5ee287eb66db5a0713e2f4fac56794e3d735 (diff)
home: big refactor
Diffstat (limited to '')
-rw-r--r--home/environ.nix73
-rw-r--r--home/environ/default.nix17
-rw-r--r--home/environ/gpg.nix (renamed from home/gpg.nix)7
-rw-r--r--home/environ/pass.nix26
-rw-r--r--home/environ/path.nix (renamed from home/path.nix)24
-rw-r--r--home/environ/source.nix23
-rw-r--r--home/environ/ssh-match.nix1
-rw-r--r--home/environ/ssh.nix (renamed from home/ssh/default.nix)11
-rw-r--r--home/environ/tmux.nix41
-rw-r--r--home/environ/units.nix33
-rw-r--r--home/environ/vtmp.nix20
11 files changed, 182 insertions, 94 deletions
diff --git a/home/environ.nix b/home/environ.nix
deleted file mode 100644
index 60d618a..0000000
--- a/home/environ.nix
+++ /dev/null
@@ -1,73 +0,0 @@
-{ config, lib, pkgs, ... }:
-with lib; let
- symlink = config.lib.file.mkOutOfStoreSymlink;
-
- #TODO: No sirve, creo que por readline
- devNull = symlink "/dev/null";
-in
-{
- config = {
- xdg.enable = true;
-
- systemd.user = {
- tmpfiles.rules = [
- "d %t/vtmp 0700"
- ];
-
- timers = {
- units-cur = {
- Install.WantedBy = [ "timers.target" ];
- Timer.OnCalendar = "daily";
- Unit.Description = "Update currency information for 'units'";
- };
- };
-
- services = {
- units-cur = {
- Unit.Description = "Update currency information for 'units'";
-
- Service = {
- Type = "exec";
- ExecStart = "${pkgs.units}/bin/units_cur .units";
- };
- };
- };
- };
-
- home.file = {
- #TODO: .calc_history
- "vtmp".source = symlink "/run/user/${toString config.local.uid}/vtmp";
- ".units_history".source = devNull;
- };
-
- programs = {
- zsh = {
- enable = true;
- autosuggestion.enable = true;
- syntaxHighlighting.enable = true;
- initExtra = import ./zshrc.nix pkgs;
- };
-
- neovim = {
- enable = true;
-
- viAlias = true;
- vimAlias = true;
- withRuby = false;
- withPython3 = false;
-
- extraConfig = ''
- set number " Enable line numbering
- set relativenumber " Enable relative line numbering
- set tabstop=4 " Set tap stop to 4
- set shiftwidth=4 " Set shift width to 4 (same as tabstop)
- set viminfo= " No tracking
- '';
- };
- };
-
- xdg.configFile."home-manager" = mkIf (!config.home.isolation.active) {
- source = symlink "${config.home.homeDirectory}/nix";
- };
- };
-}
diff --git a/home/environ/default.nix b/home/environ/default.nix
new file mode 100644
index 0000000..53841f1
--- /dev/null
+++ b/home/environ/default.nix
@@ -0,0 +1,17 @@
+{ lib, ... }:
+with lib; {
+ imports = [
+ ./gpg.nix
+ ./pass.nix
+ ./path.nix
+ ./source.nix
+ ./ssh.nix
+ ./tmux.nix
+ ./units.nix
+ ./vtmp.nix
+ ];
+
+ options.local.environ = {
+ enable = mkEnableOption "local environment";
+ };
+}
diff --git a/home/gpg.nix b/home/environ/gpg.nix
index 9117c1f..dd58181 100644
--- a/home/gpg.nix
+++ b/home/environ/gpg.nix
@@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
-with lib; {
- config = mkIf (!config.home.isolation.active) {
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ config = mkIf cfg.enable {
programs.gpg = {
enable = true;
scdaemonSettings.disable-ccid = true;
diff --git a/home/environ/pass.nix b/home/environ/pass.nix
new file mode 100644
index 0000000..69947a7
--- /dev/null
+++ b/home/environ/pass.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ config = mkIf cfg.enable {
+ programs.password-store = {
+ enable = true;
+ package = pkgs.pass.withExtensions (exts: (with exts; [
+ pass-audit
+ pass-genphrase
+ pass-otp
+ pass-tomb
+ pass-update
+ ]) ++ [
+ pkgs.local.pass-bcr
+ ]);
+
+ settings = {
+ PASSWORD_STORE_DIR = "${config.home.homeDirectory}/pass";
+ PASSWORD_STORE_TOMB_KEY = "${config.home.homeDirectory}/tomb/pass.key.gpg";
+ PASSWORD_STORE_TOMB_FILE = "${config.home.homeDirectory}/tomb/pass.tomb";
+ };
+ };
+ };
+}
diff --git a/home/path.nix b/home/environ/path.nix
index acacdbe..3d7d455 100644
--- a/home/path.nix
+++ b/home/environ/path.nix
@@ -1,19 +1,12 @@
{ config, lib, pkgs, ... }:
-with lib; {
- home.packages =
- let
- py = pkgs.python3Packages;
- in
- [
- pkgs.file
- pkgs.killall
- pkgs.man-pages
- pkgs.man-pages-posix
- pkgs.tree
- pkgs.unzip
- pkgs.wget
- pkgs.zip
- ] ++ optionals (!config.home.isolation.active) [
+with lib; let
+ cfg = config.local.environ;
+
+ py = pkgs.python3Packages;
+in
+{
+ config = mkIf cfg.enable {
+ home.packages = [
pkgs.calc
pkgs.cloc
pkgs.gcc
@@ -48,4 +41,5 @@ with lib; {
pkgs.yubikey-manager
pkgs.zoom-us
];
+ };
}
diff --git a/home/environ/source.nix b/home/environ/source.nix
new file mode 100644
index 0000000..ed9f53c
--- /dev/null
+++ b/home/environ/source.nix
@@ -0,0 +1,23 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.environ;
+
+ py = pkgs.python3Packages;
+in
+{
+ config = mkIf cfg.enable {
+ nix.registry."system".to = {
+ type = "path";
+ path = "${config.home.homeDirectory}/nix";
+ };
+
+ programs = {
+ git.signing.signByDefault = true;
+ home-manager.enable = true;
+ };
+
+ xdg.configFile."home-manager" = {
+ source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix";
+ };
+ };
+}
diff --git a/home/environ/ssh-match.nix b/home/environ/ssh-match.nix
new file mode 100644
index 0000000..1bb3788
--- /dev/null
+++ b/home/environ/ssh-match.nix
@@ -0,0 +1 @@
+# This file has been lustrated.
diff --git a/home/ssh/default.nix b/home/environ/ssh.nix
index 220d18d..29829be 100644
--- a/home/ssh/default.nix
+++ b/home/environ/ssh.nix
@@ -1,7 +1,10 @@
{ config, lib, pkgs, ... }:
-with lib; {
- config = {
- programs.ssh = mkIf (!config.home.isolation.active) {
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ config = mkIf cfg.enable {
+ programs.ssh = {
enable = true;
compression = true;
@@ -10,7 +13,7 @@ with lib; {
extraOptionOverrides.AddKeysToAgent = "true";
- matchBlocks = import ./match.nix;
+ matchBlocks = import ./ssh-match.nix;
};
systemd.user.tmpfiles.rules = [
diff --git a/home/environ/tmux.nix b/home/environ/tmux.nix
new file mode 100644
index 0000000..223851d
--- /dev/null
+++ b/home/environ/tmux.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ options.local.environ.tmuxPass = {
+ enable = mkEnableOption "tmux-pass plugin";
+ };
+
+ config = mkIf cfg.enable {
+ programs.tmux = {
+ enable = true;
+ aggressiveResize = true;
+ clock24 = true;
+ escapeTime = 10;
+ terminal = "xterm-256color";
+ keyMode = "vi";
+
+ plugins = optional cfg.tmuxPass.enable {
+ plugin = pkgs.local.tmux-pass;
+ extraConfig = ''
+ set -g @pass-key BSpace
+ set -g @pass-copy-to-clipboard on
+ set -g @pass-window-size 15
+ set -g @pass-hide-pw-from-preview 'on'
+ set -g @pass-hide-preview on
+ '';
+ };
+
+ extraConfig = ''
+ set -g mouse on
+ set -ga update-environment " LIFT_PID"
+ set -g set-titles on
+ set -g renumber-windows on
+ set -sa terminal-overrides ',xterm-termite:RGB'
+ set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,} %H:%M %d-%b-%y"
+ bind-key X set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
+ '';
+ };
+ };
+}
diff --git a/home/environ/units.nix b/home/environ/units.nix
new file mode 100644
index 0000000..bb039b7
--- /dev/null
+++ b/home/environ/units.nix
@@ -0,0 +1,33 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ config = mkIf cfg.enable {
+ systemd.user = {
+ timers = {
+ units-cur = {
+ Install.WantedBy = [ "timers.target" ];
+ Timer.OnCalendar = "daily";
+ Unit.Description = "Update currency information for 'units'";
+ };
+ };
+
+ services = {
+ units-cur = {
+ Unit.Description = "Update currency information for 'units'";
+
+ Service = {
+ Type = "exec";
+ ExecStart = "${pkgs.units}/bin/units_cur .units";
+ };
+ };
+ };
+ };
+
+ home.file = {
+ #TODO: .calc_history
+ ".units_history".source = config.lib.file.mkOutOfStoreSymlink "/dev/null";
+ };
+ };
+}
diff --git a/home/environ/vtmp.nix b/home/environ/vtmp.nix
new file mode 100644
index 0000000..9481b6f
--- /dev/null
+++ b/home/environ/vtmp.nix
@@ -0,0 +1,20 @@
+{ config, lib, ... }:
+with lib; let
+ cfg = config.local.environ;
+in
+{
+ config = mkIf cfg.enable {
+ systemd.user.tmpfiles.rules = [
+ "d %t/vtmp 0700"
+ ];
+
+ home.file = {
+ "vtmp".source = config.lib.file.mkOutOfStoreSymlink "/run/user/${toString config.local.uid}/vtmp";
+ };
+
+ gtk.gtk3.bookmarks = [
+ "file://${config.home.homeDirectory}/vtmp"
+ "file://${config.home.homeDirectory}/tmp"
+ ];
+ };
+}