From 9d7f36dbae9ea45d141ddb07860273d5eb85f6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 19:39:26 +0100 Subject: [PATCH 01/12] refactor(lazygit): move into own module --- modules/profiles/base.nix | 61 +---------------------- modules/programs/lazygit.nix | 95 ++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 60 deletions(-) create mode 100644 modules/programs/lazygit.nix diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 9aa5607..41c4a1c 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -187,7 +187,6 @@ in rs = "sudo systemctl"; uj = "journalctl --user"; rj = "sudo journalctl"; - lg = "lazygit"; }; aliases = { ls = "${getExe pkgs.eza} -lh --icons --git"; @@ -198,6 +197,7 @@ in variables = { EDITOR = "vim"; }; }; programs = { + lazygit.enable = true; direnv.enable = true; fish.enable = true; git.enable = true; @@ -299,65 +299,6 @@ in ]; }; starship.enable = true; - lazygit.enable = true; - lazygit.settings = { - customCommands = [ - { - key = ""; - context = "global"; - description = "Create new conventional commit"; - prompts = [ - { - type = "menu"; - key = "Type"; - title = "Type of change"; - options = [ - { name = "build"; description = "Changes that affect the build system or external dependencies"; value = "build"; } - { name = "feat"; description = "A new feature"; value = "feat"; } - { name = "fix"; description = "A bug fix"; value = "fix"; } - { name = "chore"; description = "Other changes that don't modify src or test files"; value = "chore"; } - { name = "ci"; description = "Changes to CI configuration files and scripts"; value = "ci"; } - { name = "docs"; description = "Documentation only changes"; value = "docs"; } - { name = "perf"; description = "A code change that improves performance"; value = "perf"; } - { name = "refactor"; description = "A code change that neither fixes a bug nor adds a feature"; value = "refactor"; } - { name = "revert"; description = "Reverts a previous commit"; value = "revert"; } - { name = "style"; description = "Changes that do not affect the meaning of the code"; value = "style"; } - { name = "test"; description = "Adding missing tests or correcting existing tests"; value = "test"; } - ]; - } - { - type = "input"; - title = "Scope"; - key = "Scope"; - initialValue = ""; - } - { - type = "menu"; - key = "Breaking"; - title = "Breaking change"; - options = [ - { name = "no"; value = ""; } - { name = "yes"; value = "!"; } - ]; - } - { - type = "input"; - title = "message"; - key = "Message"; - initialValue = ""; - } - { - type = "confirm"; - key = "Confirm"; - title = "Commit"; - body = "Are you sure you want to commit?"; - } - ]; - command = "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'"; - loadingText = "Creating conventional commit..."; - } - ]; - }; }; home = { username = "moritz"; diff --git a/modules/programs/lazygit.nix b/modules/programs/lazygit.nix new file mode 100644 index 0000000..e3a07ca --- /dev/null +++ b/modules/programs/lazygit.nix @@ -0,0 +1,95 @@ +{ config +, lib +, pkgs +, ... +}: + +with lib; +let + cfg = config.my.programs.lazygit; + + wrapper = pkgs.writeShellApplication { + name = "lg"; + text = '' + export LAZYGIT_NEW_DIR_FILE="$HOME/.lazygit/newdir" + + lazygit "$@" + + if [ -f "$LAZYGIT_NEW_DIR_FILE" ]; then + cd "$(cat "$LAZYGIT_NEW_DIR_FILE")" + rm -f "$LAZYGIT_NEW_DIR_FILE" > /dev/null + fi + ''; + runtimeInputs = [ pkgs.lazygit ]; + }; +in +{ + options.my.programs.lazygit.enable = mkEnableOption "lazygit"; + + config = mkIf cfg.enable { + home-manager.users.moritz.home.packages = [ + wrapper + ]; + home-manager.users.moritz.programs.lazygit = { + enable = true; + settings = { + customCommands = [ + { + key = ""; + context = "global"; + description = "Create new conventional commit"; + prompts = [ + { + type = "menu"; + key = "Type"; + title = "Type of change"; + options = [ + { name = "build"; description = "Changes that affect the build system or external dependencies"; value = "build"; } + { name = "feat"; description = "A new feature"; value = "feat"; } + { name = "fix"; description = "A bug fix"; value = "fix"; } + { name = "chore"; description = "Other changes that don't modify src or test files"; value = "chore"; } + { name = "ci"; description = "Changes to CI configuration files and scripts"; value = "ci"; } + { name = "docs"; description = "Documentation only changes"; value = "docs"; } + { name = "perf"; description = "A code change that improves performance"; value = "perf"; } + { name = "refactor"; description = "A code change that neither fixes a bug nor adds a feature"; value = "refactor"; } + { name = "revert"; description = "Reverts a previous commit"; value = "revert"; } + { name = "style"; description = "Changes that do not affect the meaning of the code"; value = "style"; } + { name = "test"; description = "Adding missing tests or correcting existing tests"; value = "test"; } + ]; + } + { + type = "input"; + title = "Scope"; + key = "Scope"; + initialValue = ""; + } + { + type = "menu"; + key = "Breaking"; + title = "Breaking change"; + options = [ + { name = "no"; value = ""; } + { name = "yes"; value = "!"; } + ]; + } + { + type = "input"; + title = "message"; + key = "Message"; + initialValue = ""; + } + { + type = "confirm"; + key = "Confirm"; + title = "Commit"; + body = "Are you sure you want to commit?"; + } + ]; + command = "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'"; + loadingText = "Creating conventional commit..."; + } + ]; + }; + }; + }; +} From 05e34bcfc9c257dd051afdf6ece80cbcdd501053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 19:40:51 +0100 Subject: [PATCH 02/12] feat!: switch to lix --- 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 c98c643..b158709 100644 --- a/modules/programs/nix.nix +++ b/modules/programs/nix.nix @@ -49,7 +49,7 @@ in nix = { nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - package = pkgs.nix; + package = pkgs.lix; extraOptions = '' !include ${config.age.secrets.nix-github-token.path} From e93f7ce742fa9c444bf15160d0f1176e618009e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 19:41:56 +0100 Subject: [PATCH 03/12] fix: use first nixosConfiguration instead of hardcoded name --- modules/programs/nvim/new_plugins/lsp.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/nvim/new_plugins/lsp.nix b/modules/programs/nvim/new_plugins/lsp.nix index 8a001f5..99b13e0 100644 --- a/modules/programs/nvim/new_plugins/lsp.nix +++ b/modules/programs/nvim/new_plugins/lsp.nix @@ -18,7 +18,7 @@ in }; options = { nixos = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; + expr = ''builtins.head (builtins.attrValues ((builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations).options''; }; "flake-parts" = { expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; From a31054750a05d77f18845a2097d7ea9d8923eebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 20:00:36 +0100 Subject: [PATCH 04/12] feat: add nh --- modules/profiles/base.nix | 4 ++++ modules/programs/nix.nix | 15 --------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 41c4a1c..6d301d6 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -265,6 +265,10 @@ in programs = { mtr.enable = true; command-not-found.enable = false; + nh = { + enable = true; + flake = "/home/moritz/Documents/dotfiles/"; + }; }; services = { diff --git a/modules/programs/nix.nix b/modules/programs/nix.nix index b158709..2dfc969 100644 --- a/modules/programs/nix.nix +++ b/modules/programs/nix.nix @@ -10,12 +10,6 @@ let inherit (lib) mkEnableOption mkOption types; cfg = config.my.programs.nix; - mkNom = system: nix: - inputs.nix-monitored.packages.${system}.default.override - { - withNotify = false; - nix = nix; - }; in { options.my.programs.nix = { @@ -31,15 +25,6 @@ in }; config = { - my.nixpkgs.overlays = [ - (final: prev: - { - nixos-rebuild = prev.nixos-rebuild.override { - nix = mkNom final.system final.nix; - }; - }) - ]; - home-manager.users.moritz.programs.direnv.nix-direnv.package = pkgs.nix-direnv.override { nix = config.nix.package; }; From 50c6072ee9ea5972bb2a5cc3b6432ea00e298142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 20:02:11 +0100 Subject: [PATCH 05/12] feat: enable mullvad on laptop --- hosts/nixos-laptop/default.nix | 1 + modules/profiles/impermanence.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 658b9e2..48f97f7 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -22,6 +22,7 @@ }; terminal.package = pkgs.kitty; programs.exercism.enable = true; + services.mullvad.enable = true; }; users.users.moritz.packages = [ pkgs.poetry ]; diff --git a/modules/profiles/impermanence.nix b/modules/profiles/impermanence.nix index c5113e7..93568f7 100644 --- a/modules/profiles/impermanence.nix +++ b/modules/profiles/impermanence.nix @@ -27,6 +27,7 @@ in "/var/lib/nixos" "/var/lib/systemd" "/var/log" + "/etc/mullvad-vpn/" ]; files = [ "/etc/machine-id" From df2ffacc0f0db2685477d7d9428522171264f9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Nov 2024 20:13:24 +0100 Subject: [PATCH 06/12] feat: add rust_analyzer --- modules/programs/nvim/new_plugins/lsp.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/programs/nvim/new_plugins/lsp.nix b/modules/programs/nvim/new_plugins/lsp.nix index 99b13e0..afc64ab 100644 --- a/modules/programs/nvim/new_plugins/lsp.nix +++ b/modules/programs/nvim/new_plugins/lsp.nix @@ -8,6 +8,11 @@ in plugins.lsp = { enable = true; inlayHints = true; + servers.rust_analyzer = { + enable = true; + installRustc = false; + installCargo = false; + }; servers.elixirls.enable = true; servers.nextls.enable = true; servers.nil_ls.enable = true; From 14c1cafcd8aa52505af11a3bbb208f1bfd7619ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 11 Nov 2024 13:22:46 +0100 Subject: [PATCH 07/12] feat: add prismlauncher --- hosts/nixos-desktop/default.nix | 1 + modules/profiles/impermanence.nix | 1 + modules/programs/prismlauncher.nix | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 modules/programs/prismlauncher.nix diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index b3d88b7..6804d69 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -22,6 +22,7 @@ impermanence.enable = true; webis.enable = true; }; + programs.prismlauncher.enable = true; services.wallpaper.enable = true; }; diff --git a/modules/profiles/impermanence.nix b/modules/profiles/impermanence.nix index 93568f7..992519f 100644 --- a/modules/profiles/impermanence.nix +++ b/modules/profiles/impermanence.nix @@ -56,6 +56,7 @@ in ".local/share/JetBrains" ".local/share/direnv" ".local/share/nvim" + ".local/share/PrismLauncher/" ".local/share/zoxide" ".local/state/nvim" ".mozilla" diff --git a/modules/programs/prismlauncher.nix b/modules/programs/prismlauncher.nix new file mode 100644 index 0000000..54c01aa --- /dev/null +++ b/modules/programs/prismlauncher.nix @@ -0,0 +1,26 @@ +{ config +, lib +, pkgs +, ... +}: + +with lib; +let + cfg = config.my.programs.prismlauncher; + + prismlauncher = pkgs.runCommandNoCC "prismlauncher" + { + nativeBuildInputs = [ pkgs.makeWrapper ]; + } '' + makeWrapper ${lib.getExe pkgs.prismlauncher} $out/bin/prismlauncher \ + --set QT_STYLE_OVERRIDE "" \ + --set QT_QPA_PLATFORMTHEME "gtk3" + ''; +in +{ + options.my.programs.prismlauncher.enable = mkEnableOption "prismlauncher"; + + config = mkIf cfg.enable { + users.users.moritz.packages = [ prismlauncher ]; + }; +} From c64a45ac7bdf9186e3f87a341a5f9270fdf84852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 11 Nov 2024 13:23:21 +0100 Subject: [PATCH 08/12] feat(nvim): add obsidian plugin --- modules/programs/nvim/new_plugins/other.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index e423f4c..7da6805 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -58,6 +58,25 @@ in plugins.helpview.enable = true; performance.combinePlugins.standalonePlugins = [ "helpview.nvim" ]; } + { + plugins.obsidian.enable = true; + plugins.obsidian.settings = { + dir = "~/Documents/Nextcloud/Notes/zettelkasten/"; + note_id_func.__raw = '' + function(title) + if title ~= nil then + return title + else + suffix = "" + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + return tostring(os.date("%Y-%m-%d")) .. "-" .. suffix + end + end + ''; + }; + } ]; }; } From 8d4ec90a2eb1a8c9911605262310c6dc9ec7f55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 11 Nov 2024 13:24:00 +0100 Subject: [PATCH 09/12] feat(desktop): add kanshi settings --- hosts/nixos-desktop/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 6804d69..311468c 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -31,6 +31,19 @@ stable.calibre # NOTE: breaks often in unstable ]; + home-manager.users.moritz.services.kanshi.settings = [ + { + profile.name = "default"; + profile.outputs = [ + { + adaptiveSync = true; + criteria = "*"; + scale = 1.2; + } + ]; + } + ]; + hardware = { keyboard.qmk.enable = true; nvidia = { From 54b73fbc64ff528e685dc6437f635894d4e56260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Wed, 13 Nov 2024 11:41:42 +0100 Subject: [PATCH 10/12] feat(impermanence): add steam --- modules/profiles/impermanence.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/profiles/impermanence.nix b/modules/profiles/impermanence.nix index 992519f..a3b9fa2 100644 --- a/modules/profiles/impermanence.nix +++ b/modules/profiles/impermanence.nix @@ -45,18 +45,19 @@ in ".cache/nvim/luac" ".cat_installer" # eduroam ".config/JetBrains" + ".config/Mullvad VPN/" ".config/Nextcloud" ".config/Signal/" - ".config/Mullvad VPN/" ".config/calibre" ".config/github-copilot" ".config/kdeconnect" ".config/keepassxc" ".java/.userPrefs/jetbrains/" ".local/share/JetBrains" + ".local/share/PrismLauncher/" + ".local/share/Steam/" ".local/share/direnv" ".local/share/nvim" - ".local/share/PrismLauncher/" ".local/share/zoxide" ".local/state/nvim" ".mozilla" From a9ffa8d649cee1c5e1dfc01d2aa72ade50660044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Wed, 13 Nov 2024 11:42:01 +0100 Subject: [PATCH 11/12] feat(nvim): add mini align --- modules/programs/nvim/new_plugins/other.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index 7da6805..3107253 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -77,6 +77,15 @@ in ''; }; } + { + plugins.mini = { + enable = true; + modules = { + align = { }; + }; + }; + performance.combinePlugins.standalonePlugins = [ "mini.nvim" ]; + } ]; }; } From 57dabe199f13647f618520105eb92d0a2faf5bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Wed, 13 Nov 2024 11:42:27 +0100 Subject: [PATCH 12/12] fix(kitty): set terminal package --- modules/programs/kitty.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 45983ac..02ff047 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -11,6 +11,7 @@ in options.my.programs.kitty.enable = mkEnableOption "kitty"; config = mkIf cfg.enable { + my.terminal.package = config.home-manager.users.moritz.programs.kitty.package; my.shell.aliases.ssh = "TERM=xterm-256color command ssh"; home-manager.users.moritz = { programs.kitty = {