diff --git a/flake.lock b/flake.lock index 2ffcb79..5bb59b4 100644 --- a/flake.lock +++ b/flake.lock @@ -3,9 +3,7 @@ "agenix": { "inputs": { "darwin": "darwin", - "home-manager": [ - "home-manager" - ], + "home-manager": [], "nixpkgs": [ "nixpkgs" ], @@ -119,7 +117,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1681202837, @@ -172,31 +170,33 @@ "type": "github" } }, - "home-manager": { + "hjem": { "inputs": { + "nix-darwin": [ + "nix-darwin" + ], "nixpkgs": [ "nixpkgs" - ] + ], + "smfh": "smfh" }, "locked": { - "lastModified": 1768068402, - "narHash": "sha256-bAXnnJZKJiF7Xr6eNW6+PhBf1lg2P1aFUO9+xgWkXfA=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "8bc5473b6bc2b6e1529a9c4040411e1199c43b4c", + "lastModified": 1767318528, + "narHash": "sha256-I2zxtEafZbFbqXe71rjqwVeTDv8SIVLaSzQd39SwfwM=", + "owner": "feel-co", + "repo": "hjem", + "rev": "8539013044624a257e8da370069107aea148e985", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "home-manager", + "owner": "feel-co", + "repo": "hjem", "type": "github" } }, "impermanence": { "inputs": { - "home-manager": [ - "home-manager" - ], + "home-manager": [], "nixpkgs": [ "nixpkgs" ] @@ -339,9 +339,7 @@ }, "nix-on-droid": { "inputs": { - "home-manager": [ - "home-manager" - ], + "home-manager": [], "nix-formatter-pack": "nix-formatter-pack", "nixpkgs": [ "nixpkgs" @@ -575,7 +573,7 @@ "fish-prompt-pvsr": "fish-prompt-pvsr", "flake-parts": "flake-parts", "fzf-fish": "fzf-fish", - "home-manager": "home-manager", + "hjem": "hjem", "impermanence": "impermanence", "import-tree": "import-tree", "niri": "niri", @@ -591,6 +589,28 @@ "weather": "weather" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "hjem", + "smfh", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763347184, + "narHash": "sha256-6QH8hpCYJxifvyHEYg+Da0BotUn03BwLIvYo3JAxuqQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "08895cce80433978d5bfd668efa41c5e24578cbd", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "scss-reset": { "flake": false, "locked": { @@ -607,6 +627,29 @@ "type": "github" } }, + "smfh": { + "inputs": { + "nixpkgs": [ + "hjem", + "nixpkgs" + ], + "rust-overlay": "rust-overlay", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1763430012, + "narHash": "sha256-06G7pXUdpMnUqR0JWWvV7sA8oNGOZU1cSLqQS1GMf7Y=", + "owner": "feel-co", + "repo": "smfh", + "rev": "eddda76e3dd4c6deaea5f819f174fc16dbe70f90", + "type": "github" + }, + "original": { + "owner": "feel-co", + "repo": "smfh", + "type": "github" + } + }, "srcery-textmate": { "flake": false, "locked": { @@ -688,9 +731,24 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1726560853, diff --git a/flake.nix b/flake.nix index 0837700..8db4cf7 100644 --- a/flake.nix +++ b/flake.nix @@ -3,13 +3,14 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-25.11"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + hjem.url = "github:feel-co/hjem"; + hjem.inputs.nixpkgs.follows = "nixpkgs"; + hjem.inputs.nix-darwin.follows = "nix-darwin"; impermanence.url = "github:nix-community/impermanence"; impermanence.inputs.nixpkgs.follows = "nixpkgs"; - impermanence.inputs.home-manager.follows = "home-manager"; + impermanence.inputs.home-manager.follows = ""; nixos-hardware.url = "github:nixos/nixos-hardware"; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; @@ -17,13 +18,13 @@ srvos.inputs.nixpkgs.follows = "nixpkgs"; nix-on-droid.url = "github:nix-community/nix-on-droid"; nix-on-droid.inputs.nixpkgs.follows = "nixpkgs"; - nix-on-droid.inputs.home-manager.follows = "home-manager"; + nix-on-droid.inputs.home-manager.follows = ""; flake-parts.url = "github:hercules-ci/flake-parts"; import-tree.url = "github:vic/import-tree"; agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; - agenix.inputs.home-manager.follows = "home-manager"; + agenix.inputs.home-manager.follows = ""; pre-commit-hooks.url = "github:cachix/git-hooks.nix"; pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; @@ -54,7 +55,6 @@ flake-parts.lib.mkFlake { inherit inputs; } { imports = map import-tree [ ./flake - ./home-manager ./hosts ./modules ]; diff --git a/flake/home.nix b/flake/home.nix deleted file mode 100644 index 0530fe4..0000000 --- a/flake/home.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - self, - inputs, - config, - lib, - ... -}: -{ - options.local.homeConfigurations = lib.mkOption { - type = lib.types.attrsOf lib.types.deferredModule; - }; - - config.perSystem = - { pkgs, ... }: - { - legacyPackages.homeConfigurations = builtins.mapAttrs ( - _: module: - inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - module - self.modules.homeManager.standalone - ]; - } - ) config.local.homeConfigurations; - }; -} diff --git a/flake/hosts.nix b/flake/hosts.nix index c36cc14..c844786 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -9,7 +9,7 @@ let { networking.hostName = name; } inputs.self.modules.nixos.core inputs.self.modules.nixos.${name} - { local.home.imports = [ inputs.self.modules.homeManager.${name} or { } ]; } + { hjem.extraModules = [ inputs.self.modules.hjem.${name} or { } ]; } ]; }; options.nixos = lib.mkOption { default = lib.nixosSystem { inherit (config) modules; }; }; diff --git a/home-manager/arseille.nix b/home-manager/arseille.nix deleted file mode 100644 index 6b9ba83..0000000 --- a/home-manager/arseille.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ self, ... }: -{ - flake.modules.homeManager.arseille.imports = [ self.modules.homeManager.standalone ]; - # TODO make this work for nix-on-droid app too - flake.modules.homeManager.arseille.home.file.".termux/colors.properties".text = '' - # https://github.com/srcery-colors/srcery-terminal/ - # Special - foreground=#fce8c3 - background=#1c1b19 - cursor=#fbb829 - # Black - color0=#1c1b19 - color8=#918175 - # Red - color1=#ef2f27 - color9=#f75341 - # Green - color2=#519f50 - color10=#98bc37 - # Yellow - color3=#fbb829 - color11=#fed06e - # Blue - color4=#2c78bf - color12=#68a8e4 - # Magenta - color5=#e02c6d - color13=#ff5c8f - # Cyan - color6=#0aaeb3 - color14=#2be4d0 - # White - color7=#baa67f - color15=#fce8c3 - ''; -} diff --git a/home-manager/bat.nix b/home-manager/bat.nix deleted file mode 100644 index 45e6f50..0000000 --- a/home-manager/bat.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.core = - { pkgs, ... }: - { - home.packages = with pkgs.bat-extras; [ - batgrep - batman - ]; - - programs.bat.enable = true; - programs.bat.config.theme-dark = "srcery"; - xdg.configFile."bat/themes/srcery.tmTheme".source = "${inputs.srcery-textmate}/srcery.tmTheme"; - home.sessionVariables.MANPAGER = pkgs.writeShellScript "batman" '' - awk '{ gsub(/\x1B\[[0-9;]*m/, "", $0); gsub(/.\x08/, "", $0); print }' \ - | bat --plain --language man - ''; - }; -} diff --git a/home-manager/beets.nix b/home-manager/beets.nix deleted file mode 100644 index 30545fd..0000000 --- a/home-manager/beets.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - flake.modules.homeManager.ruan.programs.beets.enable = true; - flake.modules.homeManager.ruan.programs.beets.settings = { - directory = "~/music"; - library = "~/.local/state/beets/library.db"; - plugins = [ - "random" - "scrub" - "ftintitle" - "fetchart" - "chroma" - ]; - original_date = true; - from_scratch = true; - match.preferred = { - countries = [ - "XW" - "US" - "JP" - ]; - media = [ - "Digital Media|File" - "CD" - ]; - original_year = true; - }; - scrub.auto = true; - }; -} diff --git a/home-manager/darkman.nix b/home-manager/darkman.nix deleted file mode 100644 index a5efa43..0000000 --- a/home-manager/darkman.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ lib, ... }: -let - modeToggleService = lib.mergeAttrs { - Install.WantedBy = [ "set-ui-mode.target" ]; - Service.Type = "oneshot"; - Service.RemainAfterExit = false; - }; - activate = mode: '' - systemctl --user set-environment UI_MODE=${mode} - systemctl --user start set-ui-mode.target - ''; -in -{ - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - systemd.user.targets.set-ui-mode.Unit = { - Description = "Switch to light/dark mode based on $UI_MODE"; - StopWhenUnneeded = true; - }; - systemd.user.services.set-gtk-scheme = modeToggleService { - Unit.Description = "Set GTK UI scheme"; - Service.ExecStart = pkgs.writeShellScript "set-gtk-scheme" '' - ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$UI_MODE'" - ''; - }; - systemd.user.services.niri-screen-transition = modeToggleService { - Unit.Description = "Niri screen transition effect"; - Service.ExecStart = pkgs.writeShellScript "niri-screen" '' - niri msg action do-screen-transition -d ''${UI_TRANSITION_MS:-250} - ''; - }; - - services.darkman = { - enable = true; - settings = { - lat = 42.4; - lng = -71.1; - }; - darkModeScripts.target = activate "dark"; - lightModeScripts.target = activate "light"; - }; - }; -} diff --git a/home-manager/desktop.nix b/home-manager/desktop.nix deleted file mode 100644 index 8e03600..0000000 --- a/home-manager/desktop.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - home.packages = with pkgs; [ - git-annex - moreutils - ouch - tig - manix - sd - diceware - transmission_4 - nvtopPackages.amd - (pkgs.symlinkJoin { - name = "timg-wrapped"; - paths = [ pkgs.timg ]; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = "wrapProgram $out/bin/timg --add-flags '-pk'"; - }) - inputs.qbpm.packages.${pkgs.stdenv.hostPlatform.system}.qbpm - ]; - - programs.direnv = { - enable = true; - enableBashIntegration = false; - nix-direnv.enable = true; - }; - services.lorri.enable = true; - - programs.nix-index.enable = true; - programs.tealdeer.enable = true; - programs.jq.enable = true; - }; -} diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix deleted file mode 100644 index b35bb64..0000000 --- a/home-manager/firefox.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - flake.modules.homeManager.firefox = - { lib, pkgs, ... }: - { - programs.firefox = { - enable = true; - package = lib.mkDefault (pkgs.firefox.override { cfg.speechSynthesisSupport = false; }); - policies = { - DontCheckDefaultBrowser = true; - DisablePocket = true; - FirefoxHome = { - Pocket = false; - Snippets = false; - }; - UserMessaging = { - ExtensionRecommendations = false; - SkipOnboarding = true; - }; - }; - profiles.default = { - name = "default"; - }; - }; - }; -} diff --git a/home-manager/fish/default.nix b/home-manager/fish/default.nix deleted file mode 100644 index fccbfbf..0000000 --- a/home-manager/fish/default.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.core = - { - config, - lib, - pkgs, - ... - }: - let - zoxideFile = pkgs.runCommandLocal "zoxide.fish" { - nativeBuildInputs = [ pkgs.zoxide ]; - } "zoxide init fish > $out"; - in - { - home.shell.enableBashIntegration = false; - home.shellAliases.fish = "SHELL=${pkgs.fish}/bin/fish command fish"; - - programs.zoxide.enableFishIntegration = false; - - programs.eza.enable = true; - programs.eza.git = true; - - programs.fish = { - enable = true; - preferAbbrs = true; - generateCompletions = false; - interactiveShellInit = '' - ${lib.optionalString config.programs.zoxide.enable "source ${zoxideFile}"} - set -g fish_key_bindings fish_hybrid_key_bindings - bind -M insert ctrl-n down-or-search - set -g fish_cursor_default block - set -g fish_cursor_insert line - set -g fish_cursor_replace_one underscore - set -g fish_greeting - __git.init - ''; - functions = { - session = '' - if set -q argv[1] - set -gx fish_history $argv[1] - set data_dir "$HOME/.local/share/zoxide/sessions/$argv[1]" - mkdir -p $data_dir - and set -gx _ZO_DATA_DIR "$data_dir" - pushd (zoxide query 2> /dev/null; or echo .) - else - set -ge fish_history - set -ge _ZO_DATA - popd 2> /dev/null - end - ''; - fish_mode_prompt = ""; - }; - shellAbbrs = { - # TODO only enable when commands are present - sc = "systemctl"; - ssc = "sudo systemctl"; - scu = "systemctl --user"; - jc = "journalctl"; - jce = "journalctl -e"; - jcf = "journalctl -f"; - jcu = "journalctl -u"; - jcb = "journalctl -b"; - jcm = "sudo journalctl -M"; - gcp = "git commit -p"; - "gcp!" = "git commit -p --amend"; - "gcpn!" = "git commit -p --no-edit --amend"; - gcpm = "git commit -p -m"; - gan = "git annex"; - ls = "eza"; - l = "eza -l"; - ll = "eza -l"; - la = "eza -la"; - e = "eza -l"; - ea = "eza -la"; - er = "eza -ls modified"; - et = "eza -T"; - nn = { - position = "anywhere"; - expansion = "--log-format internal-json -v 2&| nom --json"; - }; - ".c/" = { - position = "anywhere"; - setCursor = true; - expansion = "$XDG_CONFIG_HOME/%"; - }; - }; - }; - - home.packages = with pkgs.fishPlugins; [ - plugin-git - (buildFishPlugin { - pname = "fish-prompt-pvsr"; - src = inputs.fish-prompt-pvsr; - version = inputs.fish-prompt-pvsr.shortRev; - }) - ]; - - xdg.configFile."fish/themes/magenta.theme".source = ./magenta.theme; - }; -} diff --git a/home-manager/ghostty.nix b/home-manager/ghostty.nix deleted file mode 100644 index 988c76e..0000000 --- a/home-manager/ghostty.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, ... }: -{ - flake.modules.homeManager.desktop = - { lib, pkgs, ... }: - { - programs.ghostty = { - enable = true; - enableFishIntegration = false; - settings = { - theme = "light:Rose Pine Dawn,dark:Srcery"; - command = "fish"; - font-family = config.local.appFont; - font-size = lib.mkDefault 15; - cursor-style-blink = false; - shell-integration-features = "no-cursor"; - mouse-hide-while-typing = true; - window-padding-x = 0; - window-padding-y = 0; - window-padding-balance = true; - window-padding-color = "extend"; - window-step-resize = true; - gtk-single-instance = true; - confirm-close-surface = false; - quit-after-last-window-closed = true; - keybind = [ - "ctrl+[=text:\\x1b" - "ctrl+j=text:\\r" - "ctrl+m=text:\\r" - "alt+f4=unbind" - "ctrl+shift+q=unbind" - "ctrl+shift+w=unbind" - "ctrl+enter=unbind" - "alt+1=unbind" - "alt+2=unbind" - "alt+3=unbind" - "alt+4=unbind" - "alt+5=unbind" - "alt+6=unbind" - "alt+7=unbind" - "alt+8=unbind" - "alt+9=unbind" - "alt+0=unbind" - ]; - }; - }; - }; -} diff --git a/home-manager/git.nix b/home-manager/git.nix deleted file mode 100644 index 2640539..0000000 --- a/home-manager/git.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ lib, ... }: -{ - flake.modules.homeManager.core.config.programs.git = { - enable = true; - ignores = [ - ".envrc" - ".direnv" - "result*" - ]; - settings = { - user.name = "Peter Rice"; - user.email = lib.mkDefault "peterrice@fastmail.com"; - init.defaultBranch = "main"; - commit.verbose = true; - interactive.singleKey = true; - diff.algorithm = "patience"; - merge.conflictstyle = "zdiff3"; - pull.rebase = true; - push.default = "current"; - rebase.autostash = true; - rebase.autosquash = true; - rebase.updateRefs = true; - branch.autoSetupRebase = "always"; - branch.sort = "-committerdate"; - url."git@github.com:".insteadOf = "github:"; - }; - }; -} diff --git a/home-manager/grancel.nix b/home-manager/grancel.nix deleted file mode 100644 index b11bc8b..0000000 --- a/home-manager/grancel.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ self, ... }: -{ - flake.modules.homeManager.grancel = - { config, pkgs, ... }: - { - imports = [ - self.modules.homeManager.desktop - self.modules.homeManager.firefox - ]; - - home.packages = with pkgs; [ - (prismlauncher.override { - jdks = [ - jdk - ]; - }) - sptlrx - ]; - - programs.niri.settings.outputs."HDMI-A-2".variable-refresh-rate = true; - - programs.password-store.enable = true; - programs.gpg.enable = true; - programs.gpg.homedir = "${config.xdg.dataHome}/gnupg"; - services.gpg-agent = { - enable = true; - defaultCacheTtl = 3 * 60 * 60; - maxCacheTtl = 8 * 60 * 60; - pinentry.package = pkgs.pinentry-curses; - }; - - services.spotifyd = { - enable = true; - package = pkgs.spotifyd.override { withMpris = true; }; - settings.global = { - backend = "pulseaudio"; - bitrate = 160; - initial_volume = "100"; - }; - }; - - services.mpris-proxy.enable = true; - }; -} diff --git a/home-manager/helix/default.nix b/home-manager/helix/default.nix deleted file mode 100644 index 672b08c..0000000 --- a/home-manager/helix/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - flake.modules.homeManager.core = - { pkgs, ... }: - { - programs.helix = { - enable = true; - defaultEditor = true; - settings = { - theme.dark = "srcery"; - theme.light = "rose_pine_dawn"; - editor = { - line-number = "relative"; - scrolloff = 2; - rulers = [ 80 ]; - color-modes = true; - rainbow-brackets = true; - bufferline = "multiple"; - soft-wrap.enable = true; - smart-tab.supersede-menu = true; - whitespace.render.tab = "all"; - whitespace.render.newline = "all"; - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - lsp = { - display-inlay-hints = true; - }; - end-of-line-diagnostics = "hint"; - inline-diagnostics.cursor-line = "hint"; - }; - keys.insert = { - C-p = "move_line_up"; - C-n = "move_line_down"; - C-f = "move_char_right"; - C-b = "move_char_left"; - C-a = "goto_first_nonwhitespace"; - C-e = "goto_line_end_newline"; - C-c = "toggle_comments"; - C-t = "indent"; - C-g = "unindent"; - C-backspace = "delete_word_backward"; - }; - keys.normal.minus = "file_explorer_in_current_buffer_directory"; - }; - }; - }; -} diff --git a/home-manager/helix/srcery.nix b/home-manager/helix/srcery.nix deleted file mode 100644 index 0b4d42a..0000000 --- a/home-manager/helix/srcery.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - flake.modules.homeManager.core.programs.helix.themes.srcery = { - inherits = "gruvbox"; - "ui.virtual.jump-label" = { - bg = "bg2"; - modifiers = [ "bold" ]; - }; - "ui.bufferline.active".bg = "bg3"; - palette = { - bg0 = "#1c1b19"; - bg1 = "#262626"; - bg2 = "#303030"; - bg3 = "#3a3a3a"; - bg4 = "#444444"; - - fg0 = "#fce8c3"; - fg1 = "#fce8c3"; - fg2 = "#baa67f"; - fg3 = "#baa67f"; - fg4 = "#918175"; - - gray0 = "#918175"; - gray1 = "#585858"; - - red0 = "#ef2f27"; - red1 = "#f75341"; - green0 = "#519f50"; - green1 = "#98bc37"; - yellow0 = "#fbb829"; - yellow1 = "#fed06e"; - blue0 = "#2c78bf"; - blue1 = "#68a8e4"; - purple0 = "#e02c6d"; - purple1 = "#ff5c8f"; - aqua0 = "#0aaeb3"; - aqua1 = "#2be4d0"; - orange0 = "#ff5f00"; - orange1 = "#ff8700"; - }; - }; -} diff --git a/home-manager/jujutsu.nix b/home-manager/jujutsu.nix deleted file mode 100644 index a4ae5db..0000000 --- a/home-manager/jujutsu.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ lib, ... }: -{ - flake.modules.homeManager.core.programs = { - jujutsu = { - enable = true; - settings = { - user = { - name = "Peter Rice"; - email = lib.mkDefault "peterrice@fastmail.com"; - }; - ui.default-command = "log"; - ui.diff-formatter = ":git"; - templates.draft_commit_description = '' - concat( - description, - separate("\n", - "\nJJ: This commit contains the following changes:", - indent("JJ: ", diff.summary()), - "JJ: ignore-rest", - diff.git(), - ) - ) - ''; - template-aliases.shell_prompt = '' - separate(" ", - concat("(", - self.parents().map(|parent| parent.change_id().shortest()).join("/"), - " -> ", - format_short_change_id_with_change_offset(self), - ")", - ), - bookmarks, - tags, - if(conflict, label("conflict", "×")), - if(empty, label("empty", "(empty)")), - if(description, - concat("(", description.first_line(), ")"), - if(!empty, description_placeholder), - ), - ) - ''; - template-aliases."in_branch(commit)" = "commit.contained_in(\"immutable_heads()..bookmarks()\")"; - templates.log_node = '' - if(self && !current_working_copy && !immutable && !conflict && in_branch(self), - "◇", - builtin_log_node - ) - ''; - }; - }; - fish = { - shellAbbrs = { - j = "jj"; - js = "jj show"; - }; - functions = { - fish_vcs_prompt = "fish_jj_prompt $argv; or fish_git_prompt $argv; or fish_hg_prompt $argv"; - # https://github.com/fish-shell/fish-shell/blob/master/share/functions/fish_jj_prompt.fish - fish_jj_prompt = '' - set -l info "$(jj log \ - --ignore-working-copy \ - --revisions @ \ - --no-graph \ - --color=always \ - --template shell_prompt \ - 2>/dev/null)" - or return 1 - if test -n "$info" - printf ' %s' $info - end - ''; - summarize = { - wraps = "jj show"; - body = '' - set recent (jj log --no-graph \ - -r 'ancestors(immutable_heads(), 12) & ~description("flake.lock")' \ - -T 'separate("\n", - format_short_commit_id(self.commit_id()), - self.description())' \ - | string collect) - jj show --no-pager --context 12 $argv[1] >&2 - jj show --no-pager --context 12 $argv[1] |\ - llm -s "Write a one-line commit message for these changes. It \ - should be under 50 characters. If 50 characters is not enough to \ - express the main point of the changes you may continue to write \ - one or more paragraphs describing the changes, which should be \ - wrapped at 80 characters. - - It should match the style of these recent commit messages in the \ - same repository, which are each prefixed by a hexadecimal commit \ - id and a newline: - $recent - - Write the commit message with no commentary, as if the output \ - were going straight into the commit - " | tee /dev/tty | jj desc --stdin --editor $argv[1] - ''; - }; - }; - }; - }; -} diff --git a/home-manager/mpv.nix b/home-manager/mpv.nix deleted file mode 100644 index 9242d16..0000000 --- a/home-manager/mpv.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - programs.mpv.enable = true; - programs.mpv = { - bindings = { }; - scripts = with pkgs.mpvScripts; [ - autocrop - mpris - sponsorblock - - # mutually exclusive osc replacements - thumbnail - # youtube-quality - ]; - config = { - profile = "standard"; - }; - profiles = { - no-term = { - profile = "standard"; - pause = true; - force-window = "immediate"; - terminal = false; - }; - "protocol.https" = { - force-window = "immediate"; - keep-open = true; - }; - "protocol.http" = { - profile = "protocol.https"; - }; - standard = { - cache = true; - audio-display = false; - write-filename-in-watch-later-config = true; - profile = "gpu-hq"; - video-sync = "display-resample"; - interpolation = true; - tscale = "oversample"; - demuxer-mkv-subtitle-preroll = true; - slang = "eng,en,enUS,en-US"; - ytdl-raw-options = "sub-langs=\"en*\",cookies-from-browser=firefox"; - # for thumbnail/youtube-quality - osc = false; - script-opts-append = "autocrop-auto=no"; - }; - }; - }; - - programs.yt-dlp.enable = true; - programs.yt-dlp.settings = { - embed-subs = true; - write-auto-subs = true; - embed-thumbnail = true; - sub-langs = "en*,ja*"; - }; - - programs.fish = { - shellAbbrs.pmpv = "umpv (wl-paste)"; - functions.yts = { - wraps = "mpv"; - body = "mpv 'ytdl://ytsearch1:'$argv[1] $argv[2..-1]"; - }; - functions.uts = { - wraps = "mpv"; - body = "umpv 'ytdl://ytsearch1:'$argv[1] $argv[2..-1]"; - }; - - functions.m = '' - commandline 'mpv --no-video ~/music/' - set -x fzf_fd_opts -td --exact-depth 2 - _fzf_search_directory - ''; - shellAbbrs.mshuf = { - setCursor = true; - expansion = "mpv --shuffle --no-video ~/music/%"; - }; - }; - }; -} diff --git a/home-manager/niri/binds.nix b/home-manager/niri/binds.nix deleted file mode 100644 index ce854fb..0000000 --- a/home-manager/niri/binds.nix +++ /dev/null @@ -1,204 +0,0 @@ -{ - flake.modules.homeManager.desktop = - { config, ... }: - { - programs.niri.settings.binds = with config.lib.niri.actions; { - "Mod+Shift+Slash".action = show-hotkey-overlay; - - "Mod+T" = { - hotkey-overlay.title = "Open a Terminal"; - action = spawn "ghostty"; - }; - "Mod+D" = { - hotkey-overlay.title = "Run an Application"; - action = spawn "fuzzel"; - }; - "Mod+E" = { - hotkey-overlay.title = "Pick an Emoji"; - action = spawn "rofimoji"; - }; - "Mod+Q" = { - hotkey-overlay.title = "Run a qutebrowser Profile"; - action = spawn-sh "qbpm choose"; - }; - "Mod+X" = { - hotkey-overlay.title = "Play Copied Link (umpv)"; - action = spawn-sh "umpv $(wl-paste)"; - }; - "Mod+Shift+X" = { - hotkey-overlay.title = "Play Copied Link (mpv)"; - action = spawn-sh "mpv $(wl-paste)"; - }; - "Mod+Alt+L" = { - hotkey-overlay.title = "Lock the Screen"; - action = spawn "swaylock"; - }; - - "XF86AudioRaiseVolume".action = spawn-sh "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05+"; - "XF86AudioLowerVolume".action = spawn-sh "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05-"; - "Shift+XF86AudioRaiseVolume".action = spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; - "Shift+XF86AudioLowerVolume".action = spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; - "XF86AudioMute".action = spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - "XF86AudioMicMute".action = spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; - "XF86MonBrightnessUp".action = spawn-sh "light -A 5"; - "XF86MonBrightnessDown".action = spawn-sh "light -U 5"; - "XF86AudioPrev".action = spawn-sh "playerctl previous"; - "XF86AudioNext".action = spawn-sh "playerctl next"; - "XF86AudioMedia".action = spawn-sh "playerctl play-pause"; - "XF86AudioPlay".action = spawn-sh "playerctl play-pause"; - - "Mod+O" = { - action = toggle-overview; - repeat = false; - }; - "Mod+Shift+Q" = { - action = close-window; - repeat = false; - }; - - "Mod+Left".action = focus-column-left; - "Mod+Down".action = focus-window-down; - "Mod+Up".action = focus-window-up; - "Mod+Right".action = focus-column-right; - "Mod+H".action = focus-column-left; - "Mod+J".action = focus-window-down; - "Mod+K".action = focus-window-up; - "Mod+L".action = focus-column-right; - - "Mod+Shift+Left".action = move-column-left; - "Mod+Shift+Down".action = move-window-down; - "Mod+Shift+Up".action = move-window-up; - "Mod+Shift+Right".action = move-column-right; - "Mod+Shift+H".action = move-column-left; - "Mod+Shift+J".action = move-window-down; - "Mod+Shift+K".action = move-window-up; - "Mod+Shift+L".action = move-column-right; - - "Mod+Home".action = focus-column-first; - "Mod+End".action = focus-column-last; - "Mod+Shift+Home".action = move-column-to-first; - "Mod+Shift+End".action = move-column-to-last; - - "Mod+Ctrl+Left".action = focus-monitor-left; - "Mod+Ctrl+Down".action = focus-monitor-down; - "Mod+Ctrl+Up".action = focus-monitor-up; - "Mod+Ctrl+Right".action = focus-monitor-right; - "Mod+Ctrl+H".action = focus-monitor-left; - "Mod+Ctrl+J".action = focus-monitor-down; - "Mod+Ctrl+K".action = focus-monitor-up; - "Mod+Ctrl+L".action = focus-monitor-right; - - "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; - "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down; - "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up; - "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; - "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; - "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; - "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; - "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; - - "Mod+Page_Down".action = focus-workspace-down; - "Mod+Page_Up".action = focus-workspace-up; - "Mod+U".action = focus-workspace-down; - "Mod+I".action = focus-workspace-up; - "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; - "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; - "Mod+Ctrl+U".action = move-column-to-workspace-down; - "Mod+Ctrl+I".action = move-column-to-workspace-up; - - "Mod+Shift+Page_Down".action = move-workspace-down; - "Mod+Shift+Page_Up".action = move-workspace-up; - "Mod+Shift+U".action = move-workspace-down; - "Mod+Shift+I".action = move-workspace-up; - - "Mod+Shift+WheelScrollDown" = { - action = focus-workspace-down; - cooldown-ms = 150; - }; - "Mod+Shift+WheelScrollUp" = { - action = focus-workspace-up; - cooldown-ms = 150; - }; - "Mod+Ctrl+Shift+WheelScrollDown" = { - action = move-column-to-workspace-down; - cooldown-ms = 150; - }; - "Mod+Ctrl+Shift+WheelScrollUp" = { - action = move-column-to-workspace-up; - cooldown-ms = 150; - }; - - "Mod+WheelScrollRight".action = focus-column-right; - "Mod+WheelScrollLeft".action = focus-column-left; - "Mod+Ctrl+WheelScrollRight".action = move-column-right; - "Mod+Ctrl+WheelScrollLeft".action = move-column-left; - - "Mod+WheelScrollDown".action = focus-column-right; - "Mod+WheelScrollUp".action = focus-column-left; - "Mod+Ctrl+WheelScrollDown".action = move-column-right; - "Mod+Ctrl+WheelScrollUp".action = move-column-left; - - "Mod+1".action = focus-workspace 1; - "Mod+2".action = focus-workspace 2; - "Mod+3".action = focus-workspace 3; - "Mod+4".action = focus-workspace 4; - "Mod+5".action = focus-workspace 5; - "Mod+6".action = focus-workspace 6; - "Mod+7".action = focus-workspace 7; - "Mod+8".action = focus-workspace 8; - "Mod+9".action = focus-workspace 9; - "Mod+Ctrl+1".action.move-column-to-index = 1; - "Mod+Ctrl+2".action.move-column-to-index = 2; - "Mod+Ctrl+3".action.move-column-to-index = 3; - "Mod+Ctrl+4".action.move-column-to-index = 4; - "Mod+Ctrl+5".action.move-column-to-index = 5; - "Mod+Ctrl+6".action.move-column-to-index = 6; - "Mod+Ctrl+7".action.move-column-to-index = 7; - "Mod+Ctrl+8".action.move-column-to-index = 8; - "Mod+Ctrl+9".action.move-column-to-index = 9; - - "Mod+Tab".action = focus-workspace-previous; - "Mod+Z".action = focus-workspace-previous; - "Mod+Slash".action = focus-workspace-previous; - - "Mod+BracketLeft".action = consume-or-expel-window-left; - "Mod+BracketRight".action = consume-or-expel-window-right; - - "Mod+Comma".action = consume-window-into-column; - "Mod+Period".action = expel-window-from-column; - - "Mod+R".action = switch-preset-column-width; - "Mod+Shift+R".action = switch-preset-window-height; - "Mod+Ctrl+R".action = reset-window-height; - "Mod+F".action = maximize-column; - "Mod+Shift+F".action = fullscreen-window; - "Mod+Ctrl+Shift+F".action = toggle-windowed-fullscreen; - "Mod+Ctrl+F".action = expand-column-to-available-width; - - "Mod+C".action = center-column; - "Mod+Ctrl+C".action = center-visible-columns; - - "Mod+Minus".action = set-column-width "-10%"; - "Mod+Equal".action = set-column-width "+10%"; - "Mod+Shift+Minus".action = set-window-height "-10%"; - "Mod+Shift+Equal".action = set-window-height "+10%"; - - "Mod+V".action = toggle-window-floating; - "Mod+Shift+V".action = switch-focus-between-floating-and-tiling; - "Mod+W".action = toggle-column-tabbed-display; - - "Print".action.screenshot = [ ]; - "Ctrl+Print".action.screenshot-screen = [ ]; - "Alt+Print".action.screenshot-window = [ ]; - - "Mod+Escape" = { - action = toggle-keyboard-shortcuts-inhibit; - allow-inhibiting = false; - }; - - "Mod+Shift+E".action = quit; - "Ctrl+Alt+Delete".action = quit; - "Mod+Shift+P".action = power-off-monitors; - }; - }; -} diff --git a/home-manager/niri/default.nix b/home-manager/niri/default.nix deleted file mode 100644 index a61f438..0000000 --- a/home-manager/niri/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ - flake.modules.homeManager.desktop = - { config, lib, ... }: - { - programs.niri.settings = { - input.keyboard = { - xkb.layout = "us"; - xkb.options = "ctrl:nocaps"; - repeat-rate = 50; - repeat-delay = 300; - }; - input.workspace-auto-back-and-forth = true; - - layout = { - gaps = 14; - center-focused-column = "never"; - default-column-width = { - proportion = 0.5; - }; - - focus-ring = { - enable = false; - # width = 2; - # active-color = "#ff5c8f"; - # inactive-color = "#505050"; - }; - - border.enable = false; - shadow.enable = true; - struts.left = 20; - struts.right = 20; - }; - - prefer-no-csd = true; - screenshot-path = "~/pictures/screenshots/screenshot_%Y-%m-%d_%H:%M:%S.png"; - - window-rules = [ - { - geometry-corner-radius = { - top-left = 12.; - top-right = 12.; - bottom-left = 12.; - bottom-right = 12.; - }; - clip-to-geometry = true; - } - { - matches = [ - { - app-id = "firefox$"; - title = "^Picture-in-Picture$"; - } - ]; - open-floating = true; - } - ]; - }; - }; -} diff --git a/home-manager/qutebrowser/default.nix b/home-manager/qutebrowser/default.nix deleted file mode 100644 index 7174092..0000000 --- a/home-manager/qutebrowser/default.nix +++ /dev/null @@ -1,137 +0,0 @@ -{ config, ... }: -{ - flake.modules.homeManager.desktop.programs.qutebrowser = { - enable = true; - loadAutoconfig = true; - aliases = { - q = "quit"; - w = "session-save"; - wq = "quit --save"; - x = "quit --save"; - h = "help"; - }; - - keyBindings = - let - qutePass = builtins.concatStringsSep " " [ - "qute-pass --username-target secret" - "--username-pattern '(?:username|email): (.+)'" - "--dmenu-invocation 'fuzzel --dmenu'" - ]; - in - { - normal = { - "ge" = "scroll-to-perc"; - ",d" = "hint all delete"; - ",r" = "cmd-set-text :open {url:domain}/"; - ",R" = "cmd-set-text :open -t {url:domain}/"; - "xP" = "open -b -- {primary}"; - "xp" = "open -b -- {clipboard}"; - "pw" = "open https://en.wikipedia.org/wiki/Special:Search?search={primary}"; - "Pw" = "open -t https://en.wikipedia.org/wiki/Special:Search?search={primary}"; - "PW" = "open -b https://en.wikipedia.org/wiki/Special:Search?search={primary}"; - ";x" = "hint links spawn -dv umpv --profile=no-term {hint-url}"; - ";X" = "hint links spawn -dv mpv --profile=no-term {hint-url}"; - "xx" = "spawn -dv umpv --profile=no-term {url}"; - "xX" = "spawn -dv mpv --profile=no-term {url}"; - - "" = "cmd-run-with-count 2 scroll down"; - "" = "cmd-run-with-count 2 scroll up"; - "zl" = "spawn --userscript ${qutePass}"; - "zul" = "spawn --userscript ${qutePass} --username-only"; - "zpl" = "spawn --userscript ${qutePass} --password-only"; - }; - command = { - "" = "rl-rubout ' /'"; - }; - prompt = { - "" = "rl-rubout ' /'"; - }; - }; - - settings = { - confirm_quit = [ "downloads" ]; - - new_instance_open_target = "tab-silent"; - new_instance_open_target_window = "last-focused"; - - window.hide_decoration = false; - - editor.command = [ - "ghostty" - "-e" - "hx" - "{file}:{line}:{column0}" - ]; - - fileselect = { - handler = "external"; - single_file.command = [ - "ghostty" - "-e" - "ranger" - "--choosefile={}" - ]; - multiple_files.command = [ - "ghostty" - "-e" - "ranger" - "--choosefiles={}" - ]; - folder.command = [ - "ghostty" - "-e" - "ranger" - "--choosedir={}" - ]; - }; - - auto_save.session = true; - - content.autoplay = false; - content.pdfjs = true; - - completion = { - shrink = true; - scrollbar.width = 0; - scrollbar.padding = 0; - open_categories = [ - "quickmarks" - "bookmarks" - "history" - "filesystem" - ]; - }; - - hints.auto_follow = "always"; - hints.mode = "letter"; - - tabs = { - background = true; - favicons.scale = 0.9; - last_close = "close"; - mode_on_change = "restore"; - show = "multiple"; - indicator.width = 0; - }; - - url.open_base_url = true; - - fonts = { - default_family = [ - config.local.appFont - "monospace" - ]; - default_size = "14pt"; - - hints = "bold 13pt default_family"; - prompts = "13pt sans_serif"; - }; - }; - - extraConfig = - ''c.tabs.padding = { "bottom": 4, "left": 3, "right": 3, "top": 4 }'' - # TODO move to nix - + builtins.readFile ./colors.py; - }; -} diff --git a/home-manager/ripgrep.nix b/home-manager/ripgrep.nix deleted file mode 100644 index ceb4be9..0000000 --- a/home-manager/ripgrep.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - flake.modules.homeManager.core = - { config, pkgs, ... }: - { - home.packages = [ pkgs.ripgrep ]; - - home.sessionVariables.RIPGREP_CONFIG_PATH = "${config.xdg.configHome}/ripgrep/config"; - - xdg.configFile."ripgrep/config".text = "--smart-case"; - }; -} diff --git a/home-manager/ruan.nix b/home-manager/ruan.nix deleted file mode 100644 index 32423a7..0000000 --- a/home-manager/ruan.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ self, ... }: -{ - flake.modules.homeManager.ruan = - { pkgs, ... }: - { - imports = [ - self.modules.homeManager.desktop - self.modules.homeManager.firefox - ]; - - programs.niri.settings.outputs."HDMI-A-3".scale = 2.0; - }; -} diff --git a/home-manager/standalone.nix b/home-manager/standalone.nix deleted file mode 100644 index 07ac58e..0000000 --- a/home-manager/standalone.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ self, inputs, ... }: -{ - flake.modules.homeManager.standalone = { - imports = [ self.modules.homeManager.core ]; - home.stateVersion = "25.05"; - nix.registry = builtins.mapAttrs (_: flake: { inherit flake; }) inputs; - }; -} diff --git a/home-manager/typos.nix b/home-manager/typos.nix deleted file mode 100644 index 98accad..0000000 --- a/home-manager/typos.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - flake.modules.homeManager.core.programs.fish.shellAbbrs = - builtins.mapAttrs - (_: replacement: { - position = "anywhere"; - expansion = replacement; - }) - { - suod = "sudo"; - shwo = "show"; - hsow = "show"; - conifg = "config"; - eanble = "enable"; - udpate = "update"; - }; -} diff --git a/home-manager/valleria.nix b/home-manager/valleria.nix deleted file mode 100644 index f9cb58d..0000000 --- a/home-manager/valleria.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ self, ... }: -{ - local.homeConfigurations.valleria = self.modules.homeManager.valleria; - - flake.modules.homeManager.valleria = - { pkgs, ... }: - { - imports = [ - self.modules.homeManager.desktop - self.modules.homeManager.firefox - ]; - - home.username = "peter"; - home.homeDirectory = "/home/peter"; - - programs.firefox.package = null; - - services.mpris-proxy.enable = true; - }; -} diff --git a/home-manager/wayland.nix b/home-manager/wayland.nix deleted file mode 100644 index b90c6b0..0000000 --- a/home-manager/wayland.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ config, ... }: -{ - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - home.packages = with pkgs; [ - imv - xdg-utils - wl-clipboard - libnotify - dmenu-wayland - swaylock - playerctl - pulsemixer - rofimoji - ]; - - home.pointerCursor = { - package = pkgs.vanilla-dmz; - name = "Vanilla-DMZ"; - gtk.enable = true; - dotIcons.enable = false; - }; - - programs = { - mpv.profiles.standard.gpu-context = "wayland"; - fuzzel.enable = true; - fuzzel.settings = { - main = { - font = "${config.local.appFont}:size=14"; - terminal = "${pkgs.ghostty}/bin/ghostty -e"; - }; - # colors = {}; - }; - }; - - services = { - mako = with config.local.colors; { - enable = true; - settings = { - font = "${config.local.appFont} 14"; - background-color = brightBlue; - border-color = blue; - text-color = xgray1; - }; - }; - - clipman.enable = true; - clipman.systemdTarget = "graphical-session.target"; - - playerctld.enable = true; - }; - }; -} diff --git a/home-manager/xdg.nix b/home-manager/xdg.nix deleted file mode 100644 index ce8182d..0000000 --- a/home-manager/xdg.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - flake.modules.nixos.core = - { config, ... }: - { - environment.sessionVariables = { - XDG_CONFIG_HOME = "$HOME/.local/config"; - XDG_CACHE_HOME = "$HOME/.local/cache"; - }; - }; - flake.modules.homeManager.core = - { config, pkgs, ... }: - let - inherit (config.home) homeDirectory; - inherit (config.xdg) dataHome stateHome; - in - { - xdg.configHome = "${homeDirectory}/.local/config"; - xdg.cacheHome = "${homeDirectory}/.local/cache"; - xdg.userDirs = { - enable = pkgs.stdenv.hostPlatform.isLinux; - desktop = "${homeDirectory}/desktop"; - documents = "${homeDirectory}/documents"; - download = "${homeDirectory}/downloads"; - music = "${homeDirectory}/music"; - pictures = "${homeDirectory}/pictures"; - publicShare = "${homeDirectory}/public"; - templates = "${homeDirectory}/templates"; - videos = "${homeDirectory}/videos"; - }; - - home.preferXdgDirectories = true; - home.sessionVariables = { - CARGO_HOME = "${dataHome}/cargo"; - CARGO_INSTALL_ROOT = "${homeDirectory}/.local"; - HISTFILE = "${stateHome}/bash/history"; - LESSHISTFILE = "${stateHome}/less/history"; - }; - }; -} diff --git a/hosts/arseille/default.nix b/hosts/arseille/default.nix index fe0a0de..d6ca90c 100644 --- a/hosts/arseille/default.nix +++ b/hosts/arseille/default.nix @@ -9,11 +9,7 @@ inputs.nix-on-droid.overlays.default ]; }; - home-manager-path = inputs.home-manager.outPath; - modules = [ - inputs.self.modules.nixOnDroid.arseille - { home-manager.config = inputs.self.modules.homeManager.arseille; } - ]; + modules = [ inputs.self.modules.nixOnDroid.arseille ]; } ); } diff --git a/hosts/arseille/system.nix b/hosts/arseille/system.nix index 68a9471..94a80ee 100644 --- a/hosts/arseille/system.nix +++ b/hosts/arseille/system.nix @@ -28,10 +28,5 @@ gawk rsync ]; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - }; }; } diff --git a/hosts/grancel/home.nix b/hosts/grancel/home.nix new file mode 100644 index 0000000..141a26e --- /dev/null +++ b/hosts/grancel/home.nix @@ -0,0 +1,32 @@ +{ self, ... }: +{ + flake.modules.hjem.grancel = + { pkgs, ... }: + { + imports = [ + self.modules.hjem.desktop + self.modules.hjem.firefox + ]; + + packages = with pkgs; [ + (prismlauncher.override { jdks = [ jdk ]; }) + (spotifyd.override { withMpris = true; }) + sptlrx + ]; + + niri.extraConfig = ''output "HDMI-A-2" { variable-refresh-rate; }''; + + systemd.services.mpris-proxy = { + unitConfig = { + Description = "Proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players"; + BindsTo = [ "bluetooth.target" ]; + After = [ "bluetooth.target" ]; + }; + wantedBy = [ "bluetooth.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + }; + }; +} diff --git a/hosts/jurai/default.nix b/hosts/jurai/default.nix index 1e88617..80f1358 100644 --- a/hosts/jurai/default.nix +++ b/hosts/jurai/default.nix @@ -2,16 +2,19 @@ { local.hosts.jurai = { }; + flake.modules.hjem.jurai.niri.extraConfig = ''output "winit" { scale 2.0; }''; + flake.modules.nixos.jurai = { lib, pkgs, ... }: let onMacos = pkgs.stdenv.hostPlatform.system == "aarch64-linux"; in { - imports = with inputs.self.modules.nixos; [ - desktop - kde + imports = [ + inputs.self.modules.nixos.desktop + inputs.self.modules.nixos.kde ]; + hjem.extraModules = [ inputs.self.modules.hjem.desktop ]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/home-manager/jurai.nix b/hosts/macbook.nix similarity index 55% rename from home-manager/jurai.nix rename to hosts/macbook.nix index ca4241f..f928acf 100644 --- a/home-manager/jurai.nix +++ b/hosts/macbook.nix @@ -1,26 +1,8 @@ { self, inputs, ... }: { - flake.modules.homeManager.jurai.imports = [ self.modules.homeManager.desktop ]; - flake.modules.homeManager.jurai.programs.niri.settings.outputs."winit".scale = 2.0; - - local.homeConfigurations.jurai = self.modules.homeManager.macbook; - flake.modules.homeManager.macbook = - { pkgs, ... }: - { - home = { - username = "price"; - homeDirectory = "/Users/price"; - }; - - home.packages = with pkgs; [ - uutils-coreutils-noprefix - sarasa-gothic - fantasque-sans-mono - ]; - - programs.git.userEmail = "price@hubspot.com"; - programs.jujutsu.settings.user.email = "price@hubspot.com"; - }; + flake.darwinConfigurations.jurai = inputs.nix-darwin.lib.darwinSystem { + modules = [ self.modules.darwin.default ]; + }; flake.modules.darwin.default = { pkgs, ... }: @@ -33,9 +15,24 @@ system.startup.chime = false; system.stateVersion = 6; nixpkgs.hostPlatform = "aarch64-darwin"; + hjem.extraModules = [ + self.modules.hjem.core + self.modules.hjem.macbook + ]; }; - flake.darwinConfigurations.jurai = inputs.nix-darwin.lib.darwinSystem { - modules = [ self.modules.darwin.default ]; - }; + flake.modules.hjem.macbook = + { pkgs, ... }: + { + directory = "/Users/price"; + + packages = with pkgs; [ + uutils-coreutils-noprefix + sarasa-gothic + fantasque-sans-mono + ]; + + xdg.config.files."git/config".value.user.email = "price@hubspot.com"; + xdg.config.files."jj/config.toml".value.user.email = "price@hubspot.com"; + }; } diff --git a/hosts/ruan/default.nix b/hosts/ruan/default.nix index ffb8752..c8e2fa1 100644 --- a/hosts/ruan/default.nix +++ b/hosts/ruan/default.nix @@ -2,6 +2,8 @@ { local.hosts.ruan = { }; + flake.modules.hjem.ruan.niri.extraConfig = ''output "HDMI-A-3" { scale 2.0; }''; + flake.modules.nixos.ruan = { config, @@ -16,6 +18,11 @@ inputs.podcasts.nixosModules.default ]; + hjem.extraModules = [ + inputs.self.modules.hjem.desktop + inputs.self.modules.hjem.firefox + ]; + programs.steam.enable = true; boot.loader.systemd-boot.enable = true; diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix index e1dd889..46e4155 100644 --- a/modules/bluetooth.nix +++ b/modules/bluetooth.nix @@ -5,5 +5,17 @@ hardware.bluetooth.enable = true; environment.systemPackages = [ pkgs.bluetuith ]; environment.persistence.nixos.directories = [ "/var/lib/bluetooth" ]; + systemd.user.services.mpris-proxy = { + unitConfig = { + Description = "Proxy Bluetooth Controls via MPRIS"; + BindsTo = [ "bluetooth.target" ]; + After = [ "bluetooth.target" ]; + }; + wantedBy = [ "bluetooth.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + }; }; } diff --git a/modules/cli/bat.nix b/modules/cli/bat.nix new file mode 100644 index 0000000..9e7ab2f --- /dev/null +++ b/modules/cli/bat.nix @@ -0,0 +1,21 @@ +{ inputs, ... }: +{ + flake.modules.hjem.core = + { pkgs, ... }: + { + packages = with pkgs; [ + bat + bat-extras.batgrep + bat-extras.batman + ]; + + xdg.config.files."bat/config".text = "--theme-dark=srcery"; + xdg.config.files."bat/themes/srcery.tmTheme".source = "${inputs.srcery-textmate}/srcery.tmTheme"; + environment.sessionVariables.MANPAGER = toString ( + pkgs.writeShellScript "batman" '' + awk '{ gsub(/\x1B\[[0-9;]*m/, "", $0); gsub(/.\x08/, "", $0); print }' \ + | bat --plain --language man + '' + ); + }; +} diff --git a/modules/cli/beets.nix b/modules/cli/beets.nix new file mode 100644 index 0000000..a6facf6 --- /dev/null +++ b/modules/cli/beets.nix @@ -0,0 +1,27 @@ +{ + flake.modules.hjem.ruan = + { pkgs, ... }: + { + packages = [ pkgs.beets ]; + xdg.config.files."beets/config.yaml".text = '' + directory: "~/music" + library: "~/.local/state/beets/library.db" + plugins: [ + "random", + "scrub", + "ftintitle", + "fetchart", + "chroma", + ] + original_date: yes + from_scratch: yes + match: + preferred: + countries: [ "XW", "US", "JP" ] + media: [ "Digital Media|File", "CD" ] + original_year: yes + scrub: + auto: yes + ''; + }; +} diff --git a/home-manager/common.nix b/modules/cli/core.nix similarity index 56% rename from home-manager/common.nix rename to modules/cli/core.nix index ea5bced..ae1a484 100644 --- a/home-manager/common.nix +++ b/modules/cli/core.nix @@ -1,10 +1,8 @@ { - flake.modules.homeManager.core = - { pkgs, ... }: + flake.modules.hjem.core = + { lib, pkgs, ... }: { - programs.home-manager.enable = true; - - home.packages = with pkgs; [ + packages = with pkgs; [ fd moor nvd @@ -12,14 +10,16 @@ nix-output-monitor duf dust + bottom + zoxide (ranger.override { imagePreviewSupport = false; sixelPreviewSupport = false; }) ]; - home.sessionVariables = { - PAGER = "${pkgs.moor}/bin/moor"; + environment.sessionVariables = { + PAGER = "moor"; MOOR = builtins.concatStringsSep " " [ "-quit-if-one-screen" "-statusbar=bold" @@ -29,12 +29,5 @@ "-terminal-fg" ]; }; - - home.language.base = "en-US.UTF-8"; - - home.shellAliases.bell = "echo \\a"; - - programs.bottom.enable = true; - programs.zoxide.enable = true; }; } diff --git a/modules/cli/direnv.nix b/modules/cli/direnv.nix new file mode 100644 index 0000000..d186ab1 --- /dev/null +++ b/modules/cli/direnv.nix @@ -0,0 +1,9 @@ +{ + flake.modules.hjem.desktop = + { pkgs, ... }: + { + packages = [ pkgs.direnv ]; + fish.interactiveShellInit = "${pkgs.direnv}/bin/direnv hook fish | source"; + xdg.config.files."direnv/lib/nix-direnv.sh".source = "${pkgs.nix-direnv}/share/nix-direnv/direnvrc"; + }; +} diff --git a/modules/cli/eza.nix b/modules/cli/eza.nix new file mode 100644 index 0000000..afd741a --- /dev/null +++ b/modules/cli/eza.nix @@ -0,0 +1,22 @@ +{ + flake.modules.hjem.core = + { config, pkgs, ... }: + { + packages = [ pkgs.eza ]; + + fish.interactiveShellInit = # fish + '' + function eza --wraps=eza + command eza --git $argv + end + abbr -a e 'eza -l' + abbr -a ea 'eza -la' + abbr -a er 'eza -ls modified' + abbr -a et 'eza -T' + abbr -a ls 'eza' + abbr -a l 'eza -l' + abbr -a ll 'eza -l' + abbr -a la 'eza -la' + ''; + }; +} diff --git a/modules/cli/fish/default.nix b/modules/cli/fish/default.nix new file mode 100644 index 0000000..be4aa17 --- /dev/null +++ b/modules/cli/fish/default.nix @@ -0,0 +1,123 @@ +{ inputs, lib, ... }: +{ + flake.modules.nixos.core = + { pkgs, ... }: + { + programs.fish.enable = true; + programs.fish.useBabelfish = true; + users.defaultUserShell = pkgs.fish; + }; + + flake.modules.hjem.core = + { config, pkgs, ... }: + let + cfg = config.fish; + writeFish = + name: content: + pkgs.runCommandLocal name + { + inherit content; + passAsFile = [ "content" ]; + } + '' + ${pkgs.fish}/bin/fish --no-config --no-execute "$contentPath" + ${pkgs.fish}/bin/fish_indent < "$contentPath" > $out 2> /dev/null + ''; + mkFunction = name: text: { + name = "fish/functions/${name}.fish"; + value.source = writeFish "${name}.fish" '' + function ${name} + ${text} + end + ''; + }; + mkWrapper = wraps: name: text: { + name = "fish/functions/${name}.fish"; + value.source = writeFish "${name}.fish" '' + function ${name} --wraps='${wraps}' + ${text} + end + ''; + }; + in + { + options.fish = with lib.types; { + interactiveShellInit = lib.mkOption { + type = lines; + default = ""; + }; + functions = lib.mkOption { + type = attrsOf str; + default = { }; + }; + wrappers = lib.mkOption { + type = attrsOf (attrsOf str); + default = { }; + }; + }; + + config.packages = with pkgs; [ + fish + (fishPlugins.buildFishPlugin { + pname = "fish-prompt-pvsr"; + src = inputs.fish-prompt-pvsr; + version = inputs.fish-prompt-pvsr.shortRev; + }) + ]; + + config.xdg.config.files = { + "fish/conf.d/env.fish".text = lib.concatMapAttrsStringSep "\n" ( + name: value: "set -gx ${lib.escapeShellArg name} ${lib.escapeShellArg (toString value)}" + ) config.environment.sessionVariables; + "fish/conf.d/zoxide.fish".source = pkgs.runCommandLocal "zoxide.fish" { } '' + echo 'status is-interactive; or exit' > $out + ${pkgs.zoxide}/bin/zoxide init fish >> $out + ''; + "fish/themes/magenta.theme".source = ./magenta.theme; + "fish/config.fish".source = writeFish "config.fish" '' + status is-interactive; or exit + set -g fish_greeting + set -g fish_key_bindings fish_hybrid_key_bindings + bind -M insert ctrl-n down-or-search + set -g fish_cursor_default block + set -g fish_cursor_insert line + set -g fish_cursor_replace_one underscore + + abbr -a --position anywhere -- \ + nn '--log-format internal-json -v 2&| nom --json' + abbr -a --position anywhere --set-cursor -- \ + .c/ '$XDG_CONFIG_HOME/%' + + abbr -a sc 'systemctl' + abbr -a ssc 'sudo systemctl' + abbr -a scu 'systemctl --user' + abbr -a jc 'journalctl' + abbr -a jce 'journalctl -e' + abbr -a jcf 'journalctl -f' + abbr -a jcu 'journalctl -u' + abbr -a jcm 'sudo journalctl -M' + + ${cfg.interactiveShellInit} + ''; + } + // lib.mapAttrs' mkFunction { + session = # fish + '' + if set -q argv[1] + set -gx fish_history $argv[1] + set data_dir "$HOME/.local/share/zoxide/sessions/$argv[1]" + mkdir -p $data_dir + and set -gx _ZO_DATA_DIR "$data_dir" + pushd (zoxide query 2> /dev/null; or echo .) + else + set -ge fish_history + set -ge _ZO_DATA + popd 2> /dev/null + end + ''; + fish_mode_prompt = ""; + } + // lib.mapAttrs' mkFunction cfg.functions + // lib.concatMapAttrs (wrapped: lib.mapAttrs' (mkWrapper wrapped)) cfg.wrappers; + }; +} diff --git a/home-manager/fish/magenta.theme b/modules/cli/fish/magenta.theme similarity index 100% rename from home-manager/fish/magenta.theme rename to modules/cli/fish/magenta.theme diff --git a/modules/cli/fish/typos.nix b/modules/cli/fish/typos.nix new file mode 100644 index 0000000..b62ff5d --- /dev/null +++ b/modules/cli/fish/typos.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +{ + flake.modules.hjem.core.fish.interactiveShellInit = + lib.concatMapAttrsStringSep "\n" (typo: fix: "abbr --add --position anywhere -- ${typo} ${fix}") + { + suod = "sudo"; + shwo = "show"; + hsow = "show"; + conifg = "config"; + eanble = "enable"; + udpate = "update"; + }; +} diff --git a/home-manager/fzf.nix b/modules/cli/fzf.nix similarity index 84% rename from home-manager/fzf.nix rename to modules/cli/fzf.nix index bce6228..e31b5f0 100644 --- a/home-manager/fzf.nix +++ b/modules/cli/fzf.nix @@ -1,9 +1,9 @@ { inputs, ... }: { - flake.modules.homeManager.core = + flake.modules.hjem.core = { pkgs, ... }: { - home.packages = with pkgs; [ + packages = with pkgs; [ (fzf.overrideAttrs (oldAttrs: { postInstall = '' ${oldAttrs.postInstall or ""} @@ -17,7 +17,7 @@ }) ]; - home.sessionVariables.FZF_DEFAULT_OPTS = builtins.concatStringsSep " " [ + environment.sessionVariables.FZF_DEFAULT_OPTS = builtins.concatStringsSep " " [ "--bind=${ builtins.concatStringsSep "," [ "ctrl-j:accept" diff --git a/modules/cli/git.nix b/modules/cli/git.nix new file mode 100644 index 0000000..e6aa867 --- /dev/null +++ b/modules/cli/git.nix @@ -0,0 +1,49 @@ +{ lib, ... }: +let + settings = { + user.name = "Peter Rice"; + user.email = lib.mkDefault "peterrice@fastmail.com"; + init.defaultBranch = "main"; + commit.verbose = true; + interactive.singleKey = true; + diff.algorithm = "patience"; + merge.conflictstyle = "zdiff3"; + pull.rebase = true; + push.default = "current"; + rebase.autostash = true; + rebase.autosquash = true; + rebase.updateRefs = true; + branch.autoSetupRebase = "always"; + branch.sort = "-committerdate"; + url."git@github.com:".insteadOf = "github:"; + }; +in +{ + flake.modules.hjem.core = + { pkgs, ... }: + { + packages = [ + pkgs.git + pkgs.fishPlugins.plugin-git + ]; + + xdg.config.files = { + "git/config" = { + generator = lib.generators.toGitINI; + value = settings; + }; + "git/ignore".text = '' + .envrc + .direnv + result* + ''; + }; + + fish.interactiveShellInit = '' + __git.init + abbr gcp 'git commit -p' + abbr gcp! 'git commit -p --amend' + abbr gcpn! 'git commit -p --no-edit --amend' + ''; + }; +} diff --git a/modules/cli/helix/default.nix b/modules/cli/helix/default.nix new file mode 100644 index 0000000..10dc123 --- /dev/null +++ b/modules/cli/helix/default.nix @@ -0,0 +1,108 @@ +{ lib, ... }: +let + settings = { + theme.dark = "srcery"; + theme.light = "rose_pine_dawn"; + editor = { + line-number = "relative"; + scrolloff = 2; + rulers = [ 80 ]; + color-modes = true; + rainbow-brackets = true; + bufferline = "multiple"; + soft-wrap.enable = true; + smart-tab.supersede-menu = true; + whitespace.render.tab = "all"; + whitespace.render.newline = "all"; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + lsp.display-inlay-hints = true; + end-of-line-diagnostics = "hint"; + inline-diagnostics.cursor-line = "hint"; + }; + keys.insert = { + C-p = "move_line_up"; + C-n = "move_line_down"; + C-f = "move_char_right"; + C-b = "move_char_left"; + C-a = "goto_first_nonwhitespace"; + C-e = "goto_line_end_newline"; + C-c = "toggle_comments"; + C-t = "indent"; + C-g = "unindent"; + C-backspace = "delete_word_backward"; + }; + keys.normal.minus = "file_explorer_in_current_buffer_directory"; + }; + srcery = { + inherits = "gruvbox"; + "ui.virtual.jump-label" = { + bg = "bg2"; + modifiers = [ "bold" ]; + }; + "ui.bufferline.active".bg = "bg3"; + palette = { + bg0 = "#1c1b19"; + bg1 = "#262626"; + bg2 = "#303030"; + bg3 = "#3a3a3a"; + bg4 = "#444444"; + + fg0 = "#fce8c3"; + fg1 = "#fce8c3"; + fg2 = "#baa67f"; + fg3 = "#baa67f"; + fg4 = "#918175"; + + gray0 = "#918175"; + gray1 = "#585858"; + + red0 = "#ef2f27"; + red1 = "#f75341"; + green0 = "#519f50"; + green1 = "#98bc37"; + yellow0 = "#fbb829"; + yellow1 = "#fed06e"; + blue0 = "#2c78bf"; + blue1 = "#68a8e4"; + purple0 = "#e02c6d"; + purple1 = "#ff5c8f"; + aqua0 = "#0aaeb3"; + aqua1 = "#2be4d0"; + orange0 = "#ff5f00"; + orange1 = "#ff8700"; + }; + }; +in +{ + flake.modules.hjem.core = + { config, pkgs, ... }: + let + cfg = config.helix; + toml = pkgs.formats.toml { }; + mkToml = path: value: { + generator = toml.generate path; + inherit value; + }; + in + { + options.helix.languages = lib.mkOption { + type = toml.type; + default = { }; + }; + + config.packages = [ pkgs.helix ]; + config.xdg.config.files = builtins.mapAttrs mkToml ({ + "helix/config.toml" = settings; + "helix/languages.toml" = cfg.languages; + "helix/themes/srcery.toml" = srcery; + }); + config.environment.sessionVariables = { + EDITOR = "hx"; + VISUAL = "hx"; + }; + }; +} diff --git a/home-manager/helix/fish.nix b/modules/cli/helix/fish.nix similarity index 81% rename from home-manager/helix/fish.nix rename to modules/cli/helix/fish.nix index 9028e9c..7ac6ef8 100644 --- a/home-manager/helix/fish.nix +++ b/modules/cli/helix/fish.nix @@ -1,8 +1,8 @@ { - flake.modules.homeManager.core = + flake.modules.hjem.core = { pkgs, ... }: { - programs.helix.languages = { + helix.languages = { language = [ { name = "fish"; diff --git a/home-manager/helix/janet.nix b/modules/cli/helix/janet.nix similarity index 77% rename from home-manager/helix/janet.nix rename to modules/cli/helix/janet.nix index ff96498..a7a2a65 100644 --- a/home-manager/helix/janet.nix +++ b/modules/cli/helix/janet.nix @@ -1,5 +1,5 @@ { - flake.modules.homeManager.core.programs.helix.languages = { + flake.modules.hjem.core.helix.languages = { language = [ { name = "janet"; diff --git a/home-manager/helix/nix.nix b/modules/cli/helix/nix.nix similarity index 59% rename from home-manager/helix/nix.nix rename to modules/cli/helix/nix.nix index aab618e..620f7f8 100644 --- a/home-manager/helix/nix.nix +++ b/modules/cli/helix/nix.nix @@ -1,5 +1,5 @@ { - flake.modules.homeManager.core.programs.helix.languages.language = [ + flake.modules.hjem.core.helix.languages.language = [ { name = "nix"; formatter.command = "nixfmt"; diff --git a/home-manager/helix/python.nix b/modules/cli/helix/python.nix similarity index 81% rename from home-manager/helix/python.nix rename to modules/cli/helix/python.nix index e7bb818..c8f3c8e 100644 --- a/home-manager/helix/python.nix +++ b/modules/cli/helix/python.nix @@ -1,5 +1,5 @@ { - flake.modules.homeManager.core.programs.helix.languages = { + flake.modules.hjem.core.helix.languages = { language = [ { name = "python"; diff --git a/modules/cli/jujutsu.nix b/modules/cli/jujutsu.nix new file mode 100644 index 0000000..1530f1f --- /dev/null +++ b/modules/cli/jujutsu.nix @@ -0,0 +1,111 @@ +{ lib, ... }: +let + settings = { + user = { + name = "Peter Rice"; + email = lib.mkDefault "peterrice@fastmail.com"; + }; + ui.default-command = "log"; + ui.diff-formatter = ":git"; + templates.draft_commit_description = '' + concat( + description, + separate("\n", + "\nJJ: This commit contains the following changes:", + indent("JJ: ", diff.summary()), + "JJ: ignore-rest", + diff.git(), + ) + ) + ''; + template-aliases.shell_prompt = '' + separate(" ", + concat("(", + self.parents().map(|parent| parent.change_id().shortest()).join("/"), + " -> ", + format_short_change_id_with_change_offset(self), + ")", + ), + bookmarks, + tags, + if(conflict, label("conflict", "×")), + if(empty, label("empty", "(empty)")), + if(description, + concat("(", description.first_line(), ")"), + if(!empty, description_placeholder), + ), + ) + ''; + template-aliases."in_branch(commit)" = "commit.contained_in(\"immutable_heads()..bookmarks()\")"; + templates.log_node = '' + if(self && !current_working_copy && !immutable && !conflict && in_branch(self), + "◇", + builtin_log_node + ) + ''; + }; + path = "jj/config.toml"; +in +{ + flake.modules.hjem.core = + { pkgs, ... }: + { + packages = [ pkgs.jujutsu ]; + xdg.config.files.${path} = { + generator = (pkgs.formats.toml { }).generate path; + value = settings; + }; + + fish.interactiveShellInit = # fish + '' + abbr -a j 'jj' + abbr -a js 'jj show' + ''; + fish.functions.fish_vcs_prompt = # fish + '' + fish_jj_prompt $argv; or fish_git_prompt $argv; or fish_hg_prompt $argv + ''; + fish.functions.fish_jj_prompt = # fish + '' + if not command -sq jj + return 1 + end + set -l info "$(jj log \ + --ignore-working-copy \ + --revisions @ \ + --no-graph \ + --color=always \ + --template shell_prompt \ + 2>/dev/null)" + or return 1 + if test -n "$info" + printf ' %s' $info + end + ''; + fish.wrappers."jj show".summarize = # fish + '' + set recent (jj log --no-graph \ + -r 'ancestors(immutable_heads(), 12) & ~description("flake.lock")' \ + -T 'separate("\n", + format_short_commit_id(self.commit_id()), + self.description())' \ + | string collect) + jj show --no-pager --context 12 $argv[1] >&2 + jj show --no-pager --context 12 $argv[1] |\ + llm -s "Write a one-line commit message for these changes. It \ + should be under 50 characters. If 50 characters is not enough to \ + express the main point of the changes you may continue to write \ + one or more paragraphs describing the changes, which should be \ + wrapped at 80 characters. + + It should match the style of these recent commit messages in the \ + same repository, which are each prefixed by a hexadecimal commit \ + id and a newline: + $recent + + Write the commit message with no commentary, as if the output \ + were going straight into the commit + " | tee /dev/tty | jj desc --stdin --editor $argv[1] + ''; + }; +} diff --git a/home-manager/notes.nix b/modules/cli/notes.nix similarity index 63% rename from home-manager/notes.nix rename to modules/cli/notes.nix index 95e6e39..3dc147b 100644 --- a/home-manager/notes.nix +++ b/modules/cli/notes.nix @@ -1,13 +1,10 @@ { - flake.modules.homeManager.grancel = + flake.modules.hjem.grancel = { lib, pkgs, ... }: { - programs.fish.shellAbbrs.notes = { - expansion = "hx ~/notes/%"; - setCursor = true; - }; - systemd.user = { - services.commit-notes.Service = { + fish.interactiveShellInit = "abbr --add --set-cursor -- notes 'hx ~/notes/%'"; + systemd = { + services.commit-notes.serviceConfig = { Type = "oneshot"; ExecStart = pkgs.writers.writeFish "commit-notes" '' test -d notes; or exit 0 @@ -18,11 +15,11 @@ ''; }; timers.commit-notes = { - Timer = { + timerConfig = { OnCalendar = "daily"; Persistent = true; }; - Install.WantedBy = [ "timers.target" ]; + wantedBy = [ "timers.target" ]; }; }; }; diff --git a/modules/cli/pass.nix b/modules/cli/pass.nix new file mode 100644 index 0000000..635cfe5 --- /dev/null +++ b/modules/cli/pass.nix @@ -0,0 +1,29 @@ +{ + flake.modules.nixos.grancel = + { pkgs, ... }: + { + programs.gnupg.agent.enable = true; + programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses; + programs.gnupg.agent.settings = { + default-cache-ttl-ssh = 3 * 60 * 60; + max-cache-ttl = 8 * 60 * 60; + }; + }; + + flake.modules.hjem.grancel = + { config, pkgs, ... }: + { + packages = [ + pkgs.pass + pkgs.gnupg + ]; + + environment.sessionVariables.PASSWORD_STORE_DIR = "${config.xdg.data.directory}/password-store"; + environment.sessionVariables.GNUPGHOME = "${config.xdg.data.directory}/gnupg"; + + fish.interactiveShellInit = '' + set -gx GPG_TTY (tty) + ${pkgs.gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null + ''; + }; +} diff --git a/modules/cli/ripgrep.nix b/modules/cli/ripgrep.nix new file mode 100644 index 0000000..cce6bce --- /dev/null +++ b/modules/cli/ripgrep.nix @@ -0,0 +1,11 @@ +{ + flake.modules.hjem.core = + { config, pkgs, ... }: + { + packages = [ pkgs.ripgrep ]; + + xdg.config.files."ripgrep/config".text = "--smart-case"; + + environment.sessionVariables.RIPGREP_CONFIG_PATH = "${config.xdg.config.directory}/ripgrep/config"; + }; +} diff --git a/home-manager/tasks.nix b/modules/cli/tasks.nix similarity index 81% rename from home-manager/tasks.nix rename to modules/cli/tasks.nix index 97407ca..2034573 100644 --- a/home-manager/tasks.nix +++ b/modules/cli/tasks.nix @@ -1,13 +1,13 @@ { - flake.modules.homeManager.grancel = + flake.modules.hjem.grancel = { pkgs, ... }: { - home.packages = with pkgs; [ + packages = with pkgs; [ todoman vdirsyncer ]; - xdg.configFile."vdirsyncer/config".text = '' + xdg.config.files."vdirsyncer/config".text = '' [general] status_path = "~/.local/share/vdirsyncer/status/" @@ -29,7 +29,7 @@ password.fetch = ["command", "pass", "show", "calendar.peterrice.xyz"] ''; - xdg.configFile."todoman/config.py".text = '' + xdg.config.files."todoman/config.py".text = '' path = "~/.local/share/calendars/*" default_list = "work" default_due = 0 diff --git a/modules/desktop.nix b/modules/desktop.nix index 59d71c5..dc46c43 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -1,17 +1,43 @@ { inputs, ... }: { - flake.modules.nixos.desktop = + flake.modules.nixos.desktop = { + imports = [ + inputs.self.modules.nixos.yggdrasil-client + inputs.srvos.nixosModules.desktop + ]; + + nix.extraOptions = "keep-outputs = true"; + boot.tmp = { + useTmpfs = true; + tmpfsSize = "75%"; + }; + + services.lorri.enable = true; + }; + + flake.modules.hjem.desktop = { pkgs, ... }: { - imports = [ - inputs.self.modules.nixos.yggdrasil-client - inputs.srvos.nixosModules.desktop + packages = with pkgs; [ + git-annex + moreutils + ouch + tig + jq + nix-index + manix + tealdeer + sd + diceware + transmission_4 + nvtopPackages.amd + (pkgs.symlinkJoin { + name = "timg-wrapped"; + paths = [ pkgs.timg ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = "wrapProgram $out/bin/timg --add-flags '-pk'"; + }) + inputs.qbpm.packages.${pkgs.stdenv.hostPlatform.system}.qbpm ]; - - nix.extraOptions = "keep-outputs = true"; - boot.tmp = { - useTmpfs = true; - tmpfsSize = "75%"; - }; }; } diff --git a/modules/desktop/darkman.nix b/modules/desktop/darkman.nix new file mode 100644 index 0000000..127fe8c --- /dev/null +++ b/modules/desktop/darkman.nix @@ -0,0 +1,70 @@ +{ lib, ... }: +let + modeToggleService = lib.mergeAttrs { + wantedBy = [ "set-ui-mode.target" ]; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = false; + }; + activate = mode: '' + systemctl --user set-environment UI_MODE=${mode} + systemctl --user start set-ui-mode.target + ''; +in +{ + flake.modules.hjem.desktop = + { pkgs, ... }: + { + packages = [ pkgs.darkman ]; + systemd.targets.set-ui-mode.unitConfig = { + Description = "Switch to light/dark mode based on $UI_MODE"; + StopWhenUnneeded = true; + }; + systemd.services.set-gtk-scheme = modeToggleService { + description = "Set GTK UI scheme"; + script = '' + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$UI_MODE'" + ''; + }; + systemd.services.niri-screen-transition = modeToggleService { + description = "Niri screen transition effect"; + script = '' + niri msg action do-screen-transition -d ''${UI_TRANSITION_MS:-250} + ''; + }; + + xdg.config.files."darkman/config.yaml".text = '' + lat: 42.4 + lng: -71.1 + ''; + + xdg.data.files."dark-mode.d/systemd".source = pkgs.writeShellScript "systemd-dark" ( + activate "dark" + ); + xdg.data.files."light-mode.d/systemd".source = pkgs.writeShellScript "systemd-light" ( + activate "light" + ); + + # https://github.com/feel-co/hjem/issues/76 + # xdg.config.files."systemd/user/darkman.service".source = + # "${pkgs.darkman}/share/systemd/user/darkman.service"; + systemd.services.darkman = { + unitConfig = { + Description = "Darkman system service"; + Documentation = "man:darkman(1)"; + PartOf = [ "graphical-session.target" ]; + BindsTo = [ "graphical-session.target" ]; + }; + + serviceConfig = { + Type = "dbus"; + BusName = "nl.whynothugo.darkman"; + ExecStart = "${lib.getExe pkgs.darkman} run"; + Restart = "on-failure"; + TimeoutStopSec = 15; + Slice = "background.slice"; + }; + + wantedBy = lib.mkDefault [ "graphical-session.target" ]; + }; + }; +} diff --git a/modules/desktop/firefox.nix b/modules/desktop/firefox.nix new file mode 100644 index 0000000..6adfec7 --- /dev/null +++ b/modules/desktop/firefox.nix @@ -0,0 +1,29 @@ +{ + flake.modules.hjem.firefox = + { pkgs, ... }: + { + packages = [ + (pkgs.firefox.override { + cfg.speechSynthesisSupport = false; + extraPolicies = { + DontCheckDefaultBrowser = true; + DisablePocket = true; + FirefoxHome = { + Pocket = false; + Snippets = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }) + ]; + niri.extraConfig = '' + window-rule { + match app-id="firefox$" title="^Picture-in-Picture$" + open-floating true + } + ''; + }; +} diff --git a/modules/desktop/ghostty.nix b/modules/desktop/ghostty.nix new file mode 100644 index 0000000..3aba414 --- /dev/null +++ b/modules/desktop/ghostty.nix @@ -0,0 +1,42 @@ +{ config, ... }: +{ + flake.modules.hjem.desktop = + { lib, pkgs, ... }: + { + packages = [ pkgs.ghostty ]; + xdg.config.files."ghostty/config".text = '' + theme = light:Rose Pine Dawn,dark:Srcery + command = fish + font-family = ${config.local.appFont} + font-size = 15 + cursor-style-blink = false + shell-integration-features = no-cursor + mouse-hide-while-typing = true + gtk-single-instance = true + confirm-close-surface = false + quit-after-last-window-closed = true + window-padding-balance = true + window-padding-color = extend + window-padding-x = 0 + window-padding-y = 0 + window-step-resize = true + keybind = ctrl+[=text:\x1b + keybind = ctrl+j=text:\r + keybind = ctrl+m=text:\r + keybind = alt+f4=unbind + keybind = ctrl+shift+q=unbind + keybind = ctrl+shift+w=unbind + keybind = ctrl+enter=unbind + keybind = alt+1=unbind + keybind = alt+2=unbind + keybind = alt+3=unbind + keybind = alt+4=unbind + keybind = alt+5=unbind + keybind = alt+6=unbind + keybind = alt+7=unbind + keybind = alt+8=unbind + keybind = alt+9=unbind + keybind = alt+0=unbind + ''; + }; +} diff --git a/modules/desktop/mpv.nix b/modules/desktop/mpv.nix new file mode 100644 index 0000000..97f0f4f --- /dev/null +++ b/modules/desktop/mpv.nix @@ -0,0 +1,87 @@ +{ lib, ... }: +let + profiles = { + wayland = { + profile = "standard"; + gpu-context = "wayland"; + }; + no-term = { + profile = "standard"; + pause = "yes"; + force-window = "immediate"; + terminal = "no"; + }; + "protocol.https" = { + force-window = "immediate"; + keep-open = "yes"; + }; + "protocol.http" = { + profile = "protocol.https"; + }; + standard = { + cache = "yes"; + audio-display = "no"; + write-filename-in-watch-later-config = "yes"; + profile = "gpu-hq"; + video-sync = "display-resample"; + interpolation = "yes"; + tscale = "oversample"; + demuxer-mkv-subtitle-preroll = "yes"; + slang = "eng,en,enUS,en-US"; + ytdl-raw-options = "sub-langs=\"en*\",cookies-from-browser=firefox"; + # for thumbnail/youtube-quality + osc = "no"; + script-opts-append = "autocrop-auto=no"; + }; + }; +in +{ + flake.modules.hjem.core.options.mpv.defaultProfile = lib.mkOption { default = "standard"; }; + + flake.modules.hjem.desktop = + { config, pkgs, ... }: + { + packages = with pkgs; [ + yt-dlp + (mpv.override { + scripts = with mpvScripts; [ + autocrop + mpris + sponsorblock + + # mutually exclusive osc replacements + thumbnail + # youtube-quality + ]; + }) + ]; + + xdg.config.files."mpv/mpv.conf".text = '' + profile=${config.mpv.defaultProfile} + + ${lib.generators.toINI { listsAsDuplicateKeys = true; } profiles} + ''; + + xdg.config.files."yt-dlp/config".text = '' + --embed-subs + --embed-thumbnail + --sub-langs en*,ja* + --write-auto-subs + ''; + + fish = { + interactiveShellInit = '' + abbr -a mshuf 'mpv --no-video --shuffle ~/annex/music' + abbr -a pmpv 'umpv (wl-paste)' + abbr -a uts 'umpv (wl-paste)' + ''; + wrappers.mpv.yts = "mpv 'ytdl://ytsearch1:'$argv[1] $argv[2..-1]"; + wrappers.mpv.uts = "umpv 'ytdl://ytsearch1:'$argv[1] $argv[2..-1]"; + functions.m = '' + commandline 'mpv --no-video ~/music/' + set -x fzf_fd_opts -td --exact-depth 2 + _fzf_search_directory + ''; + }; + }; +} diff --git a/modules/desktop/niri/config.kdl b/modules/desktop/niri/config.kdl new file mode 100644 index 0000000..a385176 --- /dev/null +++ b/modules/desktop/niri/config.kdl @@ -0,0 +1,202 @@ +input { + keyboard { + xkb { + layout "us" + model "" + rules "" + variant "" + options "ctrl:nocaps" + } + repeat-delay 300 + repeat-rate 50 + track-layout "global" + } + touchpad { + tap + natural-scroll + } + workspace-auto-back-and-forth +} +screenshot-path "~/pictures/screenshots/screenshot_%Y-%m-%d_%H:%M:%S.png" +prefer-no-csd +layout { + gaps 14 + struts { + left 20 + right 20 + } + shadow { + on + draw-behind-window true + softness 30 + spread 5 + offset x=0 y=5 + color "#0007" + } + focus-ring { off; } + border { off; } +} +cursor { + xcursor-theme "default" + xcursor-size 24 +} +window-rule { + geometry-corner-radius 12 + clip-to-geometry true +} +binds { + Mod+Shift+Slash { show-hotkey-overlay; } + Mod+T hotkey-overlay-title="Open a Terminal" { spawn "ghostty"; } + Mod+D hotkey-overlay-title="Run an Application" { spawn "fuzzel"; } + Mod+E hotkey-overlay-title="Pick an Emoji" { spawn "rofimoji"; } + Mod+Q hotkey-overlay-title="Run a qutebrowser Profile" { spawn-sh "qbpm choose"; } + Mod+X hotkey-overlay-title="Play Copied Link (mpv)" { spawn-sh "mpv $(wl-paste)"; } + Mod+Shift+X hotkey-overlay-title="Play Copied Link (umpv)" { spawn-sh "umpv $(wl-paste)"; } + Mod+Alt+L hotkey-overlay-title="Lock the Screen" { spawn "swaylock"; } + + XF86MonBrightnessDown { spawn-sh "light -U 5"; } + XF86MonBrightnessUp { spawn-sh "light -A 5"; } + XF86AudioRaiseVolume { spawn-sh "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05+"; } + XF86AudioLowerVolume { spawn-sh "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05-"; } + Shift+XF86AudioRaiseVolume { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; } + Shift+XF86AudioLowerVolume { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; } + XF86AudioMute { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } + XF86AudioMicMute { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } + XF86AudioPrev { spawn-sh "playerctl previous"; } + XF86AudioNext { spawn-sh "playerctl next"; } + XF86AudioMedia { spawn-sh "playerctl play-pause"; } + XF86AudioPlay { spawn-sh "playerctl play-pause"; } + + Mod+O repeat=false { toggle-overview; } + + Mod+Shift+Q repeat=false { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + Mod+H { focus-column-left; } + Mod+J { focus-window-down; } + Mod+K { focus-window-up; } + Mod+L { focus-column-right; } + + Mod+Shift+Left { move-column-left; } + Mod+Shift+Down { move-window-down; } + Mod+Shift+Up { move-window-up; } + Mod+Shift+Right { move-column-right; } + Mod+Shift+H { move-column-left; } + Mod+Shift+J { move-window-down; } + Mod+Shift+K { move-window-up; } + Mod+Shift+L { move-column-right; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Shift+Home { move-column-to-first; } + Mod+Shift+End { move-column-to-last; } + + Mod+Ctrl+Left { focus-monitor-left; } + Mod+Ctrl+Down { focus-monitor-down; } + Mod+Ctrl+Up { focus-monitor-up; } + Mod+Ctrl+Right { focus-monitor-right; } + Mod+Ctrl+H { focus-monitor-left; } + Mod+Ctrl+J { focus-monitor-down; } + Mod+Ctrl+K { focus-monitor-up; } + Mod+Ctrl+L { focus-monitor-right; } + + Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+U { move-column-to-workspace-down; } + Mod+Ctrl+I { move-column-to-workspace-up; } + + Mod+Shift+Page_Down { move-workspace-down; } + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+U { move-workspace-down; } + Mod+Shift+I { move-workspace-up; } + + Mod+Shift+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+Shift+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+Shift+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+Shift+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + Mod+WheelScrollDown { focus-column-right; } + Mod+WheelScrollUp { focus-column-left; } + Mod+Ctrl+WheelScrollDown { move-column-right; } + Mod+Ctrl+WheelScrollUp { move-column-left; } + + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Ctrl+1 { move-column-to-workspace 1; } + Mod+Ctrl+2 { move-column-to-workspace 2; } + Mod+Ctrl+3 { move-column-to-workspace 3; } + Mod+Ctrl+4 { move-column-to-workspace 4; } + Mod+Ctrl+5 { move-column-to-workspace 5; } + Mod+Ctrl+6 { move-column-to-workspace 6; } + Mod+Ctrl+7 { move-column-to-workspace 7; } + Mod+Ctrl+8 { move-column-to-workspace 8; } + Mod+Ctrl+9 { move-column-to-workspace 9; } + + Mod+Tab { focus-workspace-previous; } + Mod+Z { focus-workspace-previous; } + Mod+Slash { focus-workspace-previous; } + + Mod+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + Mod+Comma { consume-window-into-column; } + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + Mod+Ctrl+Shift+F { toggle-windowed-fullscreen; } + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + Mod+Ctrl+C { center-visible-columns; } + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + Mod+W { toggle-column-tabbed-display; } + + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } + + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + Mod+Shift+P { power-off-monitors; } +} diff --git a/modules/desktop/niri/default.nix b/modules/desktop/niri/default.nix new file mode 100644 index 0000000..230d2e2 --- /dev/null +++ b/modules/desktop/niri/default.nix @@ -0,0 +1,35 @@ +{ inputs, lib, ... }: +{ + flake.modules.nixos.desktop = + { config, pkgs, ... }: + let + inherit (pkgs.stdenv.hostPlatform) system; + in + { + imports = [ + inputs.niri.nixosModules.niri + ]; + + programs.niri.enable = true; + programs.niri.package = inputs.niri.packages.${system}.niri-unstable; + + environment.systemPackages = [ + inputs.niri.packages.${system}.xwayland-satellite-unstable + ]; + + systemd.user.services.niri-flake-polkit.serviceConfig.ExecStart = + lib.mkForce "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"; + services.gnome.gnome-keyring.enable = lib.mkForce false; + }; + + flake.modules.hjem.core.options.niri.extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + }; + + flake.modules.hjem.desktop = + { config, ... }: + { + xdg.config.files."niri/config.kdl".text = builtins.readFile ./config.kdl + config.niri.extraConfig; + }; +} diff --git a/home-manager/qutebrowser/colors.py b/modules/desktop/qutebrowser/colors.py similarity index 100% rename from home-manager/qutebrowser/colors.py rename to modules/desktop/qutebrowser/colors.py diff --git a/modules/desktop/qutebrowser/config.py b/modules/desktop/qutebrowser/config.py new file mode 100644 index 0000000..794af0d --- /dev/null +++ b/modules/desktop/qutebrowser/config.py @@ -0,0 +1,88 @@ +# pylint: disable=C0111 +from qutebrowser.config.configfiles import ConfigAPI # noqa: F401 +from qutebrowser.config.config import ConfigContainer # noqa: F401 + +config: ConfigAPI = config # noqa: F821 pylint: disable=E0602,C0103 +c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103 + +c.aliases = { + "q": "quit", + "w": "session-save", + "wq": "quit --save", + "x": "quit --save", + "h": "help", +} + +c.confirm_quit = ["downloads"] + +c.new_instance_open_target = "tab-silent" +c.new_instance_open_target_window = "last-focused" + +c.window.hide_decoration = False + +def terminal(*args): + return ["ghostty", "-e", *args] + +c.editor.command = terminal("hx", "{file}:{line}:{column0}") +c.fileselect.handler = "external" +c.fileselect.single_file.command = terminal("ranger", "--choosefile={}") +c.fileselect.multiple_files.command = terminal("ranger", "--choosefiles={}") +c.fileselect.folder.command = terminal("ranger", "--choosedir={}") + +c.auto_save.session = True + +c.content.autoplay = False +c.content.pdfjs = True + +c.completion.open_categories = ["quickmarks", "bookmarks", "history", "filesystem"] +c.completion.shrink = True +c.completion.scrollbar.width = 0 +c.completion.scrollbar.padding = 0 + +c.hints.auto_follow = "always" +c.hints.mode = "letter" + +c.tabs.background = True +c.tabs.favicons.scale = 0.9 +c.tabs.last_close = "close" +c.tabs.mode_on_change = "restore" +c.tabs.show = "multiple" +c.tabs.indicator.width = 0 +c.tabs.padding = { "bottom": 4, "left": 3, "right": 3, "top": 4 } + +c.url.open_base_url = True + +c.fonts.default_size = "14pt" +c.fonts.hints = "bold 13pt default_family" +c.fonts.prompts = "13pt sans_serif" + +config.bind("", "rl-rubout ' /'", mode="command") +config.bind("", "rl-rubout ' /'", mode="prompt") + +config.bind("", "cmd-run-with-count 2 scroll down") +config.bind("", "cmd-run-with-count 2 scroll up") +config.bind("ge", "scroll-to-perc") + +config.bind("xp", "open -b -- {clipboard}") +config.bind("xP", "open -b -- {primary}") + +config.bind(",d", "hint all delete") +config.bind(",r", "cmd-set-text :open {url:domain}/") +config.bind(",R", "cmd-set-text :open -t {url:domain}/") +config.bind(";X", "hint links spawn -dv mpv --profile=no-term {hint-url}") +config.bind(";x", "hint links spawn -dv umpv --profile=no-term {hint-url}") +config.bind("xX", "spawn -dv mpv --profile=no-term {url}") +config.bind("xx", "spawn -dv umpv --profile=no-term {url}") + +config.bind("pw", "open https://en.wikipedia.org/wiki/Special:Search?search={primary}") +config.bind("Pw", "open -t https://en.wikipedia.org/wiki/Special:Search?search={primary}") +config.bind("PW", "open -b https://en.wikipedia.org/wiki/Special:Search?search={primary}") + +QUTE_PASS_CMD = ( + "qute-pass --username-target secret " + "--username-pattern '(?:username|email): (.+)' " + "--dmenu-invocation 'fuzzel --dmenu'" +) +config.bind("zl", f"spawn --userscript {QUTE_PASS_CMD}") +config.bind("zpl", f"spawn --userscript {QUTE_PASS_CMD} --password-only") +config.bind("zul", f"spawn --userscript {QUTE_PASS_CMD} --username-only") diff --git a/modules/desktop/qutebrowser/default.nix b/modules/desktop/qutebrowser/default.nix new file mode 100644 index 0000000..ab6ecaf --- /dev/null +++ b/modules/desktop/qutebrowser/default.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: +let + inherit (config.local) appFont; +in +{ + flake.modules.hjem.desktop = + { config, pkgs, ... }: + { + options.qutebrowser.extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + }; + config.packages = [ pkgs.qutebrowser ]; + config.xdg.config.files."qutebrowser/config.py".text = builtins.concatStringsSep "\n" [ + (builtins.readFile ./config.py) + (builtins.readFile ./colors.py) + ''config.set("fonts.default_family", ["${appFont}", "monospace"])'' + config.qutebrowser.extraConfig + "config.load_autoconfig()" + ]; + }; +} diff --git a/home-manager/search.nix b/modules/desktop/qutebrowser/search.nix similarity index 76% rename from home-manager/search.nix rename to modules/desktop/qutebrowser/search.nix index 4b5a143..acf656c 100644 --- a/home-manager/search.nix +++ b/modules/desktop/qutebrowser/search.nix @@ -82,7 +82,6 @@ let definedAliases = [ "pd" ]; }; }; - updateInterval = 7 * 24 * 60 * 60 * 1000; toQbEngine = n: v: lib.nameValuePair (lib.removePrefix "@" n) v; mkQbEngines = pkgs: @@ -91,39 +90,27 @@ let ) (mkEngines pkgs "{}"); in { - flake.modules.homeManager.firefox = - { pkgs, ... }: - { - programs.firefox.profiles.default.search = { - force = true; - default = "kagi"; - engines = { - bing.metaData.hidden = true; - ebay.metaData.hidden = true; - amazondotcom-us.metaData.hidden = true; - google.metaData.hidden = true; - ddg.metaData.hidden = true; - wikipedia.metaData.alias = "w"; - } - // builtins.mapAttrs (n: v: { inherit updateInterval; } // v) (mkEngines pkgs "{searchTerms}"); - }; - }; - - flake.modules.homeManager.desktop = + flake.modules.hjem.desktop = { pkgs, ... }: let qbEngines = mkQbEngines pkgs; in { - programs.qutebrowser.searchEngines = { - DEFAULT = qbEngines.k; - w = "https://en.wikipedia.org/wiki/Special:Search?search={}"; - d = "https://duckduckgo.com/?q={}"; - # TODO set these up in firefox too - a = "https://wiki.archlinux.org/?search={}"; - ap = "https://archlinux.org/packages/?q={}"; - aur = "https://aur.archlinux.org/packages.php?K={}"; - } - // qbEngines; + qutebrowser.extraConfig = + lib.concatMapAttrsStringSep "\n" (key: url: ''c.url.searchengines['${key}'] = "${url}"'') + ( + qbEngines + // { + DEFAULT = qbEngines.k; + w = "https://en.wikipedia.org/wiki/Special:Search?search={}"; + d = "https://duckduckgo.com/?q={}"; + # TODO move to main engines list + a = "https://wiki.archlinux.org/?search={}"; + ap = "https://archlinux.org/packages/?q={}"; + aur = "https://aur.archlinux.org/packages.php?K={}"; + } + ); + + # TODO firefox }; } diff --git a/modules/desktop/wayland.nix b/modules/desktop/wayland.nix new file mode 100644 index 0000000..7b7aa06 --- /dev/null +++ b/modules/desktop/wayland.nix @@ -0,0 +1,81 @@ +{ config, ... }: +let + cursor = + { pkgs, ... }: + { + packages = [ pkgs.vanilla-dmz ]; + environment.sessionVariables.XCURSOR_THEME = "Vanilla-DMZ"; + environment.sessionVariables.XCURSOR_SIZE = 32; + }; + services = + { pkgs, ... }: + { + packages = with pkgs; [ + mako + clipman + ]; + + xdg.config.files."mako/config".text = with config.local.colors; '' + font=${config.local.appFont} 14 + background-color=${brightBlue} + border-color=${blue} + text-color=${xgray1} + ''; + + xdg.data.files."dbus-1/services/fr.emersion.mako.service".source = + "${pkgs.mako}/share/dbus-1/services/fr.emersion.mako.service"; + + # from home-manager + systemd.services.clipman = { + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + unitConfig = { + Description = "Clipboard management daemon"; + ConditionEnvironment = "WAYLAND_DISPLAY"; + }; + serviceConfig = { + ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store"; + ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; + Restart = "on-failure"; + KillMode = "mixed"; + }; + }; + }; +in +{ + flake.modules.nixos.desktop = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ + fuzzel + imv + xdg-utils + wl-clipboard + libnotify + dmenu-wayland + swaylock + pulsemixer + rofimoji + ]; + + services.playerctld.enable = true; + }; + + flake.modules.hjem.desktop = + { pkgs, ... }: + { + imports = [ + cursor + services + ]; + + mpv.defaultProfile = "wayland"; + + xdg.config.files."fuzzel/fuzzel.ini".text = '' + [main] + font="${config.local.appFont}:size=14" + terminal="${pkgs.ghostty}/bin/ghostty -e" + ''; + }; +} diff --git a/modules/documentation.nix b/modules/documentation.nix index beddec7..23d0cfb 100644 --- a/modules/documentation.nix +++ b/modules/documentation.nix @@ -1,9 +1,6 @@ { lib, ... }: { flake.modules = { - homeManager.core.programs.man.generateCaches = lib.mkOverride 500 false; - homeManager.desktop.programs.man.generateCaches = true; - nixos.core.documentation.man.generateCaches = lib.mkOverride 500 false; nixos.desktop = { pkgs, ... }: diff --git a/modules/hjem.nix b/modules/hjem.nix new file mode 100644 index 0000000..f31004e --- /dev/null +++ b/modules/hjem.nix @@ -0,0 +1,23 @@ +{ inputs, ... }: +let + hjemModule = + { config, ... }: + { + hjem.users.${config.local.user.name}.enable = true; + hjem.extraModules = [ inputs.self.modules.hjem.core ]; + }; +in +{ + flake.modules.nixos.core = { + imports = [ + hjemModule + inputs.hjem.nixosModules.hjem + ]; + }; + flake.modules.darwin.default = { + imports = [ + hjemModule + inputs.hjem.darwinModules.hjem + ]; + }; +} diff --git a/modules/home.nix b/modules/home.nix deleted file mode 100644 index 2ea8019..0000000 --- a/modules/home.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.nixos.core = - { config, lib, ... }: - { - imports = [ inputs.home-manager.nixosModules.home-manager ]; - options.local.home.imports = lib.mkOption { - type = lib.types.listOf lib.types.deferredModule; - default = [ ]; - apply = modules: [ inputs.self.modules.homeManager.core ] ++ modules; - }; - config.home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${config.local.user.name} = { - inherit (config.local.home) imports; - home.stateVersion = config.system.stateVersion; - }; - }; - }; -} diff --git a/modules/niri.nix b/modules/niri.nix deleted file mode 100644 index c4ac443..0000000 --- a/modules/niri.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ inputs, lib, ... }: -{ - flake.modules.nixos.desktop = - { config, pkgs, ... }: - { - imports = [ - inputs.niri.nixosModules.niri - ]; - - programs.niri.enable = true; - programs.niri.package = inputs.niri.packages.${pkgs.stdenv.hostPlatform.system}.niri-unstable; - - environment.systemPackages = [ - inputs.niri.packages.${pkgs.stdenv.hostPlatform.system}.xwayland-satellite-unstable - ]; - - systemd.user.services.niri-flake-polkit.serviceConfig.ExecStart = - lib.mkForce "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"; - services.gnome.gnome-keyring.enable = lib.mkForce false; - }; -} diff --git a/modules/nixos.nix b/modules/nixos.nix index ca5747d..5e4e579 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -32,10 +32,6 @@ security.sudo.wheelNeedsPassword = false; - programs.fish.enable = true; - programs.fish.useBabelfish = true; - users.defaultUserShell = pkgs.fish; - programs.ssh.startAgent = true; networking.nftables.enable = true; diff --git a/modules/transmission.nix b/modules/transmission.nix index e0bdbe9..d13d66a 100644 --- a/modules/transmission.nix +++ b/modules/transmission.nix @@ -39,6 +39,7 @@ environment.persistence.data.directories = [ "/var/lib/transmission" ]; }; - flake.modules.homeManager.desktop.programs.fish.shellAbbrs.trr = - "transmission-remote ruan.ygg.pvsr.dev:9919"; + flake.modules.hjem.desktop.fish.interactiveShellInit = '' + abbr -a trr 'transmission-remote ruan.ygg.pvsr.dev:9919' + ''; } diff --git a/modules/xdg.nix b/modules/xdg.nix new file mode 100644 index 0000000..6fba5ef --- /dev/null +++ b/modules/xdg.nix @@ -0,0 +1,42 @@ +let + configPath = ".local/config"; + cachePath = ".local/cache"; +in +{ + flake.modules.nixos.core = { + environment.sessionVariables.XDG_CONFIG_HOME = "$HOME/${configPath}"; + environment.sessionVariables.XDG_CACHE_HOME = "$HOME/${cachePath}"; + }; + + flake.modules.hjem.core = + { config, lib, ... }: + let + dataDir = config.xdg.data.directory; + stateDir = config.xdg.state.directory; + userDirs = { + XDG_DESKTOP_DIR = "$HOME/desktop"; + XDG_DOCUMENTS_DIR = "$HOME/documents"; + XDG_DOWNLOAD_DIR = "$HOME/downloads"; + XDG_MUSIC_DIR = "$HOME/music"; + XDG_PICTURES_DIR = "$HOME/pictures"; + XDG_PUBLICSHARE_DIR = "$HOME/public"; + XDG_TEMPLATES_DIR = "$HOME/templates"; + XDG_VIDEOS_DIR = "$HOME/videos"; + }; + in + { + xdg.config.directory = "${config.directory}/${configPath}"; + xdg.cache.directory = "${config.directory}/${cachePath}"; + environment.sessionVariables = userDirs // { + CARGO_HOME = "${dataDir}/cargo"; + CARGO_INSTALL_ROOT = "$HOME/.local"; + HISTFILE = "${stateDir}/bash/history"; + LESSHISTFILE = "${stateDir}/less/history"; + }; + + xdg.config.files."user-dirs.conf".text = "enabled=False"; + xdg.config.files."user-dirs.dirs".text = lib.concatMapAttrsStringSep "\n" ( + name: value: ''${name}="${value}"'' + ) userDirs; + }; +}