diff --git a/flake.lock b/flake.lock index 4a843dd..a2aa820 100755 --- a/flake.lock +++ b/flake.lock @@ -750,6 +750,25 @@ "type": "github" } }, + "nh": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751031069, + "owner": "nix-community", + "repo": "nh", + "rev": "992aa30f55d35395b129376f16809319a9b23b16", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nh", + "type": "github" + } + }, "nix": { "inputs": { "flake-parts": "flake-parts", @@ -1013,6 +1032,7 @@ "determinate": "determinate", "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nh": "nh", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_4", diff --git a/flake.nix b/flake.nix index 7162372..5ed23af 100755 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,10 @@ url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; }; + nh = { + url = "github:nix-community/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*"; }; @@ -49,7 +53,8 @@ config.allowUnfree = true; overlays = [ inputs.neovim-nightly-overlay.overlays.default - inputs.nvim.overlays.default + inputs.nvim.overlays.default + inputs.nh.overlays.default ]; }; eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); @@ -81,7 +86,6 @@ devShells.${system}.default = pkgs.mkShell { inherit (self.checks.pre-commit-check) shellHook; buildInputs = [ - pkgs.nix pkgs.home-manager pkgs.git pkgs.ssh-to-age diff --git a/home-manager/home.nix b/home-manager/home.nix index 8d53f77..4d45651 100755 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,12 +1,5 @@ -{ - inputs, - attrs, - ... -}: { +{attrs, ...}: { programs.home-manager.enable = true; - nix = { - registry.nixpkgs.flake = inputs.nixpkgs; - }; home = { inherit (attrs) username; stateVersion = "22.11"; diff --git a/home-manager/shared/programs/dev.nix b/home-manager/shared/programs/dev.nix index 606dd94..0c3bc37 100644 --- a/home-manager/shared/programs/dev.nix +++ b/home-manager/shared/programs/dev.nix @@ -7,6 +7,7 @@ tree jujutsu emacs-nox + shellcheck #devops k9s diff --git a/home-manager/shared/programs/shell/default.nix b/home-manager/shared/programs/shell/default.nix index cef17da..26c4460 100755 --- a/home-manager/shared/programs/shell/default.nix +++ b/home-manager/shared/programs/shell/default.nix @@ -1,7 +1,4 @@ -{ - pkgs, - ... -}: { +{pkgs, ...}: { imports = [ ./tmux.nix ./git.nix @@ -88,6 +85,10 @@ pinentry-mode = "loopback"; }; }; + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; services.gpg-agent = { enable = true; enableSshSupport = true; @@ -95,10 +96,8 @@ allow-loopback-pinentry ''; }; - programs = { - nix-index = { - enableBashIntegration = false; - enableFishIntegration = true; - }; + programs.nix-index = { + enableBashIntegration = false; + enableFishIntegration = true; }; } diff --git a/home-manager/shared/programs/shell/fish/default.nix b/home-manager/shared/programs/shell/fish/default.nix index c6014d1..3c3f8ca 100644 --- a/home-manager/shared/programs/shell/fish/default.nix +++ b/home-manager/shared/programs/shell/fish/default.nix @@ -1,4 +1,4 @@ -{pkgs, host, ...}: { +{pkgs, ...}: { programs.fish = { enable = true; interactiveShellInit = '' @@ -6,17 +6,21 @@ set show_startup_tips false ''; shellInit = " - fish_add_path /usr/local/go/bin fish_add_path ~/go/bin fish_add_path ~/.local/bin set -gx MANPAGER 'nvim +Man!' set -gx EDITOR 'nvim' - set -gx _JAVA_AWT_WM_NONREPARENTING 1 - set -gx NIX_FLAKE '/home/e/dev/nix' + set -gx NH_FLAKE '/home/e/dev/nix' "; plugins = [ - {name = "fzf"; inherit (pkgs.fishPlugins.fzf-fish) src;} - {name = "puffer"; inherit (pkgs.fishPlugins.puffer) src;} + { + name = "fzf"; + inherit (pkgs.fishPlugins.fzf-fish) src; + } + { + name = "puffer"; + inherit (pkgs.fishPlugins.puffer) src; + } ]; functions = import ./functions.nix; shellAbbrs = { @@ -25,14 +29,11 @@ }; shellAliases = { ":q" = "exit"; - hms = "home-manager switch --flake $NIX_FLAKE#${host.username}"; - rbs = "sudo nixos-rebuild switch --flake $NIX_FLAKE#${host.hostName}"; mpv = "mpv --no-keepaspect-window"; cat = "bat -pp"; tcd = "cd $(mktemp -d)"; docker = "nerdctl"; vimdiff = "nvim -d"; - ls = "eza"; }; }; } diff --git a/home-manager/shared/programs/shell/fish/functions.nix b/home-manager/shared/programs/shell/fish/functions.nix index 3c8e00d..d238e2a 100644 --- a/home-manager/shared/programs/shell/fish/functions.nix +++ b/home-manager/shared/programs/shell/fish/functions.nix @@ -16,19 +16,29 @@ end ''; }; + nix-prefetch-hash = { + body = '' + nix-hash --type sha256 --to-base64 (nix-prefetch-url $argv) + ''; + }; fish_jj_prompt = { body = '' if not command -sq jj return 1 end - + if not command -sq timeout + return 1 + end + if set -q FISH_JJ + return 0 + end if not jj root &>/dev/null return 1 end # Generate prompt set -l info "$( - jj log --ignore-working-copy --no-graph --color=always --revisions=@ --template " + timeout 5 jj log --ignore-working-copy --no-graph --color=always --revisions=@ --template " separate( ' ', self.change_id().shortest(), diff --git a/home-manager/shared/programs/shell/git.nix b/home-manager/shared/programs/shell/git.nix index a6178d2..f078523 100755 --- a/home-manager/shared/programs/shell/git.nix +++ b/home-manager/shared/programs/shell/git.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.git = { enable = true; userEmail = "cjriddz@protonmail.com"; @@ -26,6 +27,9 @@ settings = { core = { fsmonitor = "watchman"; + watchman = { + register-snapshot-trigger = false; + }; }; user = { email = "cjriddz@protonmail.com"; @@ -35,7 +39,7 @@ username = "iofq"; }; signing = { - behavior = "own"; + behavior = "drop"; backend = "gpg"; key = "cjriddz@protonmail.com"; }; @@ -43,48 +47,63 @@ sign-on-push = true; }; ui = { - default-command = ["log"]; + default-command = [ "log" ]; conflict-marker-style = "git"; merge-editor = "vimdiff"; diff-editor = "diffview"; - diff.format = "git"; + diff-formatter = ":git"; paginate = "never"; movement = { edit = true; }; }; merge-tools.vimdiff = { - program = "nvim"; + program = "nvim"; }; merge-tools.diffview = { - program = "sh"; - edit-args = [ - "-c" - '' - set -eu - rm -f "$right/JJ-INSTRUCTIONS" - git -C "$left" init -q - git -C "$left" add -A - git -C "$left" commit -q -m baseline --allow-empty - mv "$left/.git" "$right" - git -C "$right" add --intent-to-add -A - (cd "$right"; nvim -c "lua vim.g.snacks_indent=false" -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen) - git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; } - git -C "$right" commit -q -m split - git -C "$right" restore . # undo changes in modified files - git -C "$right" reset . # undo --intent-to-add - git -C "$right" clean -q -df # remove untracked files - '' - ]; + program = "sh"; + edit-args = [ + "-c" + '' + set -eu + rm -f "$right/JJ-INSTRUCTIONS" + git -C "$left" init -q + git -C "$left" add -A + git -C "$left" commit -q -m baseline --allow-empty + mv "$left/.git" "$right" + git -C "$right" add --intent-to-add -A + (cd "$right"; nvim -c "lua vim.g.snacks_indent=false" -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen) + git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; } + git -C "$right" commit -q -m split + git -C "$right" restore . # undo changes in modified files + git -C "$right" reset . # undo --intent-to-add + git -C "$right" clean -q -df # remove untracked files + '' + ]; }; snapshot = { max-new-file-size = "10MiB"; }; revsets = { - log = "ancestors(reachable(@,trunk()..),2) | trunk()"; + anc = "ancestors(@,10) | trunk()"; }; aliases = { - tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@"]; + tug = [ + "bookmark" + "move" + "--from" + "heads(::@- & bookmarks())" + "--to" + "@" + ]; + }; + fix = { + tools = { + treefmt = { + command = [ "treefmt" ]; + patterns = [ "glob:**/*.nix" ]; + }; + }; }; }; }; diff --git a/home-manager/shared/programs/shell/tmux.nix b/home-manager/shared/programs/shell/tmux.nix index e892d8c..1cb9733 100755 --- a/home-manager/shared/programs/shell/tmux.nix +++ b/home-manager/shared/programs/shell/tmux.nix @@ -26,7 +26,8 @@ default_mode "locked" keybinds { tmux { - bind "Ctrl a" { Write 2; SwitchToMode "Locked"; } + bind "Ctrl a" { SwitchToMode "Locked"; } + bind "Ctrl b" { Write 1; } bind "[" { SwitchToMode "Scroll"; } bind "\"" { NewPane "Down"; SwitchToMode "Locked"; } bind "%" { NewPane "Right"; SwitchToMode "Locked"; } @@ -60,6 +61,9 @@ bind "8" { GoToTab 8; SwitchToMode "Locked"; } bind "9" { GoToTab 9; SwitchToMode "Locked"; } } + locked { + unbind "Ctrl g" + } shared_except "tmux" { bind "Ctrl a" { SwitchToMode "Tmux" diff --git a/home-manager/shared/wayland/default.nix b/home-manager/shared/wayland/default.nix index fd1cc19..a80e37e 100644 --- a/home-manager/shared/wayland/default.nix +++ b/home-manager/shared/wayland/default.nix @@ -7,66 +7,76 @@ ./alacritty ./hyprland ]; - - home.packages = with pkgs; [ - pulseaudio - pulsemixer - alsa-utils - wlogout - wf-recorder - wdisplays - wl-clipboard - gammastep - sway-contrib.grimshot - xdg-utils - ]; - home.sessionVariables = { - MOZ_DBUS_REMOTE = 1; + home = { + packages = with pkgs; [ + pulseaudio + pulsemixer + alsa-utils + wlogout + wf-recorder + wdisplays + wl-clipboard + gammastep + sway-contrib.grimshot + xdg-utils + ]; + sessionVariables = { + MOZ_DBUS_REMOTE = 1; + }; + file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/DMZ-Black"; }; - programs.wofi = { - enable = true; - style = '' - window, #input, #entry, #scroll, #text, #inner-box { - background-color: #152528; - color: #e6eaea; - } - #entry:selected, #text:selected { - background-color: #a1cdd8; - color: #152528; - } - ''; - }; - services.gammastep = { - enable = true; - dawnTime = "6:00-8:00"; - duskTime = "20:00-22:00"; - latitude = 43.0; - longitude = -89.0; - temperature.day = 6000; - temperature.night = 3500; - }; - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - settings = { - color = "#152528"; - daemonize = true; - clock = true; - ignore-empty-password = true; + services = { + gammastep = { + enable = true; + dawnTime = "6:00-8:00"; + duskTime = "20:00-22:00"; + latitude = 43.0; + longitude = -89.0; + temperature.day = 6000; + temperature.night = 3500; + }; + swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${config.programs.swaylock.package}/bin/swaylock"; + } + { + event = "lock"; + command = "${config.programs.swaylock.package}/bin/swaylock"; + } + ]; + }; + mako.enable = true; + mako.settings = { + default-timeout = 5; }; }; - services.swayidle = { - enable = true; - events = [ - { - event = "before-sleep"; - command = "${config.programs.swaylock.package}/bin/swaylock"; - } - { - event = "lock"; - command = "${config.programs.swaylock.package}/bin/swaylock"; - } - ]; + programs = { + wofi = { + enable = true; + style = '' + window, #input, #entry, #scroll, #text, #inner-box { + background-color: #152528; + color: #e6eaea; + } + #entry:selected, #text:selected { + background-color: #a1cdd8; + color: #152528; + } + ''; + }; + swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + color = "#152528"; + daemonize = true; + clock = true; + ignore-empty-password = true; + }; + }; }; xdg = { configFile."mimeapps.list".force = true; @@ -92,6 +102,4 @@ }; }; }; - services.mako.enable = true; - home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/DMZ-Black"; } diff --git a/home-manager/shared/wayland/hyprland/default.nix b/home-manager/shared/wayland/hyprland/default.nix index 5829016..ce1160f 100644 --- a/home-manager/shared/wayland/hyprland/default.nix +++ b/home-manager/shared/wayland/hyprland/default.nix @@ -91,7 +91,7 @@ ",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" ## Movement - "$mod, p, layoutmsg, swapwithmaster" + "$mod, m, layoutmsg, swapwithmaster" "$mod, e, layoutmsg, orientationnext" "$mod, i, layoutmsg, addmaster" "$mod, d, layoutmsg, removemaster" @@ -100,6 +100,7 @@ "$mod, k, movefocus, u" "$mod, j, movefocus, d" "$mod, n, changegroupactive, f" + "$mod, p, changegroupactive, b" "$mod SHIFT, h, movewindoworgroup, l" "$mod SHIFT, l, movewindoworgroup, r" "$mod SHIFT, k, movewindoworgroup, u" diff --git a/home-manager/t14/home.nix b/home-manager/t14/home.nix index df5ee01..6bf33e1 100755 --- a/home-manager/t14/home.nix +++ b/home-manager/t14/home.nix @@ -32,7 +32,12 @@ appimage-run wireguard-tools android-tools + nh ]; + sessionVariables = { + MOZ_ENABLE_WAYLAND = 1; + JAVA_AWT_WM_NONREPARENTING = 1; + }; }; programs.librewolf.enable = true; programs.ssh = { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 5cd7a51..277ebf6 100755 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,7 +1,9 @@ { -host, -... -}: { # Create plugdev group + inputs, + host, + ... +}: { + # Create plugdev group networking.hostName = host.hostName; time.timeZone = "America/Chicago"; users = { @@ -28,6 +30,7 @@ host, # Enable flakes and unfree packages nix = { + registry.nixpkgs.flake = inputs.nixpkgs; settings = { auto-optimise-store = true; substituters = [ @@ -40,11 +43,15 @@ host, ]; trusted-users = [host.username]; experimental-features = ["nix-command" "flakes"]; + lazy-trees = true; }; + channel.enable = false; + nixPath = ["nixpkgs=flake:nixpkgs"]; gc = { automatic = true; dates = "00:00"; options = "--delete-older-than 14d"; }; }; + security.sudo-rs.enable = true; } diff --git a/nixos/consensus/configuration.nix b/nixos/consensus/configuration.nix index 2ccfe67..6e5e10b 100644 --- a/nixos/consensus/configuration.nix +++ b/nixos/consensus/configuration.nix @@ -1,11 +1,16 @@ -{lib, pkgs, config, ...}: { +{ + lib, + pkgs, + config, + ... +}: { imports = [ ./hardware-configuration.nix ./backups.nix ]; sops = { secrets = { - "env" = { sopsFile = ../../secrets/cf-acme.yaml; }; + "env" = {sopsFile = ../../secrets/cf-acme.yaml;}; }; }; documentation = { @@ -44,26 +49,26 @@ port = 2283; host = "localhost"; openFirewall = true; - machine-learning.enable = false; + machine-learning.enable = true; mediaLocation = "/rice/immich"; }; nginx = { - enable = true; - virtualHosts."img.10110110.xyz" = { - useACMEHost = "10110110.xyz"; - forceSSL = true; - locations."/" = { - proxyPass = "http://localhost:${toString config.services.immich.port}"; - proxyWebsockets = true; - recommendedProxySettings = true; - extraConfig = '' - client_max_body_size 50000M; - proxy_read_timeout 600s; - proxy_send_timeout 600s; - send_timeout 600s; - ''; - }; + enable = true; + virtualHosts."img.10110110.xyz" = { + useACMEHost = "10110110.xyz"; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:${toString config.services.immich.port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + extraConfig = '' + client_max_body_size 50000M; + proxy_read_timeout 600s; + proxy_send_timeout 600s; + send_timeout 600s; + ''; }; + }; }; }; boot = { @@ -76,8 +81,8 @@ zramSwap.enable = false; swapDevices = [ { - device = "/var/swapfile"; - size = 4 * 1024; + device = "/swapfile"; + size = 8 * 1024; } ]; virtualisation.docker.enable = true; @@ -115,7 +120,7 @@ ]; }; }; - security.sudo.wheelNeedsPassword = false; + security.sudo-rs.wheelNeedsPassword = false; security.acme = { acceptTerms = true; defaults.email = "acme@10110110.xyz"; diff --git a/nixos/default.nix b/nixos/default.nix index 6f1beb8..e50ec56 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -6,6 +6,7 @@ ... }: let defaultModules = [ + ./configuration.nix inputs.sops-nix.nixosModules.sops inputs.nix-index-database.nixosModules.nix-index inputs.determinate.nixosModules.default @@ -23,7 +24,6 @@ in { modules = defaultModules ++ [ - ./configuration.nix ./t14/configuration.nix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 ]; @@ -40,7 +40,6 @@ in { modules = defaultModules ++ [ - ./configuration.nix ./consensus/configuration.nix ]; }; diff --git a/nixos/t14/backups.nix b/nixos/t14/backups.nix index c25f9cf..d1f3182 100644 --- a/nixos/t14/backups.nix +++ b/nixos/t14/backups.nix @@ -17,6 +17,7 @@ paths = [ "/home/e/backmeup" + "/home/e/orgfiles" "/home/e/.ssh" "/home/e/.librewolf" "/home/e/.runelite" diff --git a/nixos/t14/configuration.nix b/nixos/t14/configuration.nix index 20ddc73..bd5ee3a 100755 --- a/nixos/t14/configuration.nix +++ b/nixos/t14/configuration.nix @@ -15,6 +15,7 @@ in { cryptsetup nfs-utils nerdctl + (lib.hiPrio uutils-coreutils-noprefix) ]; extraInit = "[[ -f ${homeManagerSessionVars} ]] && source ${homeManagerSessionVars} && echo 'x' > /tmp/test"; };