about summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/beets/default.nix46
-rw-r--r--home/default.nix17
-rw-r--r--home/feh/default.nix8
-rw-r--r--home/fish/default.nix13
-rw-r--r--home/flac/default.nix16
-rw-r--r--home/git/default.nix51
-rw-r--r--home/go/default.nix16
-rw-r--r--home/packages/default.nix18
-rw-r--r--home/python/default.nix9
-rw-r--r--home/ssh/default.nix23
-rw-r--r--home/tmux/default.nix22
-rw-r--r--home/yt-dlp/config26
-rw-r--r--home/yt-dlp/default.nix12
13 files changed, 277 insertions, 0 deletions
diff --git a/home/beets/default.nix b/home/beets/default.nix
new file mode 100644
index 0000000..b93ddd1
--- /dev/null
+++ b/home/beets/default.nix
@@ -0,0 +1,46 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.beets;
+in {
+  options.my.home.beets = with lib.my; {
+    enable = mkEnableOption "beets configuration";
+    musicDirectory = mkOption {
+      type = types.str;
+      example = "/home/fcuny/media/music";
+      description = "path to the music directory";
+    };
+  };
+
+  config.program.beets = lib.mkIf cfg.enable {
+    enable = true;
+    settings = {
+      directory = cfg.musicDirectory;
+      plugins =
+        "fromfilename discogs duplicates fetchart embedart badfiles lastgenre scrub";
+      paths = {
+        default = "$albumartist/$album%aunique{}/$track $title";
+        singleton = "Singles/$artist/$title";
+        comp = "Compilations/$album%aunique{}/$track - $title";
+        "albumtype:soundtrack" = "Soundtracks/$album ($year)/$track $title";
+      };
+      import = {
+        copy = true;
+        move = true;
+      };
+      va_name = "Various Artists";
+      embedart = { ifempty = true; };
+
+      lastgenre = {
+        auto = false;
+        canonical = true;
+        fallback = "unknown";
+        force = true;
+        prefer_specific = true;
+      };
+
+      fetchart = {
+        cautious = true;
+        sources = "filesystem coverart itunes amazon lastfm wikipedia";
+      };
+    };
+  };
+}
diff --git a/home/default.nix b/home/default.nix
new file mode 100644
index 0000000..be4c47d
--- /dev/null
+++ b/home/default.nix
@@ -0,0 +1,17 @@
+{ ... }:
+
+{
+  imports = [
+    ./beets
+    ./feh
+    ./fish
+    ./flac
+    ./git
+    ./go
+    ./packages
+    ./python
+    ./ssh
+    ./tmux
+    ./yt-dlp
+  ];
+}
diff --git a/home/feh/default.nix b/home/feh/default.nix
new file mode 100644
index 0000000..0032252
--- /dev/null
+++ b/home/feh/default.nix
@@ -0,0 +1,8 @@
+{ config, lib, ... }:
+let cfg = config.my.home.feh;
+in {
+  options.my.home.feh = with lib; {
+    enable = mkEnableOption "feh configuration";
+  };
+  config.programs.feh = lib.mkIf cfg.enable { enable = true; };
+}
diff --git a/home/fish/default.nix b/home/fish/default.nix
new file mode 100644
index 0000000..1ba3d6c
--- /dev/null
+++ b/home/fish/default.nix
@@ -0,0 +1,13 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.fish;
+in {
+  options.my.home.fish = with lib.my; {
+    enable = mkEnableOption "fish configuration";
+  };
+  config.programs.ssh = lib.mkIf cfg.enable {
+    enable = true;
+    interactiveShellInit = ''
+      set fish_greeting
+    '';
+  };
+}
diff --git a/home/flac/default.nix b/home/flac/default.nix
new file mode 100644
index 0000000..a97149f
--- /dev/null
+++ b/home/flac/default.nix
@@ -0,0 +1,16 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.flac;
+in {
+  options.my.home.flac = with lib.my; {
+    enable = mkEnableOption "flac configuration";
+  };
+
+  config.home.packages = with pkgs;
+    lib.mkIf cfg.enable ([
+      flac
+      abcde
+      (pkgs.writers.writeDashBin "rip-flac" ''
+        ${pkgs.abcde}/bin/abcde -Vx -G -a "cddb,read,encode,tag,move,clean" -o flac
+      '')
+    ]);
+}
diff --git a/home/git/default.nix b/home/git/default.nix
new file mode 100644
index 0000000..3b0bc86
--- /dev/null
+++ b/home/git/default.nix
@@ -0,0 +1,51 @@
+{ lib, config, ... }:
+
+let cfg = config.my.home.git;
+in {
+  options.my.home.git = with lib.my; {
+    enable = mkEnableOption "git configuration";
+  };
+
+  config.programs.git = lib.mkIf cfg.enable {
+    enable = true;
+    aliases = {
+      s = "status --short --branch";
+      amend = "commit --amend --no-edit";
+    };
+    extraConfig = {
+      core.whitespace = "trailing-space,space-before-tab";
+      color.ui = "true";
+      push.default = "simple";
+      init.defaultBranch = "main";
+      branch.autosetuprebase = "remote";
+      branch.sort = "authordate";
+    };
+    userName = "Franck Cuny";
+    userEmail = "franck@fcuny.net";
+    extraConfig = {
+      "credential \"https://github.com\"" = { username = "fcuny"; };
+      "credential \"https://git.fcuny.net\"" = { username = "fcuny"; };
+    };
+    ignores = [
+      "*.elc"
+      "*.iml"
+      "*.o"
+      "*.pyc"
+      "*.pyo"
+      "*pyc"
+      "*~"
+      ".DS_Store"
+      ".\\#"
+      ".dir-locals.el"
+      ".direnv/*"
+      ".idea"
+      ".projectile"
+      ".pytest_cache/"
+      "/env/*"
+      "Icon"
+      "TAGS"
+      "\\#*\\#"
+      "tags"
+    ];
+  };
+}
diff --git a/home/go/default.nix b/home/go/default.nix
new file mode 100644
index 0000000..c316189
--- /dev/null
+++ b/home/go/default.nix
@@ -0,0 +1,16 @@
+{ config, ... }:
+let cfg = config.my.home.go;
+in {
+  options.my.home.go = with lib.my; {
+    enable = mkEnableOption "go configuration";
+  };
+
+  config.programs.go = lib.mkIf cfg.enable {
+    enable = true;
+    goPath = ".local/share/pkg.go";
+    goBin = ".local/bin.go";
+    goPrivate = [ "git.fcuny.net" "golang.fcuny.net" ];
+  };
+
+  # home.sessionPath = [ config.home.sessionVariables.GOBIN ];
+}
diff --git a/home/packages/default.nix b/home/packages/default.nix
new file mode 100644
index 0000000..ee75c74
--- /dev/null
+++ b/home/packages/default.nix
@@ -0,0 +1,18 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.packages;
+in {
+  options.my.home.packages = with lib; {
+    enable = my.mkDisableOption "user packages";
+    additionalPackages = mkOption {
+      type = with types; listOf package;
+      default = [ ];
+      example = literalExample ''
+        with pkgs; [
+          pavucontrol
+        ]
+      '';
+    };
+  };
+  config.home.packages = with pkgs;
+    lib.mkIf cfg.enable ([ util-linux jq ripgrep ] ++ cfg.additionalPackages);
+}
diff --git a/home/python/default.nix b/home/python/default.nix
new file mode 100644
index 0000000..c7069e3
--- /dev/null
+++ b/home/python/default.nix
@@ -0,0 +1,9 @@
+{ pkgs, lib, ... }:
+let cfg = config.my.home.python;
+in {
+  options.my.home.python = with lib.my; {
+    enable = mkEnableOption "python configuration";
+  };
+
+  config.home.packages = with pkgs; lib.mkIf cfg.enable ([ python310 ]);
+}
diff --git a/home/ssh/default.nix b/home/ssh/default.nix
new file mode 100644
index 0000000..a4eabbf
--- /dev/null
+++ b/home/ssh/default.nix
@@ -0,0 +1,23 @@
+{ config, lib, ... }:
+let cfg = config.my.home.ssh;
+in {
+  options.my.home.ssh = with lib.my; {
+    enable = mkEnableOption "ssh configuration";
+  };
+
+  config.programs.ssh = lib.mkIf cfg.enable {
+    enable = true;
+    forwardAgent = true;
+    serverAliveInterval = 60;
+    controlMaster = "auto";
+    controlPersist = "30m";
+    matchBlocks = {
+      "github.com" = {
+        hostname = "github.com";
+        user = "git";
+        forwardAgent = false;
+        extraOptions = { preferredAuthentications = "publickey"; };
+      };
+    };
+  };
+}
diff --git a/home/tmux/default.nix b/home/tmux/default.nix
new file mode 100644
index 0000000..d1d9993
--- /dev/null
+++ b/home/tmux/default.nix
@@ -0,0 +1,22 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.tmux;
+in {
+  options.my.home.tmux = with lib.my; {
+    enable = mkEnableOption "tmux terminal multiplexer";
+  };
+
+  config.programs.tmux = lib.mkIf cfg.enable {
+    enable = true;
+
+    terminal = "xterm-256color";
+    escapeTime = 0;
+    aggressiveResize = true;
+    shortcut = "z";
+    clock24 = true;
+    historyLimit = 50000; # Bigger buffer
+
+    extraConfig = ''
+      setw -g mouse on
+    '';
+  };
+}
diff --git a/home/yt-dlp/config b/home/yt-dlp/config
new file mode 100644
index 0000000..4710c9f
--- /dev/null
+++ b/home/yt-dlp/config
@@ -0,0 +1,26 @@
+# Preferred formats:
+# 1. 1080p, combined, mp4 (for some non-youtube sites).
+# 2. 1080p, combined, any format (in case mp4 is not available).
+# 3. 1080p, best video + best audio (only available with separate video and audio on youtube).
+# 4. >30fps (any resolution), best video + best audio (only available with separate video and audio on youtube).
+# 5. 720p, pre-joined, because it is available on youtube.
+# 6. <720p, best video + best audio (480p and some other lower resolutions are only available with separate video and audio on youtube).
+# 7. When all else fails, take whatever youtube-dl thinks is the best (mainly for non-YT websites).
+--format="best[height=1080][ext=mp4]/best[height=1080]/bestvideo[height=1080][ext=mp4]+bestaudio[ext=m4a]/bestvideo[fps>30][ext=mp4]+bestaudio[ext=m4a]/best[height=720][ext=mp4]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best"
+
+--sub-langs all
+--write-subs
+
+--convert-subs=srt
+
+--restrict-filenames
+--output="$HOME/media/videos/%(title)s.%(ext)s"
+--merge-output-format mkv
+
+--embed-metadata
+--embed-chapters
+--embed-info-json
+# create chapter entries to mark sponsor segments
+--sponsorblock-mark all
+
+--yes-playlist
diff --git a/home/yt-dlp/default.nix b/home/yt-dlp/default.nix
new file mode 100644
index 0000000..ce42014
--- /dev/null
+++ b/home/yt-dlp/default.nix
@@ -0,0 +1,12 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.home.yt-dlp;
+in {
+  options.my.home.yt-dlp = with lib.my; {
+    enable = mkEnableOption "yt-dlp configuration";
+  };
+
+  config.programs.yt-dlp = lib.mkIf cfg.enable {
+    config.home.packages = with pkgs; [ yt-dlp ];
+    xdg.configFile."yt-dlp/config".source = config;
+  };
+}