From 72def5c785559608ce827726e40bfc16029737e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 10:14:11 +0200 Subject: [PATCH 1/9] feat: add more git abbreviations --- modules/programs/git.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 0dbd586..12171e0 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -29,18 +29,24 @@ in config = mkIf cfg.enable { my.shell.abbreviations = { + g = "git"; + gC = "git clone"; + gF = "git pull"; + gS = "git switch"; ga = "git add"; gap = "git add --patch"; - gr = "git restore"; - grp = "git restore --patch"; gb = "git branch"; gc = "git commit"; gco = "git checkout"; gd = "git diff"; gds = "git diff --staged"; - gp = "git push"; gf = "git fetch"; - gF = "git pull"; + gp = "git push"; + gr = "git restore"; + grm = "git rm --cached"; + grp = "git restore --patch"; + grps = "git restore --patch --staged"; + grs = "git restore --staged"; gs = "git status"; }; home-manager.users.moritz = { From 189036f2c87f725da47214faf38796bb89c77945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 21:39:05 +0200 Subject: [PATCH 2/9] fix: openssh CVE-2024-6387 --- flake.lock | 6 +++--- modules/security/default.nix | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 8783f04..b632025 100644 --- a/flake.lock +++ b/flake.lock @@ -720,11 +720,11 @@ }, "master": { "locked": { - "lastModified": 1719764577, - "narHash": "sha256-304HNA/XvmyfD7JZfpqF4dEBnbUYci/gMZvDThXmYkE=", + "lastModified": 1719834384, + "narHash": "sha256-M6Vr7LbYeesXrG3hjAExzIfYFxrncrs1dpnp7zdeUN4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19581e2ce8bc43f898ef724f8072ebf62bebb325", + "rev": "c08bd9add4732d87fde747e15b8fc053dfd1234b", "type": "github" }, "original": { diff --git a/modules/security/default.nix b/modules/security/default.nix index 3fcd4fb..e7b42fe 100644 --- a/modules/security/default.nix +++ b/modules/security/default.nix @@ -1,5 +1,6 @@ { config , lib +, pkgs , ... }: { ## System security tweaks @@ -69,6 +70,7 @@ # SSH services.openssh = { + package = pkgs.master.openssh; # HACK: to fix CVE-2024-6387 settings = { # Disable ssh password login PasswordAuthentication = lib.mkDefault false; From 9bd0870f1d6418e908aaef4d3b001ab6e79846a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 21:40:49 +0200 Subject: [PATCH 3/9] fix: typo --- modules/programs/hyprland/_config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/hyprland/_config.nix b/modules/programs/hyprland/_config.nix index 5d210e5..8731021 100644 --- a/modules/programs/hyprland/_config.nix +++ b/modules/programs/hyprland/_config.nix @@ -226,7 +226,7 @@ in # Lid open/close bindl=,switch:on:Lid Switch,exec,monitors="$(hyprctl monitors | grep -c '^Monitor')" && hyprctl keyword monitor "eDP-1, disable" && [ "$monitors" = 1 ] && loginctl lock-session - bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, prefered, auto" + bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, preferred, auto" # Extra Config ${cfg.extraConfig} From 55325053ec76bd2abb794a9d8ac6c5d3ce3d42af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 21:41:04 +0200 Subject: [PATCH 4/9] fix: replace deprecated function --- modules/programs/nvim/plugins/lua/nvim-lspconfig.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua index 898b190..a4e6af4 100644 --- a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua @@ -49,10 +49,10 @@ local on_attach_def = function(client, bufnr) l = { function() lsp_lines.toggle() - if vim.diagnostic.is_disabled() then - vim.diagnostic.enable() - else + if vim.diagnostic.is_enabled() then vim.diagnostic.disable() + else + vim.diagnostic.enable() end end, "LSP lines", From a11717c8ceaf6b3121f6f53ef0d00a47f8522d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 1 Jul 2024 21:41:32 +0200 Subject: [PATCH 5/9] feat: configure nil_ls --- modules/programs/nvim/plugins/lua/nvim-lspconfig.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua index a4e6af4..8476272 100644 --- a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua @@ -123,7 +123,6 @@ local servers = { "bashls", "gleam", "gopls", - "nil_ls", "pylsp", "ruff_lsp", "templ", @@ -133,6 +132,16 @@ for _, lsp in ipairs(servers) do lspconfig_setup(lsp, {}) end +lspconfig_setup("nil_ls", { + settings = { + flake = { + autoArchive = true, + autoEvalInputs = true, + nixpkgsInputName = "nixpkgs", + }, + }, +}) + lspconfig_setup("nixd", { settings = { nixd = { From b8ec445560795ed701b2ea93d982c9f87eb61fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 30 Jul 2024 14:55:23 +0200 Subject: [PATCH 6/9] feat!: prefix P abbr with a dot --- modules/programs/fish.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 8934508..d96f9b0 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -31,7 +31,7 @@ in enable = true; shellAbbrs = shellConfig.abbreviations; shellAliases = shellConfig.aliases; - shellInit = '' + shellInit = /* fish */ '' # Vi Mode fish_vi_key_bindings @@ -62,7 +62,7 @@ in end abbr --add dotdot --regex '^\.\.+$' --function multicd - abbr -a P --position anywhere --set-cursor "% | $PAGER" + abbr -a .P --position anywhere --set-cursor "% | $PAGER" function editor_edit echo $EDITOR $argv From e94c6ea4d7ea8b5192a8fe2c0f273f7954aae611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 30 Jul 2024 14:56:01 +0200 Subject: [PATCH 7/9] feat: add short alias for default flake --- modules/programs/nix.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/programs/nix.nix b/modules/programs/nix.nix index 9435552..d9c0516 100644 --- a/modules/programs/nix.nix +++ b/modules/programs/nix.nix @@ -85,6 +85,7 @@ in stable.flake = inputs.stable; dotfiles.flake = self; default.flake = self; + d.flake = self; }; settings = { From 7472b94108d61f6fb4c99a97e2885a4614762779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 30 Jul 2024 14:56:24 +0200 Subject: [PATCH 8/9] feat: do not use nom by default --- modules/programs/nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/nix.nix b/modules/programs/nix.nix index d9c0516..3d314de 100644 --- a/modules/programs/nix.nix +++ b/modules/programs/nix.nix @@ -39,7 +39,7 @@ in }; optimise.enable = mkEnableOption "nix-optimise"; useSuper = mkEnableOption "use nix super"; - useNom = mkEnableOption "use nix output monitor" // { default = true; }; + useNom = mkEnableOption "use nix output monitor"; }; config = { From 1cae5d144af8451eb7950856f9fef3d5e168a896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 12 Aug 2024 11:06:18 +0200 Subject: [PATCH 9/9] feat: add hyprland monitor options --- hosts/nixos-laptop/default.nix | 6 +++-- modules/programs/hyprland/_config.nix | 12 +++++++-- modules/programs/hyprland/default.nix | 38 ++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 87ed2be..987c719 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -20,8 +20,10 @@ webis.enable = true; impermanence.enable = true; }; - programs.hyprland.enable = true; - programs.gitbutler.enable = true; + programs.hyprland = { + enable = true; + monitors.DP-3.scale = "auto"; + }; programs.exercism.enable = true; }; diff --git a/modules/programs/hyprland/_config.nix b/modules/programs/hyprland/_config.nix index 8731021..18a6c5b 100644 --- a/modules/programs/hyprland/_config.nix +++ b/modules/programs/hyprland/_config.nix @@ -3,10 +3,18 @@ , ... }: -with lib; let + inherit (lib) concatStringsSep flip boolToString mapAttrsToList; cfg = config.my.programs.hyprland; + mkMonitor = { name, resolution, position, scale, disabled, extra }: + if disabled + then "monitor=${name},disabled" + else "monitor=${name},${resolution},${position},${scale},${extra}"; + + monitorsList = mapAttrsToList (name: value: { name = name; } // value) cfg.monitors; + monitors = map mkMonitor monitorsList; + mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}"; mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules); in @@ -17,7 +25,7 @@ in # # See https://wiki.hyprland.org/Configuring/Monitors/ - ${concatLines (map (x: "monitor=${x}") cfg.monitors)} + ${concatStringsSep "\n" monitors} # See https://wiki.hyprland.org/Configuring/Keywords/ for more diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index 4c6bed1..76caa5c 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -5,8 +5,8 @@ , ... } @ args: -with lib; let + inherit (lib) mkOption mkEnableOption mkIf types getExe genAttrs optionalAttrs optional; cfg = config.my.programs.hyprland; hyprland = inputs.hyprland.packages.${pkgs.system}.default; @@ -31,9 +31,38 @@ in default = [ "de" "us" ]; }; monitors = mkOption { - type = types.listOf types.str; - description = "monitor settings"; - default = [ ",preferred,auto,1" ]; + type = types.attrsOf ( + let + sub = types.submodule { + options = { + resolution = mkOption { + type = types.strMatching "\(preferred\)|\([[:digit:]]+x[[:digit:]]+\(@[[:digit:]]+\)\?\)"; + default = "preferred"; + }; + position = mkOption { + type = types.strMatching "\(auto\)|\(-\?[[:digit:]]+x-?[[:digit:]]+\)"; + default = "auto"; + }; + disabled = mkEnableOption "disabled"; + scale = mkOption { + type = types.oneOf [ types.float (types.strMatching "auto") ]; + default = 1.0; + apply = x: if lib.isFloat x then lib.strings.floatToString x else x; + }; + extra = mkOption { + type = types.listOf types.str; + default = [ ]; + apply = lib.concatStringsSep ","; + }; + }; + }; + in + sub + ); + description = "monitor setting"; + default = { + "" = { }; + }; }; extraConfig = mkOption { type = types.str; @@ -51,6 +80,7 @@ in # foot.enable = true; kitty.enable = true; rofi.enable = true; + hyprland.monitors."" = lib.mkDefault { }; }; wallpapers.enable = true; services = {