diff options
author | Franck Cuny <franck@fcuny.net> | 2023-05-05 19:41:58 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-05-05 19:41:58 -0700 |
commit | 43da9edb4598eef509c481ae0b305384418c45de (patch) | |
tree | a0ad614c90102757143e026e4fe1806431a3dbf4 | |
parent | profiles/default: users are immutable (diff) | |
download | world-43da9edb4598eef509c481ae0b305384418c45de.tar.gz |
home/profiles: move (almost) all modules to profiles
This is a major refactor, similar to what was done for the hosts, but in a single commit.
Diffstat (limited to '')
81 files changed, 973 insertions, 1530 deletions
diff --git a/home/age/default.nix b/home/age/default.nix deleted file mode 100644 index 0e2fd13..0000000 --- a/home/age/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, config, lib, ... }: -let cfg = config.my.home.age; -in -{ - options.my.home.age = with lib; { - enable = mkEnableOption "r|age tooling"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - age # https://github.com/FiloSottile/age - rage # https://github.com/str4d/rage - age-plugin-yubikey # https://github.com/str4d/age-plugin-yubikey - ]; - }; -} diff --git a/home/beets/default.nix b/home/beets/default.nix deleted file mode 100644 index ab8cc43..0000000 --- a/home/beets/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.home.beets; - bc-to-beet = pkgs.writeShellApplication { - name = "bc-to-beet"; - runtimeInputs = [ pkgs.beets ]; - text = '' - ALBUM_PATH="''${1}" - ALBUM_NAME=$(basename "''${ALBUM_PATH}") - - mkdir -p ~/import - rm -rf ~/import/tmp-bc - unzip -d ~/import/tmp-bc ~/import/album.zip - beet import ~/import/tmp-bc - rm -rf ~/import/tmp-bc - rm -rf ~/import/album.zip - ''; - }; -in -{ - options.my.home.beets = with lib; { - enable = mkEnableOption "beets configuration"; - musicDirectory = mkOption { - type = types.str; - example = "/home/fcuny/media/music"; - description = "path to the music directory"; - }; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ bc-to-beet ]; - - programs.beets = { - 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/bluetooth/default.nix b/home/bluetooth/default.nix deleted file mode 100644 index d0febca..0000000 --- a/home/bluetooth/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, ... }: -let cfg = config.my.home.bluetooth; -in -{ - options.my.home.bluetooth = with lib; { - enable = mkEnableOption "bluetooth configuration"; - }; - - config = - lib.mkIf cfg.enable { services.blueman-applet = { enable = true; }; }; -} diff --git a/home/default.nix b/home/default.nix index d9efc94..8be9fc1 100644 --- a/home/default.nix +++ b/home/default.nix @@ -2,42 +2,8 @@ { imports = [ - ./age - ./beets - ./bluetooth - ./direnv - ./documentation - ./emacs - ./eog - ./evince - ./feh - ./firefox - ./flac - ./gcloud - ./git - ./go ./gpg - ./gtk ./mail ./matrix-client - ./mpv - ./packages - ./pass - ./pcmanfm - ./python - ./rust - ./scanner - ./shell - ./ssh - ./sublime-music - ./terminal - ./terraform - ./tmux - ./transmission-remote - ./vlc - ./wm - ./xdg - ./yt-dlp - ./yubikey ]; } diff --git a/home/direnv/default.nix b/home/direnv/default.nix deleted file mode 100644 index ce4982c..0000000 --- a/home/direnv/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.home.direnv; - fishEnabled = config.my.home.shell.name == "fish"; -in -{ - options.my.home.direnv = with lib; { - enable = mkEnableOption "direnv configuration"; - }; - - config = lib.mkIf cfg.enable { - programs.direnv = { - enable = true; - nix-direnv = { enable = true; }; - config = { - global.disable_stdin = true; - global.strict_env = true; - }; - }; - - programs.fish.interactiveShellInit = lib.mkIf fishEnabled ( - # Using mkAfter to make it more likely to appear after other - # manipulations of the prompt. - lib.mkAfter '' - ${pkgs.direnv}/bin/direnv hook fish | source - ''); - - home.sessionVariables = { DIRENV_DEFAULT_FLAKE = "nixpkgs"; }; - }; -} diff --git a/home/documentation/default.nix b/home/documentation/default.nix deleted file mode 100644 index 047239e..0000000 --- a/home/documentation/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, ... }: { - # Add documentation for user packages - config.programs.man = { - enable = true; - generateCaches = true; # Enables the use of `apropos` etc... - }; - - config.programs.info.enable = true; -} diff --git a/home/emacs/default.nix b/home/emacs/default.nix deleted file mode 100644 index 076b886..0000000 --- a/home/emacs/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.emacs; -in -{ - options.my.home.emacs = with lib; { - enable = mkEnableOption "emacs configuration"; - }; - - config.home = lib.mkIf cfg.enable { - packages = with pkgs; [ - emacsPgtk - # see https://github.com/hlissner/doom-emacs/issues/4138 - (aspellWithDicts (dicts: with dicts; [ en en-computers en-science ])) - ]; - - sessionVariables = { - EDITOR = "emacsclient -a="; - VISUAL = "emacsclient -a="; - }; - }; -} diff --git a/home/eog/default.nix b/home/eog/default.nix deleted file mode 100644 index 1fa1108..0000000 --- a/home/eog/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.eog; -in -{ - options.my.home.eog = with lib; { - enable = mkEnableOption "eog configuration"; - }; - - config.home.packages = with pkgs; lib.mkIf cfg.enable ([ gnome3.eog ]); -} diff --git a/home/evince/default.nix b/home/evince/default.nix deleted file mode 100644 index 36dc1dd..0000000 --- a/home/evince/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.evince; -in -{ - options.my.home.evince = with lib; { - enable = mkEnableOption "evince configuration"; - }; - - config.home.packages = with pkgs; lib.mkIf cfg.enable ([ gnome3.evince ]); -} diff --git a/home/feh/default.nix b/home/feh/default.nix deleted file mode 100644 index eda4466..0000000 --- a/home/feh/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ 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/flac/default.nix b/home/flac/default.nix deleted file mode 100644 index 42500af..0000000 --- a/home/flac/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.flac; -in -{ - options.my.home.flac = with lib; { - enable = mkEnableOption "flac configuration"; - }; - - config.home.packages = with pkgs; - lib.mkIf cfg.enable ([ - flac - abcde - (pkgs.writers.writeDashBin "rip-flac" '' - cd ~/import - ${pkgs.abcde}/bin/abcde -Vx -G -a "cddb,read,encode,tag,move,clean" -o flac - '') - ]); -} diff --git a/home/gcloud/default.nix b/home/gcloud/default.nix deleted file mode 100644 index 766fcfe..0000000 --- a/home/gcloud/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.gcloud; -in -{ - options.my.home.gcloud = with lib; { - enable = mkEnableOption "google cloud sdk"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ google-cloud-sdk ]; - }; -} diff --git a/home/git/commit.template b/home/git/commit.template deleted file mode 100644 index b116a68..0000000 --- a/home/git/commit.template +++ /dev/null @@ -1,11 +0,0 @@ - -# (If applied, this commit will...) <subject> - -# Explain why this change is being made - -# --- COMMIT END --- -# Remember to -# Use the imperative mood, present tense: `change' not `changed' nor `changes' -# Do not end the subject line with a period -# Use the body to explain what and why vs. how -# Can use multiple lines with "-" for bullet points in body diff --git a/home/git/default.nix b/home/git/default.nix deleted file mode 100644 index e840f54..0000000 --- a/home/git/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib, config, pkgs, ... }: - -let - cfg = config.my.home.git; - sshPub = builtins.fromTOML (builtins.readFile ../../configs/ssh-pubkeys.toml); -in -{ - options.my.home.git = with lib; { - enable = mkEnableOption "git configuration"; - }; - - config = lib.mkIf cfg.enable { - home.file.".ssh/allowed_signers".text = lib.concatMapStrings (x: "franck@fcuny.net ${x}\n") (with sshPub; [ aptos work git ykey-laptop ]); - - programs.git = { - enable = true; - aliases = { - s = "status --short --branch"; - amend = "commit --amend --no-edit"; - }; - signing = { - key = "key::${sshPub.ykey-laptop}"; - signByDefault = true; - }; - extraConfig = { - core.whitespace = "trailing-space,space-before-tab"; - color.ui = "true"; - - diff = { - age.textconv = "${pkgs.age}/bin/age --identity ${config.home.homeDirectory}/.age/key.txt --decrypt"; - }; - - gpg = { - format = "ssh"; - ssh.allowedSignersFile = "~/.ssh/allowed_signers"; - }; - # abort if the remote branch does not match the local one - push.default = "simple"; - - init.defaultBranch = "main"; - - pull.rebase = true; - rebase = { - # Automatically create a temporary stash entry before the - # operation begins, and apply it after the operation ends. - autoStash = true; - # Print a warning if some commits are removed - missingCommitsCheck = "warn"; - }; - - branch.autosetuprebase = "remote"; - branch.sort = "authordate"; - - commit.template = "${config.xdg.dataHome}/git/commit.template"; - }; - userName = "Franck Cuny"; - userEmail = "franck@fcuny.net"; - ignores = [ (builtins.readFile ./gitignore) ]; - }; - xdg.dataFile."git/commit.template" = { source = ./commit.template; }; - home.packages = with pkgs; [ tools.git-blame-stats gitAndTools.pre-commit ]; - }; -} diff --git a/home/git/gitignore b/home/git/gitignore deleted file mode 100644 index 83adbce..0000000 --- a/home/git/gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.elc -*pyc -*~ -.DS_Store -.\\# -.dir-locals.el -.direnv/* -.projectile -.pytest_cache/ -tags -/result -/.pre-commit-config.yaml diff --git a/home/go/default.nix b/home/go/default.nix deleted file mode 100644 index 40c65f0..0000000 --- a/home/go/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.go; -in -{ - options.my.home.go = with lib; { - enable = mkEnableOption "go configuration"; - }; - - config = lib.mkIf cfg.enable { - programs.go = { - enable = true; - goPath = ".local/share/pkg.go"; - goBin = ".local/bin.go"; - goPrivate = [ "git.fcuny.net" "golang.fcuny.net" ]; - package = pkgs.go_1_18; - }; - home.packages = with pkgs; [ gopls go-tools ]; - home.sessionPath = [ config.home.sessionVariables.GOBIN ]; - }; -} diff --git a/home/gtk/default.nix b/home/gtk/default.nix deleted file mode 100644 index 4c55f0c..0000000 --- a/home/gtk/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.gtk; -in -{ - options.my.home.gtk = with lib; { - enable = mkEnableOption "GTK configuration"; - }; - - config = lib.mkIf cfg.enable { - gtk = { - enable = true; - font = { - package = pkgs.source-sans-pro; - name = "Source Sans Pro"; - }; - iconTheme = { - package = pkgs.gnome3.adwaita-icon-theme; - name = "Adwaita"; - }; - theme = { - package = pkgs.gnome.gnome-themes-extra; - name = "Adwaita"; - }; - gtk2 = { - extraConfig = '' - gtk-xft-antialias = 1 - gtk-xft-hinting = 1 - gtk-xft-hintstyle = "hintslight" - gtk-cursor-theme-size = cursorSize - ''; - }; - - gtk3 = { - extraConfig = { - gtk-xft-antialias = 1; - gtk-xft-hinting = 1; - gtk-xft-hintstyle = "hintslight"; - }; - bookmarks = - [ "file:///home/fcuny/workspace" "file:///home/fcuny/documents" ]; - }; - }; - }; -} diff --git a/home/mpv/default.nix b/home/mpv/default.nix deleted file mode 100644 index c2a3a6a..0000000 --- a/home/mpv/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.mpv; -in -{ - options.my.home.mpv = with lib; { - enable = mkEnableOption "mpv configuration"; - }; - - config = lib.mkIf cfg.enable { - programs.mpv = { - enable = true; - config = { - sub-auto = "fuzzy"; - vo = "gpu"; - hwdec = "auto-safe"; - gpu-context = "wayland"; - audio-display = "no"; - cache-pause = "no"; - cache = "yes"; - mute = "no"; - osc = "yes"; - screenshot-directory = "~/documents/screenshots/mpv-screenshots/"; - screenshot-format = "png"; - }; - scripts = lib.attrVals [ "sponsorblock" ] pkgs.mpvScripts; - }; - }; -} diff --git a/home/packages/default.nix b/home/packages/default.nix deleted file mode 100644 index e6e4a5b..0000000 --- a/home/packages/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.home.packages; - album-to-nas = pkgs.writeShellApplication { - name = "album-to-nas"; - runtimeInputs = [ pkgs.jq pkgs.tailscale ]; - text = '' - ALBUM_PATH="''${1}" - ALBUM_NAME=$(basename "''${ALBUM_PATH}") - - NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]') - - scp "''${ALBUM_PATH}" "''${NAS}:~/import/album.zip" - ssh "''${NAS}" bc-to-beet ~/import/album.zip - ''; - }; - restic-nas = pkgs.writeShellApplication - { - name = "restic-nas"; - runtimeInputs = [ pkgs.restic pkgs.tailscale pkgs.jq ]; - text = '' - NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]') - - RESTIC_REPOSITORY="sftp:''${NAS}:/$(hostname)" - export RESTIC_REPOSITORY - export RESTIC_PASSWORD_FILE=/run/agenix/restic/repo-users - - sudo -E restic -o sftp.command="ssh backup@''${NAS} -i /run/agenix/restic/ssh-key -s sftp" "$@" - ''; - }; -in -{ - options.my.home.packages = with lib; { - enable = mkEnableOption "user packages"; - additionalPackages = mkOption { - type = with types; listOf package; - default = [ ]; - example = literalExample '' - with pkgs; [ - pavucontrol - ] - ''; - }; - }; - config.home.packages = with pkgs; - lib.mkIf cfg.enable - ([ - dive # explore layers in docker images - jq - restic # in order to interact with my backups - ripgrep - util-linux - - # custom tools - album-to-nas - restic-nas - - # tools inside the tools directory - tools.gha-billing - tools.git-blame-stats - tools.git-broom - tools.ipconverter - tools.seqstat - - # tools from external repositories - # x509-info - # gh-ssh-keys - # masked-emails - ] - ++ cfg.additionalPackages); -} diff --git a/home/pass/default.nix b/home/pass/default.nix deleted file mode 100644 index eb43c3a..0000000 --- a/home/pass/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.pass; -in -{ - options.my.home.pass = with lib; { - enable = mkEnableOption "passage configuration"; - }; - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - passage - tree - ]; - - home.sessionVariables = { - PASSAGE_DIR = "${config.xdg.dataHome}/passage/store"; - PASSAGE_IDENTITIES_FILE = "${config.xdg.dataHome}/passage/identities"; - # for now I have to default to rage, as the version of age is - # not recent enough to work with keys generated by - # age-plugin-yubikey - PASSAGE_AGE = "${pkgs.rage}/bin/rage"; - }; - - }; -} diff --git a/home/pcmanfm/default.nix b/home/pcmanfm/default.nix deleted file mode 100644 index 2babf0c..0000000 --- a/home/pcmanfm/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.pcmanfm; -in -{ - options.my.home.pcmanfm = with lib; { - enable = mkEnableOption "pcmanfm configuration"; - }; - - config = lib.mkIf cfg.enable { home.packages = with pkgs; [ pcmanfm ]; }; -} diff --git a/home/profiles/alacritty.nix b/home/profiles/alacritty.nix new file mode 100644 index 0000000..2789f12 --- /dev/null +++ b/home/profiles/alacritty.nix @@ -0,0 +1,51 @@ +{ + programs.alacritty = { + enable = true; + settings = { + env = { + TERM = "xterm-256color"; + }; + + live_config_reload = true; + draw_bold_text_with_bright_colors = true; + selection = { save_to_clipboard = true; }; + + colors = { + primary = { + background = "#000000"; + foreground = "#D3D7CF"; + }; + + normal = { + black = "#2E3436"; + red = "#CC0000"; + green = "#4E9A06"; + yellow = "#C4A000"; + blue = "#3465A4"; + magenta = "#EF33C0"; + cyan = "#04B5B8"; + white = "#D3D7CF"; + }; + + bright = { + black = "#555753"; + red = "#EF2929"; + green = "#8AE234"; + yellow = "#FCE94F"; + blue = "#729FCF"; + magenta = "#EE38DA"; + cyan = "#34E2E2"; + white = "#EEEEEC"; + }; + }; + font = { + size = 13; + normal.family = "Source Code Pro"; + }; + cursor = { + style.blinking = "Never"; + unfocused_hollow = true; + }; + }; + }; +} diff --git a/home/profiles/dev.nix b/home/profiles/dev.nix new file mode 100644 index 0000000..c1323d6 --- /dev/null +++ b/home/profiles/dev.nix @@ -0,0 +1,49 @@ +{ pkgs, config, ... }: +let + ruststable = (pkgs.rust-bin.stable.latest.default.override { + extensions = [ + "rust-src" + "rust-analyzer-preview" + "rust-analysis" + "rustfmt-preview" + ]; + }); + pythonEnv = pkgs.python3.withPackages (p: with p; [ + black + isort + pylsp-mypy + requests + types-requests + pip + ipython + ]); +in +{ + programs.go = { + enable = true; + goPath = ".local/share/pkg.go"; + goBin = ".local/bin.go"; + goPrivate = [ "git.fcuny.net" "golang.fcuny.net" ]; + package = pkgs.go_1_18; + }; + + home.packages = with pkgs; [ + go-tools + pythonEnv + google-cloud-sdk + ruststable + ]; + + home.sessionPath = [ + config.home.sessionVariables.GOBIN + "$CARGO_HOME/bin" + ]; + + home.sessionVariables = with config.xdg; { + IPYTHONDIR = "${cacheHome}/ipython"; + PIP_LOG = "${cacheHome}/pip/pip.log"; + PYLINTHOME = "${cacheHome}/pylint"; + PYTHON_EGG_CACHE = "${cacheHome}/python-eggs"; + CARGO_HOME = "${dataHome}/cargo"; + }; +} diff --git a/home/profiles/emacs.nix b/home/profiles/emacs.nix new file mode 100644 index 0000000..17c751d --- /dev/null +++ b/home/profiles/emacs.nix @@ -0,0 +1,13 @@ +{ lib, config, pkgs, ... }: +{ + home.packages = with pkgs; [ + emacsPgtk + # see https://github.com/hlissner/doom-emacs/issues/4138 + (aspellWithDicts (dicts: with dicts; [ en en-computers en-science ])) + ]; + + home.sessionVariables = { + EDITOR = "emacsclient -a="; + VISUAL = "emacsclient -a="; + }; +} diff --git a/home/firefox/default.nix b/home/profiles/firefox.nix index b07b82c..e74aaea 100644 --- a/home/firefox/default.nix +++ b/home/profiles/firefox.nix @@ -1,13 +1,6 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.home.firefox; -in +{ pkgs, lib, config, ... }: { - options.my.home.firefox = with lib; { - enable = mkEnableOption "firefox configuration"; - }; - - config.programs.firefox = lib.mkIf cfg.enable { + programs.firefox = { enable = true; profiles = { default = { diff --git a/home/profiles/git.nix b/home/profiles/git.nix new file mode 100644 index 0000000..de2cbf6 --- /dev/null +++ b/home/profiles/git.nix @@ -0,0 +1,73 @@ +{ self, lib, pkgs, config, ... }: +let + sshPub = builtins.fromTOML ( + builtins.readFile "${self}/configs/ssh-pubkeys.toml" + ); +in +{ + home.file.".ssh/allowed_signers".text = lib.concatMapStrings (x: "franck@fcuny.net ${x}\n") (with sshPub; [ aptos work git ykey-laptop ]); + + programs.git = { + enable = true; + userName = "Franck Cuny"; + userEmail = "franck@fcuny.net"; + + signing = { + key = "key::${sshPub.ykey-laptop}"; + signByDefault = true; + }; + + extraConfig = { + core.whitespace = "trailing-space,space-before-tab"; + color.ui = "true"; + + diff.age.textconv = "${pkgs.age}/bin/age --identity ${config.home.homeDirectory}/.age/key.txt --decrypt"; + + gpg.format = "ssh"; + gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers"; + + # abort if the remote branch does not match the local one + push.default = "simple"; + + init.defaultBranch = "main"; + + pull.rebase = true; + rebase = { + # Automatically create a temporary stash entry before the + # operation begins, and apply it after the operation ends. + autoStash = true; + # Print a warning if some commits are removed + missingCommitsCheck = "warn"; + }; + + branch.autosetuprebase = "remote"; + branch.sort = "authordate"; + + commit.template = "${config.xdg.dataHome}/git/commit.template"; + }; + + ignores = [ + "*~" + ".direnv" + ]; + }; + + xdg.dataFile."git/commit.template".source = pkgs.writeText "commit.template" '' + + # (If applied, this commit will...) <subject> + + # Explain why this change is being made + + # --- COMMIT END --- + # Remember to + # Use the imperative mood, present tense: `change' not `changed' nor `changes' + # Do not end the subject line with a period + # Use the body to explain what and why vs. how + # Can use multiple lines with "-" for bullet points in body +''; + + home.packages = with pkgs; [ + tools.git-blame-stats + gitAndTools.pre-commit + ]; +} diff --git a/home/profiles/gtk.nix b/home/profiles/gtk.nix new file mode 100644 index 0000000..a3fff9d --- /dev/null +++ b/home/profiles/gtk.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: +{ + gtk = { + enable = true; + + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + + theme = { + name = "palenight"; + package = pkgs.palenight-theme; + }; + + cursorTheme = { + name = "Numix-Cursor"; + package = pkgs.numix-cursor-theme; + }; + + gtk3.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + + gtk4.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + }; + + home.sessionVariables.GTK_THEME = "palenight"; +} diff --git a/home/profiles/home.nix b/home/profiles/home.nix new file mode 100644 index 0000000..1aa90cf --- /dev/null +++ b/home/profiles/home.nix @@ -0,0 +1,69 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ./git.nix + ./ssh.nix + ./zsh + ]; + + home.packages = with pkgs; [ + dive # explore layers in docker images + jq + ripgrep + util-linux + xdg-utils + + age + rage + age-plugin-yubikey + + # tools inside the tools directory + tools.git-blame-stats + tools.git-broom + tools.ipconverter + tools.seqstat + + # tools from external repositories + # x509-info + # gh-ssh-keys + # masked-emails + ]; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + config = { + global.disable_stdin = true; + global.strict_env = true; + }; + }; + + xdg = { + enable = true; + # File types + mime.enable = true; + # File associatons + mimeApps = { enable = true; }; + # User directories + userDirs = { + enable = true; + createDirectories = true; + desktop = "${config.home.homeDirectory}/documents"; + documents = "${config.home.homeDirectory}/documents"; + download = "${config.home.homeDirectory}/downloads"; + music = "${config.home.homeDirectory}/media/music"; + pictures = "${config.home.homeDirectory}/media/pictures"; + publicShare = "${config.home.homeDirectory}/documents/public"; + templates = "${config.home.homeDirectory}/documents/templates"; + videos = "${config.home.homeDirectory}/media/videos"; + }; + }; + + home.sessionVariables = with config.xdg; { + LESS = "-FRSXM"; + LESSCHARSET = "utf-8"; + LESSHISTFILE = "${dataHome}/less/history"; + LESSKEY = "${configHome}/less/lesskey"; + PAGER = "less"; + }; +} diff --git a/home/profiles/mako.nix b/home/profiles/mako.nix new file mode 100644 index 0000000..d4e54fe --- /dev/null +++ b/home/profiles/mako.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: +{ + home.packages = [ + pkgs.libnotify + ]; + + # All the options are documented via `man 5 mako` + services.mako = { + enable = true; + font = "Source Code Pro"; + backgroundColor = "#000021DD"; + textColor = "#FFFFFFFF"; + borderSize = 0; + borderRadius = 15; + icons = true; + iconPath = "${pkgs.moka-icon-theme}/share/icons/Moka"; + markup = true; + actions = true; + defaultTimeout = 3000; + padding = "20"; + height = 200; + width = 500; + layer = "overlay"; + }; +} diff --git a/home/profiles/nas.nix b/home/profiles/nas.nix new file mode 100644 index 0000000..c1e5ca9 --- /dev/null +++ b/home/profiles/nas.nix @@ -0,0 +1,67 @@ +{ config, lib, pkgs, ... }: +let + bc-to-beet = pkgs.writeShellApplication { + name = "bc-to-beet"; + runtimeInputs = [ pkgs.beets ]; + text = '' + ALBUM_PATH="$1" + ALBUM_NAME=$(basename "$ALBUM_PATH") + + mkdir -p ~/import + rm -rf ~/import/tmp-bc + unzip -d ~/import/tmp-bc ~/import/album.zip + beet import ~/import/tmp-bc + rm -rf ~/import/tmp-bc + rm -rf ~/import/album.zip + ''; + }; +in +{ + imports = [ + ./ytdlp.nix + ]; + + home.packages = with pkgs; [ + bc-to-beet + flac + abcde + (pkgs.writers.writeDashBin "rip-flac" '' + cd ~/import + ${pkgs.abcde}/bin/abcde -Vx -G -a "cddb,read,encode,tag,move,clean" -o flac + '') + ]; + + programs.beets = { + 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/ssh/default.nix b/home/profiles/ssh.nix index eecca99..576f451 100644 --- a/home/ssh/default.nix +++ b/home/profiles/ssh.nix @@ -1,12 +1,6 @@ -{ config, lib, ... }: -let cfg = config.my.home.ssh; -in +{ ... }: { - options.my.home.ssh = with lib; { - enable = mkEnableOption "ssh configuration"; - }; - - config.programs.ssh = lib.mkIf cfg.enable { + programs.ssh = { enable = true; forwardAgent = true; serverAliveInterval = 60; diff --git a/home/profiles/sway.nix b/home/profiles/sway.nix new file mode 100644 index 0000000..0665556 --- /dev/null +++ b/home/profiles/sway.nix @@ -0,0 +1,172 @@ +{ config, lib, pkgs, ... }: +let + modifier = "Mod4"; # `Super` key +in +{ + imports = [ + ./gtk.nix + ./mako.nix + ./waybar.nix + ./wofi.nix + ]; + + home.packages = with pkgs; [ + wlogout + brightnessctl + pulseaudio + grim + slurp + polkit_gnome + xsettingsd + swaylock + swayidle + wl-clipboard + ]; + + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + XDG_CURRENT_DESKTOP = "sway"; + XDG_SESSION_TYPE = "wayland"; + }; + + programs = { + zsh.loginExtra = '' + if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then + eval $(ssh-agent -s) > /dev/null + fi + if [ "$(tty)" = "/dev/tty1" ]; then + exec sway &> /dev/null + fi + ''; + + zsh.profileExtra = '' + if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then + eval $(ssh-agent -s) > /dev/null + fi + if [ "$(tty)" = "/dev/tty1" ]; then + exec sway &> /dev/null + fi + ''; + }; + + wayland.windowManager.sway = { + enable = true; + # in order to import some variables (e.g. PATH) so that all the + # units that will be started have all the required environment + # variables + extraSessionCommands = "systemctl --user import-environment"; + # this will start sway-session.target and run + # dbus-update-activation-environment + systemdIntegration = true; + config = { + # FIXME: this should be a variable + terminal = "alacritty"; + modifier = modifier; + menu = ''${pkgs.wofi}/bin/wofi -S drun -p "app:" -L 10''; + bars = [ ]; + fonts = { + names = [ "Source Code Pro" ]; + size = 10.0; + }; + keybindings = lib.mkOptionDefault { + # control the volume + "XF86AudioRaiseVolume" = + "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = + "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = + "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = + "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + + # control brightness + "XF86MonBrightnessDown" = + "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; + "XF86MonBrightnessUp" = + "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%"; + + # logout + "${modifier}+Escape" = "exec ${pkgs.wlogout}/bin/wlogout"; + + # screenshot + "${modifier}+s" = + "exec ${pkgs.grim}/bin/grim $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; + "${modifier}+Shift+s" = + "exec ${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; + + # File Manager + "${modifier}+p" = "exec ${pkgs.pcmanfm}/bin/pcmanfm"; + }; + + # use `swaymsg -t get_tree' to get the title/name/ID of the applications + window = { + commands = [ + { + criteria.class = ".blueman-manager-wrapped"; + command = "floating enable"; + } + { + criteria.class = "Pavucontrol"; + command = "floating enable"; + } + ]; + }; + + input = { + "*" = { + "xkb_layout" = "us,fr"; + # map capslock to ctrl, and switch layout using shift+caps + "xkb_options" = "ctrl:nocaps,grp:shift_caps_toggle"; + }; + }; + + assigns = { + "1" = [{ app_id = "emacs"; }]; + "2" = [{ app_id = "Alacritty"; }]; + "3" = [{ app_id = "firefox"; }]; + "4" = [{ app_id = "org.gnome.Fractal"; }]; + }; + + output = { + "*" = { + scale = "1.5"; + bg = "#2E3440 solid_color"; + }; + # This is for aptos + "eDP-1" = { scale = "1.3"; }; + }; + }; + }; + + xdg.configFile."swaylock/config".source = pkgs.writeText "config" '' + color=2E3440 + daemonize + indicator-caps-lock + hide-keyboard-layout + ''; + + services.swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${pkgs.swaylock}/bin/swaylock -fF"; + } + { + event = "lock"; + command = "${pkgs.swaylock}/bin/swaylock -fF"; + } + ]; + timeouts = [ + { + timeout = 300; + command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\""; + resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; + } + { + timeout = 310; + command = "${pkgs.systemd}/bin/loginctl lock-session"; + } + ]; + }; +} diff --git a/home/tmux/default.nix b/home/profiles/tmux.nix index a30bd28..22f8683 100644 --- a/home/tmux/default.nix +++ b/home/profiles/tmux.nix @@ -1,12 +1,6 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.tmux; -in +{ ... }: { - options.my.home.tmux = with lib; { - enable = mkEnableOption "tmux terminal multiplexer"; - }; - - config.programs.tmux = lib.mkIf cfg.enable { + programs.tmux = { enable = true; terminal = "xterm-256color"; diff --git a/home/profiles/waybar.nix b/home/profiles/waybar.nix new file mode 100644 index 0000000..e6f6c3d --- /dev/null +++ b/home/profiles/waybar.nix @@ -0,0 +1,155 @@ +{ config, lib, pkgs, ... }: +let + # waybar-systemd = pkgs.writeShellApplication { + # name = "waybar-systemd.sh"; + # runtimeInputs = [ ]; + # text = '' + # failed_user="$(systemctl --plain --no-legend --user list-units --state=failed | awk '{ print $1 }')" + # failed_system="$(systemctl --plain --no-legend list-units --state=failed | awk '{ print $1 }')" + + # failed_systemd_count="$(echo -n "$failed_system" | grep -c '^')" + # failed_user_count="$(echo -n "$failed_user" | grep -c '^')" + + # text=$(( failed_systemd_count + failed_user_count )) + + # if [ "$text" -eq 0 ]; then + # printf '{"text": ""}\n' + # else + # tooltip="" + + # [ -n "$failed_system" ] && tooltip="Failed system services:\n\n${failed_system}\n\n${tooltip}" + # [ -n "$failed_user" ] && tooltip="Failed user services:\n\n${failed_user}\n\n${tooltip}" + + # tooltip="$(printf "%s" "$tooltip" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')" + + # printf '{"text": "%s", "tooltip": "%s" }\n' "$text" "$tooltip" + # fi + # ''; + # }; +in +{ + programs.waybar = { + enable = true; + systemd.enable = true; + + settings = [{ + layer = "bottom"; + height = 25; + position = "top"; + margin-top = 0; + margin-left = 0; + margin-right = 0; + margin-bottom = 0; + modules-left = [ "sway/workspaces" "sway/mode" ]; + modules-right = [ "pulseaudio" "network" "battery" "clock" "tray" ]; + "sway/workspaces" = { + format = "{name}"; + disable-scroll = true; + }; + "sway/mode" = { format = "{}"; }; + tray = { spacing = 10; }; + clock = { format = "{: %a %b %d %R}"; }; + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "ac:{capacity}%"; + tooltip = true; + tooltip-format = "{timeTo} ({capacity}%)"; + }; + # "custom/systemd" = { + # exec = "${waybarSystemd}/bin/waybar-systemd"; + # return-type = "json"; + # interval = 10; + # }; + pulseaudio = { + format = "vol:{volume}%"; + format-bluetooth = "bt:{volume}%"; + format-bluetooth-muted = "bt:{volume}%"; + format-muted = "vol:{volume}%"; + on-click = "pavucontrol"; + }; + "network" = { + format-wifi = "{essid}:{signalStrength}%"; + format-ethernet = "{ipaddr}/{cidr}"; + format-linked = "{ifname} (No IP)"; + format-disconnected = "network unavailable"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + tooltip = false; + }; + }]; + }; + + programs.waybar.style = pkgs.writeText "style.css" '' + * { + border-radius: 0; + border: none; + margin: 0; + min-height: 0; + padding: 0; + font-family: Source Code Pro; + font-size: 15px; + } + window#waybar { + background-color: #282A36; + color: #eee; + } + #workspaces button { + padding: 0 3px; + background-color: transparent; + color: #eee; + } + #workspaces button.focused { + background-color: #285577; + border: 1px solid #4c7899; + } + #clock, + #battery, + #network, + #pulseaudio, + #tray, + #mode { + padding-left: 10px; + padding-right: 10px; + } + #mode { + /* No styles */ + } + #tray { + /* No styles */ + } + #clock { + /* No styles */ + } + #battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + #battery.discharging { + color: #90a1ad; + } + #battery.charging { + color: #fffff8; + } + #battery.warning { + border-bottom: 2px solid #ff9e21; + } + #battery.critical { + border-bottom: 2px solid #ff3121; + } + #network { + /* No styles */ + } + #network.disconnected { + color: orange; + } + #pulseaudio { + /* No styles */ + } + #pulseaudio.muted { + color: #90a1ad; + } + ''; +} diff --git a/home/profiles/wofi.nix b/home/profiles/wofi.nix new file mode 100644 index 0000000..7140650 --- /dev/null +++ b/home/profiles/wofi.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: { + + home.packages = with pkgs; [ wofi ]; + + xdg.configFile."wofi/config".source = pkgs.writeText "config" '' + allow_images=true + image_size=25px + drun-display_generic=true + dynamic_lines=true + insensitive=true + run-cache_file=/dev/null + ''; +} diff --git a/home/profiles/workstation.nix b/home/profiles/workstation.nix new file mode 100644 index 0000000..acbbccb --- /dev/null +++ b/home/profiles/workstation.nix @@ -0,0 +1,113 @@ +{ config, lib, pkgs, ... }: +let + restic-nas = pkgs.writeShellApplication + { + name = "restic-nas"; + runtimeInputs = [ pkgs.restic pkgs.tailscale pkgs.jq ]; + text = '' + NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]') + + RESTIC_REPOSITORY="sftp:''${NAS}:/$(hostname)" + export RESTIC_REPOSITORY + export RESTIC_PASSWORD_FILE=/run/agenix/restic/repo-users + + sudo -E restic -o sftp.command="ssh backup@''${NAS} -i /run/agenix/restic/ssh-key -s sftp" "$@" + ''; + }; + + album-to-nas = pkgs.writeShellApplication { + name = "album-to-nas"; + runtimeInputs = [ pkgs.jq pkgs.tailscale ]; + text = '' + ALBUM_PATH="$1" + + NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]') + + scp "$ALBUM_PATH" "$NAS:~/import/album.zip" + ssh "$NAS" bc-to-beet ~/import/album.zip + ''; + }; +in +{ + imports = [ + ./alacritty.nix + ./dev.nix + ./emacs.nix + ./firefox.nix + ./tmux.nix + ./yubikey.nix + ./ytdlp.nix + ]; + + home.packages = with pkgs; [ + # media + gnome3.eog + gnome3.evince + sublime-music + vlc + yt-dlp + + passage + tree + + # scanning + tesseract + imagemagick + exiftool + sane-airscan + + transmission-remote-gtk + + # custom tools + album-to-nas + restic-nas + + # tools from external repositories + # x509-info + # gh-ssh-keys + # masked-emails + ]; + + programs.feh.enable = true; + programs.mpv = { + enable = true; + config = { + sub-auto = "fuzzy"; + vo = "gpu"; + hwdec = "auto-safe"; + gpu-context = "wayland"; + audio-display = "no"; + cache-pause = "no"; + cache = "yes"; + mute = "no"; + osc = "yes"; + screenshot-directory = "~/documents/screenshots/mpv-screenshots/"; + screenshot-format = "png"; + }; + scripts = lib.attrVals [ "sponsorblock" ] pkgs.mpvScripts; + }; + + services.gammastep = { + enable = true; + #TODO: this needs to come from locale.nix + latitude = 37.8715; + longitude = -122.273; + temperature = { + day = 5000; + night = 3700; + }; + }; + + home.sessionVariables = { + PASSAGE_DIR = "${config.xdg.dataHome}/passage/store"; + PASSAGE_IDENTITIES_FILE = "${config.xdg.dataHome}/passage/identities"; + # for now I have to default to rage, as the version of age is + # not recent enough to work with keys generated by + # age-plugin-yubikey + PASSAGE_AGE = "${pkgs.rage}/bin/rage"; + }; + + + # enable bluetooth + services.blueman-applet.enable = true; +} diff --git a/home/profiles/ytdlp.nix b/home/profiles/ytdlp.nix new file mode 100644 index 0000000..ce2e32c --- /dev/null +++ b/home/profiles/ytdlp.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + yt-dlp + ]; + + xdg.configFile."yt-dlp/config".source = pkgs.writeText "config" '' + # 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" + + --continue + + --sub-langs all + --write-subs + + --convert-subs=srt + + --restrict-filenames + --output="$HOME/media/videos/%(uploader)s/%(playlist)s/%(upload_date)s-%(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/profiles/yubikey.nix b/home/profiles/yubikey.nix new file mode 100644 index 0000000..b18ce5d --- /dev/null +++ b/home/profiles/yubikey.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, config, ... }: +{ + home.packages = with pkgs; [ yubikey-manager yubikey-touch-detector ]; + + systemd.user.sockets.yubikey-touch-detector = { + Unit.Description = "Unix socket activation for YubiKey touch detector service"; + Socket = { + ListenStream = "%t/yubikey-touch-detector.socket"; + RemoveOnStop = true; + }; + Install.WantedBy = [ "sockets.target" ]; + }; + + systemd.user.services.yubikey-touch-detector = { + Unit = { + Description = "Detects when your YubiKey is waiting for a touch"; + Requires = "yubikey-touch-detector.socket"; + }; + Service = { + ExecStart = "${pkgs.yubikey-touch-detector}/bin/yubikey-touch-detector --libnotify"; + EnvironmentFile = "-%E/yubikey-touch-detector/service.conf"; + }; + Install = { + Also = "yubikey-touch-detector.socket"; + WantedBy = [ "default.target" ]; + }; + }; +} diff --git a/home/shell/zsh/completion-style.zsh b/home/profiles/zsh/completion-style.zsh index 79a4e68..79a4e68 100644 --- a/home/shell/zsh/completion-style.zsh +++ b/home/profiles/zsh/completion-style.zsh diff --git a/home/profiles/zsh/default.nix b/home/profiles/zsh/default.nix new file mode 100644 index 0000000..38450ab --- /dev/null +++ b/home/profiles/zsh/default.nix @@ -0,0 +1,51 @@ +{ config, pkgs, lib, ... }: +{ + home.packages = with pkgs; [ zsh-completions ]; + + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + + enableCompletion = true; + enableAutosuggestions = true; + + history = { + size = 500000; + save = 500000; + extended = false; + ignoreSpace = true; + ignoreDups = true; + share = false; + # see + # https://github.com/nix-community/home-manager/blob/32a7da69dc53c9eb5ad0675eb7fdc58f7fe35272/modules/programs/zsh.nix#L537 + path = "${config.xdg.dataHome}/zsh/zsh_history"; + }; + + localVariables = { + # Print timing statistics for everything which takes longer than 5 seconds of + # user + system time. + REPORTTIME = 5; + }; + + shellAliases = { + ll = "ls -l --color=auto"; + lt = "ls -ltrh --color=auto"; + la = "ls -ltrha --color=auto"; + pkgsearch = "nix search nixpkgs"; + hms = "home-manager switch --flake ."; + nr = "sudo nixos-rebuild switch --flake ."; + flup = "nix flake update --commit-lock-file"; + dhcp-leasese = "xdg-open http://192.168.6.1:8067/"; + }; + + defaultKeymap = "emacs"; + + initExtra = lib.concatMapStrings builtins.readFile [ + ./completion-style.zsh + ./options.zsh + ./prompt.zsh + ./tmux.zsh + ./new-go-project.zsh + ]; + }; +} diff --git a/home/shell/zsh/new-go-project.zsh b/home/profiles/zsh/new-go-project.zsh index 0b96a34..0b96a34 100644 --- a/home/shell/zsh/new-go-project.zsh +++ b/home/profiles/zsh/new-go-project.zsh diff --git a/home/shell/zsh/options.zsh b/home/profiles/zsh/options.zsh index 6d39bc1..6d39bc1 100644 --- a/home/shell/zsh/options.zsh +++ b/home/profiles/zsh/options.zsh diff --git a/home/shell/zsh/prompt.zsh b/home/profiles/zsh/prompt.zsh index 8a3efa9..8a3efa9 100644 --- a/home/shell/zsh/prompt.zsh +++ b/home/profiles/zsh/prompt.zsh diff --git a/home/shell/zsh/tmux.zsh b/home/profiles/zsh/tmux.zsh index 97944f5..97944f5 100644 --- a/home/shell/zsh/tmux.zsh +++ b/home/profiles/zsh/tmux.zsh diff --git a/home/python/default.nix b/home/python/default.nix deleted file mode 100644 index 32a2129..0000000 --- a/home/python/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.my.home.python; - pythonEnv = pkgs.python3.withPackages (p: with p; [ - black # format - isort # format - pylsp-mypy # language server protocol - requests # HTTP library - types-requests # types for requests (for mypy) - pip # to install dependencies - ipython # nicer REPL - ]); -in -{ - options.my.home.python = with lib; { - enable = mkEnableOption "python configuration"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs.python3Packages; [ pythonEnv ]; - - home.sessionVariables = with config.xdg; { - IPYTHONDIR = "${cacheHome}/ipython"; - PIP_LOG = "${cacheHome}/pip/pip.log"; - PYLINTHOME = "${cacheHome}/pylint"; - PYTHON_EGG_CACHE = "${cacheHome}/python-eggs"; - }; - }; -} diff --git a/home/rust/default.nix b/home/rust/default.nix deleted file mode 100644 index 9d86ca7..0000000 --- a/home/rust/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, config, pkgs, ... }: -let - cfg = config.my.home.rust; - ruststable = (pkgs.rust-bin.stable.latest.default.override { - extensions = [ - "rust-src" - "rust-analyzer-preview" - "rust-analysis" - "rustfmt-preview" - ]; - }); -in -{ - options.my.home.rust = with lib; { - enable = mkEnableOption "rust configuration"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ ruststable ]; - home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo"; - home.sessionPath = [ "$CARGO_HOME/bin" ]; - }; -} diff --git a/home/scanner/default.nix b/home/scanner/default.nix deleted file mode 100644 index ee51239..0000000 --- a/home/scanner/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.scanner; -in -{ - options.my.home.scanner = with lib; { - enable = mkEnableOption "scanner configuration"; - }; - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ tesseract imagemagick exiftool sane-airscan ]; - }; -} diff --git a/home/shell/aliases.nix b/home/shell/aliases.nix deleted file mode 100644 index 49d1725..0000000 --- a/home/shell/aliases.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - ll = "ls -l --color=auto"; - lt = "ls -ltrh --color=auto"; - la = "ls -ltrha --color=auto"; - pkgsearch = "nix search nixpkgs"; - hms = "home-manager switch --flake ."; - nr = "sudo nixos-rebuild switch --flake ."; - flup = "nix flake update --commit-lock-file"; - dhcp-leasese = "xdg-open http://192.168.6.1:8067/"; -} diff --git a/home/shell/default.nix b/home/shell/default.nix deleted file mode 100644 index f34d997..0000000 --- a/home/shell/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.my.home.shell; - aliases = import ./aliases.nix; -in -{ - options.my.home.shell = { - name = mkOption { - default = "zsh"; - type = types.enum [ "fish" "zsh" ]; - example = "zsh"; - }; - aliases = mkOption { - default = aliases; - description = '' - A wrapper for shellAliases for zsh and fish - ''; - type = types.attrsOf types.str; - }; - }; - - imports = [ ./fish ./zsh ]; -} diff --git a/home/shell/fish/default.nix b/home/shell/fish/default.nix deleted file mode 100644 index f3e41d9..0000000 --- a/home/shell/fish/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.home.shell; - aliases = config.my.home.shell.aliases; -in -{ - config = lib.mkIf (cfg.name == "fish") { - programs.fish = { - enable = true; - shellAliases = aliases; - interactiveShellInit = builtins.readFile ./interactive.fish; - loginShellInit = builtins.readFile ./login.fish; - }; - - xdg.configFile."fish/functions" = { - source = ./functions; - recursive = true; - }; - }; -} diff --git a/home/shell/fish/functions/find-ssh-agent.fish b/home/shell/fish/functions/find-ssh-agent.fish deleted file mode 100644 index 9e2de8d..0000000 --- a/home/shell/fish/functions/find-ssh-agent.fish +++ /dev/null @@ -1,20 +0,0 @@ -function find-ssh-agent --description "find or run ssh-agent" - # let's avoid storing the agent's socket under /tmp - set -l ssh_auth_sock $XDG_RUNTIME_DIR/ssh-agent.sock - - if set -q SSH_AGENT_PID; and set -q SSH_AUTH_SOCK - # if variables already defined, then try to connect to agent - ssh-add -l &>/dev/null - test $status -ne 2; and return - end - - set -l user_id (id -u) - set -l ssh_agent_pid (pgrep --exact --newest --uid $user_id ssh-agent) - - if test -S $ssh_auth_sock - set --global --export SSH_AUTH_SOCK $ssh_auth_sock - set --global --export SSH_AGENT_PID $ssh_agent_pid - else - eval (ssh-agent -c -a $ssh_auth_sock) - end -end diff --git a/home/shell/fish/functions/new-go-project.fish b/home/shell/fish/functions/new-go-project.fish deleted file mode 100644 index e00a036..0000000 --- a/home/shell/fish/functions/new-go-project.fish +++ /dev/null @@ -1,27 +0,0 @@ -function new-go-project --description "create a new go project" - set -l project_name $argv[1] - - echo "> creating $project_name" - cd ~/workspace/ - mkdir $project_name - cd $project_name - - echo "> running `git init'" - git init . - - echo "> setting the default template for go projects" - nix flake init -t ~/workspace/world/templates#go - direnv allow - - echo "> creating initial commit, touch your yubikey" - git add . - git commit -m 'initial commit' - - echo "> pushing to https://git.fcuny.net/fcuny/$project_name" - git remote add origin https://git.fcuny.net/fcuny/$project_name - git push origin --all - - echo "> enabling drone CI for the repository" - drone --token (pass credentials/ci.fcuny.net) repo sync - drone --token (pass credentials/ci.fcuny.net) repo enable fcuny/$project_name -end diff --git a/home/shell/fish/functions/nix-rebuild-hm.fish b/home/shell/fish/functions/nix-rebuild-hm.fish deleted file mode 100644 index 3101e51..0000000 --- a/home/shell/fish/functions/nix-rebuild-hm.fish +++ /dev/null @@ -1,4 +0,0 @@ -function nix-rebuild-hm --description "rebuild home manager" - cd ~/workspace/world - home-manager switch --flake . -end diff --git a/home/shell/fish/functions/nix-rebuild-host.fish b/home/shell/fish/functions/nix-rebuild-host.fish deleted file mode 100644 index 02c0050..0000000 --- a/home/shell/fish/functions/nix-rebuild-host.fish +++ /dev/null @@ -1,4 +0,0 @@ -function nix-rebuild-host --description "rebuild the current host" - cd ~/workspace/world - sudo nixos-rebuild switch --flake . -end diff --git a/home/shell/fish/interactive.fish b/home/shell/fish/interactive.fish deleted file mode 100644 index 4adcba8..0000000 --- a/home/shell/fish/interactive.fish +++ /dev/null @@ -1,8 +0,0 @@ -# Tmux on terminal start, unless we're in a SSH connection -if status is-interactive - if test -z "$SSH_CONNECTION" - if not tmux has-session 2>/dev/null; or test -z "$TMUX" - exec tmux new-session -A -s 0 - end - end -end diff --git a/home/shell/fish/login.fish b/home/shell/fish/login.fish deleted file mode 100644 index 8f29553..0000000 --- a/home/shell/fish/login.fish +++ /dev/null @@ -1,10 +0,0 @@ -# disable greeting -set -U fish_greeting '' - -# set up ssh-agent -find-ssh-agent - -# start sway -if test -z "$DISPLAY"; and test (tty) = "/dev/tty1" - exec sway -end diff --git a/home/shell/zsh/default.nix b/home/shell/zsh/default.nix deleted file mode 100644 index 3734fc3..0000000 --- a/home/shell/zsh/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.my.home.shell; - aliases = config.my.home.shell.aliases; -in -{ - config = lib.mkIf (cfg.name == "zsh") { - home.packages = with pkgs; [ zsh-completions ]; - - programs.zsh = { - enable = true; - dotDir = ".config/zsh"; - - enableCompletion = true; - enableAutosuggestions = true; - - history = { - size = 500000; - save = 500000; - extended = false; - ignoreSpace = true; - ignoreDups = true; - share = false; - # see - # https://github.com/nix-community/home-manager/blob/32a7da69dc53c9eb5ad0675eb7fdc58f7fe35272/modules/programs/zsh.nix#L537 - path = ".local/share/zsh/zsh_history"; - }; - - localVariables = { - # Print timing statistics for everything which takes longer than 5 seconds of - # user + system time. - REPORTTIME = 5; - }; - - shellAliases = aliases; - - defaultKeymap = "emacs"; - - initExtra = lib.concatMapStrings builtins.readFile [ - ./completion-style.zsh - ./options.zsh - ./prompt.zsh - ./tmux.zsh - ./new-go-project.zsh - ]; - }; - }; -} diff --git a/home/sublime-music/default.nix b/home/sublime-music/default.nix deleted file mode 100644 index aa44520..0000000 --- a/home/sublime-music/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.sublime-music; -in -{ - options.my.home.sublime-music = with lib; { - enable = mkEnableOption "sublime-music configuration"; - }; - - config = - lib.mkIf cfg.enable { home.packages = with pkgs; [ sublime-music ]; }; -} diff --git a/home/terminal/alacritty/default.nix b/home/terminal/alacritty/default.nix deleted file mode 100644 index 1e74914..0000000 --- a/home/terminal/alacritty/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.terminal; -in -{ - config = lib.mkIf (cfg.program == "alacritty") { - programs.alacritty = { - enable = true; - - settings = { - env = { TERM = "xterm-256color"; }; - live_config_reload = true; - draw_bold_text_with_bright_colors = true; - selection = { save_to_clipboard = true; }; - colors = { - primary = { - background = "#000000"; - foreground = "#D3D7CF"; - }; - - normal = { - black = "#2E3436"; - red = "#CC0000"; - green = "#4E9A06"; - yellow = "#C4A000"; - blue = "#3465A4"; - magenta = "#EF33C0"; - cyan = "#04B5B8"; - white = "#D3D7CF"; - }; - - bright = { - black = "#555753"; - red = "#EF2929"; - green = "#8AE234"; - yellow = "#FCE94F"; - blue = "#729FCF"; - magenta = "#EE38DA"; - cyan = "#34E2E2"; - white = "#EEEEEC"; - }; - }; - font = { - size = 13; - normal.family = "Source Code Pro"; - }; - cursor = { - style.blinking = "Never"; - unfocused_hollow = true; - }; - }; - }; - }; -} diff --git a/home/terminal/default.nix b/home/terminal/default.nix deleted file mode 100644 index 68dcf4b..0000000 --- a/home/terminal/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: -let cfg = config.my.home.terminal; -in -{ - imports = [ ./alacritty ]; - options.my.home = with lib; { - terminal = { - program = mkOption { - type = with types; nullOr (enum [ "alacritty" ]); - default = null; - example = "alacritty"; - description = "Which terminal to use for home session"; - }; - }; - }; - config.home.sessionVariables = - lib.mkIf (cfg.program != null) { TERMINAL = cfg.program; }; -} diff --git a/home/terraform/default.nix b/home/terraform/default.nix deleted file mode 100644 index b307bd7..0000000 --- a/home/terraform/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.terraform; -in -{ - options.my.home.terraform = with lib; { - enable = mkEnableOption "terraform configuration"; - }; - - config.home.packages = with pkgs; lib.mkIf cfg.enable ([ - terraform - terraform-ls # official lsp-server - ]); -} diff --git a/home/transmission-remote/default.nix b/home/transmission-remote/default.nix deleted file mode 100644 index 629e382..0000000 --- a/home/transmission-remote/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.transmission-remote; -in -{ - options.my.home.transmission-remote = with lib; { - enable = mkEnableOption "transmission-remote configuration"; - }; - - config.home.packages = with pkgs; - lib.mkIf cfg.enable ([ transmission-remote-gtk ]); -} diff --git a/home/vlc/default.nix b/home/vlc/default.nix deleted file mode 100644 index c06994b..0000000 --- a/home/vlc/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib, config, pkgs, ... }: -let cfg = config.my.home.vlc; -in -{ - options.my.home.vlc = with lib; { - enable = mkEnableOption "vlc configuration"; - }; - - config = lib.mkIf cfg.enable { home.packages = with pkgs; [ vlc ]; }; -} diff --git a/home/wm/default.nix b/home/wm/default.nix deleted file mode 100644 index ecf8bf3..0000000 --- a/home/wm/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ... }: -{ - imports = [ ./sway ./waybar ./mako ./swaylock ./wofi ./gammastep ]; - options.my.home.wm = with lib; { - windowManager = mkOption { - type = with types; nullOr (enum [ "sway" ]); - default = null; - example = "sway"; - description = "Which window manager to use for home session"; - }; - }; -} diff --git a/home/wm/gammastep/default.nix b/home/wm/gammastep/default.nix deleted file mode 100644 index 4530126..0000000 --- a/home/wm/gammastep/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - services.gammastep = { - enable = true; - #TODO: this needs to come from locale.nix - latitude = 37.8715; - longitude = -122.273; - temperature = { - day = 5000; - night = 3700; - }; - }; - }; -} diff --git a/home/wm/mako/default.nix b/home/wm/mako/default.nix deleted file mode 100644 index 325ee3d..0000000 --- a/home/wm/mako/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - home.packages = [ - pkgs.libnotify # to send notifications - ]; - - systemd.user.services.mako = { - Service = { ExecStart = "${pkgs.mako}/bin/mako"; }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - - # All the options are documented via `man 5 mako` - services.mako = { - enable = true; - layer = "overlay"; - # The timeout value is in millisecond - defaultTimeout = 30000; - padding = "10,20"; - width = 400; - height = 150; - borderSize = 2; - # The maximum number of notifications - maxVisible = 3; - maxIconSize = 24; - # Enable pango markup (see https://docs.gtk.org/Pango/pango_markup.html) - markup = true; - actions = true; - }; - }; -} diff --git a/home/wm/sway/default.nix b/home/wm/sway/default.nix deleted file mode 100644 index 7ee6791..0000000 --- a/home/wm/sway/default.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ config, lib, pkgs, ... }: -let - isEnabled = config.my.home.wm.windowManager == "sway"; - terminal = config.my.home.terminal.program; - modifier = "Mod4"; # `Super` key -in -{ - config = lib.mkIf isEnabled { - home.packages = with pkgs; [ - wlogout - brightnessctl - pulseaudio - grim - slurp - polkit_gnome - xsettingsd - swaylock - swayidle - wl-clipboard - ]; - - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; - XDG_CURRENT_DESKTOP = "sway"; - XDG_SESSION_TYPE = "wayland"; - }; - - programs = { - zsh.loginExtra = '' - if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then - eval $(ssh-agent -s) > /dev/null - fi - if [ "$(tty)" = "/dev/tty1" ]; then - exec sway &> /dev/null - fi - ''; - - zsh.profileExtra = '' - if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then - eval $(ssh-agent -s) > /dev/null - fi - if [ "$(tty)" = "/dev/tty1" ]; then - exec sway &> /dev/null - fi - ''; - }; - - wayland.windowManager.sway = { - enable = true; - # in order to import some variables (e.g. PATH) so that all the - # units that will be started have all the required environment - # variables - extraSessionCommands = "systemctl --user import-environment"; - # this will start sway-session.target and run - # dbus-update-activation-environment - systemdIntegration = true; - config = { - # FIXME: this should be a variable - terminal = "alacritty"; - modifier = modifier; - menu = ''${pkgs.wofi}/bin/wofi -S drun -p "app:" -L 10''; - bars = [ ]; - fonts = { - names = [ "Source Code Pro" ]; - size = 10.0; - }; - keybindings = lib.mkOptionDefault { - # control the volume - "XF86AudioRaiseVolume" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86AudioMute" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = - "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - - # control brightness - "XF86MonBrightnessDown" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; - "XF86MonBrightnessUp" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%"; - - # logout - "${modifier}+Escape" = "exec ${pkgs.wlogout}/bin/wlogout"; - - # screenshot - "${modifier}+s" = - "exec ${pkgs.grim}/bin/grim $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; - "${modifier}+Shift+s" = - "exec ${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; - - # File Manager - "${modifier}+p" = "exec ${pkgs.pcmanfm}/bin/pcmanfm"; - }; - - # use `swaymsg -t get_tree' to get the title/name/ID of the applications - window = { - commands = [ - { - criteria.class = ".blueman-manager-wrapped"; - command = "floating enable"; - } - { - criteria.class = "Pavucontrol"; - command = "floating enable"; - } - ]; - }; - - input = { - "*" = { - "xkb_layout" = "us,fr"; - # map capslock to ctrl, and switch layout using shift+caps - "xkb_options" = "ctrl:nocaps,grp:shift_caps_toggle"; - }; - }; - - - assigns = { - "1" = [{ app_id = "emacs"; }]; - "2" = [{ app_id = "Alacritty"; }]; - "3" = [{ app_id = "firefox"; }]; - "4" = [{ app_id = "org.gnome.Fractal"; }]; - }; - - output = { - "*" = { - scale = "1.5"; - bg = "#2E3440 solid_color"; - }; - # This is for aptos - "eDP-1" = { scale = "1.3"; }; - }; - }; - }; - }; -} diff --git a/home/wm/swaylock/config b/home/wm/swaylock/config deleted file mode 100644 index 2d5b4a1..0000000 --- a/home/wm/swaylock/config +++ /dev/null @@ -1,4 +0,0 @@ -color=2E3440 -daemonize -indicator-caps-lock -hide-keyboard-layout diff --git a/home/wm/swaylock/default.nix b/home/wm/swaylock/default.nix deleted file mode 100644 index a22d548..0000000 --- a/home/wm/swaylock/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - xdg.configFile."swaylock/config" = { source = ./config; }; - - services.swayidle = { - enable = true; - events = [ - { - event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -fF"; - } - { - event = "lock"; - command = "${pkgs.swaylock}/bin/swaylock -fF"; - } - ]; - timeouts = [ - { - timeout = 300; - command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\""; - resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; - } - { - timeout = 310; - command = "${pkgs.systemd}/bin/loginctl lock-session"; - } - ]; - }; - - }; -} diff --git a/home/wm/waybar/default.nix b/home/wm/waybar/default.nix deleted file mode 100644 index 4a524a8..0000000 --- a/home/wm/waybar/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, lib, pkgs, ... }: -let - isEnabled = config.my.home.wm.windowManager == "sway"; - waybarSystemd = - pkgs.runCommandLocal "waybar-systemd" - { nativeBuildInputs = [ pkgs.makeWrapper ]; } - '' - makeWrapper ${./waybar-systemd.sh} $out/bin/waybar-systemd - ''; -in -{ - config = lib.mkIf isEnabled { - programs.waybar = { - enable = true; - systemd = { enable = true; }; - - settings = [{ - layer = "bottom"; - height = 25; - position = "top"; - margin-top = 0; - margin-left = 0; - margin-right = 0; - margin-bottom = 0; - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-right = [ "custom/systemd" "pulseaudio" "network" "battery" "clock" "tray" ]; - "sway/workspaces" = { - format = "{name}"; - disable-scroll = true; - }; - "sway/mode" = { format = "{}"; }; - tray = { spacing = 10; }; - clock = { format = "{: %a %b %d %R}"; }; - battery = { - states = { - warning = 30; - critical = 15; - }; - format = "ac:{capacity}%"; - tooltip = true; - tooltip-format = "{timeTo} ({capacity}%)"; - }; - "custom/systemd" = { - exec = "${waybarSystemd}/bin/waybar-systemd"; - return-type = "json"; - interval = 10; - }; - pulseaudio = { - format = "vol:{volume}%"; - format-bluetooth = "bt:{volume}%"; - format-bluetooth-muted = "bt:{volume}%"; - format-muted = "vol:{volume}%"; - on-click = "pavucontrol"; - }; - "network" = { - format-wifi = "{essid}:{signalStrength}%"; - format-ethernet = "{ipaddr}/{cidr}"; - format-linked = "{ifname} (No IP)"; - format-disconnected = "network unavailable"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - tooltip = false; - }; - }]; - style = (builtins.readFile ./style.css); - }; - }; -} diff --git a/home/wm/waybar/style.css b/home/wm/waybar/style.css deleted file mode 100644 index 1362cd5..0000000 --- a/home/wm/waybar/style.css +++ /dev/null @@ -1,69 +0,0 @@ -* { - border-radius: 0; - border: none; - margin: 0; - min-height: 0; - padding: 0; - font-family: Source Code Pro; - font-size: 15px; -} -window#waybar { - background-color: #282A36; - color: #eee; -} -#workspaces button { - padding: 0 3px; - background-color: transparent; - color: #eee; -} -#workspaces button.focused { - background-color: #285577; - border: 1px solid #4c7899; -} -#clock, -#battery, -#network, -#pulseaudio, -#tray, -#mode { - padding-left: 10px; - padding-right: 10px; -} -#mode { - /* No styles */ -} -#tray { - /* No styles */ -} -#clock { - /* No styles */ -} -#battery { - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} -#battery.discharging { - color: #90a1ad; -} -#battery.charging { - color: #fffff8; -} -#battery.warning { - border-bottom: 2px solid #ff9e21; -} -#battery.critical { - border-bottom: 2px solid #ff3121; -} -#network { - /* No styles */ -} -#network.disconnected { - color: orange; -} -#pulseaudio { - /* No styles */ -} -#pulseaudio.muted { - color: #90a1ad; -} diff --git a/home/wm/waybar/waybar-systemd.sh b/home/wm/waybar/waybar-systemd.sh deleted file mode 100755 index bf4e8b8..0000000 --- a/home/wm/waybar/waybar-systemd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -failed_user="$(systemctl --plain --no-legend --user list-units --state=failed | awk '{ print $1 }')" -failed_system="$(systemctl --plain --no-legend list-units --state=failed | awk '{ print $1 }')" - -failed_systemd_count="$(echo -n "$failed_system" | grep -c '^')" -failed_user_count="$(echo -n "$failed_user" | grep -c '^')" - -text=$(( failed_systemd_count + failed_user_count )) - -if [ "$text" -eq 0 ]; then - printf '{"text": ""}\n' -else - tooltip="" - - [ -n "$failed_system" ] && tooltip="Failed system services:\n\n${failed_system}\n\n${tooltip}" - [ -n "$failed_user" ] && tooltip="Failed user services:\n\n${failed_user}\n\n${tooltip}" - - tooltip="$(printf "%s" "$tooltip" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')" - - printf '{"text": "%s", "tooltip": "%s" }\n' "$text" "$tooltip" -fi diff --git a/home/wm/wofi/config b/home/wm/wofi/config deleted file mode 100644 index 3d8133f..0000000 --- a/home/wm/wofi/config +++ /dev/null @@ -1,6 +0,0 @@ -allow_images=true -image_size=25px -drun-display_generic=true -dynamic_lines=true -insensitive=true -run-cache_file=/dev/null diff --git a/home/wm/wofi/default.nix b/home/wm/wofi/default.nix deleted file mode 100644 index 7f8a92b..0000000 --- a/home/wm/wofi/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - home.packages = with pkgs; [ wofi ]; - xdg.configFile."wofi/config".source = ./config; - }; -} diff --git a/home/xdg/default.nix b/home/xdg/default.nix deleted file mode 100644 index f5f60b3..0000000 --- a/home/xdg/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.xdg; -in -{ - options.my.home.xdg = with lib; { - enable = mkEnableOption "XDG configuration"; - }; - - config = lib.mkIf cfg.enable { - xdg = { - enable = true; - # File types - mime.enable = true; - # File associatons - mimeApps = { enable = true; }; - # User directories - userDirs = { - enable = true; - createDirectories = true; - desktop = "${config.home.homeDirectory}/documents"; - documents = "${config.home.homeDirectory}/documents"; - download = "${config.home.homeDirectory}/downloads"; - music = "${config.home.homeDirectory}/media/music"; - pictures = "${config.home.homeDirectory}/media/pictures"; - publicShare = "${config.home.homeDirectory}/documents/public"; - templates = "${config.home.homeDirectory}/documents/templates"; - videos = "${config.home.homeDirectory}/media/videos"; - }; - }; - - # xdg.portal = { - # enable = true; - # gtkUsePortal = true; - # extraPortals = - # [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; - # }; - - home.packages = with pkgs; [ xdg-utils ]; - - # I want a tidier home - home.sessionVariables = with config.xdg; { - DOCKER_CONFIG = "${configHome}/docker"; - LESS = "-FRSXM"; - LESSCHARSET = "utf-8"; - LESSHISTFILE = "${dataHome}/less/history"; - LESSKEY = "${configHome}/less/lesskey"; - PAGER = "less"; - }; - }; -} diff --git a/home/yt-dlp/config b/home/yt-dlp/config deleted file mode 100644 index 815bc66..0000000 --- a/home/yt-dlp/config +++ /dev/null @@ -1,28 +0,0 @@ -# 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" - ---continue - ---sub-langs all ---write-subs - ---convert-subs=srt - ---restrict-filenames ---output="$HOME/media/videos/%(uploader)s/%(playlist)s/%(upload_date)s-%(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 deleted file mode 100644 index 4ac1fb9..0000000 --- a/home/yt-dlp/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, pkgs, ... }: -let cfg = config.my.home.yt-dlp; -in -{ - options.my.home.yt-dlp = with lib; { - enable = mkEnableOption "yt-dlp configuration"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ yt-dlp ]; - xdg.configFile."yt-dlp/config".source = ./config; - }; -} diff --git a/home/yubikey/default.nix b/home/yubikey/default.nix deleted file mode 100644 index d4b73d5..0000000 --- a/home/yubikey/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, config, lib, ... }: -let cfg = config.my.home.yubikey; -in -{ - options.my.home.yubikey = with lib; { - enable = mkEnableOption "yubikey tooling"; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ yubikey-manager yubikey-touch-detector ]; - - systemd.user.sockets.yubikey-touch-detector = { - Unit.Description = "Unix socket activation for YubiKey touch detector service"; - Socket = { - ListenStream = "%t/yubikey-touch-detector.socket"; - RemoveOnStop = true; - }; - Install.WantedBy = [ "sockets.target" ]; - }; - - systemd.user.services.yubikey-touch-detector = { - Unit = { - Description = "Detects when your YubiKey is waiting for a touch"; - Requires = "yubikey-touch-detector.socket"; - }; - Service = { - ExecStart = "${pkgs.yubikey-touch-detector}/bin/yubikey-touch-detector --libnotify"; - EnvironmentFile = "-%E/yubikey-touch-detector/service.conf"; - }; - Install = { - Also = "yubikey-touch-detector.socket"; - WantedBy = [ "default.target" ]; - }; - }; - }; -} diff --git a/hosts/aptos/home.nix b/hosts/aptos/home.nix index 8341d8e..568e7ae 100644 --- a/hosts/aptos/home.nix +++ b/hosts/aptos/home.nix @@ -1,57 +1,17 @@ -{ ... }: { - my.home = { - wm.windowManager = "sway"; - - # default packages I want on all hosts - packages.enable = true; - - # desktop - evince.enable = true; - gtk.enable = true; - pcmanfm.enable = true; +{ self, ... }: { + imports = [ + "${self}/home/profiles/home.nix" + "${self}/home/profiles/workstation.nix" + "${self}/home/profiles/sway.nix" + ]; - # multimedia - bluetooth.enable = true; - eog.enable = true; - mpv.enable = true; - scanner.enable = true; - sublime-music.enable = true; - vlc.enable = true; - - # communication + my.home = { mail.enable = true; matrix-client.enable = true; - - # terminal - direnv.enable = true; - gcloud.enable = true; - shell.name = "zsh"; - ssh.enable = true; - terminal.program = "alacritty"; - terraform.enable = true; - tmux.enable = true; - xdg.enable = true; - - # software development - emacs.enable = true; - git.enable = true; - go.enable = true; - python.enable = true; - rust.enable = true; - - # web - firefox.enable = true; - transmission-remote.enable = true; - yt-dlp.enable = true; - - # security - age.enable = true; gpg = { enable = true; pinentry = "gnome3"; defaultKey = "23348B57F01D4234B5CFBA0923208AC01EB6EEA1"; }; - pass.enable = true; - yubikey.enable = true; }; } diff --git a/hosts/carmel/home.nix b/hosts/carmel/home.nix index eb6c9ab..6fb5fc2 100644 --- a/hosts/carmel/home.nix +++ b/hosts/carmel/home.nix @@ -1,14 +1,6 @@ -{ ... }: { - my.home = { - # default packages I want on all hosts - packages.enable = true; +{ self, ... }: { - # terminal - shell.name = "zsh"; - ssh.enable = true; - tmux.enable = true; - - # software development - git.enable = true; - }; + imports = [ + "${self}/home/modules/home.nixhome" + ]; } diff --git a/hosts/tahoe/home.nix b/hosts/tahoe/home.nix index c58d0d4..9177e59 100644 --- a/hosts/tahoe/home.nix +++ b/hosts/tahoe/home.nix @@ -1,26 +1,8 @@ -{ pkgs, ... }: +{ pkgs, self, ... }: { - my.home = { - # default packages I want on all hosts - packages.enable = true; - - # terminal - shell.name = "zsh"; - ssh.enable = true; - tmux.enable = true; - - # software development - git.enable = true; - - # multimedia - beets = { - enable = true; - musicDirectory = "/data/fast/music"; - }; - flac.enable = true; - - # web - yt-dlp.enable = true; - }; + imports = [ + "${self}/home/profiles/home.nix" + "${self}/home/profiles/nas.nix" + ]; } |