From 88b125c6da80adb321228d04c1bcc1e7889e3d4c Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Wed, 11 Dec 2024 01:04:12 +0100 Subject: [PATCH] Clean up and move kalle-laptop over to new layout as well --- ags/config/bar/Bar.js | 46 --- ags/config/bar/Clock.js | 24 -- ags/config/bar/Systray.js | 16 - ags/config/colors.css | 35 -- ags/config/config.js | 14 - ags/config/constants.js | 5 - ags/config/media/Media.js | 160 --------- ags/config/media/style.css | 59 ---- ags/config/notifications/Notifications.js | 129 -------- ags/config/notifications/style.css | 59 ---- ags/config/style.css | 22 -- ags/config/tsconfig.json | 18 - ags/config/types | 1 - ags/default.nix | 15 - eww/config/_variables.yuck | 3 - eww/config/bar.yuck | 87 ----- eww/config/eww.scss | 0 eww/config/eww.yuck | 2 - eww/default.nix | 14 - home-manager/kalle-laptop/kalle.nix | 128 ------- home-manager/kalle-pc/kalle.nix | 12 - hosts/kalle-laptop/default.nix | 75 +++++ .../kalle-laptop/hardware-configuration.nix | 0 hyprland/default.nix | 311 ------------------ hyprland/hyprpaper.nix | 58 ---- modules/plasma.nix | 6 + nixos/kalle-laptop/configuration.nix | 117 ------- nixos/kalle-pc/configuration.nix | 11 - nixos/kalle-pc/hardware-configuration.nix | 0 .../hardware-configuration.override.nix | 0 nvim/default.nix | 136 -------- nvim/keymaps.lua | 44 --- nvim/options.lua | 41 --- nvim/plugin/cmp.lua | 102 ------ nvim/plugin/lsp.lua | 172 ---------- nvim/plugin/telescope.lua | 13 - nvim/plugin/treesitter.lua | 9 - tmux/default.nix | 38 --- 38 files changed, 81 insertions(+), 1901 deletions(-) delete mode 100644 ags/config/bar/Bar.js delete mode 100644 ags/config/bar/Clock.js delete mode 100644 ags/config/bar/Systray.js delete mode 100644 ags/config/colors.css delete mode 100644 ags/config/config.js delete mode 100644 ags/config/constants.js delete mode 100644 ags/config/media/Media.js delete mode 100644 ags/config/media/style.css delete mode 100644 ags/config/notifications/Notifications.js delete mode 100644 ags/config/notifications/style.css delete mode 100644 ags/config/style.css delete mode 100644 ags/config/tsconfig.json delete mode 120000 ags/config/types delete mode 100644 ags/default.nix delete mode 100644 eww/config/_variables.yuck delete mode 100644 eww/config/bar.yuck delete mode 100644 eww/config/eww.scss delete mode 100644 eww/config/eww.yuck delete mode 100644 eww/default.nix delete mode 100644 home-manager/kalle-laptop/kalle.nix delete mode 100644 home-manager/kalle-pc/kalle.nix create mode 100644 hosts/kalle-laptop/default.nix rename {nixos => hosts}/kalle-laptop/hardware-configuration.nix (100%) delete mode 100644 hyprland/default.nix delete mode 100644 hyprland/hyprpaper.nix create mode 100644 modules/plasma.nix delete mode 100644 nixos/kalle-laptop/configuration.nix delete mode 100644 nixos/kalle-pc/configuration.nix delete mode 100644 nixos/kalle-pc/hardware-configuration.nix delete mode 100644 nixos/kalle-pc/hardware-configuration.override.nix delete mode 100644 nvim/default.nix delete mode 100644 nvim/keymaps.lua delete mode 100644 nvim/options.lua delete mode 100644 nvim/plugin/cmp.lua delete mode 100644 nvim/plugin/lsp.lua delete mode 100644 nvim/plugin/telescope.lua delete mode 100644 nvim/plugin/treesitter.lua delete mode 100644 tmux/default.nix diff --git a/ags/config/bar/Bar.js b/ags/config/bar/Bar.js deleted file mode 100644 index 3526bdf..0000000 --- a/ags/config/bar/Bar.js +++ /dev/null @@ -1,46 +0,0 @@ -import { GTK_ALIGN_CENTER, GTK_ALIGN_END, GTK_ALIGN_START } from "../constants.js" -import { Clock } from "./Clock.js" -import { SysTray } from "./Systray.js" - -function BarStart() { - return Widget.Box({ - halign: GTK_ALIGN_START, - children: [ - Widget.Label({ label: "Start" }), - Widget.Button({ label: "Button", onClicked: () => App.ToggleWindow("media2") }), - ], - }) -} -function BarCenter() { - return Widget.Box({ - halign: GTK_ALIGN_CENTER, - children: [ - Clock(), - ], - }) -} -function BarEnd() { - return Widget.Box({ - halign: GTK_ALIGN_END, - children: [ - SysTray(), - ], - }) -} - -export function Bar(monitor = 0) { - return Widget.Window({ - monitor, - exclusivity: "exclusive", - className: "bar", - margins: [5, 5, 0, 5], - name: `bar${monitor}`, - anchor: ["left", "top", "right"], - child: Widget.CenterBox({ - vertical: false, - startWidget: BarStart(), - centerWidget: BarCenter(), - endWidget: BarEnd(), - }) - }) -} diff --git a/ags/config/bar/Clock.js b/ags/config/bar/Clock.js deleted file mode 100644 index 3660cc1..0000000 --- a/ags/config/bar/Clock.js +++ /dev/null @@ -1,24 +0,0 @@ -const time = Variable("", { - poll: [1000, 'date "+%H:%M"'], -}) - -const date = Variable("", { - poll: [1000, 'date "+%Y-%m-%d"'], -}) - -export function Clock() { - return Widget.Box({ - className: "clock", - vertical: true, - children: [ - Widget.Label({ - className: "time", - label: time.bind(), - }), - Widget.Label({ - className: "date", - label: date.bind(), - }), - ], - }) -} diff --git a/ags/config/bar/Systray.js b/ags/config/bar/Systray.js deleted file mode 100644 index 6d30e93..0000000 --- a/ags/config/bar/Systray.js +++ /dev/null @@ -1,16 +0,0 @@ -const systemtray = await Service.import("systemtray") - -export function SysTray() { - const items = systemtray.bind("items") - .as(items => items.map(item => Widget.Button({ - child: Widget.Icon({ icon: item.bind("icon") }), - on_primary_click: (_, event) => item.activate(event), - on_secondary_click: (_, event) => item.openMenu(event), - tooltip_markup: item.bind("tooltip_markup"), - }))) - - return Widget.Box({ - className: "systray", - children: items, - }) -} diff --git a/ags/config/colors.css b/ags/config/colors.css deleted file mode 100644 index 3e3f215..0000000 --- a/ags/config/colors.css +++ /dev/null @@ -1,35 +0,0 @@ -@define-color ctp-rosewater #f5e0dc; -@define-color ctp-flamingo #f2cdcd; -@define-color ctp-pink #f5c2e7; -@define-color ctp-mauve #cba6f7; -@define-color ctp-red #f38ba8; -@define-color ctp-maroon #eba0ac; -@define-color ctp-peach #fab387; -@define-color ctp-yellow #f9e2af; -@define-color ctp-green #a6e3a1; -@define-color ctp-teal #94e2d5; -@define-color ctp-sky #89dceb; -@define-color ctp-sapphire #74c7ec; -@define-color ctp-blue #89b4fa; -@define-color ctp-lavender #b4befe; -@define-color ctp-text #cdd6f4; -@define-color ctp-subtext1 #bac2de; -@define-color ctp-subtext0 #a6adc8; -@define-color ctp-overlay2 #9399b2; -@define-color ctp-overlay1 #7f849c; -@define-color ctp-overlay0 #6c7086; -@define-color ctp-surface2 #585b70; -@define-color ctp-surface1 #45475a; -@define-color ctp-surface0 #313244; -@define-color ctp-base #1e1e2e; -@define-color ctp-mantle #181825; -@define-color ctp-crust #11111b; - -button { - background: @ctp-surface0; - border: none; -} - -button:active, button:hover, button:focus { - background: @ctp-surface1; -} diff --git a/ags/config/config.js b/ags/config/config.js deleted file mode 100644 index 5999848..0000000 --- a/ags/config/config.js +++ /dev/null @@ -1,14 +0,0 @@ -import { Media } from "./media/Media.js"; -import { Bar } from "./bar/Bar.js"; -import { Notifications } from "./notifications/Notifications.js"; - - -App.config({ - style: "./style.css", - windows: [ - Bar(2), - Media(2), - Notifications(2), - ] -}) - diff --git a/ags/config/constants.js b/ags/config/constants.js deleted file mode 100644 index 3824349..0000000 --- a/ags/config/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -export const GTK_ALIGN_FILL = 0; -export const GTK_ALIGN_START = 1; -export const GTK_ALIGN_END = 2; -export const GTK_ALIGN_CENTER = 3; -export const GTK_ALIGN_BASELINE = 4; diff --git a/ags/config/media/Media.js b/ags/config/media/Media.js deleted file mode 100644 index b21c412..0000000 --- a/ags/config/media/Media.js +++ /dev/null @@ -1,160 +0,0 @@ -import { GTK_ALIGN_CENTER, GTK_ALIGN_FILL } from '../constants.js' - -const mpris = await Service.import("mpris") -const players = mpris.bind("players") - -const FALLBACK_ICON = "audio-x-generic-symbolic" -const PLAY_ICON = "media-playback-start-symbolic" -const PAUSE_ICON = "media-playback-pause-symbolic" -const PREV_ICON = "media-skip-backward-symbolic" -const NEXT_ICON = "media-skip-forward-symbolic" - -/** @param {number} length */ -function lengthStr(length) { - const min = Math.floor(length / 60) - const sec = Math.floor(length % 60) - const sec0 = sec < 10 ? "0" : "" - return `${min}:${sec0}${sec}` -} - -/** @param {import('types/service/mpris').MprisPlayer} player */ -function Player(player) { - const artists = player.bind("track_artists").transform(a => a.join(", ")) - - const playPause = Widget.Button({ - className: "play-pause", - onClicked: () => player.playPause(), - visible: player.bind("can_play"), - child: Widget.Icon({ - icon: player.bind("play_back_status").transform(s => { - switch (s) { - case "Playing": return PAUSE_ICON - case "Paused": - case "Stopped": return PLAY_ICON - } - }), - }), - }) - - const prev = Widget.Button({ - onClicked: () => player.previous(), - visible: player.bind("can_go_prev"), - child: Widget.Icon(PREV_ICON), - }) - - const next = Widget.Button({ - onClicked: () => player.next(), - visible: player.bind("can_go_next"), - child: Widget.Icon(NEXT_ICON), - }) - - const positionSlider = Widget.Slider({ - className: "position", - drawValue: false, - onChange: ({ value }) => player.position = value * player.length, - visible: player.bind("length").as(l => l > 0), - setup: self => { - function update() { - const value = player.position / player.length - self.value = value > 0 ? value : 0 - } - self.hook(player, update) - self.hook(player, update, "position") - self.poll(1000, update) - }, - }) - - const positionLabel = Widget.Label({ - className: "position", - hpack: "start", - setup: self => { - const update = (_, time) => { - self.label = lengthStr(time || player.position) - self.visible = player.length > 0 - } - - self.hook(player, update, "position") - self.poll(1000, update) - }, - }) - - const lengthLabel = Widget.Label({ - className: "length", - hpack: "end", - visible: player.bind("length").transform(l => l > 0), - label: player.bind("length").transform(lengthStr), - }) - - return Widget.Overlay({ - className: "player", - child: Widget.Box({ - className: "bg-img", - vpack: "start", - css: player.bind("cover_path").transform(p => `background-image: url('${p}');`), - }), - overlays: [ - Widget.Box({ - className: "bg-cover" - }), - Widget.Box({ - className: "overlay", - vertical: true, - halign: GTK_ALIGN_CENTER, - children: [ - Widget.Box({ - className: "info", - vertical: true, - children: [ - Widget.Label({ className: "title", label: player.bind("track_title") }), - Widget.Label({ className: "album", label: player.bind("track_album") }), - Widget.Label({ className: "artist", label: artists }), - ], - }), - Widget.Box({ - vexpand: true, - }), - Widget.CenterBox({ - className: "controls", - startWidget: positionLabel, - centerWidget: Widget.Box({ - halign: GTK_ALIGN_CENTER, - spacing: 20, - children: [ - prev, - playPause, - next, - ], - }), - endWidget: lengthLabel, - }), - positionSlider, - ], - }) - ], - }) -} - -function MediaContent() { - const currentIdx = Variable(0); - const currentPlayer = Utils.merge([currentIdx.bind(), players], (currentIdx, players) => { - const idx = Math.min(currentIdx, players.length - 1); - return players[idx]; - }) - - return Widget.Box({ - children: currentPlayer.as(p => [Player(p)]), - }) -} - -export function Media(monitor = 0) { - return Widget.Window({ - monitor, - visible: false, - exclusivity: "normal", - className: "media", - margins: [10, 10, 0, 10], - name: `media${monitor}`, - anchor: ["left", "top"], - child: MediaContent(), - }) -} diff --git a/ags/config/media/style.css b/ags/config/media/style.css deleted file mode 100644 index 38b4551..0000000 --- a/ags/config/media/style.css +++ /dev/null @@ -1,59 +0,0 @@ -.media > box { - border-radius: 5px; - - background-color: transparent; - color: @ctp-text; -} - -.media .player .bg-img { - border-radius: 5px; - min-width: 400px; - min-height: 200px; - background-size: cover; -} - -.media .player .bg-cover { - background: linear-gradient(alpha(@ctp-base, 0.5), @ctp-base); -} - -.media .player .overlay { - border-radius: 5px; - min-width: 400px; -} - -.media .player .info { - padding: 10px; -} - -.media .player .controls { - padding: 10px; -} - -.media .player .info .title { - font-size: 1.2em; - font-weight: bold; -} - -.media .player scale.position { - padding: 0; - border-radius: 0; - border: none; -} - -.media .player scale.position trough { - min-height: 4px; - border-radius: 0; - border: none; - background-color: @ctp-overlay0; -} - -.media .player scale.position highlight { - border-radius: 0; - border: none; - background-color: @ctp-lavender; -} - -.media .player scale.position slider { - all: unset; -} - diff --git a/ags/config/notifications/Notifications.js b/ags/config/notifications/Notifications.js deleted file mode 100644 index 7c5366b..0000000 --- a/ags/config/notifications/Notifications.js +++ /dev/null @@ -1,129 +0,0 @@ -const notifications = await Service.import("notifications") - -/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */ -function NotificationIcon({ app_entry, app_icon, image }) { - if (image) { - return Widget.Box({ - css: `background-image: url("${image}");` - + "background-size: contain;" - + "background-repeat: no-repeat;" - + "background-position: center;", - }) - } - - let icon = "dialog-information-symbolic" - if (Utils.lookUpIcon(app_icon)) - icon = app_icon - - if (app_entry && Utils.lookUpIcon(app_entry)) - icon = app_entry - - return Widget.Box({ - child: Widget.Icon(icon), - }) -} - -/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */ -function Notification(n) { - const icon = Widget.Box({ - vpack: "start", - class_name: "icon", - child: NotificationIcon(n), - }) - - const title = Widget.Label({ - class_name: "title", - xalign: 0, - justification: "left", - hexpand: true, - max_width_chars: 24, - label: n.summary, - use_markup: true, - }) - - const body = Widget.Label({ - class_name: "body", - hexpand: true, - use_markup: true, - xalign: 0, - justification: "left", - label: n.body, - wrap: true, - }) - - const content = Widget.Box({ - className: "content", - children: [ - icon, - Widget.Box({ - vertical: true, - children: [ - title, - body, - ] - }), - ], - }) - - const actions = Widget.Box({ - className: "actions", - children: n.actions.map(({ id, label }) => Widget.Button({ - className: "action", - on_clicked: () => { - n.invoke(id) - n.dismiss() - }, - hexpand: true, - child: Widget.Label(label), - })), - }) - - - return Widget.EventBox({ - attribute: { id: n.id }, - onPrimaryClick: n.dismiss, - child: Widget.Box({ - classNames: ["notification", n.urgency], - vertical: true, - children: [ - content, - actions, - ], - }), - }) -} - -function NotificationList() { - const list = Widget.Box({ - css: "min-width: 2px; min-height: 2px;", - vertical: true, - spacing: 10, - children: notifications.popups.map(Notification), - }) - - function onNotified(_, /** @type {number} */ id) { - const n = notifications.getNotification(id) - if (n) - list.children = [Notification(n), ...list.children] - } - - function onDismissed(_, /** @type {number} */ id) { - list.children.find(n => n.attribute.id === id)?.destroy() - } - - list.hook(notifications, onNotified, "notified") - .hook(notifications, onDismissed, "dismissed") - return list -} - -export function Notifications(monitor = 0) { - return Widget.Window({ - monitor, - exclusivity: "normal", - className: "notifications", - margins: [10, 10, 10, 10], - name: `notifications${monitor}`, - anchor: ["left", "top"], - child: NotificationList(), - }) -} diff --git a/ags/config/notifications/style.css b/ags/config/notifications/style.css deleted file mode 100644 index aa5b3a9..0000000 --- a/ags/config/notifications/style.css +++ /dev/null @@ -1,59 +0,0 @@ -.notification { - min-width: 300px; - padding: 10px; - background-color: alpha(@ctp-base, 0.7); - border-radius: 5px; - - border: 1px solid; - border-left: 5px solid; - border-color: @ctp-overlay1; -} - -.notification.low { - border-color: @ctp-base; -} - -.notification.critical { - border-color: @ctp-red; -} - -.notification .icon { - min-width: 68px; - min-height: 68px; - margin-right: 1em; -} - -.notification .icon image { - font-size: 58px; - /* to center the icon */ - margin: 5px; - color: @ctp-text; -} - -.notification .icon box { - min-width: 68px; - min-height: 68px; - border-radius: 7px; -} - -.notification .actions .action { - margin: 0 .4em; - margin-top: .8em; -} - -.notification .actions .action:first-child { - margin-left: 0; -} - -.notification .actions .action:last-child { - margin-right: 0; -} - -.notification .title { - color: @ctp-text; - font-size: 1.4em; -} - -.notification .body { - color: @ctp-subtext0; -} diff --git a/ags/config/style.css b/ags/config/style.css deleted file mode 100644 index b0053a9..0000000 --- a/ags/config/style.css +++ /dev/null @@ -1,22 +0,0 @@ -@import url("colors.css"); -@import url("notifications/style.css"); -@import url("media/style.css"); - - -.bar > box { - padding: 10px; - border-radius: 5px; - - background-color: alpha(@ctp-base, 0.95); - color: @ctp-text; -} - -.clock .time { - font-weight: bold; - font-size: 1em; -} - -.clock .date { - font-size: 0.8em; -} - diff --git a/ags/config/tsconfig.json b/ags/config/tsconfig.json deleted file mode 100644 index f03f2d1..0000000 --- a/ags/config/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ES2022", - "lib": [ - "ES2022" - ], - "allowJs": true, - "checkJs": true, - "strict": true, - "noImplicitAny": false, - "baseUrl": ".", - "typeRoots": [ - "./types" - ], - "skipLibCheck": true - } -} \ No newline at end of file diff --git a/ags/config/types b/ags/config/types deleted file mode 120000 index b7f3cac..0000000 --- a/ags/config/types +++ /dev/null @@ -1 +0,0 @@ -/home/kalle/.local/share/com.github.Aylur.ags/types \ No newline at end of file diff --git a/ags/default.nix b/ags/default.nix deleted file mode 100644 index fff16ab..0000000 --- a/ags/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ inputs -, lib -, config -, pkgs -, ... -}: - -{ - imports = [ inputs.ags.homeManagerModules.default ]; - programs.ags = { - enable = true; - configDir = ./config; - }; -} - diff --git a/eww/config/_variables.yuck b/eww/config/_variables.yuck deleted file mode 100644 index 34a5a59..0000000 --- a/eww/config/_variables.yuck +++ /dev/null @@ -1,3 +0,0 @@ -(defpoll time :interval "10s" "date '+%H:%M'") -(defpoll year :interval "10h" "date '+%Y'") -(defpoll date :interval "30m" "date '+%m-%d'") diff --git a/eww/config/bar.yuck b/eww/config/bar.yuck deleted file mode 100644 index a6ab912..0000000 --- a/eww/config/bar.yuck +++ /dev/null @@ -1,87 +0,0 @@ -(defwidget notifications [] - (eventbox :class "notifications" - "" - ) -) - -(defwidget audio [] - (eventbox :class "audio" - :onclick "eww open --toggle audio" - "󰕾" - )) - -(defwidget clipboard [] - (eventbox :class "clipboard" - "󰅌" - ) -) - -(defwidget left [] - (box :class "left" - :space-evenly "false" - :halign "start" - :valign "center" - :orientation "h" - (notifications) - (audio) - (clipboard) - ) -) - -(defwidget workspace-indicator [] - ". . . . . . . . . ." -) - -(defwidget center [] - (box :class "center" - :space-evenly "false" - :halign "center" - :valign "center" - :orientation "h" - (workspace-indicator) - ) -) - -(defwidget time [] - (eventbox :class "time" - time - ) -) - -(defwidget date [] - (eventbox :class "date" - "${year}-${date}" - ) -) - -(defwidget right [] - (box :class "right" - :space-evenly "false" - :halign "end" - :valign "center" - :orientation "v" - (time) - (date) - ) -) - -(defwidget bar [] - (box :class "bar" - :orientation "h" - (left) - (center) - (right) - ) -) - -(defwindow bar - :monitor 2 - :geometry (geometry :x "0px" - :y "10px" - :width "1060px" - :height "48px" - :anchor "center top") - :stacking "fg" - :exclusive true - (bar) -) diff --git a/eww/config/eww.scss b/eww/config/eww.scss deleted file mode 100644 index e69de29..0000000 diff --git a/eww/config/eww.yuck b/eww/config/eww.yuck deleted file mode 100644 index 2dd08c8..0000000 --- a/eww/config/eww.yuck +++ /dev/null @@ -1,2 +0,0 @@ -(include "_variables.yuck") -(include "bar.yuck") diff --git a/eww/default.nix b/eww/default.nix deleted file mode 100644 index f1e435c..0000000 --- a/eww/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ inputs -, lib -, config -, pkgs -, ... -}: - -{ - programs.eww = { - enable = true; - - configDir = ./config; - }; -} diff --git a/home-manager/kalle-laptop/kalle.nix b/home-manager/kalle-laptop/kalle.nix deleted file mode 100644 index 524c9ff..0000000 --- a/home-manager/kalle-laptop/kalle.nix +++ /dev/null @@ -1,128 +0,0 @@ -{ inputs -, outputs -, lib -, config -, pkgs -, ... -}: - -{ - home = { - username = "kalle"; - homeDirectory = "/home/kalle"; - }; - - imports = - [ - ../../nvim - ../../tmux - ]; - - nixpkgs = { - overlays = with outputs.overlays; [ - nvim-plugins - ]; - - config = { - allowUnfree = true; - allowUnfreePredicate = _: true; - - permittedInsecurePackages = [ - "electron-25.9.0" - ]; - }; - }; - - # The home.packages option allows you to install Nix packages into your - # environment. - home.packages = with pkgs; [ - discord - vesktop - firefox - chromium - httpie - kate - dolphin - ark - rustup - gcc - pavucontrol - difftastic - sops - obsidian - - cachix - ]; - - programs.home-manager.enable = true; - - programs.bash = { - enable = true; - shellAliases = { - # Git aliases - gg = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an (%ae)%C(reset)' --all"; - gca = "git add -A; git commit -a --amend --no-edit"; - gs = "git status"; - - # Replace some commands with better versions - ssh = "kitty +kitten ssh"; - diff = "${pkgs.difftastic}/bin/difftastic"; - }; - initExtra = '' - function open() { - xdg-open $@ &> /dev/null & - } - ''; - }; - - programs.kitty = { - enable = true; - theme = "Catppuccin-Mocha"; - settings = { - background_opacity = "0.8"; - allow_remote_control = true; - }; - }; - - programs.starship = { - enable = true; - settings = { - add_newline = true; - - # Remove text from nix shell component - nix_shell.format = "via [$symbol]($style) "; - - git_status.disabled = true; - package.disabled = true; - }; - }; - - programs.direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; - }; - - programs.git = { - enable = true; - userName = "Kalle Struik"; - userEmail = "kalle@kallestruik.nl"; - difftastic.enable = true; - extraConfig = { - init.defaultBranch = "main"; - }; - }; - - home.sessionVariables = { - EDITOR = "nvim"; - }; - - # 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.05"; # Please read the comment before changing. -} diff --git a/home-manager/kalle-pc/kalle.nix b/home-manager/kalle-pc/kalle.nix deleted file mode 100644 index 6597f85..0000000 --- a/home-manager/kalle-pc/kalle.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - inputs, - outputs, - lib, - config, - pkgs, - ... -}: - -{ - do.not.rebuild = migration in progress; -} diff --git a/hosts/kalle-laptop/default.nix b/hosts/kalle-laptop/default.nix new file mode 100644 index 0000000..b109246 --- /dev/null +++ b/hosts/kalle-laptop/default.nix @@ -0,0 +1,75 @@ +{ + inputs, + config, + pkgs, + ... +}: +{ + imports = [ + ../_base + ./hardware-configuration.nix + + ../../modules/sddm.nix + + ../../modules/bash.nix + ../../modules/kitty.nix + ../../modules/git.nix + ../../modules/direnv.nix + ../../modules/firefox.nix + ../../modules/nvim + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "kalle-laptop"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Amsterdam"; + + services.xserver = { + enable = true; + xkb.layout = "us"; + xkb.options = "eurosign:e,caps:escape"; + }; + + # Disable firewall. + networking.firewall.enable = false; + + home-manager.users.kalle = { + home.packages = with pkgs; [ + discord + vesktop + firefox + chromium + httpie + kate + dolphin + ark + rustup + gcc + pavucontrol + difftastic + sops + obsidian + + cachix + ]; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; # Did you read the comment? + # 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.05"; # Please read the comment before changing. +} diff --git a/nixos/kalle-laptop/hardware-configuration.nix b/hosts/kalle-laptop/hardware-configuration.nix similarity index 100% rename from nixos/kalle-laptop/hardware-configuration.nix rename to hosts/kalle-laptop/hardware-configuration.nix diff --git a/hyprland/default.nix b/hyprland/default.nix deleted file mode 100644 index 81fad16..0000000 --- a/hyprland/default.nix +++ /dev/null @@ -1,311 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: - -{ - options = - let - inherit (lib) mkOption types; - in - { - hyprland = { - mod = mkOption { - type = types.str; - default = "SUPER"; - }; - - autoStart = mkOption { - type = types.listOf types.str; - default = [ ]; - }; - - primaryMonitor = mkOption { - type = types.str; - }; - - monitors = mkOption { - type = types.listOf ( - types.submodule { - options = { - name = mkOption { - type = types.str; - }; - width = mkOption { - type = types.int; - }; - height = mkOption { - type = types.int; - }; - refreshRate = mkOption { - type = types.int; - default = 60; - }; - x = mkOption { - type = types.int; - default = 0; - }; - y = mkOption { - type = types.int; - default = 0; - }; - transform = mkOption { - type = types.int; - default = 0; - }; - vrr = mkOption { - type = types.int; - default = 0; - }; - enabled = mkOption { - type = types.bool; - default = true; - }; - }; - } - ); - default = [ ]; - }; - - environment = mkOption { - type = types.attrsOf types.str; - default = { }; - }; - - sensitivity = mkOption { - type = types.float; - default = 0.0; - }; - - keyboard = { - layout = mkOption { - type = types.str; - default = "us"; - }; - - variant = mkOption { - type = types.str; - default = ""; - }; - - options = mkOption { - type = types.str; - default = ""; - }; - }; - - layout = mkOption { type = types.str; }; - - layerRules = mkOption { - type = types.attrsOf (types.listOf types.str); - default = { }; - }; - - windowRules = mkOption { - type = types.attrsOf (types.listOf types.str); - default = { }; - }; - - windowRulesV2 = mkOption { - type = types.attrsOf (types.listOf types.str); - default = { }; - }; - - binds = mkOption { - type = types.attrsOf types.str; - default = { }; - }; - - mouseBinds = mkOption { - type = types.attrsOf types.str; - default = { }; - }; - }; - }; - - config = - let - cfg = config.hyprland; - in - { - home.packages = with pkgs; [ - wl-clipboard - cliphist - ulauncher - ]; - - wayland.windowManager.hyprland = { - enable = true; - settings = { - monitor = - map ( - m: - let - resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}"; - position = "${toString m.x}x${toString m.y}"; - vrr = if m.vrr != 0 then ",vrr,${toString m.vrr}" else ""; - transform = if m.transform != 0 then ",transform,${toString m.transform}" else ""; - in - "${m.name},${if m.enabled then "${resolution},${position},1${vrr}${transform}" else "disable"}" - ) (cfg.monitors) - # Automatically detect newly connected monitors - ++ [ ",preferred,auto,auto" ]; - - exec-once = [ - "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store" - "${pkgs.ulauncher}/bin/ulauncher --no-window-shadow --hide-window" - "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1" - # kde-connect (somehow, wasnt working well last time) - ] ++ cfg.autoStart; - - env = lib.mapAttrsToList (k: v: "${toString k},${v}") cfg.environment; - - input = { - kb_layout = cfg.keyboard.layout; - kb_variant = cfg.keyboard.variant; - kb_options = cfg.keyboard.options; - - follow_mouse = 1; - - touchpad = { - natural_scroll = "yes"; - }; - - sensitivity = cfg.sensitivity; - accel_profile = "flat"; - }; - - general = { - gaps_in = 5; - gaps_out = 10; - - border_size = 1; - "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; - "col.inactive_border" = "rgba(595959aa)"; - - layout = cfg.layout; - }; - - misc = { - force_default_wallpaper = 2; - }; - - decoration = { - rounding = 5; - - blur = { - enabled = "yes"; - size = 3; - passes = 1; - new_optimizations = "on"; - }; - - # drop_shadow = "yes"; - # shadow_range = 4; - # shadow_render_power = 3; - # "col.shadow" = "rgba(1a1a1aee)"; - }; - - gestures = { - workspace_swipe = "on"; - }; - - animations = { - enabled = "yes"; - - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - - bezier = [ - "myBezier, 0.05, 0.9, 0.1, 1.05" - ]; - - animation = [ - "windows, 1, 3, myBezier" - "windowsOut, 1, 3, default, popin 80%" - "border, 1, 5, default" - "borderangle, 1, 4, default" - "fade, 1, 3, default" - "workspaces, 1, 2, default" - ]; - - }; - - layerrule = - let - y = ident: value: "${value},${ident}"; - x = ident: values: map (y ident) values; - in - lib.flatten (lib.mapAttrsToList x cfg.layerRules); - - workspace = - let - # Create one work space for each non primary monitor - perMonitorWorkspaces = map (m: "name:${m.name}, monitor:${m.name}") ( - lib.filter (m: m.name != cfg.primaryMonitor) cfg.monitors - ); - - # Create 10 work spaces on the primary monitor - primaryMonitorWorkspaces = map (i: "${toString i}, monitor:${cfg.primaryMonitor}") (lib.range 1 10); - - in - primaryMonitorWorkspaces ++ perMonitorWorkspaces; - - bind = - let - # Create binds to switch workspaces and move windows between them - workspaceBinds = lib.flatten ( - map ( - i: - let - k = if i == 10 then 0 else i; - in - [ - "${cfg.mod}, ${toString k}, workspace, ${toString i}" - "${cfg.mod} SHIFT, ${toString k}, movetoworkspace, ${toString i}" - ] - ) (lib.range 1 10) - ); - - # Create binds to manage wiwdows - windowManagementBinds = [ - "${cfg.mod} SHIFT, Q, killactive" - "${cfg.mod}, F, togglefloating" - "${cfg.mod} SHIFT, F, fullscreen" - ]; - - configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds; - in - configBinds ++ workspaceBinds ++ windowManagementBinds; - - bindm = - let - windowManagementBinds = [ - "${cfg.mod}, mouse:272, movewindow" - "${cfg.mod}, mouse:273, resizewindow" - ]; - - configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds; - - in - configBinds ++ windowManagementBinds; - - windowrule = - let - y = ident: value: "${value},${ident}"; - x = ident: values: map (y ident) values; - in - lib.flatten (lib.mapAttrsToList x cfg.windowRules); - - windowrulev2 = - let - y = ident: value: "${value},${ident}"; - x = ident: values: map (y ident) values; - in - lib.flatten (lib.mapAttrsToList x cfg.windowRulesV2); - }; - }; - }; -} diff --git a/hyprland/hyprpaper.nix b/hyprland/hyprpaper.nix deleted file mode 100644 index 2562a63..0000000 --- a/hyprland/hyprpaper.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: - -{ - options = - let - inherit (lib) mkOption types; - in - { - hyprpaper = { - wallpaperFolder = mkOption { - type = types.str; - }; - }; - }; - - config = - let - cfg = config.hyprpaper; - hyprlandCfg = config.hyprland; - - changeWallpaperScript = pkgs.writeShellScriptBin "change-wallpaper" ( - lib.concatStringsSep "\n" ( - lib.flatten ( - map ( - m: - let - output = m.name; - wallpaper = "\"$(${pkgs.findutils}/bin/find -L \"${cfg.wallpaperFolder}\" -type f | ${pkgs.coreutils}/bin/shuf -n 1)\""; - in - [ - "wallpaper=${wallpaper}" - "${pkgs.hyprland}/bin/hyprctl hyprpaper preload $wallpaper" - "${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ${output},$wallpaper" - ] - ) hyprlandCfg.monitors - ) - ++ [ "${pkgs.hyprland}/bin/hyprctl hyprpaper unload all" ] - ) - ); - in - { - hyprland.autoStart = [ - "${pkgs.hyprpaper}/bin/hyprpaper" - "sleep 2; ${changeWallpaperScript}/bin/change-wallpaper" - ]; - - home.packages = with pkgs; [ - hyprpaper - changeWallpaperScript - ]; - }; -} diff --git a/modules/plasma.nix b/modules/plasma.nix new file mode 100644 index 0000000..2b827ec --- /dev/null +++ b/modules/plasma.nix @@ -0,0 +1,6 @@ +{ + ... +}: +{ + services.xserver.desktopManager.plasma6.enable = true; +} diff --git a/nixos/kalle-laptop/configuration.nix b/nixos/kalle-laptop/configuration.nix deleted file mode 100644 index 6256dde..0000000 --- a/nixos/kalle-laptop/configuration.nix +++ /dev/null @@ -1,117 +0,0 @@ -{ inputs -, config -, pkgs -, ... -}: - -{ - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - nix.settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; - - nixpkgs.config.allowUnfree = true; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "kalle-laptop"; - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - console = { - font = "Lat2-Terminus16"; - useXkbConfig = true; # use xkbOptions in tty. - }; - - # Enable the X11 windowing system. - services.xserver = { - enable = true; - - displayManager.sddm.enable = true; - desktopManager.plasma6.enable = true; - - # Configure keymap in X11 - xkb = { - layout = "us"; - options = "eurosign:e,caps:escape"; - }; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound. - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - - users.users.kalle = { - isNormalUser = true; - group = "kalle"; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - }; - - users.groups.kalle.gid = 1000; - - environment.systemPackages = with pkgs; [ - xdg-user-dirs - ]; - - fonts = { - enableDefaultPackages = true; - packages = with pkgs; [ - noto-fonts - noto-fonts-cjk - noto-fonts-color-emoji - - fira-code - fira-code-symbols - - (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) - ]; - - fontconfig = { - defaultFonts = { - serif = [ "Noto Serif" "Symbols Nerd Font" ]; - sansSerif = [ "Noto Sans" "Symbols Nerd Font" ]; - monospace = [ "Fira Code" "Symbols Nerd Font Mono" ]; - }; - }; - }; - - # Enable the OpenSSH daemon. - services.openssh.enable = true; - - # Disable firewall. - networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - -} - diff --git a/nixos/kalle-pc/configuration.nix b/nixos/kalle-pc/configuration.nix deleted file mode 100644 index 479679a..0000000 --- a/nixos/kalle-pc/configuration.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: - -{ - still.migrating = do not rebuild this; - -} diff --git a/nixos/kalle-pc/hardware-configuration.nix b/nixos/kalle-pc/hardware-configuration.nix deleted file mode 100644 index e69de29..0000000 diff --git a/nixos/kalle-pc/hardware-configuration.override.nix b/nixos/kalle-pc/hardware-configuration.override.nix deleted file mode 100644 index e69de29..0000000 diff --git a/nvim/default.nix b/nvim/default.nix deleted file mode 100644 index faa279a..0000000 --- a/nvim/default.nix +++ /dev/null @@ -1,136 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: - -{ - programs.neovim = - let - toLua = str: "lua << EOF\n${str}\nEOF\n"; - toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; - in - { - enable = true; - - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - - extraPackages = with pkgs; [ - nodejs_22 # Required for copilot-vim - ripgrep # Required for telescope - wl-clipboard # Required for clipboard sync - - # Language servers - clang-tools - lua-language-server - nodePackages.typescript-language-server - nodePackages."@astrojs/language-server" - typescript - tailwindcss-language-server - gopls - vhdl-ls - nixd - nixfmt-rfc-style - ]; - - plugins = with pkgs.vimPlugins; [ - yuck-vim - - { - plugin = which-key-nvim; - config = toLua "require('which-key').setup()"; - } - - neodev-nvim - plenary-nvim - - { - plugin = telescope-nvim; - config = toLuaFile ./plugin/telescope.lua; - } - telescope-ui-select-nvim - - FTerm-nvim - - vim-fugitive - - harpoon1 - - { - plugin = undotree-nvim; - config = toLua "require('undotree').setup()"; - } - - { - plugin = comment-nvim; - config = toLua "require('Comment').setup()"; - } - { - plugin = todo-comments-nvim; - config = toLua "require('todo-comments').setup()"; - } - - { - plugin = neoconf-nvim; - config = toLua "require('neoconf').setup()"; - } - { - plugin = catppuccin-nvim; - config = "colorscheme catppuccin-mocha"; - } - - cmp-nvim-lsp - cmp-nvim-lsp-signature-help - cmp-buffer - cmp-path - cmp-cmdline - cmp-git - cmp-calc - cmp_luasnip - copilot-cmp - luasnip - friendly-snippets - { - plugin = nvim-cmp; - config = toLuaFile ./plugin/cmp.lua; - } - - { - plugin = nvim-lspconfig; - config = toLuaFile ./plugin/lsp.lua; - } - rust-tools-nvim - { - plugin = fidget-nvim; - config = toLua "require('fidget').setup({})"; - } - - rainbow-delimiters-nvim - - { - plugin = (nvim-treesitter.withAllGrammars); - config = toLuaFile ./plugin/treesitter.lua; - } - - { - plugin = copilot-lua; - config = toLua '' - require("copilot").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - }) - ''; - } - ]; - - extraLuaConfig = '' - ${builtins.readFile ./options.lua} - ${builtins.readFile ./keymaps.lua} - ''; - - }; -} diff --git a/nvim/keymaps.lua b/nvim/keymaps.lua deleted file mode 100644 index 9493b37..0000000 --- a/nvim/keymaps.lua +++ /dev/null @@ -1,44 +0,0 @@ ----@diagnostic disable: redefined-local - -local function map(mode, keys, func, desc, silent) - local silent = silent == nil and true or silent - vim.keymap.set(mode, keys, func, { desc = desc, silent = silent }) -end - --- Movement between windows -map('n', 'h', function() vim.cmd.wincmd('h') end, "Window Left") -map('n', 'j', function() vim.cmd.wincmd('j') end, "Window Down") -map('n', 'k', function() vim.cmd.wincmd('k') end, "Window Up") -map('n', 'l', function() vim.cmd.wincmd('l') end, "Window Right") - --- Harpoon keybinds -map('n', 'mm', require('harpoon.mark').add_file, "[M]ark file in harpoon") -map('n', 'mh', require('harpoon.ui').toggle_quick_menu, "[M]enu [H]arpoon") -map('n', '1', function() require('harpoon.ui').nav_file(1) end, "Harpoon [1]") -map('n', '2', function() require('harpoon.ui').nav_file(2) end, "Harpoon [2]") -map('n', '3', function() require('harpoon.ui').nav_file(3) end, "Harpoon [3]") -map('n', '4', function() require('harpoon.ui').nav_file(4) end, "Harpoon [4]") -map('n', '5', function() require('harpoon.ui').nav_file(5) end, "Harpoon [5]") -map('n', '6', function() require('harpoon.ui').nav_file(6) end, "Harpoon [6]") -map('n', '7', function() require('harpoon.ui').nav_file(7) end, "Harpoon [7]") -map('n', '8', function() require('harpoon.ui').nav_file(8) end, "Harpoon [8]") -map('n', '9', function() require('harpoon.ui').nav_file(9) end, "Harpoon [9]") - -map('n', 'tg', vim.cmd.Neogit, '[T]oggle [G]it view') -map('n', 'tu', require('undotree').toggle, '[T]oggle [U]ndo tree') - -map('n', '[d', vim.diagnostic.goto_prev, 'Goto Previous Diagnostic') -map('n', ']d', vim.diagnostic.goto_next, 'Goto Next Diagnostic') -map('n', 'e', vim.diagnostic.open_float, 'Show [E]rrors') -map('n', 'q', vim.diagnostic.setloclist, 'Errors to [Q]uickfix') - - -map('n', '?', require('telescope.builtin').oldfiles, '[?] Find recently opened files') -map('n', '', require('telescope.builtin').find_files, '[ ]Search Files') -map('n', 'sb', require('telescope.builtin').buffers, '[S]earch [B]uffers') -map('n', 'sh', require('telescope.builtin').help_tags, '[S]earch [H]elp') -map('n', 'sw', require('telescope.builtin').grep_string, '[S]earch current [W]ord') -map('n', 'sg', require('telescope.builtin').live_grep, '[S]earch by [G]rep') -map('n', 'sd', require('telescope.builtin').diagnostics, '[S]earch [D]iagnostics') - -map({ 'n', 't' }, '', require("FTerm").toggle, 'Toggle Terminal') diff --git a/nvim/options.lua b/nvim/options.lua deleted file mode 100644 index 2ee098c..0000000 --- a/nvim/options.lua +++ /dev/null @@ -1,41 +0,0 @@ -vim.opt.termguicolors = true -vim.opt.clipboard = 'unnamed,unnamedplus' -vim.opt.timeoutlen = 300 -vim.opt.mouse = 'a' -vim.opt.listchars = 'tab:▸ ,extends:❯,precedes:❮' - -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = vim.fn.expand('~/.cache/vim/undo') -vim.opt.undofile = true - -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.list = true - -vim.opt.wrap = false - -vim.opt.scrolloff = 8 - -vim.opt.autoindent = true -vim.opt.expandtab = true -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.tabstop = 4 -vim.opt.smartindent = true -vim.opt.modeline = true - -vim.opt.spell = true - -vim.g.mapleader = ' ' - -vim.opt.hlsearch = false -vim.opt.incsearch = true -vim.opt.signcolumn = 'yes' - -vim.opt.updatetime = 50 -vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' } -vim.opt.shortmess = vim.opt.shortmess + { c = true } - --- Autoformat on save -vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] diff --git a/nvim/plugin/cmp.lua b/nvim/plugin/cmp.lua deleted file mode 100644 index 0fa8876..0000000 --- a/nvim/plugin/cmp.lua +++ /dev/null @@ -1,102 +0,0 @@ -local cmp = require 'cmp' -local luasnip = require 'luasnip' - -require("copilot_cmp").setup() - -local has_words_before = function() - if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil -end - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - -- Add tab support - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() and has_words_before() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }) - }), - sources = cmp.config.sources({ - { name = "copilot", group_index = 2 }, - { name = 'path' }, -- file paths - { name = 'nvim_lsp' }, -- from language server - { name = 'nvim_lsp_signature_help' }, -- display function signatures with current parameter emphasized - { name = 'luasnip' }, - { name = 'nvim_lua' }, -- complete neovim's Lua runtime API such vim.lsp.* - { name = 'buffer' }, -- source current buffer - { name = 'calc' }, -- source for math calculation - }), - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - fields = { 'menu', 'abbr', 'kind' }, - format = function(entry, item) - local menu_icon = { - nvim_lsp = 'λ', - vsnip = '⋗', - buffer = 'Ω', - path = '🖫', - } - item.menu = menu_icon[entry.source.name] - return item - end, - }, -}) - -cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = 'buffer' }, - }) -}) - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline('/', { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) diff --git a/nvim/plugin/lsp.lua b/nvim/plugin/lsp.lua deleted file mode 100644 index 0f0b419..0000000 --- a/nvim/plugin/lsp.lua +++ /dev/null @@ -1,172 +0,0 @@ -local on_attach = function(_, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - if vim.lsp.buf.format then - vim.lsp.buf.format() - elseif vim.lsp.buf.formatting then - vim.lsp.buf.formatting() - end - end, { desc = 'Format current buffer with LSP' }) -end - --- LSP Diagnostics Options Setup -local sign = function(opts) - vim.fn.sign_define(opts.name, { - texthl = opts.name, - text = opts.text, - numhl = '' - }) -end - -sign({ name = 'DiagnosticSignError', text = '' }) -sign({ name = 'DiagnosticSignWarn', text = '' }) -sign({ name = 'DiagnosticSignHint', text = '' }) -sign({ name = 'DiagnosticSignInfo', text = '' }) - -vim.diagnostic.config({ - virtual_text = false, - signs = true, - update_in_insert = true, - underline = true, - severity_sort = false, - float = { - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, -}) - -vim.cmd([[ -autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) -]]) - --- LSP Configuration - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - -require('neodev').setup({ - override = function(root_dir, library) - if root_dir:find("/home/kalle/.dots", 1, true) == 1 then - library.enabled = true - library.plugins = true - end - end, -}) - -require('lspconfig').lua_ls.setup { - on_attach = on_attach, - capabilities = capabilities, - root_dir = function() - return vim.loop.cwd() - end, - cmd = { "lua-language-server" }, - settings = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - }, - } -} - -require('lspconfig').nixd.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - nixd = { - formatting = { - command = { "nixfmt" }, - }, - }, - }, -} - -require('lspconfig').tsserver.setup { - on_attach = on_attach, - capabilities = capabilities, - init_options = { - tsserver = { - fallbackPath = string.gsub(vim.fn.system("dirname `which tsserver`"), '^%s*(.-)%s*$', '%1') .. "/../lib/node_modules/typescript/lib", - }, - }, -} - -require('lspconfig').tailwindcss.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('lspconfig').clangd.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('lspconfig').gopls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('lspconfig').vhdl_ls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('lspconfig').astro.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('rust-tools').setup({ - server = { - on_attach = on_attach, - settings = { - ["rust-analyzer"] = { - checkOnSave = { - command = "clippy" - }, - }, - } - }, -}) - --- Workaround for https://github.com/neovim/neovim/issues/30985 -for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do - local default_diagnostic_handler = vim.lsp.handlers[method] - vim.lsp.handlers[method] = function(err, result, context, config) - if err ~= nil and err.code == -32802 then - return - end - return default_diagnostic_handler(err, result, context, config) - end -end diff --git a/nvim/plugin/telescope.lua b/nvim/plugin/telescope.lua deleted file mode 100644 index 4980c91..0000000 --- a/nvim/plugin/telescope.lua +++ /dev/null @@ -1,13 +0,0 @@ -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - }, -} - -require("telescope").load_extension("ui-select") -pcall(require('telescope').load_extension, 'fzf') diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua deleted file mode 100644 index 2edb953..0000000 --- a/nvim/plugin/treesitter.lua +++ /dev/null @@ -1,9 +0,0 @@ -require('nvim-treesitter.configs').setup { - ensure_installed = {}, - - auto_install = false, - - highlight = { enable = true }, - - indent = { enable = true }, -} diff --git a/tmux/default.nix b/tmux/default.nix deleted file mode 100644 index ec073b9..0000000 --- a/tmux/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ inputs -, lib -, config -, pkgs -, ... -}: - -{ - programs.tmux = { - enable = true; - keyMode = "vi"; - mouse = true; - baseIndex = 1; - escapeTime = 20; - terminal = "tmux-256color"; - historyLimit = 100000; - plugins = with pkgs.tmuxPlugins; - [ - better-mouse-mode - catppuccin - ]; - extraConfig = '' - # Use catppuccin-mocha theme. - set -g @catppuccin_flavour 'mocha' - # Other catppuccin settigns. - set -g @catppuccin_window_default_text "#{window_name}" - - # Don't leave gaps inDon't leave gaps in window numbers. - set -g renumber-windows on - - # Vim keys for pane navigation. - bind h select-pane -L - bind j select-pane -D - bind k select-pane -U - bind l select-pane -R - ''; - }; -}