{ config, lib, pkgs, pkgs-unstable, inputs, self, ... }: { imports = [ ../gnome ./dnote.nix ../modules/zed ./secrets.nix inputs.hastebin.nixosModules.hm inputs.agenix.homeManagerModules.default ]; # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release # introduces backwards incompatible changes. # # You should not change this value, even if you update Home Manager. If you do # want to update the value, then make sure to first check the Home Manager # release notes. home.stateVersion = "23.11"; # Please read the comment before changing. home.packages = with pkgs; [ htop gnupg pkgs-unstable.yubioath-flutter pkgs-unstable.yubikey-manager gcc sqlite noto-fonts noto-fonts-cjk-sans noto-fonts-color-emoji source-sans-pro mosh docker-compose signal-desktop cargo blanket wl-clipboard gnumeric gh neovim-remote pkgs-unstable.gradia crystal shards moreutils keymapp gnumake tig jq yt-dlp ffmpeg otp manix (writeShellScriptBin "fd" '' ${fd}/bin/fd -H "$@" '') pkgs-unstable.rpi-imager picocom imagemagick ghostscript inkscape jless scribus dnscontrol protonmail-bridge hydroxide imapsync nixfmt-rfc-style tree virt-manager pkgs-unstable.ncspot pkgs-unstable.devbox pkgs-unstable.feishin openscad pkgs-unstable.walker pkgs-unstable.shairport-sync-airplay2 (writeShellScriptBin "pw" '' ${lib.getExe rbw} ls --fields 'id,folder,name' | \ ${lib.getExe gawk} -F '\t' '{print $1 "\t" ($2 == "" ? "" : $2 "/") $3}' | \ ${lib.getExe pkgs-unstable.walker} -d -l 2 | \ xargs ${lib.getExe rbw} get "$@" | ${lib.getExe' wl-clipboard "wl-copy"} '') (google-fonts.override { fonts = [ "Tajawal" ]; }) pkgs-unstable.opencode (writeShellScriptBin "nr" '' ${lib.getExe nix} run "nixpkgs#''${1}" "$@" '') pkgs-unstable.tidal-hifi inputs.tonearm.packages.${pkgs.stdenv.hostPlatform.system}.tonearm ]; programs = { nh = { enable = true; flake = self; }; dnote.enable = true; home-manager.enable = true; bat = { enable = true; extraPackages = with pkgs.bat-extras; [ batdiff batwatch ]; config = { pager = "less -FR"; }; }; direnv = { enable = true; nix-direnv.enable = true; enableZshIntegration = true; }; mpv = { enable = true; config = { hwdec = "auto-safe"; vo = "gpu"; profile = "gpu-hq"; gpu-context = "wayland"; }; }; kitty = { enable = true; font = { name = "IosevkaTerm NFM"; size = 14; }; shellIntegration.enableZshIntegration = true; themeFile = "Tomorrow_Night"; settings = { hide_window_decorations = true; enabled_layouts = "splits,stack"; }; keybindings = { "kitty_mod+q" = ""; "kitty_mod+w" = ""; "kitty_mod+t" = "new_tab_with_cwd"; "kitty_mod+tab" = "next_tab"; "kitty_mod+enter" = "launch --location=hsplit --cwd=current"; "kitty_mod+space" = "launch --location=vsplit --cwd=current"; "kitty_mod+h" = "neighboring_window left"; "kitty_mod+l" = "neighboring_window right"; "kitty_mod+k" = "neighboring_window up"; "kitty_mod+j" = "neighboring_window down"; "kitty_mod+1" = "goto_tab 1"; "kitty_mod+2" = "goto_tab 2"; "kitty_mod+3" = "goto_tab 3"; "kitty_mod+4" = "goto_tab 4"; "kitty_mod+5" = "goto_tab 5"; "kitty_mod+6" = "goto_tab 6"; "kitty_mod+7" = "goto_tab 7"; "kitty_mod+8" = "goto_tab 8"; "kitty_mod+9" = "goto_tab 9"; "kitty_mod+0" = "goto_tab 10"; "kitty_mod+f" = "toggle_layout stack"; "kitty_mod+/" = "show_scrollback"; "ctrl+alt+h" = "move_window left"; "ctrl+alt+l" = "move_window right"; "ctrl+alt+k" = "move_window up"; "ctrl+alt+j" = "move_window down"; "ctrl+alt+enter" = "layout_action rotate"; }; }; vivaldi.enable = true; git = { enable = true; settings = { alias = { st = "status"; co = "checkout"; b = "branch"; }; pull = { rebase = "true"; }; push = { autoSetupRemote = true; }; init = { defaultBranch = "main"; }; user = { name = "Joakim Repomaa"; signingKey = "F0AF1CE34733B22317A8937D05557F53CD3C6458"; }; commit.gpgSign = true; }; }; gpg = { enable = true; }; zsh = { enable = true; enableVteIntegration = true; cdpath = [ "${config.xdg.configHome}/home-manager" ]; defaultKeymap = "viins"; dirHashes = { hm = "${config.xdg.configHome}/home-manager"; }; history = { path = "${config.home.homeDirectory}/.cache/zsh/history"; save = 100000; size = 100000; }; initContent = '' . "${config.xdg.configHome}/zsh/init" . "${config.age.secrets.context7.path}" ''; }; lazygit = let getBaseBranch = pkgs.writeShellScriptBin "git-base-branch" '' current_branch="$(git rev-parse --abbrev-ref HEAD)" if [[ "$current_branch" =~ -review$ ]]; then echo "''${current_branch%-review}" else git config get init.defaultBranch fi ''; escapeGoTemplate = builtins.replaceStrings [ "{{" "}}" ] [ ''{{"{{"}}'' ''{{"}}"}}'' ]; in { enable = true; settings = { gui = { nerdFontsVersion = "3"; }; git = { showUntrackedFiles = "all"; branchLogCmd = "git log {{branchName}} --first-parent --color=always --pretty=format:'%Cgreen%h%Creset %Cblue%aN%Creset %C(cyan)%<(14)%ar%Creset %s' --abbrev-commit"; overrideGpg = true; }; os = { edit = "\${EDITOR} -- {{filename}}"; editAtLine = "\${EDITOR} -- {{filename}}:{{line}}"; editAtLineAndWait = "\${EDITOR} --wait -- {{filename}}:{{line}}"; openDirInEditor = "\${EDITOR} -- {{dir}}"; }; promptToReturnFromSubprocess = false; keybinding = { universal = { nextItem = ""; prevItem = ""; }; commits = { moveDownCommit = ""; moveUpCommit = ""; }; }; customCommands = [ { key = ""; context = "global"; command = '' git push --force-with-lease --set-upstream origin "{{.SelectedLocalBranch.Name}}" && gh pr create --title "{{.SelectedLocalBranch.Name}}" -B "$(${lib.getExe getBaseBranch})" --fill || (git log --reverse --no-merges --pretty='- %s' master..HEAD | gh pr edit --body-file -); gh pr view --web ''; } { key = "N"; context = "localBranches"; prompts = [ { type = "input"; title = "New Branch Name:"; key = "BranchName"; initialValue = "{{.SelectedLocalBranch.Name}}-review"; } ]; command = '' git checkout -b {{.Form.BranchName | quote}} ''; } { key = "G"; context = "localBranches"; prompts = [ { type = "menuFromCommand"; title = "PR:"; key = "pr"; command = escapeGoTemplate "gh pr list --search '-author:@me' --json number,title,author,updatedAt -t '{{range .}}{{tablerow .number .title .author.login}}{{end}}'"; filter = "(?[0-9]+)(?.*)"; labelFormat = "{{ .rest }}"; valueFormat = "{{ .pr_number }}"; } ]; command = '' gh pr checkout {{.Form.pr | quote}} ''; } ]; }; }; obs-studio.enable = true; ssh = { enable = true; enableDefaultConfig = false; matchBlocks = { "*" = { controlMaster = "auto"; controlPath = "${config.home.homeDirectory}/.ssh/masters-control/%r@%h:%p"; controlPersist = "1h"; forwardAgent = false; addKeysToAgent = "no"; compression = false; serverAliveInterval = 0; serverAliveCountMax = 3; hashKnownHosts = false; userKnownHostsFile = "${config.home.homeDirectory}/.ssh/known_hosts"; setEnv = { TERM = "screen-256color"; }; }; "apu" = { hostname = "apu.tempel-vibes.ts.net"; user = "root"; }; }; }; spotify-player = { enable = true; settings = { enable_streaming = "Always"; theme = "tomorrow_night"; copy_command = "wl-copy"; }; themes = [ { name = "tomorrow_night"; palette = { background = "#1d1f21"; foreground = "#c5c8c6"; black = "#000000"; red = "#cc6666"; green = "#b5bd68"; yellow = "#f0c674"; blue = "#81a2be"; magenta = "#b294bb"; cyan = "#8abeb7"; white = "#ffffff"; bright_black = "#000000"; bright_red = "#cc6666"; bright_green = "#b5bd68"; bright_yellow = "#f0c674"; bright_blue = "#81a2be"; bright_magenta = "#b294bb"; bright_cyan = "#8abeb7"; bright_white = "#ffffff"; }; component_style = { playback_metadata = { fg = "#8abeb7"; }; playback_progress_bar = { bg = "#1d1f21"; fg = "#c5c8c6"; }; }; } ]; }; neovide = { enable = true; settings = { font = { normal = [ "IosevkaTerm NFM" ]; size = 12.0; }; fork = true; }; }; hastebin = { enable = true; settings = { host = "https://bin.freun.dev"; auth_token_file = "${config.xdg.configHome}/hastebin/auth_token"; clipboard_command = "${pkgs.wl-copy-both}/bin/wl-copy"; default_renderers = let code = [ "js" "ts" "jsx" "tsx" "rs" "nix" "cr" "ecr" "rb" "erb" "yaml" "yml" "json" "toml" "html" "xml" "css" "scss" "sass" "less" "sql" "sh" ]; in lib.listToAttrs ( lib.map (name: { inherit name; value = "hl"; }) code ); }; }; zed-editor = { enable = true; defaultEditor = true; }; }; gnome = { keyboard.sources = [ "us+altgr-intl" ]; keybindings = { builtin = { screenshot-window = [ ]; show-screenshot-ui = [ ]; }; custom = [ { binding = "Print"; command = "gradia --screenshot"; name = "Gradia"; } { binding = "Print"; command = "kooha"; name = "Kooha"; } ]; }; power = { powerButton = "hibernate"; }; extensions = { paperwm = { enable = true; winprops = [ { wm_class = "vivaldi-stable"; preferredWidth = "67%"; } { wm_class = "yubioath-flutter"; scratch_layer = true; } { wm_class = "signal"; scratch_layer = true; } { wm_class = "Slack"; scratch_layer = true; } { wm_class = "Supersonic"; scratch_layer = true; } { wm_class = "io.github.seadve.Kooha"; scratch_layer = true; } { wm_class = "/.*/"; preferredWidth = "33"; } ]; keybindings = { move-down = [ "Down" "j" ]; move-left = [ "Left" "h" ]; move-right = [ "Right" "l" ]; move-up = [ "Up" "k" ]; switch-down = [ "Down" "j" ]; switch-left = [ "Left" "h" ]; switch-right = [ "Right" "l" ]; switch-up = [ "Up" "k" ]; }; }; freon = { enable = true; }; }; nightLight.enable = true; }; fonts.fontconfig = { enable = true; defaultFonts = { emoji = [ "Noto Color Emoji" ]; monospace = [ "IosevkaTerm NFM" ]; sansSerif = [ "Source Sans Pro" ]; }; }; targets.genericLinux.enable = true; xdg.mime.enable = true; xdg = { enable = true; configFile = { tmux.source = dotfiles/tmux; zsh.source = dotfiles/zsh; "fd/ignore".text = '' /.git/ ''; "vivaldi/NativeMessagingHosts/ff2mpv.json".text = builtins.toJSON { name = "ff2mpv"; description = "ff2mpv's external manifest"; path = "${pkgs.ff2mpv-rust}/bin/ff2mpv-rust"; type = "stdio"; allowed_origins = [ "chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg/" ]; }; }; }; # Home Manager can also manage your environment variables through # 'home.sessionVariables'. If you don't want to manage your shell through Home # Manager then you have to manually source 'hm-session-vars.sh' located at # either # # ~/.nix-profile/etc/profile.d/hm-session-vars.sh # # or # # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh # # or # # /etc/profiles/per-user/jokke/etc/profile.d/hm-session-vars.sh # systemd.user.sessionVariables = { NIXOS_OZONE_WL = 1; NVIM_LISTEN_ADDRESS = "$XDG_RUNTIME_DIR/nvimsocket"; PAGER = "bat --paging=always --style=plain"; MANPAGER = "sh -c 'col -bx | bat -l man -p'"; MANROFFOPT = "-c"; DO_NOT_TRACK = 1; }; home.shellAliases = { _ = "sudo"; icr = "crystal i"; hm = "home-manager"; chat = "ssh root@ipv4.jokke.space pkill mosh; mosh weechat@ipv4.jokke.space"; wget = " wget --content-disposition"; pj = "jq | bat -l json"; ls = "ls --color=auto"; }; services.gpg-agent = with pkgs; { enable = true; enableSshSupport = true; pinentry.package = pinentry-gnome3; }; systemd.user.services.shairport-sync = { Unit = { Description = "AirPlay audio server"; After = [ "pipewire-pulse.service" "network.target" ]; }; Service = { ExecStart = "${lib.getExe pkgs-unstable.shairport-sync-airplay2} -- pw"; Restart = "on-failure"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; }; programs.gpg.scdaemonSettings = { disable-ccid = true; }; programs.rbw.enable = true; programs.rclone.enable = true; programs.firefox.enable = true; xdg.configFile."opencode/opencode.jsonc".text = builtins.toJSON { "$schema" = "https://opencode.ai/config.json"; model = "opencode/kimi-k2.5"; small_model = "opencode/minimax-m2.1"; agent = { explore.model = "opencode/minimax-m2.1"; }; lsp = { ruby-lsp = { initialization = { enabledFeatures = { codeActions = true; codeLens = true; completion = true; definition = true; diagnostics = true; documentHighlights = true; documentLink = true; documentSymbols = true; foldingRanges = true; formatting = false; hover = true; inlayHint = true; onTypeFormatting = true; selectionRanges = true; semanticHighlighting = true; signatureHelp = true; typeHierarchy = true; workspaceSymbol = true; }; linters = [ "standard" ]; }; extensions = [ ".rb" ".erb" ".haml" ]; command = [ "bundle" "exec" "ruby-lsp" "--lsp" ]; }; rubocop = { command = [ "bundle" "exec" "rubocop" "--lsp" ]; extensions = [ ".rb" ".erb" ".haml" ]; }; }; mcp = { memory = { type = "local"; command = [ "npx" "-y" "@modelcontextprotocol/server-memory" ]; }; browser = { type = "local"; command = [ "npx" "-y" "@agent-infra/mcp-server-browser" "--headless" "--executable-path" (lib.getExe pkgs-unstable.chromium) ]; }; context7 = { type = "remote"; url = "https://mcp.context7.com/mcp"; headers = { CONTEXT7_API_KEY = "{env:CONTEXT7_API_KEY}"; }; enabled = true; }; }; }; gnome.automaticTimeZone = true; gtk.enable = true; home.pointerCursor = { enable = true; name = "Adwaita"; package = pkgs.adwaita-icon-theme; gtk.enable = true; }; }