From 6c4377f7e1167182f7f52519d7c6dd839aee3e99 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 28 May 2024 20:46:24 +0200 Subject: [PATCH 01/76] Add emacs --- flake.lock | 453 ++++++++++++++++++ flake.nix | 18 + modules/home/editors/default.nix | 1 + modules/home/editors/emacs/default.nix | 19 + modules/home/editors/emacs/doom.d/config.el | 76 +++ modules/home/editors/emacs/doom.d/init.el | 195 ++++++++ modules/home/editors/emacs/doom.d/packages.el | 52 ++ 7 files changed, 814 insertions(+) create mode 100644 modules/home/editors/emacs/default.nix create mode 100644 modules/home/editors/emacs/doom.d/config.el create mode 100644 modules/home/editors/emacs/doom.d/init.el create mode 100644 modules/home/editors/emacs/doom.d/packages.el diff --git a/flake.lock b/flake.lock index 326a4af..f30e2f5 100644 --- a/flake.lock +++ b/flake.lock @@ -47,6 +47,203 @@ "type": "github" } }, + "doom-emacs": { + "flake": false, + "locked": { + "lastModified": 1662497747, + "narHash": "sha256-4n7E1fqda7cn5/F2jTkOnKw1juG6XMS/FI9gqODL3aU=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + } + }, + "doom-snippets": { + "flake": false, + "locked": { + "lastModified": 1694887483, + "narHash": "sha256-KlKhruPSLPSKqUnr5/U65arm16VrY9ORzm+XKNZhpTQ=", + "owner": "doomemacs", + "repo": "snippets", + "rev": "f022984ee1318a4015d5d081b3c3dab5a60dc6ff", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "snippets", + "type": "github" + } + }, + "emacs-overlay": { + "flake": false, + "locked": { + "lastModified": 1676366521, + "narHash": "sha256-i4UAY8t9Au9SJtsgYppa3NHSVf1YkV6yqnNIQd+Km4g=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + } + }, + "emacs-so-long": { + "flake": false, + "locked": { + "lastModified": 1575031854, + "narHash": "sha256-xIa5zO0ZaToDrec1OFjBK6l39AbA4l/CE4LInVu2hi0=", + "owner": "hlissner", + "repo": "emacs-so-long", + "rev": "ed666b0716f60e8988c455804de24b55919e71ca", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "emacs-so-long", + "type": "github" + } + }, + "evil-escape": { + "flake": false, + "locked": { + "lastModified": 1588439096, + "narHash": "sha256-aB2Ge5o/93B18tPf4fN1c+O46CNh/nOqwLJbox4c8Gw=", + "owner": "hlissner", + "repo": "evil-escape", + "rev": "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-escape", + "type": "github" + } + }, + "evil-markdown": { + "flake": false, + "locked": { + "lastModified": 1626852210, + "narHash": "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=", + "owner": "Somelauw", + "repo": "evil-markdown", + "rev": "8e6cc68af83914b2fa9fd3a3b8472573dbcef477", + "type": "github" + }, + "original": { + "owner": "Somelauw", + "repo": "evil-markdown", + "type": "github" + } + }, + "evil-org-mode": { + "flake": false, + "locked": { + "lastModified": 1607203864, + "narHash": "sha256-JxwqVYDN6OIJEH15MVI6XOZAPtUWUhJQWHyzcrUvrFg=", + "owner": "hlissner", + "repo": "evil-org-mode", + "rev": "a9706da260c45b98601bcd72b1d2c0a24a017700", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-org-mode", + "type": "github" + } + }, + "evil-quick-diff": { + "flake": false, + "locked": { + "lastModified": 1575189609, + "narHash": "sha256-oGzl1ayW9rIuq0haoiFS7RZsS8NFMdEA7K1BSozgnJU=", + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "rev": "69c883720b30a892c63bc89f49d4f0e8b8028908", + "type": "github" + }, + "original": { + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "type": "github" + } + }, + "explain-pause-mode": { + "flake": false, + "locked": { + "lastModified": 1595842060, + "narHash": "sha256-++znrjiDSx+cy4okFBBXUBkRFdtnE2x+trkmqjB3Njs=", + "owner": "lastquestion", + "repo": "explain-pause-mode", + "rev": "2356c8c3639cbeeb9751744dbe737267849b4b51", + "type": "github" + }, + "original": { + "owner": "lastquestion", + "repo": "explain-pause-mode", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "format-all": { + "flake": false, + "locked": { + "lastModified": 1581716637, + "narHash": "sha256-ul7LCe60W8TIvUmUtZtZRo8489TK9iTPDsLHmzxY57M=", + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + }, + "original": { + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -67,6 +264,52 @@ "type": "github" } }, + "nix-doom-emacs": { + "inputs": { + "doom-emacs": "doom-emacs", + "doom-snippets": "doom-snippets", + "emacs-overlay": "emacs-overlay", + "emacs-so-long": "emacs-so-long", + "evil-escape": "evil-escape", + "evil-markdown": "evil-markdown", + "evil-org-mode": "evil-org-mode", + "evil-quick-diff": "evil-quick-diff", + "explain-pause-mode": "explain-pause-mode", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "format-all": "format-all", + "nix-straight": [ + "nix-straight" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nose": "nose", + "ob-racket": "ob-racket", + "org": "org", + "org-contrib": "org-contrib", + "org-yt": "org-yt", + "php-extras": "php-extras", + "revealjs": "revealjs", + "rotate-text": "rotate-text", + "sln-mode": "sln-mode", + "ts-fold": "ts-fold", + "ws-butler": "ws-butler" + }, + "locked": { + "lastModified": 1701264882, + "narHash": "sha256-MBXR7x7Ua8qystlGr+lenwjQd7dsFNFpEFmtHhh10zM=", + "owner": "nix-community", + "repo": "nix-doom-emacs", + "rev": "f7413022370f24bb53cb450bfb2803233510113e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-doom-emacs", + "type": "github" + } + }, "nix-flatpak": { "locked": { "lastModified": 1711997201, @@ -83,6 +326,23 @@ "type": "github" } }, + "nix-straight": { + "flake": false, + "locked": { + "lastModified": 1696948727, + "narHash": "sha256-6fQamWVIyeLoFSJl1WKcIl+LUdZluzFla4H+4Z5Cv2E=", + "owner": "codingkoi", + "repo": "nix-straight.el", + "rev": "c64edbf49598453bd85dae1acef9a0f9d294185d", + "type": "github" + }, + "original": { + "owner": "codingkoi", + "ref": "codingkoi/apply-librephoenixs-fix", + "repo": "nix-straight.el", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1716509168, @@ -99,14 +359,160 @@ "type": "github" } }, + "nose": { + "flake": false, + "locked": { + "lastModified": 1400604510, + "narHash": "sha256-daEi8Kta1oGaDEmUUDDQMahTTPOpvNpDKk22rlr7cB0=", + "owner": "emacsattic", + "repo": "nose", + "rev": "f8528297519eba911696c4e68fa88892de9a7b72", + "type": "github" + }, + "original": { + "owner": "emacsattic", + "repo": "nose", + "type": "github" + } + }, + "ob-racket": { + "flake": false, + "locked": { + "lastModified": 1584656173, + "narHash": "sha256-rBUYDDCXb+3D4xTPQo9UocbTPZ32kWV1Uya/1DmZknU=", + "owner": "xchrishawk", + "repo": "ob-racket", + "rev": "83457ec9e1e96a29fd2086ed19432b9d75787673", + "type": "github" + }, + "original": { + "owner": "xchrishawk", + "repo": "ob-racket", + "type": "github" + } + }, + "org": { + "flake": false, + "locked": { + "lastModified": 1695726851, + "narHash": "sha256-qgbjspklSoI8M3cbCJOcUdjuijRgsL/+PSyEOW9VX4I=", + "owner": "emacs-straight", + "repo": "org-mode", + "rev": "aa9177e1a8b039c357d369c1c9aaab710bb247a9", + "type": "github" + }, + "original": { + "owner": "emacs-straight", + "repo": "org-mode", + "type": "github" + } + }, + "org-contrib": { + "flake": false, + "locked": { + "lastModified": 1694946041, + "narHash": "sha256-X/HFG6NZe5BY00KvGbcsIuf9R6Lg8x7Uhd0Y5+Q3qZU=", + "owner": "emacsmirror", + "repo": "org-contrib", + "rev": "5eabbf22bdd4523c922a30787e98ee66c24221aa", + "type": "github" + }, + "original": { + "owner": "emacsmirror", + "repo": "org-contrib", + "type": "github" + } + }, + "org-yt": { + "flake": false, + "locked": { + "lastModified": 1527381913, + "narHash": "sha256-dzQ6B7ryzatHCTLyEnRSbWO0VUiX/FHYnpHTs74aVUs=", + "owner": "TobiasZawada", + "repo": "org-yt", + "rev": "40cc1ac76d741055cbefa13860d9f070a7ade001", + "type": "github" + }, + "original": { + "owner": "TobiasZawada", + "repo": "org-yt", + "type": "github" + } + }, + "php-extras": { + "flake": false, + "locked": { + "lastModified": 1573312690, + "narHash": "sha256-r4WyVbzvT0ra4Z6JywNBOw5RxOEYd6Qe2IpebHXkj1U=", + "owner": "arnested", + "repo": "php-extras", + "rev": "d410c5af663c30c01d461ac476d1cbfbacb49367", + "type": "github" + }, + "original": { + "owner": "arnested", + "repo": "php-extras", + "type": "github" + } + }, + "revealjs": { + "flake": false, + "locked": { + "lastModified": 1695738029, + "narHash": "sha256-Z9c9Q41jMkj/DyXOiZYyIa7Gmn8VB8yauTyWrSsT+ps=", + "owner": "hakimel", + "repo": "reveal.js", + "rev": "88fbfc5751ad01e3f6adee5819eabeb9e73c3757", + "type": "github" + }, + "original": { + "owner": "hakimel", + "repo": "reveal.js", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "home-manager": "home-manager", + "nix-doom-emacs": "nix-doom-emacs", "nix-flatpak": "nix-flatpak", + "nix-straight": "nix-straight", "nixpkgs": "nixpkgs" } }, + "rotate-text": { + "flake": false, + "locked": { + "lastModified": 1322962747, + "narHash": "sha256-SOeOgSlcEIsKhUiYDJv0p+mLUb420s9E2BmvZQvZ0wk=", + "owner": "debug-ito", + "repo": "rotate-text.el", + "rev": "48f193697db996855aee1ad2bc99b38c6646fe76", + "type": "github" + }, + "original": { + "owner": "debug-ito", + "repo": "rotate-text.el", + "type": "github" + } + }, + "sln-mode": { + "flake": false, + "locked": { + "lastModified": 1423727528, + "narHash": "sha256-XqkqPyEJuTtFslOz1fpTf/Klbd/zA7IGpzpmum/MGao=", + "owner": "sensorflo", + "repo": "sln-mode", + "rev": "0f91d1b957c7d2a7bab9278ec57b54d57f1dbd9c", + "type": "github" + }, + "original": { + "owner": "sensorflo", + "repo": "sln-mode", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -121,6 +527,53 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "ts-fold": { + "flake": false, + "locked": { + "lastModified": 1695278494, + "narHash": "sha256-O4NcUC1u08W8ZslqoA/i+iTaLotKwheURXQWBxLLMFc=", + "owner": "jcs-elpa", + "repo": "ts-fold", + "rev": "70b2c79ff4daa7351d4e2917b0343b9a18d4d4f2", + "type": "github" + }, + "original": { + "owner": "jcs-elpa", + "repo": "ts-fold", + "type": "github" + } + }, + "ws-butler": { + "flake": false, + "locked": { + "lastModified": 1634511126, + "narHash": "sha256-c0y0ZPtxxICPk+eaNbbQf6t+FRCliNY54CCz9QHQ8ZI=", + "owner": "hlissner", + "repo": "ws-butler", + "rev": "572a10c11b6cb88293de48acbb59a059d36f9ba5", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "ws-butler", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 8eb11a3..51ab319 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,21 @@ }; nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; + + # Follow nix-doom-emacs completely when this is merged or fixed + # - https://github.com/nix-community/nix-doom-emacs/issues/409 + # - https://github.com/nix-community/nix-straight.el/pull/4 + nix-straight = { + url = "github:codingkoi/nix-straight.el?ref=codingkoi/apply-librephoenixs-fix"; + flake = false; + }; + nix-doom-emacs = { + url = "github:nix-community/nix-doom-emacs"; + inputs = { + nix-straight.follows = "nix-straight"; + nixpkgs.follows = "nixpkgs"; + }; + }; }; outputs = inputs@{ @@ -23,6 +38,7 @@ home-manager, agenix, nix-flatpak, + nix-doom-emacs, ... }: let @@ -47,6 +63,8 @@ home-manager.extraSpecialArgs = inputs; home-manager.users.florian.imports = [ nix-flatpak.homeManagerModules.nix-flatpak + nix-doom-emacs.hmModule + ./hosts/${s.name}/home.nix ]; } diff --git a/modules/home/editors/default.nix b/modules/home/editors/default.nix index 40db812..f265d2c 100644 --- a/modules/home/editors/default.nix +++ b/modules/home/editors/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./emacs ./vscode ]; } \ No newline at end of file diff --git a/modules/home/editors/emacs/default.nix b/modules/home/editors/emacs/default.nix new file mode 100644 index 0000000..5a70616 --- /dev/null +++ b/modules/home/editors/emacs/default.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.home.editors.emacs; +in +{ + options.modules.home.editors.emacs = { + enable = mkEnableOption '' + Enable emacs with my custom configurations + ''; + }; + config = mkIf cfg.enable { + programs.doom-emacs = { + enable = true; + doomPrivateDir = ./doom.d; + }; + }; +} \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/config.el b/modules/home/editors/emacs/doom.d/config.el new file mode 100644 index 0000000..576a6e5 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/config.el @@ -0,0 +1,76 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. It is optional. +;; (setq user-full-name "John Doe" +;; user-mail-address "john@doe.com") + +;; Doom exposes five (optional) variables for controlling fonts in Doom: +;; +;; - `doom-font' -- the primary font to use +;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable) +;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; - `doom-symbol-font' -- for symbols +;; - `doom-serif-font' -- for the `fixed-pitch-serif' face +;; +;; See 'C-h v doom-font' for documentation and more examples of what they +;; accept. For example: +;; +;; (setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) +;; +;; If you or Emacs can't find your font, use 'M-x describe-font' to look them +;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to +;; refresh your font settings. If Emacs still can't find your font, it likely +;; wasn't installed correctly. Font issues are rarely Doom issues! + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-one) + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type t) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") + + +;; Whenever you reconfigure a package, make sure to wrap your config in an +;; `after!' block, otherwise Doom's defaults may override your settings. E.g. +;; +;; (after! PACKAGE +;; (setq x y)) +;; +;; The exceptions to this rule: +;; +;; - Setting file/directory variables (like `org-directory') +;; - Setting variables which explicitly tell you to set them before their +;; package is loaded (see 'C-h v VARIABLE' to look up their documentation). +;; - Setting doom variables (which start with 'doom-' or '+'). +;; +;; Here are some additional functions/macros that will help you configure Doom. +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces, +;; etc). +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/init.el b/modules/home/editors/emacs/doom.d/init.el new file mode 100644 index 0000000..aa00999 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/init.el @@ -0,0 +1,195 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a link to Doom's Module Index where all +;; of our modules are listed, including what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;bidi ; (tfel ot) thgir etirw uoy gnipleh + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji +unicode) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + tabs ; a tab bar for Emacs + (treemacs +lsp) ; a project drawer, like neotree but cooler + ;;unicode ; extended unicode support for various languages + (vc-gutter +pretty) ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + ;;(format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + (ibuffer +icons) ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + ;;vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;collab ; buffers with friends + (debugger +lsp) ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp ; M-x vscode + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + ;;pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + tree-sitter ; syntax and parsing, sitting in a tree... + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + (cc +lsp) ; C > C++ == 1 + ;;cloju + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + (dart +flutter +lsp) ; paint ui and not much else + ;;dhall + (elixir +lsp) ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + ;;(graphql +lsp) ; Give queries a REST + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + (java +lsp) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + (kotlin +lsp) ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;;nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + org ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + ;;python ; beautiful is better than ugly + (qt +lsp +xp) ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + (ruby +lsp +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/packages.el b/modules/home/editors/emacs/doom.d/packages.el new file mode 100644 index 0000000..be08796 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/packages.el @@ -0,0 +1,52 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/radian-software/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see radian-software/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + +(package! ripgrep) \ No newline at end of file From 3bc86778ff95fbffc5a9c079a8062bcabf8d5e1e Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 29 May 2024 10:17:45 +0200 Subject: [PATCH 02/76] Install ollama (support for cuda) --- hosts/pro-laptop/configuration.nix | 4 ++++ modules/system/server/default.nix | 1 + modules/system/server/ollama/default.nix | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 modules/system/server/ollama/default.nix diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 4a0eec2..72cabc3 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -47,5 +47,9 @@ printing.enable = true; waydroid.enable = true; }; + + server = { + ollama.enable = true; + }; }; } diff --git a/modules/system/server/default.nix b/modules/system/server/default.nix index d75b7fd..84c8c31 100644 --- a/modules/system/server/default.nix +++ b/modules/system/server/default.nix @@ -3,6 +3,7 @@ { imports = [ ./docker + ./ollama ./openssh ]; } \ No newline at end of file diff --git a/modules/system/server/ollama/default.nix b/modules/system/server/ollama/default.nix new file mode 100644 index 0000000..c1bfd7d --- /dev/null +++ b/modules/system/server/ollama/default.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.system.server.ollama; + nvidiaEnabled = config.modules.system.hardware.nvidia.enable; +in +{ + options.modules.system.server.ollama = { + enable = mkEnableOption '' + Enable ollama with my custom configurations + ''; + }; + config = mkIf cfg.enable { + services.ollama = { + enable = true; + + acceleration = if config.modules.system.hardware.nvidia.enable then "cuda" else null; + }; + }; +} \ No newline at end of file From 03b8fb2d5d150481744a0b74734f983d24646b55 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 29 May 2024 10:46:26 +0200 Subject: [PATCH 03/76] modules.system.server.ollama: use var nvidiaEnabled --- modules/system/server/ollama/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/server/ollama/default.nix b/modules/system/server/ollama/default.nix index c1bfd7d..469fb96 100644 --- a/modules/system/server/ollama/default.nix +++ b/modules/system/server/ollama/default.nix @@ -15,7 +15,7 @@ in services.ollama = { enable = true; - acceleration = if config.modules.system.hardware.nvidia.enable then "cuda" else null; + acceleration = if nvidiaEnabled then "cuda" else null; }; }; } \ No newline at end of file From 9d3bbbe01a7e723ba64121e7ec1dda884d5d0450 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 29 May 2024 13:41:11 +0200 Subject: [PATCH 04/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 326a4af..c2a6801 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1716736760, - "narHash": "sha256-h3RmnNknKYtVA+EvUSra6QAwfZjC2q1G8YA7W0gat8Y=", + "lastModified": 1716930911, + "narHash": "sha256-t4HT5j3Jy7skRB5PINnxcEBCkgE89rGBpwTI7YS4Ffo=", "owner": "nix-community", "repo": "home-manager", - "rev": "5d151429e1e79107acf6d06dcc5ace4e642ec239", + "rev": "a9b36cbe9292a649222b89fdb9ae9907e9c74086", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716509168, - "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", + "lastModified": 1716769173, + "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bfb7a882678e518398ce9a31a881538679f6f092", + "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632", "type": "github" }, "original": { From 1d210c4cada34d7ebb703d8398fe9cea71cf7661 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 31 May 2024 11:02:50 +0200 Subject: [PATCH 05/76] perso-desktop: Enable ollama --- hosts/perso-desktop/configuration.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index 43e5e9a..ccbfaf8 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -34,5 +34,9 @@ printing.enable = true; waydroid.enable = true; }; + + server = { + ollama.enable = true; + }; }; } From 6636261dbcb647f7605a07a0a7ed658d0187f398 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 31 May 2024 12:15:48 +0200 Subject: [PATCH 06/76] kwin: Remove syncobj patch Useless because lot of application run with XWayland and is already patched for NVIDIA 555 --- modules/system/desktop/plasma/default.nix | 7 +- overlays/.gitkeep | 0 overlays/kwin/5511.patch | 2027 --------------------- overlays/kwin/default.nix | 9 - 4 files changed, 1 insertion(+), 2042 deletions(-) create mode 100644 overlays/.gitkeep delete mode 100644 overlays/kwin/5511.patch delete mode 100644 overlays/kwin/default.nix diff --git a/modules/system/desktop/plasma/default.nix b/modules/system/desktop/plasma/default.nix index b0387fe..521f98d 100644 --- a/modules/system/desktop/plasma/default.nix +++ b/modules/system/desktop/plasma/default.nix @@ -33,10 +33,5 @@ in glxinfo clinfo ]; - - # Uncomment when kwin is available in nixpkgs and NVIDIA 555 - nixpkgs.overlays = [ - (import ../../../../overlays/kwin) - ]; }; -} \ No newline at end of file +} diff --git a/overlays/.gitkeep b/overlays/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/overlays/kwin/5511.patch b/overlays/kwin/5511.patch deleted file mode 100644 index 341dc2e..0000000 --- a/overlays/kwin/5511.patch +++ /dev/null @@ -1,2027 +0,0 @@ -From e1791de663807bc93c09418481cb844c7daeb8f7 Mon Sep 17 00:00:00 2001 -From: Xaver Hugl -Date: Wed, 22 Nov 2023 19:51:24 +0100 -Subject: [PATCH 1/5] wayland: implement linux-drm-syncobj-v1 - -linux-drm-syncobj-v1 allows drivers and apps to synchronize KWin's buffer access -to their rendering, and synchronize their rendering to KWin's buffer release. This -fixes severe glitches with the proprietary NVidia driver and allows for some -performance improvements with Mesa too. - -(cherry picked from commit 32addf4d599135678a5120470bc27a881f34a3d9) ---- - src/CMakeLists.txt | 1 + - src/backends/drm/drm_egl_backend.cpp | 16 ++ - src/backends/drm/drm_egl_backend.h | 3 + - src/backends/drm/drm_gpu.cpp | 8 + - src/backends/drm/drm_gpu.h | 2 + - src/compositor_wayland.cpp | 2 +- - src/core/graphicsbuffer.cpp | 6 + - src/core/graphicsbuffer.h | 8 + - src/core/renderbackend.cpp | 11 + - src/core/renderbackend.h | 5 + - src/core/syncobjtimeline.cpp | 83 ++++++ - src/core/syncobjtimeline.h | 72 +++++ - src/opengl/eglnativefence.cpp | 5 + - src/opengl/eglnativefence.h | 1 + - .../scenes/opengl/abstract_egl_backend.cpp | 5 + - .../scenes/opengl/abstract_egl_backend.h | 2 +- - .../scenes/opengl/openglbackend.cpp | 4 + - .../scenes/opengl/openglbackend.h | 3 + - src/scene/item.h | 1 + - src/scene/itemrenderer_opengl.cpp | 20 +- - src/scene/itemrenderer_opengl.h | 9 +- - src/scene/surfaceitem.cpp | 5 + - src/scene/surfaceitem.h | 3 + - src/scene/surfaceitem_wayland.cpp | 6 + - src/scene/surfaceitem_wayland.h | 1 + - src/scene/workspacescene_opengl.cpp | 2 +- - src/wayland/CMakeLists.txt | 8 + - src/wayland/linux_drm_syncobj_v1.cpp | 190 +++++++++++++ - src/wayland/linux_drm_syncobj_v1.h | 63 +++++ - src/wayland/linux_drm_syncobj_v1_p.h | 32 +++ - .../protocols/linux-drm-syncobj-v1.xml | 261 ++++++++++++++++++ - src/wayland/surface.cpp | 20 ++ - src/wayland/surface.h | 8 + - src/wayland/surface_p.h | 9 + - src/wayland/transaction.cpp | 27 +- - src/wayland/transaction_p.h | 15 + - src/wayland_server.cpp | 17 ++ - src/wayland_server.h | 7 + - 38 files changed, 935 insertions(+), 6 deletions(-) - create mode 100644 src/core/syncobjtimeline.cpp - create mode 100644 src/core/syncobjtimeline.h - create mode 100644 src/wayland/linux_drm_syncobj_v1.cpp - create mode 100644 src/wayland/linux_drm_syncobj_v1.h - create mode 100644 src/wayland/linux_drm_syncobj_v1_p.h - create mode 100644 src/wayland/protocols/linux-drm-syncobj-v1.xml - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 4e0db4fe9a9..0130caf3b8e 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -73,6 +73,7 @@ target_sources(kwin PRIVATE - core/session_logind.cpp - core/session_noop.cpp - core/shmgraphicsbufferallocator.cpp -+ core/syncobjtimeline.cpp - cursor.cpp - cursorsource.cpp - dbusinterface.cpp -diff --git a/src/backends/drm/drm_egl_backend.cpp b/src/backends/drm/drm_egl_backend.cpp -index cfb7a482a03..943407e1d9b 100644 ---- a/src/backends/drm/drm_egl_backend.cpp -+++ b/src/backends/drm/drm_egl_backend.cpp -@@ -9,6 +9,7 @@ - #include "drm_egl_backend.h" - #include "platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.h" - // kwin -+#include "core/syncobjtimeline.h" - #include "drm_abstract_output.h" - #include "drm_backend.h" - #include "drm_egl_cursor_layer.h" -@@ -199,6 +200,21 @@ DrmGpu *EglGbmBackend::gpu() const - return m_backend->primaryGpu(); - } - -+bool EglGbmBackend::supportsTimelines() const -+{ -+ return m_backend->primaryGpu()->syncObjTimelinesSupported(); -+} -+ -+std::unique_ptr EglGbmBackend::importTimeline(FileDescriptor &&syncObjFd) -+{ -+ uint32_t handle = 0; -+ if (drmSyncobjFDToHandle(m_backend->primaryGpu()->fd(), syncObjFd.get(), &handle) != 0) { -+ qCWarning(KWIN_DRM) << "importing syncobj timeline failed!" << strerror(errno); -+ return nullptr; -+ } -+ return std::make_unique(m_backend->primaryGpu()->fd(), handle); -+} -+ - } // namespace KWin - - #include "moc_drm_egl_backend.cpp" -diff --git a/src/backends/drm/drm_egl_backend.h b/src/backends/drm/drm_egl_backend.h -index 43c431f07be..4a47e900cd3 100644 ---- a/src/backends/drm/drm_egl_backend.h -+++ b/src/backends/drm/drm_egl_backend.h -@@ -63,6 +63,9 @@ public: - EglDisplay *displayForGpu(DrmGpu *gpu); - std::shared_ptr contextForGpu(DrmGpu *gpu); - -+ bool supportsTimelines() const override; -+ std::unique_ptr importTimeline(FileDescriptor &&syncObjFd) override; -+ - private: - bool initializeEgl(); - bool initRenderingContext(); -diff --git a/src/backends/drm/drm_gpu.cpp b/src/backends/drm/drm_gpu.cpp -index c5d258a2d7c..7141ed8beac 100644 ---- a/src/backends/drm/drm_gpu.cpp -+++ b/src/backends/drm/drm_gpu.cpp -@@ -76,6 +76,9 @@ DrmGpu::DrmGpu(DrmBackend *backend, const QString &devNode, int fd, dev_t device - m_addFB2ModifiersSupported = drmGetCap(fd, DRM_CAP_ADDFB2_MODIFIERS, &capability) == 0 && capability == 1; - qCDebug(KWIN_DRM) << "drmModeAddFB2WithModifiers is" << (m_addFB2ModifiersSupported ? "supported" : "not supported") << "on GPU" << m_devNode; - -+ m_supportsSyncTimelines = drmGetCap(fd, DRM_CAP_SYNCOBJ_TIMELINE, &capability) == 0 && capability == 1; -+ qCDebug(KWIN_DRM) << "sync obj timelines are" << (m_supportsSyncTimelines ? "supported" : "not supported") << "on GPU" << this; -+ - // find out what driver this kms device is using - DrmUniquePtr version(drmGetVersion(fd)); - m_isI915 = strstr(version->name, "i915"); -@@ -699,6 +702,11 @@ bool DrmGpu::asyncPageflipSupported() const - return m_asyncPageflipSupported; - } - -+bool DrmGpu::syncObjTimelinesSupported() const -+{ -+ return m_supportsSyncTimelines; -+} -+ - bool DrmGpu::isI915() const - { - return m_isI915; -diff --git a/src/backends/drm/drm_gpu.h b/src/backends/drm/drm_gpu.h -index 0cc6b2126a3..c8dbde47af7 100644 ---- a/src/backends/drm/drm_gpu.h -+++ b/src/backends/drm/drm_gpu.h -@@ -77,6 +77,7 @@ public: - bool atomicModeSetting() const; - bool addFB2ModifiersSupported() const; - bool asyncPageflipSupported() const; -+ bool syncObjTimelinesSupported() const; - bool isI915() const; - bool isNVidia() const; - bool isVmwgfx() const; -@@ -146,6 +147,7 @@ private: - bool m_isRemoved = false; - bool m_isActive = true; - bool m_forceModeset = false; -+ bool m_supportsSyncTimelines = false; - clockid_t m_presentationClock; - gbm_device *m_gbmDevice; - FileDescriptor m_gbmFd; -diff --git a/src/compositor_wayland.cpp b/src/compositor_wayland.cpp -index f63ead77964..69916e9d348 100644 ---- a/src/compositor_wayland.cpp -+++ b/src/compositor_wayland.cpp -@@ -86,7 +86,7 @@ bool WaylandCompositor::attemptOpenGLCompositing() - } - - m_scene = std::make_unique(backend.get()); -- m_cursorScene = std::make_unique(std::make_unique()); -+ m_cursorScene = std::make_unique(std::make_unique(backend->eglDisplayObject())); - m_backend = std::move(backend); - - qCDebug(KWIN_CORE) << "OpenGL compositing has been successfully initialized"; -diff --git a/src/core/graphicsbuffer.cpp b/src/core/graphicsbuffer.cpp -index f234d09fa9f..e83fcd7bf8a 100644 ---- a/src/core/graphicsbuffer.cpp -+++ b/src/core/graphicsbuffer.cpp -@@ -40,6 +40,7 @@ void GraphicsBuffer::unref() - if (m_dropped) { - delete this; - } else { -+ m_releasePoints.clear(); - Q_EMIT released(); - } - } -@@ -73,6 +74,11 @@ const ShmAttributes *GraphicsBuffer::shmAttributes() const - return nullptr; - } - -+void GraphicsBuffer::addReleasePoint(const std::shared_ptr &releasePoint) -+{ -+ m_releasePoints.push_back(releasePoint); -+} -+ - bool GraphicsBuffer::alphaChannelFromDrmFormat(uint32_t format) - { - const auto info = FormatInfo::get(format); -diff --git a/src/core/graphicsbuffer.h b/src/core/graphicsbuffer.h -index cacf49dde5a..2e046e58de0 100644 ---- a/src/core/graphicsbuffer.h -+++ b/src/core/graphicsbuffer.h -@@ -16,6 +16,8 @@ - namespace KWin - { - -+class SyncReleasePoint; -+ - struct DmaBufAttributes - { - int planeCount = 0; -@@ -87,6 +89,11 @@ public: - virtual const DmaBufAttributes *dmabufAttributes() const; - virtual const ShmAttributes *shmAttributes() const; - -+ /** -+ * the added release point will be referenced as long as this buffer is referenced -+ */ -+ void addReleasePoint(const std::shared_ptr &releasePoint); -+ - static bool alphaChannelFromDrmFormat(uint32_t format); - - Q_SIGNALS: -@@ -95,6 +102,7 @@ Q_SIGNALS: - protected: - int m_refCount = 0; - bool m_dropped = false; -+ std::vector> m_releasePoints; - }; - - /** -diff --git a/src/core/renderbackend.cpp b/src/core/renderbackend.cpp -index 98276385cec..5bbf37d9a4b 100644 ---- a/src/core/renderbackend.cpp -+++ b/src/core/renderbackend.cpp -@@ -7,6 +7,7 @@ - #include "renderbackend.h" - #include "renderloop_p.h" - #include "scene/surfaceitem.h" -+#include "syncobjtimeline.h" - - #include - -@@ -103,6 +104,16 @@ std::unique_ptr RenderBackend::createSurfaceTextureWayland(Surfa - return nullptr; - } - -+bool RenderBackend::supportsTimelines() const -+{ -+ return false; -+} -+ -+std::unique_ptr RenderBackend::importTimeline(FileDescriptor &&syncObjFd) -+{ -+ return nullptr; -+} -+ - } // namespace KWin - - #include "moc_renderbackend.cpp" -diff --git a/src/core/renderbackend.h b/src/core/renderbackend.h -index b902a28984a..682e35aa0b8 100644 ---- a/src/core/renderbackend.h -+++ b/src/core/renderbackend.h -@@ -8,6 +8,7 @@ - - #include "core/rendertarget.h" - #include "effect/globals.h" -+#include "utils/filedescriptor.h" - - #include - -@@ -26,6 +27,7 @@ class SurfacePixmapX11; - class SurfaceTexture; - class PresentationFeedback; - class RenderLoop; -+class SyncTimeline; - - class PresentationFeedback - { -@@ -88,6 +90,9 @@ public: - - virtual std::unique_ptr createSurfaceTextureX11(SurfacePixmapX11 *pixmap); - virtual std::unique_ptr createSurfaceTextureWayland(SurfacePixmap *pixmap); -+ -+ virtual bool supportsTimelines() const; -+ virtual std::unique_ptr importTimeline(FileDescriptor &&syncObjFd); - }; - - } // namespace KWin -diff --git a/src/core/syncobjtimeline.cpp b/src/core/syncobjtimeline.cpp -new file mode 100644 -index 00000000000..3e2c100370a ---- /dev/null -+++ b/src/core/syncobjtimeline.cpp -@@ -0,0 +1,83 @@ -+/* -+ SPDX-FileCopyrightText: 2024 Xaver Hugl -+ -+ SPDX-License-Identifier: GPL-2.0-or-later -+*/ -+#include "syncobjtimeline.h" -+ -+#include -+#include -+ -+namespace KWin -+{ -+ -+SyncReleasePoint::SyncReleasePoint(const std::shared_ptr &timeline, uint64_t timelinePoint) -+ : m_timeline(timeline) -+ , m_timelinePoint(timelinePoint) -+{ -+} -+ -+SyncReleasePoint::~SyncReleasePoint() -+{ -+ m_timeline->signal(m_timelinePoint); -+} -+ -+SyncTimeline *SyncReleasePoint::timeline() const -+{ -+ return m_timeline.get(); -+} -+ -+uint64_t SyncReleasePoint::timelinePoint() const -+{ -+ return m_timelinePoint; -+} -+ -+SyncTimeline::SyncTimeline(int drmFd, uint32_t handle) -+ : m_drmFd(drmFd) -+ , m_handle(handle) -+{ -+} -+ -+SyncTimeline::~SyncTimeline() -+{ -+ drmSyncobjDestroy(m_drmFd, m_handle); -+} -+ -+FileDescriptor SyncTimeline::eventFd(uint64_t timelinePoint) const -+{ -+ FileDescriptor ret{eventfd(0, EFD_CLOEXEC)}; -+ if (!ret.isValid()) { -+ return {}; -+ } -+ struct drm_syncobj_eventfd args -+ { -+ .handle = m_handle, -+ .flags = 0, -+ .point = timelinePoint, -+ .fd = ret.get(), -+ }; -+ if (drmIoctl(m_drmFd, DRM_IOCTL_SYNCOBJ_EVENTFD, &args) != 0) { -+ return {}; -+ } -+ return ret; -+} -+ -+void SyncTimeline::signal(uint64_t timelinePoint) -+{ -+ drmSyncobjTimelineSignal(m_drmFd, &m_handle, &timelinePoint, 1); -+} -+ -+SyncReleasePointHolder::SyncReleasePointHolder(FileDescriptor &&requirement, std::unordered_set> &&releasePoints) -+ : m_fence(std::move(requirement)) -+ , m_notifier(m_fence.get(), QSocketNotifier::Type::Read) -+ , m_releasePoints(std::move(releasePoints)) -+{ -+ connect(&m_notifier, &QSocketNotifier::activated, this, &SyncReleasePointHolder::signaled); -+ m_notifier.setEnabled(true); -+} -+ -+void SyncReleasePointHolder::signaled() -+{ -+ delete this; -+} -+} -diff --git a/src/core/syncobjtimeline.h b/src/core/syncobjtimeline.h -new file mode 100644 -index 00000000000..cffdb75e330 ---- /dev/null -+++ b/src/core/syncobjtimeline.h -@@ -0,0 +1,72 @@ -+/* -+ SPDX-FileCopyrightText: 2024 Xaver Hugl -+ -+ SPDX-License-Identifier: GPL-2.0-or-later -+*/ -+#pragma once -+#include "kwin_export.h" -+#include "utils/filedescriptor.h" -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace KWin -+{ -+ -+class SyncTimeline; -+ -+/** -+ * A helper to signal the release point when it goes out of scope -+ */ -+class KWIN_EXPORT SyncReleasePoint -+{ -+public: -+ explicit SyncReleasePoint(const std::shared_ptr &timeline, uint64_t timelinePoint); -+ ~SyncReleasePoint(); -+ -+ SyncTimeline *timeline() const; -+ uint64_t timelinePoint() const; -+ -+private: -+ const std::shared_ptr m_timeline; -+ const uint64_t m_timelinePoint; -+}; -+ -+class KWIN_EXPORT SyncTimeline -+{ -+public: -+ explicit SyncTimeline(int drmFd, uint32_t handle); -+ ~SyncTimeline(); -+ -+ /** -+ * @returns an event fd that gets signalled when the timeline point gets signalled -+ */ -+ FileDescriptor eventFd(uint64_t timelinePoint) const; -+ -+ void signal(uint64_t timelinePoint); -+ -+private: -+ const int32_t m_drmFd; -+ const uint32_t m_handle; -+}; -+ -+class SyncReleasePointHolder : public QObject -+{ -+ Q_OBJECT -+public: -+ /** -+ * @param requirement the filedescriptor that needs to be readable before the release points may be signalled. Once that's happened, this object deletes itself!' -+ */ -+ explicit SyncReleasePointHolder(FileDescriptor &&requirement, std::unordered_set> &&releasePoints); -+ -+private: -+ void signaled(); -+ -+ const FileDescriptor m_fence; -+ QSocketNotifier m_notifier; -+ const std::unordered_set> m_releasePoints; -+}; -+} -diff --git a/src/opengl/eglnativefence.cpp b/src/opengl/eglnativefence.cpp -index e68098bc768..13c42ade543 100644 ---- a/src/opengl/eglnativefence.cpp -+++ b/src/opengl/eglnativefence.cpp -@@ -51,6 +51,11 @@ const FileDescriptor &EGLNativeFence::fileDescriptor() const - return m_fileDescriptor; - } - -+FileDescriptor &&EGLNativeFence::fileDescriptor() -+{ -+ return std::move(m_fileDescriptor); -+} -+ - bool EGLNativeFence::waitSync() const - { - return eglWaitSync(m_display->handle(), m_sync, 0) == EGL_TRUE; -diff --git a/src/opengl/eglnativefence.h b/src/opengl/eglnativefence.h -index d5f6bdbbba2..05c248ff8e0 100644 ---- a/src/opengl/eglnativefence.h -+++ b/src/opengl/eglnativefence.h -@@ -27,6 +27,7 @@ public: - - bool isValid() const; - const FileDescriptor &fileDescriptor() const; -+ FileDescriptor &&fileDescriptor(); - bool waitSync() const; - - static EGLNativeFence importFence(EglDisplay *display, FileDescriptor &&fd); -diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp -index 4e227aef462..4ad2064148b 100644 ---- a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp -+++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp -@@ -13,6 +13,7 @@ - #include "opengl/egl_context_attribute_builder.h" - #include "utils/common.h" - #include "wayland/drmclientbuffer.h" -+#include "wayland/linux_drm_syncobj_v1.h" - #include "wayland_server.h" - // kwin libs - #include "opengl/eglimagetexture.h" -@@ -217,9 +218,13 @@ void AbstractEglBackend::initWayland() - .formatTable = includeShaderConversions(filterFormats({}, true)), - }); - -+ waylandServer()->setRenderBackend(this); - LinuxDmaBufV1ClientBufferIntegration *dmabuf = waylandServer()->linuxDmabuf(); - dmabuf->setRenderBackend(this); - dmabuf->setSupportedFormatsWithModifiers(m_tranches); -+ if (auto syncObj = waylandServer()->linuxSyncObj()) { -+ syncObj->setRenderBackend(this); -+ } - } - - void AbstractEglBackend::initClientExtensions() -diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.h b/src/platformsupport/scenes/opengl/abstract_egl_backend.h -index 0abd331ed6b..1f77898db50 100644 ---- a/src/platformsupport/scenes/opengl/abstract_egl_backend.h -+++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.h -@@ -34,7 +34,7 @@ public: - - EGLSurface surface() const; - EGLConfig config() const; -- EglDisplay *eglDisplayObject() const; -+ EglDisplay *eglDisplayObject() const override; - EglContext *contextObject(); - - bool testImportBuffer(GraphicsBuffer *buffer) override; -diff --git a/src/platformsupport/scenes/opengl/openglbackend.cpp b/src/platformsupport/scenes/opengl/openglbackend.cpp -index 92ca501d96e..0bb6de64021 100644 ---- a/src/platformsupport/scenes/opengl/openglbackend.cpp -+++ b/src/platformsupport/scenes/opengl/openglbackend.cpp -@@ -93,6 +93,10 @@ bool OpenGLBackend::checkGraphicsReset() - return true; - } - -+EglDisplay *OpenGLBackend::eglDisplayObject() const -+{ -+ return nullptr; -+} - } - - #include "moc_openglbackend.cpp" -diff --git a/src/platformsupport/scenes/opengl/openglbackend.h b/src/platformsupport/scenes/opengl/openglbackend.h -index 3318f4da187..e0749561826 100644 ---- a/src/platformsupport/scenes/opengl/openglbackend.h -+++ b/src/platformsupport/scenes/opengl/openglbackend.h -@@ -19,6 +19,7 @@ namespace KWin - class Output; - class OpenGLBackend; - class GLTexture; -+class EglDisplay; - - /** - * @brief The OpenGLBackend creates and holds the OpenGL context and is responsible for Texture from Pixmap. -@@ -97,6 +98,8 @@ public: - - virtual std::pair, ColorDescription> textureForOutput(Output *output) const; - -+ virtual EglDisplay *eglDisplayObject() const; -+ - protected: - /** - * @brief Sets the backend initialization to failed. -diff --git a/src/scene/item.h b/src/scene/item.h -index 5e9e4f1c92a..b77fc91c64b 100644 ---- a/src/scene/item.h -+++ b/src/scene/item.h -@@ -22,6 +22,7 @@ namespace KWin - - class SceneDelegate; - class Scene; -+class SyncReleasePoint; - - /** - * The Item class is the base class for items in the scene. -diff --git a/src/scene/itemrenderer_opengl.cpp b/src/scene/itemrenderer_opengl.cpp -index 44ec0918e33..3fee3863f2c 100644 ---- a/src/scene/itemrenderer_opengl.cpp -+++ b/src/scene/itemrenderer_opengl.cpp -@@ -8,7 +8,9 @@ - #include "core/pixelgrid.h" - #include "core/rendertarget.h" - #include "core/renderviewport.h" -+#include "core/syncobjtimeline.h" - #include "effect/effect.h" -+#include "opengl/eglnativefence.h" - #include "platformsupport/scenes/opengl/openglsurfacetexture.h" - #include "scene/decorationitem.h" - #include "scene/imageitem.h" -@@ -20,7 +22,8 @@ - namespace KWin - { - --ItemRendererOpenGL::ItemRendererOpenGL() -+ItemRendererOpenGL::ItemRendererOpenGL(EglDisplay *eglDisplay) -+ : m_eglDisplay(eglDisplay) - { - const QString visualizeOptionsString = qEnvironmentVariable("KWIN_SCENE_VISUALIZE"); - if (!visualizeOptionsString.isEmpty()) { -@@ -46,6 +49,14 @@ void ItemRendererOpenGL::endFrame() - { - GLVertexBuffer::streamingBuffer()->endOfFrame(); - GLFramebuffer::popFramebuffer(); -+ -+ if (m_eglDisplay) { -+ EGLNativeFence fence(m_eglDisplay); -+ if (fence.isValid()) { -+ new SyncReleasePointHolder(std::move(fence.fileDescriptor()), std::move(m_releasePoints)); -+ } -+ } -+ m_releasePoints.clear(); - } - - QVector4D ItemRendererOpenGL::modulate(float opacity, float brightness) const -@@ -173,6 +184,7 @@ void ItemRendererOpenGL::createRenderNode(Item *item, RenderContext *context) - .coordinateType = UnnormalizedCoordinates, - .scale = scale, - .colorDescription = item->colorDescription(), -+ .bufferReleasePoint = nullptr, - }); - } - } else if (auto decorationItem = qobject_cast(item)) { -@@ -187,6 +199,7 @@ void ItemRendererOpenGL::createRenderNode(Item *item, RenderContext *context) - .coordinateType = UnnormalizedCoordinates, - .scale = scale, - .colorDescription = item->colorDescription(), -+ .bufferReleasePoint = nullptr, - }); - } - } else if (auto surfaceItem = qobject_cast(item)) { -@@ -202,6 +215,7 @@ void ItemRendererOpenGL::createRenderNode(Item *item, RenderContext *context) - .coordinateType = NormalizedCoordinates, - .scale = scale, - .colorDescription = item->colorDescription(), -+ .bufferReleasePoint = surfaceItem->bufferReleasePoint(), - }); - } - } -@@ -216,6 +230,7 @@ void ItemRendererOpenGL::createRenderNode(Item *item, RenderContext *context) - .coordinateType = NormalizedCoordinates, - .scale = scale, - .colorDescription = item->colorDescription(), -+ .bufferReleasePoint = nullptr, - }); - } - } -@@ -407,6 +422,9 @@ void ItemRendererOpenGL::renderItem(const RenderTarget &renderTarget, const Rend - contents.planes[plane]->unbind(); - } - } -+ if (renderNode.bufferReleasePoint) { -+ m_releasePoints.insert(renderNode.bufferReleasePoint); -+ } - } - if (shader) { - ShaderManager::instance()->popShader(); -diff --git a/src/scene/itemrenderer_opengl.h b/src/scene/itemrenderer_opengl.h -index c35839335c6..11ab8cea386 100644 ---- a/src/scene/itemrenderer_opengl.h -+++ b/src/scene/itemrenderer_opengl.h -@@ -10,9 +10,13 @@ - #include "platformsupport/scenes/opengl/openglsurfacetexture.h" - #include "scene/itemrenderer.h" - -+#include -+ - namespace KWin - { - -+class EglDisplay; -+ - class KWIN_EXPORT ItemRendererOpenGL : public ItemRenderer - { - public: -@@ -28,6 +32,7 @@ public: - TextureCoordinateType coordinateType = UnnormalizedCoordinates; - qreal scale = 1.0; - ColorDescription colorDescription; -+ std::shared_ptr bufferReleasePoint; - }; - - struct RenderContext -@@ -41,7 +46,7 @@ public: - const qreal renderTargetScale; - }; - -- ItemRendererOpenGL(); -+ ItemRendererOpenGL(EglDisplay *eglDisplay); - - void beginFrame(const RenderTarget &renderTarget, const RenderViewport &viewport) override; - void endFrame() override; -@@ -58,6 +63,8 @@ private: - void visualizeFractional(const RenderViewport &viewport, const QRegion ®ion, const RenderContext &renderContext); - - bool m_blendingEnabled = false; -+ EglDisplay *const m_eglDisplay; -+ std::unordered_set> m_releasePoints; - - struct - { -diff --git a/src/scene/surfaceitem.cpp b/src/scene/surfaceitem.cpp -index 4404dbc3c6c..f04053f3566 100644 ---- a/src/scene/surfaceitem.cpp -+++ b/src/scene/surfaceitem.cpp -@@ -270,6 +270,11 @@ std::chrono::nanoseconds SurfaceItem::frameTimeEstimation() const - } - } - -+std::shared_ptr SurfaceItem::bufferReleasePoint() const -+{ -+ return m_bufferReleasePoint; -+} -+ - SurfaceTexture::~SurfaceTexture() - { - } -diff --git a/src/scene/surfaceitem.h b/src/scene/surfaceitem.h -index 5dfcfd0ad16..f6c8ca5d56d 100644 ---- a/src/scene/surfaceitem.h -+++ b/src/scene/surfaceitem.h -@@ -38,6 +38,8 @@ public: - QSize bufferSize() const; - void setBufferSize(const QSize &size); - -+ std::shared_ptr bufferReleasePoint() const; -+ - QRegion mapFromBuffer(const QRegion ®ion) const; - - void addDamage(const QRegion ®ion); -@@ -82,6 +84,7 @@ protected: - std::deque m_lastDamageTimeDiffs; - std::optional m_lastDamage; - std::chrono::nanoseconds m_frameTimeEstimation = std::chrono::days(1000); -+ std::shared_ptr m_bufferReleasePoint; - }; - - class KWIN_EXPORT SurfaceTexture -diff --git a/src/scene/surfaceitem_wayland.cpp b/src/scene/surfaceitem_wayland.cpp -index 82863c3a456..6f16c47142f 100644 ---- a/src/scene/surfaceitem_wayland.cpp -+++ b/src/scene/surfaceitem_wayland.cpp -@@ -41,6 +41,7 @@ SurfaceItemWayland::SurfaceItemWayland(SurfaceInterface *surface, Scene *scene, - this, &SurfaceItemWayland::handleColorDescriptionChanged); - connect(surface, &SurfaceInterface::presentationModeHintChanged, - this, &SurfaceItemWayland::handlePresentationModeHintChanged); -+ connect(surface, &SurfaceInterface::bufferReleasePointChanged, this, &SurfaceItemWayland::handleReleasePointChanged); - - SubSurfaceInterface *subsurface = surface->subSurface(); - if (subsurface) { -@@ -184,6 +185,11 @@ void SurfaceItemWayland::handlePresentationModeHintChanged() - setPresentationHint(m_surface->presentationModeHint()); - } - -+void SurfaceItemWayland::handleReleasePointChanged() -+{ -+ m_bufferReleasePoint = m_surface->bufferReleasePoint(); -+} -+ - SurfacePixmapWayland::SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent) - : SurfacePixmap(Compositor::self()->backend()->createSurfaceTextureWayland(this), parent) - , m_item(item) -diff --git a/src/scene/surfaceitem_wayland.h b/src/scene/surfaceitem_wayland.h -index ab31192cb9a..c428f1ea417 100644 ---- a/src/scene/surfaceitem_wayland.h -+++ b/src/scene/surfaceitem_wayland.h -@@ -48,6 +48,7 @@ private Q_SLOTS: - void handleSubSurfaceMappedChanged(); - void handleColorDescriptionChanged(); - void handlePresentationModeHintChanged(); -+ void handleReleasePointChanged(); - - protected: - std::unique_ptr createPixmap() override; -diff --git a/src/scene/workspacescene_opengl.cpp b/src/scene/workspacescene_opengl.cpp -index 3a024f56bd9..aabee9be151 100644 ---- a/src/scene/workspacescene_opengl.cpp -+++ b/src/scene/workspacescene_opengl.cpp -@@ -40,7 +40,7 @@ namespace KWin - ***********************************************/ - - WorkspaceSceneOpenGL::WorkspaceSceneOpenGL(OpenGLBackend *backend) -- : WorkspaceScene(std::make_unique()) -+ : WorkspaceScene(std::make_unique(backend->eglDisplayObject())) - , m_backend(backend) - { - } -diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt -index 41ee1c5581a..9d2add111fc 100644 ---- a/src/wayland/CMakeLists.txt -+++ b/src/wayland/CMakeLists.txt -@@ -231,6 +231,10 @@ ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml - PROTOCOL ${PROJECT_SOURCE_DIR}/src/wayland/protocols/xx-color-management-v2.xml - BASENAME xx-color-management-v2 - ) -+ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml -+ PROTOCOL ${PROJECT_SOURCE_DIR}/src/wayland/protocols/linux-drm-syncobj-v1.xml -+ BASENAME linux-drm-syncobj-v1 -+) - - target_sources(kwin PRIVATE - abstract_data_source.cpp -@@ -265,6 +269,7 @@ target_sources(kwin PRIVATE - keyboard_shortcuts_inhibit_v1.cpp - keystate.cpp - layershell_v1.cpp -+ linux_drm_syncobj_v1.cpp - linuxdmabufv1clientbuffer.cpp - lockscreen_overlay_v1.cpp - output.cpp -@@ -344,6 +349,7 @@ install(FILES - keyboard_shortcuts_inhibit_v1.h - keystate.h - layershell_v1.h -+ linux_drm_syncobj_v1.h - lockscreen_overlay_v1.h - output.h - output_order_v1.h -@@ -390,10 +396,12 @@ install(FILES - - ${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-content-type-v1.h - ${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-frog-color-management-v1.h -+ ${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-linux-drm-syncobj-v1.h - ${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-presentation-time.h - ${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-xx-color-management-v2.h - ${CMAKE_CURRENT_BINARY_DIR}/wayland-content-type-v1-server-protocol.h - ${CMAKE_CURRENT_BINARY_DIR}/wayland-frog-color-management-v1-server-protocol.h -+ ${CMAKE_CURRENT_BINARY_DIR}/wayland-linux-drm-syncobj-v1-server-protocol.h - ${CMAKE_CURRENT_BINARY_DIR}/wayland-presentation-time-server-protocol.h - ${CMAKE_CURRENT_BINARY_DIR}/wayland-xx-color-management-v2-server-protocol.h - -diff --git a/src/wayland/linux_drm_syncobj_v1.cpp b/src/wayland/linux_drm_syncobj_v1.cpp -new file mode 100644 -index 00000000000..589ccd78c3b ---- /dev/null -+++ b/src/wayland/linux_drm_syncobj_v1.cpp -@@ -0,0 +1,190 @@ -+/* -+ KWin - the KDE window manager -+ This file is part of the KDE project. -+ -+ SPDX-FileCopyrightText: 2024 Xaver Hugl -+ -+ SPDX-License-Identifier: GPL-2.0-or-later -+*/ -+#include "linux_drm_syncobj_v1.h" -+#include "core/syncobjtimeline.h" -+#include "display.h" -+#include "linux_drm_syncobj_v1_p.h" -+#include "surface.h" -+#include "surface_p.h" -+#include "transaction.h" -+#include "utils/resource.h" -+ -+#include -+ -+namespace KWin -+{ -+ -+static constexpr uint32_t s_version = 1; -+ -+LinuxDrmSyncObjV1Interface::LinuxDrmSyncObjV1Interface(Display *display, QObject *parent) -+ : QObject(parent) -+ , QtWaylandServer::wp_linux_drm_syncobj_manager_v1(*display, s_version) -+{ -+} -+ -+void LinuxDrmSyncObjV1Interface::wp_linux_drm_syncobj_manager_v1_get_surface(Resource *resource, uint32_t id, wl_resource *surface) -+{ -+ SurfaceInterface *surf = SurfaceInterface::get(surface); -+ SurfaceInterfacePrivate *priv = SurfaceInterfacePrivate::get(surf); -+ if (priv->syncObjV1) { -+ wl_resource_post_error(resource->handle, error_surface_exists, "surface already exists"); -+ return; -+ } -+ priv->syncObjV1 = new LinuxDrmSyncObjSurfaceV1(surf, resource->client(), id); -+} -+ -+void LinuxDrmSyncObjV1Interface::wp_linux_drm_syncobj_manager_v1_import_timeline(Resource *resource, uint32_t id, int32_t rawFd) -+{ -+ FileDescriptor fd(rawFd); -+ // TODO add a GPU abstraction, instead of using the render backend -+ if (!m_renderBackend || isGlobalRemoved()) { -+ // to not crash the client, create an inert timeline -+ new LinuxDrmSyncObjTimelineV1(resource->client(), id, nullptr); -+ return; -+ } -+ auto timeline = m_renderBackend->importTimeline(std::move(fd)); -+ if (!timeline) { -+ wl_resource_post_error(resource->handle, WP_LINUX_DRM_SYNCOBJ_MANAGER_V1_ERROR_INVALID_TIMELINE, "Importing timeline failed"); -+ return; -+ } -+ new LinuxDrmSyncObjTimelineV1(resource->client(), id, std::move(timeline)); -+} -+ -+void LinuxDrmSyncObjV1Interface::setRenderBackend(RenderBackend *backend) -+{ -+ m_renderBackend = backend; -+} -+ -+void LinuxDrmSyncObjV1Interface::wp_linux_drm_syncobj_manager_v1_destroy(Resource *resource) -+{ -+ wl_resource_destroy(resource->handle); -+} -+ -+void LinuxDrmSyncObjV1Interface::remove() -+{ -+ QtWaylandServer::wp_linux_drm_syncobj_manager_v1::globalRemove(); -+} -+ -+void LinuxDrmSyncObjV1Interface::wp_linux_drm_syncobj_manager_v1_destroy_global() -+{ -+ delete this; -+} -+ -+LinuxDrmSyncObjTimelineV1::LinuxDrmSyncObjTimelineV1(wl_client *client, uint32_t id, std::unique_ptr &&timeline) -+ : QtWaylandServer::wp_linux_drm_syncobj_timeline_v1(client, id, s_version) -+ , m_timeline(std::move(timeline)) -+{ -+} -+ -+LinuxDrmSyncObjTimelineV1::~LinuxDrmSyncObjTimelineV1() -+{ -+} -+ -+void LinuxDrmSyncObjTimelineV1::wp_linux_drm_syncobj_timeline_v1_destroy_resource(Resource *resource) -+{ -+ delete this; -+} -+ -+void LinuxDrmSyncObjTimelineV1::wp_linux_drm_syncobj_timeline_v1_destroy(Resource *resource) -+{ -+ wl_resource_destroy(resource->handle); -+} -+ -+std::shared_ptr LinuxDrmSyncObjTimelineV1::timeline() const -+{ -+ return m_timeline; -+} -+ -+LinuxDrmSyncObjSurfaceV1::LinuxDrmSyncObjSurfaceV1(SurfaceInterface *surface, wl_client *client, uint32_t id) -+ : QtWaylandServer::wp_linux_drm_syncobj_surface_v1(client, id, s_version) -+ , m_surface(surface) -+{ -+} -+ -+LinuxDrmSyncObjSurfaceV1::~LinuxDrmSyncObjSurfaceV1() -+{ -+ if (m_surface) { -+ SurfaceInterfacePrivate::get(m_surface)->syncObjV1 = nullptr; -+ } -+} -+ -+void LinuxDrmSyncObjSurfaceV1::wp_linux_drm_syncobj_surface_v1_set_acquire_point(Resource *resource, wl_resource *timeline_resource, uint32_t point_hi, uint32_t point_lo) -+{ -+ if (!m_surface) { -+ wl_resource_post_error(resource->handle, WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_SURFACE, "Surface got destroyed already"); -+ return; -+ } -+ const auto timeline = resource_cast(timeline_resource); -+ if (!timeline->timeline()) { -+ // in the normal case this should never happen, but if it does, -+ // there's nothing we can do about it without killing the client -+ return; -+ } -+ const uint64_t point = (uint64_t(point_hi) << 32) | point_lo; -+ const auto priv = SurfaceInterfacePrivate::get(m_surface); -+ priv->pending->acquirePoint.timeline = timeline->timeline(); -+ priv->pending->acquirePoint.point = point; -+} -+ -+void LinuxDrmSyncObjSurfaceV1::wp_linux_drm_syncobj_surface_v1_set_release_point(Resource *resource, wl_resource *timeline_resource, uint32_t point_hi, uint32_t point_lo) -+{ -+ if (!m_surface) { -+ wl_resource_post_error(resource->handle, WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_SURFACE, "Surface got destroyed already"); -+ return; -+ } -+ const auto timeline = resource_cast(timeline_resource); -+ if (!timeline->timeline()) { -+ // in the normal case this should never happen, but if it does, -+ // there's nothing we can do about it without killing the client -+ return; -+ } -+ const uint64_t point = (uint64_t(point_hi) << 32) | point_lo; -+ SurfaceInterfacePrivate::get(m_surface)->pending->releasePoint = std::make_unique(timeline->timeline(), point); -+} -+ -+void LinuxDrmSyncObjSurfaceV1::wp_linux_drm_syncobj_surface_v1_destroy_resource(Resource *resource) -+{ -+ delete this; -+} -+ -+void LinuxDrmSyncObjSurfaceV1::wp_linux_drm_syncobj_surface_v1_destroy(Resource *resource) -+{ -+ wl_resource_destroy(resource->handle); -+} -+ -+bool LinuxDrmSyncObjSurfaceV1::maybeEmitProtocolErrors() -+{ -+ const auto priv = SurfaceInterfacePrivate::get(m_surface); -+ if (!priv->pending->bufferIsSet && !priv->pending->acquirePoint.timeline && !priv->pending->releasePoint) { -+ return false; -+ } -+ if (!priv->pending->acquirePoint.timeline) { -+ wl_resource_post_error(resource()->handle, error_no_acquire_point, "explicit sync is used, but no acquire point is set"); -+ return true; -+ } -+ if (!priv->pending->releasePoint) { -+ wl_resource_post_error(resource()->handle, error_no_release_point, "explicit sync is used, but no release point is set"); -+ return true; -+ } -+ if (priv->pending->acquirePoint.timeline.get() == priv->pending->releasePoint->timeline() -+ && priv->pending->acquirePoint.point >= priv->pending->releasePoint->timelinePoint()) { -+ wl_resource_post_error(resource()->handle, error_conflicting_points, "acquire and release points are on the same timeline and acquire >= release"); -+ return true; -+ } -+ if (!priv->pending->buffer) { -+ wl_resource_post_error(resource()->handle, error_no_buffer, "explicit sync is used, but no buffer is attached"); -+ return true; -+ } -+ if (!priv->pending->buffer->dmabufAttributes()) { -+ wl_resource_post_error(resource()->handle, error_unsupported_buffer, "only linux dmabuf buffers are allowed to use explicit sync"); -+ return true; -+ } -+ return false; -+} -+} -diff --git a/src/wayland/linux_drm_syncobj_v1.h b/src/wayland/linux_drm_syncobj_v1.h -new file mode 100644 -index 00000000000..ff6ddbe0340 ---- /dev/null -+++ b/src/wayland/linux_drm_syncobj_v1.h -@@ -0,0 +1,63 @@ -+/* -+ KWin - the KDE window manager -+ This file is part of the KDE project. -+ -+ SPDX-FileCopyrightText: 2024 Xaver Hugl -+ -+ SPDX-License-Identifier: GPL-2.0-or-later -+*/ -+#pragma once -+ -+#include "kwin_export.h" -+#include "qwayland-server-linux-drm-syncobj-v1.h" -+ -+#include -+#include -+ -+namespace KWin -+{ -+ -+class Display; -+class SurfaceInterface; -+class RenderBackend; -+class SyncTimeline; -+ -+class KWIN_EXPORT LinuxDrmSyncObjV1Interface : public QObject, private QtWaylandServer::wp_linux_drm_syncobj_manager_v1 -+{ -+ Q_OBJECT -+public: -+ explicit LinuxDrmSyncObjV1Interface(Display *display, QObject *parent = nullptr); -+ -+ void setRenderBackend(RenderBackend *backend); -+ void remove(); -+ -+private: -+ void wp_linux_drm_syncobj_manager_v1_get_surface(Resource *resource, uint32_t id, wl_resource *surface) override; -+ void wp_linux_drm_syncobj_manager_v1_import_timeline(Resource *resource, uint32_t id, int32_t fd) override; -+ void wp_linux_drm_syncobj_manager_v1_destroy(Resource *resource) override; -+ void wp_linux_drm_syncobj_manager_v1_destroy_global() override; -+ -+ QPointer m_renderBackend; -+}; -+ -+class LinuxDrmSyncObjSurfaceV1 : private QtWaylandServer::wp_linux_drm_syncobj_surface_v1 -+{ -+public: -+ explicit LinuxDrmSyncObjSurfaceV1(SurfaceInterface *surface, wl_client *client, uint32_t id); -+ ~LinuxDrmSyncObjSurfaceV1() override; -+ -+ /** -+ * checks for protocol errors that may need to be sent at commit time -+ * @returns if any protocol errors were actually emitted -+ */ -+ bool maybeEmitProtocolErrors(); -+ -+private: -+ void wp_linux_drm_syncobj_surface_v1_set_acquire_point(Resource *resource, wl_resource *timeline, uint32_t point_hi, uint32_t point_lo) override; -+ void wp_linux_drm_syncobj_surface_v1_set_release_point(Resource *resource, wl_resource *timeline, uint32_t point_hi, uint32_t point_lo) override; -+ void wp_linux_drm_syncobj_surface_v1_destroy_resource(Resource *resource) override; -+ void wp_linux_drm_syncobj_surface_v1_destroy(Resource *resource) override; -+ -+ const QPointer m_surface; -+}; -+} -diff --git a/src/wayland/linux_drm_syncobj_v1_p.h b/src/wayland/linux_drm_syncobj_v1_p.h -new file mode 100644 -index 00000000000..6efbc12ee30 ---- /dev/null -+++ b/src/wayland/linux_drm_syncobj_v1_p.h -@@ -0,0 +1,32 @@ -+/* -+ KWin - the KDE window manager -+ This file is part of the KDE project. -+ -+ SPDX-FileCopyrightText: 2024 Xaver Hugl -+ -+ SPDX-License-Identifier: GPL-2.0-or-later -+*/ -+#pragma once -+#include "linux_drm_syncobj_v1.h" -+ -+namespace KWin -+{ -+ -+class LinuxDrmSyncObjTimelineV1 : public QtWaylandServer::wp_linux_drm_syncobj_timeline_v1 -+{ -+public: -+ explicit LinuxDrmSyncObjTimelineV1(wl_client *client, uint32_t id, std::unique_ptr &&timeline); -+ ~LinuxDrmSyncObjTimelineV1() override; -+ -+ /** -+ * May return nullptr if the timeline resource is inert -+ */ -+ std::shared_ptr timeline() const; -+ -+private: -+ void wp_linux_drm_syncobj_timeline_v1_destroy_resource(Resource *resource) override; -+ void wp_linux_drm_syncobj_timeline_v1_destroy(Resource *resource) override; -+ -+ const std::shared_ptr m_timeline; -+}; -+} -diff --git a/src/wayland/protocols/linux-drm-syncobj-v1.xml b/src/wayland/protocols/linux-drm-syncobj-v1.xml -new file mode 100644 -index 00000000000..2c491eaf43a ---- /dev/null -+++ b/src/wayland/protocols/linux-drm-syncobj-v1.xml -@@ -0,0 +1,261 @@ -+ -+ -+ -+ Copyright 2016 The Chromium Authors. -+ Copyright 2017 Intel Corporation -+ Copyright 2018 Collabora, Ltd -+ Copyright 2021 Simon Ser -+ -+ Permission is hereby granted, free of charge, to any person obtaining a -+ copy of this software and associated documentation files (the "Software"), -+ to deal in the Software without restriction, including without limitation -+ the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ and/or sell copies of the Software, and to permit persons to whom the -+ Software is furnished to do so, subject to the following conditions: -+ -+ The above copyright notice and this permission notice (including the next -+ paragraph) shall be included in all copies or substantial portions of the -+ Software. -+ -+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+ DEALINGS IN THE SOFTWARE. -+ -+ -+ -+ This protocol allows clients to request explicit synchronization for -+ buffers. It is tied to the Linux DRM synchronization object framework. -+ -+ Synchronization refers to co-ordination of pipelined operations performed -+ on buffers. Most GPU clients will schedule an asynchronous operation to -+ render to the buffer, then immediately send the buffer to the compositor -+ to be attached to a surface. -+ -+ With implicit synchronization, ensuring that the rendering operation is -+ complete before the compositor displays the buffer is an implementation -+ detail handled by either the kernel or userspace graphics driver. -+ -+ By contrast, with explicit synchronization, DRM synchronization object -+ timeline points mark when the asynchronous operations are complete. When -+ submitting a buffer, the client provides a timeline point which will be -+ waited on before the compositor accesses the buffer, and another timeline -+ point that the compositor will signal when it no longer needs to access the -+ buffer contents for the purposes of the surface commit. -+ -+ Linux DRM synchronization objects are documented at: -+ https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#drm-sync-objects -+ -+ Warning! The protocol described in this file is currently in the testing -+ phase. Backward compatible changes may be added together with the -+ corresponding interface version bump. Backward incompatible changes can -+ only be done by creating a new major version of the extension. -+ -+ -+ -+ -+ This global is a factory interface, allowing clients to request -+ explicit synchronization for buffers on a per-surface basis. -+ -+ See wp_linux_drm_syncobj_surface_v1 for more information. -+ -+ -+ -+ -+ Destroy this explicit synchronization factory object. Other objects -+ shall not be affected by this request. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Instantiate an interface extension for the given wl_surface to provide -+ explicit synchronization. -+ -+ If the given wl_surface already has an explicit synchronization object -+ associated, the surface_exists protocol error is raised. -+ -+ Graphics APIs, like EGL or Vulkan, that manage the buffer queue and -+ commits of a wl_surface themselves, are likely to be using this -+ extension internally. If a client is using such an API for a -+ wl_surface, it should not directly use this extension on that surface, -+ to avoid raising a surface_exists protocol error. -+ -+ -+ -+ -+ -+ -+ -+ Import a DRM synchronization object timeline. -+ -+ If the FD cannot be imported, the invalid_timeline error is raised. -+ -+ -+ -+ -+ -+ -+ -+ -+ This object represents an explicit synchronization object timeline -+ imported by the client to the compositor. -+ -+ -+ -+ -+ Destroy the synchronization object timeline. Other objects are not -+ affected by this request, in particular timeline points set by -+ set_acquire_point and set_release_point are not unset. -+ -+ -+ -+ -+ -+ -+ This object is an add-on interface for wl_surface to enable explicit -+ synchronization. -+ -+ Each surface can be associated with only one object of this interface at -+ any time. -+ -+ Explicit synchronization is guaranteed to be supported for buffers -+ created with any version of the linux-dmabuf protocol. Compositors are -+ free to support explicit synchronization for additional buffer types. -+ If at surface commit time the attached buffer does not support explicit -+ synchronization, an unsupported_buffer error is raised. -+ -+ As long as the wp_linux_drm_syncobj_surface_v1 object is alive, the -+ compositor may ignore implicit synchronization for buffers attached and -+ committed to the wl_surface. The delivery of wl_buffer.release events -+ for buffers attached to the surface becomes undefined. -+ -+ Clients must set both acquire and release points if and only if a -+ non-null buffer is attached in the same surface commit. See the -+ no_buffer, no_acquire_point and no_release_point protocol errors. -+ -+ If at surface commit time the acquire and release DRM syncobj timelines -+ are identical, the acquire point value must be strictly less than the -+ release point value, or else the conflicting_points protocol error is -+ raised. -+ -+ -+ -+ -+ Destroy this surface synchronization object. -+ -+ Any timeline point set by this object with set_acquire_point or -+ set_release_point since the last commit may be discarded by the -+ compositor. Any timeline point set by this object before the last -+ commit will not be affected. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Set the timeline point that must be signalled before the compositor may -+ sample from the buffer attached with wl_surface.attach. -+ -+ The 64-bit unsigned value combined from point_hi and point_lo is the -+ point value. -+ -+ The acquire point is double-buffered state, and will be applied on the -+ next wl_surface.commit request for the associated surface. Thus, it -+ applies only to the buffer that is attached to the surface at commit -+ time. -+ -+ If an acquire point has already been attached during the same commit -+ cycle, the new point replaces the old one. -+ -+ If the associated wl_surface was destroyed, a no_surface error is -+ raised. -+ -+ If at surface commit time there is a pending acquire timeline point set -+ but no pending buffer attached, a no_buffer error is raised. If at -+ surface commit time there is a pending buffer attached but no pending -+ acquire timeline point set, the no_acquire_point protocol error is -+ raised. -+ -+ -+ -+ -+ -+ -+ -+ -+ Set the timeline point that must be signalled by the compositor when it -+ has finished its usage of the buffer attached with wl_surface.attach -+ for the relevant commit. -+ -+ Once the timeline point is signaled, and assuming the associated buffer -+ is not pending release from other wl_surface.commit requests, no -+ additional explicit or implicit synchronization with the compositor is -+ required to safely re-use the buffer. -+ -+ Note that clients cannot rely on the release point being always -+ signaled after the acquire point: compositors may release buffers -+ without ever reading from them. In addition, the compositor may use -+ different presentation paths for different commits, which may have -+ different release behavior. As a result, the compositor may signal the -+ release points in a different order than the client committed them. -+ -+ Because signaling a timeline point also signals every previous point, -+ it is generally not safe to use the same timeline object for the -+ release points of multiple buffers. The out-of-order signaling -+ described above may lead to a release point being signaled before the -+ compositor has finished reading. To avoid this, it is strongly -+ recommended that each buffer should use a separate timeline for its -+ release points. -+ -+ The 64-bit unsigned value combined from point_hi and point_lo is the -+ point value. -+ -+ The release point is double-buffered state, and will be applied on the -+ next wl_surface.commit request for the associated surface. Thus, it -+ applies only to the buffer that is attached to the surface at commit -+ time. -+ -+ If a release point has already been attached during the same commit -+ cycle, the new point replaces the old one. -+ -+ If the associated wl_surface was destroyed, a no_surface error is -+ raised. -+ -+ If at surface commit time there is a pending release timeline point set -+ but no pending buffer attached, a no_buffer error is raised. If at -+ surface commit time there is a pending buffer attached but no pending -+ release timeline point set, the no_release_point protocol error is -+ raised. -+ -+ -+ -+ -+ -+ -+ -diff --git a/src/wayland/surface.cpp b/src/wayland/surface.cpp -index 23f981f2f81..6a33c5fca10 100644 ---- a/src/wayland/surface.cpp -+++ b/src/wayland/surface.cpp -@@ -13,6 +13,7 @@ - #include "fractionalscale_v1_p.h" - #include "frog_colormanagement_v1.h" - #include "idleinhibit_v1_p.h" -+#include "linux_drm_syncobj_v1.h" - #include "linuxdmabufv1clientbuffer.h" - #include "output.h" - #include "pointerconstraints_v1_p.h" -@@ -342,6 +343,10 @@ void SurfaceInterfacePrivate::surface_commit(Resource *resource) - { - const bool sync = subsurface.handle && subsurface.handle->isSynchronized(); - -+ if (syncObjV1 && syncObjV1->maybeEmitProtocolErrors()) { -+ return; -+ } -+ - Transaction *transaction; - if (sync) { - if (!subsurface.transaction) { -@@ -518,6 +523,9 @@ void SurfaceState::mergeInto(SurfaceState *target) - target->offset = offset; - target->damage = damage; - target->bufferDamage = bufferDamage; -+ target->acquirePoint.timeline = std::exchange(acquirePoint.timeline, nullptr); -+ target->acquirePoint.point = acquirePoint.point; -+ target->releasePoint = std::move(releasePoint); - target->bufferIsSet = true; - } - if (viewport.sourceGeometryIsSet) { -@@ -600,6 +608,7 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next) - const bool visibilityChanged = bufferChanged && bool(current->buffer) != bool(next->buffer); - const bool colorDescriptionChanged = next->colorDescriptionIsSet; - const bool presentationModeHintChanged = next->presentationModeHintIsSet; -+ const bool bufferReleasePointChanged = next->releasePointIsSet; - - const QSizeF oldSurfaceSize = surfaceSize; - const QSize oldBufferSize = bufferSize; -@@ -608,6 +617,9 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next) - - next->mergeInto(current.get()); - bufferRef = current->buffer; -+ if (bufferRef && current->releasePoint) { -+ bufferRef->addReleasePoint(current->releasePoint); -+ } - scaleOverride = pendingScaleOverride; - - if (current->buffer) { -@@ -689,6 +701,9 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next) - if (presentationModeHintChanged) { - Q_EMIT q->presentationModeHintChanged(); - } -+ if (bufferReleasePointChanged) { -+ Q_EMIT q->bufferReleasePointChanged(); -+ } - - if (bufferChanged) { - if (current->buffer && (!current->damage.isEmpty() || !current->bufferDamage.isEmpty())) { -@@ -1179,6 +1194,11 @@ void SurfaceInterface::traverseTree(std::function SurfaceInterface::bufferReleasePoint() const -+{ -+ return d->current->releasePoint; -+} -+ - } // namespace KWin - - #include "moc_surface.cpp" -diff --git a/src/wayland/surface.h b/src/wayland/surface.h -index 597f06774f8..80d1fa55708 100644 ---- a/src/wayland/surface.h -+++ b/src/wayland/surface.h -@@ -32,6 +32,7 @@ class SlideInterface; - class SubSurfaceInterface; - class SurfaceInterfacePrivate; - class Transaction; -+class SyncReleasePoint; - - /** - * The SurfaceRole class represents a role assigned to a wayland surface. -@@ -342,6 +343,12 @@ public: - - void setPreferredColorDescription(const ColorDescription &descr); - -+ /** -+ * @returns the release point that should be referenced as long as the buffer on this surface -+ * is, or may still be used by the compositor -+ */ -+ std::shared_ptr bufferReleasePoint() const; -+ - /** - * Traverses the surface sub-tree with this surface as the root. - */ -@@ -426,6 +433,7 @@ Q_SIGNALS: - - void colorDescriptionChanged(); - void presentationModeHintChanged(); -+ void bufferReleasePointChanged(); - - /** - * Emitted when the Surface has been committed. -diff --git a/src/wayland/surface_p.h b/src/wayland/surface_p.h -index f78bd107b44..775f9d7bd2e 100644 ---- a/src/wayland/surface_p.h -+++ b/src/wayland/surface_p.h -@@ -28,6 +28,7 @@ class FractionalScaleV1Interface; - class FrogColorManagementSurfaceV1; - class PresentationTimeFeedback; - class XXColorSurfaceV2; -+class LinuxDrmSyncObjSurfaceV1; - - struct SurfaceState - { -@@ -58,6 +59,7 @@ struct SurfaceState - bool contentTypeIsSet = false; - bool presentationModeHintIsSet = false; - bool colorDescriptionIsSet = false; -+ bool releasePointIsSet = false; - qint32 bufferScale = 1; - OutputTransform bufferTransform = OutputTransform::Normal; - wl_list frameCallbacks; -@@ -71,6 +73,12 @@ struct SurfaceState - PresentationModeHint presentationHint = PresentationModeHint::VSync; - ColorDescription colorDescription = ColorDescription::sRGB; - std::unique_ptr presentationFeedback; -+ struct -+ { -+ std::shared_ptr timeline; -+ uint64_t point = 0; -+ } acquirePoint; -+ std::shared_ptr releasePoint; - - struct - { -@@ -169,6 +177,7 @@ public: - TearingControlV1Interface *tearing = nullptr; - FrogColorManagementSurfaceV1 *frogColorManagement = nullptr; - XXColorSurfaceV2 *xxColorSurface = nullptr; -+ LinuxDrmSyncObjSurfaceV1 *syncObjV1 = nullptr; - - struct - { -diff --git a/src/wayland/transaction.cpp b/src/wayland/transaction.cpp -index 93004ba863d..fcd19d4036f 100644 ---- a/src/wayland/transaction.cpp -+++ b/src/wayland/transaction.cpp -@@ -5,7 +5,9 @@ - */ - - #include "wayland/transaction.h" -+#include "core/syncobjtimeline.h" - #include "utils/filedescriptor.h" -+#include "wayland/clientconnection.h" - #include "wayland/subcompositor.h" - #include "wayland/surface_p.h" - #include "wayland/transaction_p.h" -@@ -76,6 +78,24 @@ bool TransactionDmaBufLocker::arm() - return !m_pending.isEmpty(); - } - -+TransactionEventFdLocker::TransactionEventFdLocker(Transaction *transaction, FileDescriptor &&eventFd, ClientConnection *client) -+ : m_transaction(transaction) -+ , m_client(client) -+ , m_eventFd(std::move(eventFd)) -+ , m_notifier(m_eventFd.get(), QSocketNotifier::Type::Read) -+{ -+ transaction->lock(); -+ connect(&m_notifier, &QSocketNotifier::activated, this, &TransactionEventFdLocker::unlock); -+ // when the client quits, the eventfd may never be signaled -+ connect(m_client, &ClientConnection::aboutToBeDestroyed, this, &TransactionEventFdLocker::unlock); -+} -+ -+void TransactionEventFdLocker::unlock() -+{ -+ m_transaction->unlock(); -+ delete this; -+} -+ - Transaction::Transaction() - { - } -@@ -248,7 +268,12 @@ void Transaction::commit() - for (TransactionEntry &entry : m_entries) { - if (entry.state->bufferIsSet && entry.state->buffer) { - // Avoid applying the transaction until all graphics buffers have become idle. -- if (auto locker = TransactionDmaBufLocker::get(entry.state->buffer)) { -+ if (entry.state->acquirePoint.timeline) { -+ auto eventFd = entry.state->acquirePoint.timeline->eventFd(entry.state->acquirePoint.point); -+ if (entry.surface && eventFd.isValid()) { -+ new TransactionEventFdLocker(this, std::move(eventFd), entry.surface->client()); -+ } -+ } else if (auto locker = TransactionDmaBufLocker::get(entry.state->buffer)) { - locker->add(this); - } - } -diff --git a/src/wayland/transaction_p.h b/src/wayland/transaction_p.h -index 5bcf148aaad..29a9921e81f 100644 ---- a/src/wayland/transaction_p.h -+++ b/src/wayland/transaction_p.h -@@ -33,4 +33,19 @@ private: - std::vector> m_notifiers; - }; - -+class TransactionEventFdLocker : public QObject -+{ -+ Q_OBJECT -+public: -+ TransactionEventFdLocker(Transaction *transaction, FileDescriptor &&eventFd, ClientConnection *client); -+ -+private: -+ void unlock(); -+ -+ Transaction *const m_transaction; -+ const QPointer m_client; -+ const FileDescriptor m_eventFd; -+ QSocketNotifier m_notifier; -+}; -+ - } // namespace KWin -diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp -index 2b02eb2fa69..037b633fc6c 100644 ---- a/src/wayland_server.cpp -+++ b/src/wayland_server.cpp -@@ -41,6 +41,7 @@ - #include "wayland/inputmethod_v1.h" - #include "wayland/keyboard_shortcuts_inhibit_v1.h" - #include "wayland/keystate.h" -+#include "wayland/linux_drm_syncobj_v1.h" - #include "wayland/linuxdmabufv1clientbuffer.h" - #include "wayland/lockscreen_overlay_v1.h" - #include "wayland/output.h" -@@ -811,6 +812,22 @@ QString WaylandServer::socketName() const - return QString(); - } - -+LinuxDrmSyncObjV1Interface *WaylandServer::linuxSyncObj() const -+{ -+ return m_linuxDrmSyncObj; -+} -+ -+void WaylandServer::setRenderBackend(RenderBackend *backend) -+{ -+ if (backend->supportsTimelines()) { -+ if (!m_linuxDrmSyncObj) { -+ m_linuxDrmSyncObj = new LinuxDrmSyncObjV1Interface(m_display, m_display); -+ } -+ } else if (m_linuxDrmSyncObj) { -+ m_linuxDrmSyncObj->remove(); -+ } -+} -+ - #if KWIN_BUILD_SCREENLOCKER - WaylandServer::LockScreenPresentationWatcher::LockScreenPresentationWatcher(WaylandServer *server) - { -diff --git a/src/wayland_server.h b/src/wayland_server.h -index 8eb6f31a176..60dc67d9670 100644 ---- a/src/wayland_server.h -+++ b/src/wayland_server.h -@@ -58,6 +58,8 @@ class XdgSurfaceWindow; - class XdgToplevelWindow; - class PresentationTime; - class XXColorManagerV2; -+class LinuxDrmSyncObjV1Interface; -+class RenderBackend; - - class KWIN_EXPORT WaylandServer : public QObject - { -@@ -226,6 +228,10 @@ public: - return m_xdgActivationIntegration; - } - -+ LinuxDrmSyncObjV1Interface *linuxSyncObj() const; -+ -+ void setRenderBackend(RenderBackend *backend); -+ - Q_SIGNALS: - void windowAdded(KWin::Window *); - void windowRemoved(KWin::Window *); -@@ -284,6 +290,7 @@ private: - TearingControlManagerV1Interface *m_tearingControlInterface = nullptr; - XwaylandShellV1Interface *m_xwaylandShell = nullptr; - PresentationTime *m_presentationTime = nullptr; -+ LinuxDrmSyncObjV1Interface *m_linuxDrmSyncObj = nullptr; - QList m_windows; - InitializationFlags m_initFlags; - QHash m_waylandOutputs; --- -GitLab - - -From 489761e5d772ad11d195c3eb679f6747d1aa2e46 Mon Sep 17 00:00:00 2001 -From: Xaver Hugl -Date: Sat, 6 Apr 2024 18:51:01 +0200 -Subject: [PATCH 2/5] core/syncobjtimeline: make explicit sync use - SYNC_IOC_MERGE instead of waiting on the CPU side - -This brings some performance benefits, because the application can potentially reuse -the buffer earlier, and it simplifies the code a bit - -(cherry picked from commit 4c6000b3e1829da5f0ccb81bbccfee37fb28cd24) ---- - src/core/syncobjtimeline.cpp | 63 +++++++++++++++++++++++++------ - src/core/syncobjtimeline.h | 28 ++++---------- - src/scene/itemrenderer_opengl.cpp | 5 ++- - src/wayland/surface.h | 6 ++- - 4 files changed, 67 insertions(+), 35 deletions(-) - -diff --git a/src/core/syncobjtimeline.cpp b/src/core/syncobjtimeline.cpp -index 3e2c100370a..1152e895722 100644 ---- a/src/core/syncobjtimeline.cpp -+++ b/src/core/syncobjtimeline.cpp -@@ -6,8 +6,24 @@ - #include "syncobjtimeline.h" - - #include -+#include - #include - -+#if defined(Q_OS_LINUX) -+#include -+#else -+struct sync_merge_data -+{ -+ char name[32]; -+ __s32 fd2; -+ __s32 fence; -+ __u32 flags; -+ __u32 pad; -+}; -+#define SYNC_IOC_MAGIC '>' -+#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) -+#endif -+ - namespace KWin - { - -@@ -19,7 +35,39 @@ SyncReleasePoint::SyncReleasePoint(const std::shared_ptr &timeline - - SyncReleasePoint::~SyncReleasePoint() - { -- m_timeline->signal(m_timelinePoint); -+ if (m_releaseFence.isValid()) { -+ m_timeline->moveInto(m_timelinePoint, m_releaseFence); -+ } else { -+ m_timeline->signal(m_timelinePoint); -+ } -+} -+ -+static FileDescriptor mergeSyncFds(const FileDescriptor &fd1, const FileDescriptor &fd2) -+{ -+ struct sync_merge_data data -+ { -+ .name = "merged release fence", -+ .fd2 = fd2.get(), -+ .fence = -1, -+ }; -+ int err = -1; -+ do { -+ err = ioctl(fd1.get(), SYNC_IOC_MERGE, &data); -+ } while (err == -1 && (errno == EINTR || errno == EAGAIN)); -+ if (err < 0) { -+ return FileDescriptor{}; -+ } else { -+ return FileDescriptor(data.fence); -+ } -+} -+ -+void SyncReleasePoint::addReleaseFence(const FileDescriptor &fd) -+{ -+ if (m_releaseFence.isValid()) { -+ m_releaseFence = mergeSyncFds(m_releaseFence, fd); -+ } else { -+ m_releaseFence = fd.duplicate(); -+ } - } - - SyncTimeline *SyncReleasePoint::timeline() const -@@ -67,17 +115,8 @@ void SyncTimeline::signal(uint64_t timelinePoint) - drmSyncobjTimelineSignal(m_drmFd, &m_handle, &timelinePoint, 1); - } - --SyncReleasePointHolder::SyncReleasePointHolder(FileDescriptor &&requirement, std::unordered_set> &&releasePoints) -- : m_fence(std::move(requirement)) -- , m_notifier(m_fence.get(), QSocketNotifier::Type::Read) -- , m_releasePoints(std::move(releasePoints)) --{ -- connect(&m_notifier, &QSocketNotifier::activated, this, &SyncReleasePointHolder::signaled); -- m_notifier.setEnabled(true); --} -- --void SyncReleasePointHolder::signaled() -+void SyncTimeline::moveInto(uint64_t timelinePoint, const FileDescriptor &fd) - { -- delete this; -+ drmSyncobjImportSyncFile(m_drmFd, m_handle, fd.get()); - } - } -diff --git a/src/core/syncobjtimeline.h b/src/core/syncobjtimeline.h -index cffdb75e330..4ced3e06272 100644 ---- a/src/core/syncobjtimeline.h -+++ b/src/core/syncobjtimeline.h -@@ -7,11 +7,8 @@ - #include "kwin_export.h" - #include "utils/filedescriptor.h" - --#include --#include - #include - #include --#include - - namespace KWin - { -@@ -30,9 +27,16 @@ public: - SyncTimeline *timeline() const; - uint64_t timelinePoint() const; - -+ /** -+ * Adds the fence of a graphics job that this release point should wait for -+ * before the timeline point is signaled -+ */ -+ void addReleaseFence(const FileDescriptor &fd); -+ - private: - const std::shared_ptr m_timeline; - const uint64_t m_timelinePoint; -+ FileDescriptor m_releaseFence; - }; - - class KWIN_EXPORT SyncTimeline -@@ -47,26 +51,10 @@ public: - FileDescriptor eventFd(uint64_t timelinePoint) const; - - void signal(uint64_t timelinePoint); -+ void moveInto(uint64_t timelinePoint, const FileDescriptor &fd); - - private: - const int32_t m_drmFd; - const uint32_t m_handle; - }; -- --class SyncReleasePointHolder : public QObject --{ -- Q_OBJECT --public: -- /** -- * @param requirement the filedescriptor that needs to be readable before the release points may be signalled. Once that's happened, this object deletes itself!' -- */ -- explicit SyncReleasePointHolder(FileDescriptor &&requirement, std::unordered_set> &&releasePoints); -- --private: -- void signaled(); -- -- const FileDescriptor m_fence; -- QSocketNotifier m_notifier; -- const std::unordered_set> m_releasePoints; --}; - } -diff --git a/src/scene/itemrenderer_opengl.cpp b/src/scene/itemrenderer_opengl.cpp -index 3fee3863f2c..ffcc6de3914 100644 ---- a/src/scene/itemrenderer_opengl.cpp -+++ b/src/scene/itemrenderer_opengl.cpp -@@ -53,7 +53,10 @@ void ItemRendererOpenGL::endFrame() - if (m_eglDisplay) { - EGLNativeFence fence(m_eglDisplay); - if (fence.isValid()) { -- new SyncReleasePointHolder(std::move(fence.fileDescriptor()), std::move(m_releasePoints)); -+ for (const auto &releasePoint : m_releasePoints) { -+ releasePoint->addReleaseFence(fence.fileDescriptor()); -+ } -+ m_releasePoints.clear(); - } - } - m_releasePoints.clear(); -diff --git a/src/wayland/surface.h b/src/wayland/surface.h -index 80d1fa55708..152f1accc10 100644 ---- a/src/wayland/surface.h -+++ b/src/wayland/surface.h -@@ -344,8 +344,10 @@ public: - void setPreferredColorDescription(const ColorDescription &descr); - - /** -- * @returns the release point that should be referenced as long as the buffer on this surface -- * is, or may still be used by the compositor -+ * Returns the current release point for the buffer on this surface. The buffer keeps the -+ * release point referenced as long as it's referenced itself; for synchronization on the -+ * GPU side, the compositor has to either keep the release point referenced as long as the -+ * GPU task is running, or add a fence for each GPU task to the release point - */ - std::shared_ptr bufferReleasePoint() const; - --- -GitLab - - -From eef4cbe0278e81c33b496932400854a74a08bfa4 Mon Sep 17 00:00:00 2001 -From: Xaver Hugl -Date: Tue, 16 Apr 2024 13:51:42 +0200 -Subject: [PATCH 3/5] wayland_server: guard against DRM_IOCTL_SYNCOBJ_EVENTFD - being broken - -...either because it's not implemented, or because it's buggy. - -(cherry picked from commit 26afbfb6fa030c3dadf6a22309686f96ca033f59) ---- - src/wayland_server.cpp | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp -index 037b633fc6c..d9240f0e8ce 100644 ---- a/src/wayland_server.cpp -+++ b/src/wayland_server.cpp -@@ -19,6 +19,7 @@ - #include "layershellv1window.h" - #include "main.h" - #include "options.h" -+#include "utils/kernel.h" - #include "utils/serviceutils.h" - #include "virtualdesktops.h" - #include "wayland/appmenu.h" -@@ -820,6 +821,15 @@ LinuxDrmSyncObjV1Interface *WaylandServer::linuxSyncObj() const - void WaylandServer::setRenderBackend(RenderBackend *backend) - { - if (backend->supportsTimelines()) { -+ // ensure the DRM_IOCTL_SYNCOBJ_EVENTFD ioctl is supported -+ const auto linuxVersion = linuxKernelVersion(); -+ if (linuxVersion.majorVersion() < 6 && linuxVersion.minorVersion() < 6) { -+ return; -+ } -+ // also ensure the implementation isn't totally broken, see https://lists.freedesktop.org/archives/dri-devel/2024-January/439101.html -+ if (linuxVersion.majorVersion() == 6 && (linuxVersion.minorVersion() == 7 || (linuxVersion.minorVersion() == 6 && linuxVersion.patchVersion() < 19))) { -+ return; -+ } - if (!m_linuxDrmSyncObj) { - m_linuxDrmSyncObj = new LinuxDrmSyncObjV1Interface(m_display, m_display); - } --- -GitLab - - -From 2e9ecb0edf137309fb526adc7c8504e8c669b17f Mon Sep 17 00:00:00 2001 -From: Erik Kurzinger -Date: Tue, 16 Apr 2024 14:44:50 -0700 -Subject: [PATCH 4/5] core/syncobjtimeline: import release fence at correct - timeline point - -SyncTimeline::moveInto imports the provided fence to the syncobj by -calling drmSyncobjImportSyncFile. However, that function assumes the -syncobj a binary syncobj, meaning the fence will be imported at timeline -point 0, not at the intended timeline point. - -Since there is no timeline equivalent of drmSyncobjImportSyncFile, to -achieve the correct behavior we create a temporary binary syncobj, -import the fence into that, and then use drmSyncobjTransfer to transfer -the fence to the desired timeline point on the destination syncobj. - -Signed-off-by: Erik Kurzinger -(cherry picked from commit 9ca7b9b1cf292e790223419dc197737f875109d4) ---- - src/core/syncobjtimeline.cpp | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/core/syncobjtimeline.cpp b/src/core/syncobjtimeline.cpp -index 1152e895722..80054e93480 100644 ---- a/src/core/syncobjtimeline.cpp -+++ b/src/core/syncobjtimeline.cpp -@@ -117,6 +117,10 @@ void SyncTimeline::signal(uint64_t timelinePoint) - - void SyncTimeline::moveInto(uint64_t timelinePoint, const FileDescriptor &fd) - { -- drmSyncobjImportSyncFile(m_drmFd, m_handle, fd.get()); -+ uint32_t tempHandle = 0; -+ drmSyncobjCreate(m_drmFd, 0, &tempHandle); -+ drmSyncobjImportSyncFile(m_drmFd, tempHandle, fd.get()); -+ drmSyncobjTransfer(m_drmFd, m_handle, timelinePoint, tempHandle, 0, 0); -+ drmSyncobjDestroy(m_drmFd, tempHandle); - } - } --- -GitLab - - -From 463ae633e878004b1799f618641a0c44573c10f4 Mon Sep 17 00:00:00 2001 -From: Xaver Hugl -Date: Wed, 17 Apr 2024 03:26:34 +0200 -Subject: [PATCH 5/5] wayland/surface: fix the change signal for release points - not being emitted - -(cherry picked from commit eed7943939524895225ab4cf4eb3a1fa880b42bf) ---- - src/wayland/surface.cpp | 2 +- - src/wayland/surface_p.h | 1 - - 2 files changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/wayland/surface.cpp b/src/wayland/surface.cpp -index 6a33c5fca10..6a77e98d0ee 100644 ---- a/src/wayland/surface.cpp -+++ b/src/wayland/surface.cpp -@@ -608,7 +608,7 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next) - const bool visibilityChanged = bufferChanged && bool(current->buffer) != bool(next->buffer); - const bool colorDescriptionChanged = next->colorDescriptionIsSet; - const bool presentationModeHintChanged = next->presentationModeHintIsSet; -- const bool bufferReleasePointChanged = next->releasePointIsSet; -+ const bool bufferReleasePointChanged = next->bufferIsSet && current->releasePoint != next->releasePoint; - - const QSizeF oldSurfaceSize = surfaceSize; - const QSize oldBufferSize = bufferSize; -diff --git a/src/wayland/surface_p.h b/src/wayland/surface_p.h -index 775f9d7bd2e..7bcf95c0bef 100644 ---- a/src/wayland/surface_p.h -+++ b/src/wayland/surface_p.h -@@ -59,7 +59,6 @@ struct SurfaceState - bool contentTypeIsSet = false; - bool presentationModeHintIsSet = false; - bool colorDescriptionIsSet = false; -- bool releasePointIsSet = false; - qint32 bufferScale = 1; - OutputTransform bufferTransform = OutputTransform::Normal; - wl_list frameCallbacks; --- -GitLab - diff --git a/overlays/kwin/default.nix b/overlays/kwin/default.nix deleted file mode 100644 index d766a6e..0000000 --- a/overlays/kwin/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -self: super: { - kdePackages = super.kdePackages.overrideScope (kde-self: kde-super: rec { - kwin = kde-super.kwin.overrideAttrs (oldAttrs: rec { - patches = oldAttrs.patches ++ [ - ./5511.patch # https://invent.kde.org/plasma/kwin/-/merge_requests/5511 - ]; - }); - }); -} \ No newline at end of file From 98040c5e7139b0a79a095bfa69cd15b5d547ab84 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 31 May 2024 13:46:47 +0200 Subject: [PATCH 07/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index c2a6801..e3af9d1 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1716930911, - "narHash": "sha256-t4HT5j3Jy7skRB5PINnxcEBCkgE89rGBpwTI7YS4Ffo=", + "lastModified": 1717097707, + "narHash": "sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs=", "owner": "nix-community", "repo": "home-manager", - "rev": "a9b36cbe9292a649222b89fdb9ae9907e9c74086", + "rev": "0eb314b4f0ba337e88123e0b1e57ef58346aafd9", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716769173, - "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", "type": "github" }, "original": { From db5ca96ada358df771c39869b557a695dfca9ef9 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 3 Jun 2024 09:09:10 +0200 Subject: [PATCH 08/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index e3af9d1..4e250bd 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1717097707, - "narHash": "sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs=", + "lastModified": 1717316182, + "narHash": "sha256-Xi0EpZcu39N0eW7apLjFfUOR9y80toyjYizez7J1wMI=", "owner": "nix-community", "repo": "home-manager", - "rev": "0eb314b4f0ba337e88123e0b1e57ef58346aafd9", + "rev": "9b53a10f4c91892f5af87cf55d08fba59ca086af", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716948383, - "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", + "lastModified": 1717196966, + "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", + "rev": "57610d2f8f0937f39dbd72251e9614b1561942d8", "type": "github" }, "original": { From 1829515dd34dcc467ca30ed2d622aa882bb4df1f Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 3 Jun 2024 09:39:04 +0200 Subject: [PATCH 09/76] pto-laptop: Remove ollama + Set nvidia to prime sync --- hosts/pro-laptop/configuration.nix | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 72cabc3..3c3da56 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -20,10 +20,7 @@ networking.hostName = "nixos-laptop-pro"; # Define your hostname. hardware.nvidia.prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; + sync.enable = true; # Make sure to use the correct Bus ID values for your system! # information bus: pci@0000:00:02.0 @@ -47,9 +44,5 @@ printing.enable = true; waydroid.enable = true; }; - - server = { - ollama.enable = true; - }; }; } From 21e26daea325f35caf697a72887a135620c2d900 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 3 Jun 2024 12:45:16 +0200 Subject: [PATCH 10/76] pro-laptop: Remove iGPU (Very slow) --- hosts/pro-laptop/configuration.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 3c3da56..d07179a 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -19,16 +19,6 @@ networking.hostName = "nixos-laptop-pro"; # Define your hostname. - hardware.nvidia.prime = { - sync.enable = true; - - # Make sure to use the correct Bus ID values for your system! - # information bus: pci@0000:00:02.0 - intelBusId = "PCI:0:2:0"; - # information bus: pci@0000:01:00.0 - nvidiaBusId = "PCI:1:0:0"; - }; - modules.system = { desktop = { plasma.enable = true; From 5a52a2734d089c5dc1b2325ba09525556c0753be Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 3 Jun 2024 20:32:09 +0200 Subject: [PATCH 11/76] perso-desktop: Remove ollama --- hosts/perso-desktop/configuration.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index ccbfaf8..43e5e9a 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -34,9 +34,5 @@ printing.enable = true; waydroid.enable = true; }; - - server = { - ollama.enable = true; - }; }; } From 819cd005c720f330542649858f52b245be4653ab Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 4 Jun 2024 21:14:48 +0200 Subject: [PATCH 12/76] perso-desktop: Enable ollama --- hosts/perso-desktop/configuration.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index 43e5e9a..ccbfaf8 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -34,5 +34,9 @@ printing.enable = true; waydroid.enable = true; }; + + server = { + ollama.enable = true; + }; }; } From 8e722cfe5a86d75552f1bec8d7c4a88929c90a82 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 4 Jun 2024 21:59:55 +0200 Subject: [PATCH 13/76] modules: Move vscode to flatpak --- .gitignore | 3 +- hosts/nixos-test/home.nix | 4 --- hosts/perso-desktop/home.nix | 4 --- hosts/perso-laptop/home.nix | 4 --- hosts/pro-laptop/home.nix | 4 --- modules/home/apps/flatpak/default.nix | 1 + modules/home/default.nix | 1 - modules/home/editors/default.nix | 7 ---- modules/home/editors/vscode/default.nix | 47 ------------------------- 9 files changed, 3 insertions(+), 72 deletions(-) delete mode 100644 modules/home/editors/default.nix delete mode 100644 modules/home/editors/vscode/default.nix diff --git a/.gitignore b/.gitignore index abd4567..ab8439a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ result *.swp -*.qcow2 \ No newline at end of file +*.qcow2 +.idea/ \ No newline at end of file diff --git a/hosts/nixos-test/home.nix b/hosts/nixos-test/home.nix index 0aafc57..6dcf755 100644 --- a/hosts/nixos-test/home.nix +++ b/hosts/nixos-test/home.nix @@ -13,10 +13,6 @@ kitty.enable = true; }; - editors = { - vscode.enable = true; - }; - shell = { zsh.enable = true; atuin.enable = true; diff --git a/hosts/perso-desktop/home.nix b/hosts/perso-desktop/home.nix index 0aafc57..6dcf755 100644 --- a/hosts/perso-desktop/home.nix +++ b/hosts/perso-desktop/home.nix @@ -13,10 +13,6 @@ kitty.enable = true; }; - editors = { - vscode.enable = true; - }; - shell = { zsh.enable = true; atuin.enable = true; diff --git a/hosts/perso-laptop/home.nix b/hosts/perso-laptop/home.nix index 0aafc57..6dcf755 100644 --- a/hosts/perso-laptop/home.nix +++ b/hosts/perso-laptop/home.nix @@ -13,10 +13,6 @@ kitty.enable = true; }; - editors = { - vscode.enable = true; - }; - shell = { zsh.enable = true; atuin.enable = true; diff --git a/hosts/pro-laptop/home.nix b/hosts/pro-laptop/home.nix index 0aafc57..6dcf755 100644 --- a/hosts/pro-laptop/home.nix +++ b/hosts/pro-laptop/home.nix @@ -13,10 +13,6 @@ kitty.enable = true; }; - editors = { - vscode.enable = true; - }; - shell = { zsh.enable = true; atuin.enable = true; diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index 052f6b0..7084ec5 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -30,6 +30,7 @@ in { appId = "org.mozilla.Thunderbird"; origin = "flathub"; } { appId = "ch.protonmail.protonmail-bridge"; origin = "flathub"; } { appId = "org.kde.neochat"; origin = "flathub"; } + { appId = "com.visualstudio.code"; origin = "flathub"; } # Loisir { appId = "com.spotify.Client"; origin = "flathub"; } diff --git a/modules/home/default.nix b/modules/home/default.nix index 6d528ce..92279a8 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -3,7 +3,6 @@ { imports = [ ./apps - ./editors ./desktop ./shell ]; diff --git a/modules/home/editors/default.nix b/modules/home/editors/default.nix deleted file mode 100644 index 40db812..0000000 --- a/modules/home/editors/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./vscode - ]; -} \ No newline at end of file diff --git a/modules/home/editors/vscode/default.nix b/modules/home/editors/vscode/default.nix deleted file mode 100644 index 13ed250..0000000 --- a/modules/home/editors/vscode/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; -let - cfg = config.modules.home.editors.vscode; -in -{ - options.modules.home.editors.vscode = { - enable = mkEnableOption '' - Enable vscode with my custom configurations - ''; - }; - config = mkIf cfg.enable { - programs.vscode = { - enable = true; - enableUpdateCheck = false; - enableExtensionUpdateCheck = false; - - userSettings = { - "files.autoSave" = "onFocusChange"; - "emmet.includeLanguages" = { - "phoenix-heex" = "html"; - }; - "git.autofetch" = true; - }; - - userTasks = {}; - - extensions = with pkgs; with vscode-extensions; [ - # Nix - bbenoist.nix - - # Rust - rust-lang.rust-analyzer - serayuzgur.crates - tamasfe.even-better-toml - - # Phoenix - phoenixframework.phoenix - elixir-lsp.vscode-elixir-ls - - # Ruby - shopify.ruby-lsp - ]; - }; - }; -} \ No newline at end of file From 65ce70cda9b987fd96ca3a49e0fc178c7dc51448 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 5 Jun 2024 08:58:04 +0200 Subject: [PATCH 14/76] pro-laptop: Add ollama --- hosts/pro-laptop/configuration.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index d07179a..1df2249 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -34,5 +34,9 @@ printing.enable = true; waydroid.enable = true; }; + + server = { + ollama.enable = true; + }; }; } From 63a9058e30494b8c65e4ba468e672c086c2595fd Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 6 Jun 2024 19:32:39 +0200 Subject: [PATCH 15/76] perso-laptop: Add ollama --- hosts/perso-laptop/configuration.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/perso-laptop/configuration.nix b/hosts/perso-laptop/configuration.nix index 37c845a..0a25108 100644 --- a/hosts/perso-laptop/configuration.nix +++ b/hosts/perso-laptop/configuration.nix @@ -47,5 +47,9 @@ printing.enable = true; waydroid.enable = true; }; + + server = { + ollama.enable = true; + }; }; } From de6d981cf0708b0e32e5bad52c2163ab23a948da Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 6 Jun 2024 19:35:57 +0200 Subject: [PATCH 16/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 4e250bd..1be26d5 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1717316182, - "narHash": "sha256-Xi0EpZcu39N0eW7apLjFfUOR9y80toyjYizez7J1wMI=", + "lastModified": 1717525419, + "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", "owner": "nix-community", "repo": "home-manager", - "rev": "9b53a10f4c91892f5af87cf55d08fba59ca086af", + "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717196966, - "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", + "lastModified": 1717602782, + "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "57610d2f8f0937f39dbd72251e9614b1561942d8", + "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", "type": "github" }, "original": { From 00cbba8b0add4056d5684cfbc826baf1b7d970a0 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 7 Jun 2024 19:37:01 +0200 Subject: [PATCH 17/76] Add fwupd and aha --- modules/system/common.nix | 2 ++ modules/system/desktop/plasma/default.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/modules/system/common.nix b/modules/system/common.nix index 43cc570..a7550df 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -28,6 +28,8 @@ nixd ]; + systemd.packages = with pkgs; [ fwupd ]; + # Define a user account. Don't forget to set a password with ‘passwd’. users.users.florian = { isNormalUser = true; diff --git a/modules/system/desktop/plasma/default.nix b/modules/system/desktop/plasma/default.nix index 521f98d..77c3ec9 100644 --- a/modules/system/desktop/plasma/default.nix +++ b/modules/system/desktop/plasma/default.nix @@ -32,6 +32,7 @@ in wayland-utils # For wayland-info command glxinfo clinfo + aha ]; }; } From 0367ebecae5c84bcfe19d32bb6210767c0e94dbb Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 7 Jun 2024 19:40:54 +0200 Subject: [PATCH 18/76] Fix fwupd --- modules/system/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/common.nix b/modules/system/common.nix index a7550df..92a26aa 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -28,7 +28,7 @@ nixd ]; - systemd.packages = with pkgs; [ fwupd ]; + services.fwupd.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.florian = { From 6c93b657c5ee039d968f89f7578aaa63fb7e53bc Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 7 Jun 2024 19:53:53 +0200 Subject: [PATCH 19/76] Add usbutils and pciutils --- modules/system/common.nix | 9 +++++++++ modules/system/desktop/plasma/default.nix | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/system/common.nix b/modules/system/common.nix index 92a26aa..967e327 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -26,6 +26,15 @@ environment.systemPackages = with pkgs; [ vim nixd + + # Usefull for automatic informations collect software like KDE + vulkan-tools # For vulkaninfo command + wayland-utils # For wayland-info command + glxinfo + clinfo + aha + usbutils + pciutils ]; services.fwupd.enable = true; diff --git a/modules/system/desktop/plasma/default.nix b/modules/system/desktop/plasma/default.nix index 77c3ec9..261b54f 100644 --- a/modules/system/desktop/plasma/default.nix +++ b/modules/system/desktop/plasma/default.nix @@ -26,13 +26,6 @@ in environment.systemPackages = with pkgs; with kdePackages; [ krfb # Use by kdeconnect for virtualmonitorplugin "krfb-virtualmonitor" discover - - # Usefull for automatic informations collect software like KDE - vulkan-tools # For vulkaninfo command - wayland-utils # For wayland-info command - glxinfo - clinfo - aha ]; }; } From 242fc839cda41b1be124e3c6d379c1ed4fbfd1a5 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 9 Jun 2024 13:08:43 +0200 Subject: [PATCH 20/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 1be26d5..5087451 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1717525419, - "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", + "lastModified": 1717734000, + "narHash": "sha256-ZEdZiPaFgrBi+Wb0aQ5nEix6fnjZHRcw/NGDf2WvvOQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", + "rev": "8f1b183c91c65c81131bbf7d76f0d845580c60bd", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717602782, - "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", + "lastModified": 1717786204, + "narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", + "rev": "051f920625ab5aabe37c920346e3e69d7d34400e", "type": "github" }, "original": { From 4fa1f87caae8865d2343f752565b54bbc81d0382 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 11 Jun 2024 18:34:20 +0200 Subject: [PATCH 21/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 5087451..c13159b 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1717734000, - "narHash": "sha256-ZEdZiPaFgrBi+Wb0aQ5nEix6fnjZHRcw/NGDf2WvvOQ=", + "lastModified": 1717931644, + "narHash": "sha256-Sz8Wh9cAiD5FhL8UWvZxBfnvxETSCVZlqWSYWaCPyu0=", "owner": "nix-community", "repo": "home-manager", - "rev": "8f1b183c91c65c81131bbf7d76f0d845580c60bd", + "rev": "3d65009effd77cb0d6e7520b68b039836a7606cf", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717786204, - "narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", + "lastModified": 1717974879, + "narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "051f920625ab5aabe37c920346e3e69d7d34400e", + "rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3", "type": "github" }, "original": { From ed8665fa49c5be69eda8bd359bf2ddbc13b659bb Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 13 Jun 2024 09:10:15 +0200 Subject: [PATCH 22/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index c13159b..7f6dff9 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1717931644, - "narHash": "sha256-Sz8Wh9cAiD5FhL8UWvZxBfnvxETSCVZlqWSYWaCPyu0=", + "lastModified": 1718243258, + "narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=", "owner": "nix-community", "repo": "home-manager", - "rev": "3d65009effd77cb0d6e7520b68b039836a7606cf", + "rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717974879, - "narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=", + "lastModified": 1718160348, + "narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3", + "rev": "57d6973abba7ea108bac64ae7629e7431e0199b6", "type": "github" }, "original": { From 3ef6e6e3816ea43feae245cf36791088f8c83d81 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 13 Jun 2024 19:42:52 +0200 Subject: [PATCH 23/76] git: Add required configuration for kdesrc-build --- modules/home/shell/git/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/home/shell/git/default.nix b/modules/home/shell/git/default.nix index ad50961..b73308f 100644 --- a/modules/home/shell/git/default.nix +++ b/modules/home/shell/git/default.nix @@ -17,6 +17,11 @@ in userEmail = "florian.richer@protonmail.com"; # signing.signByDefault = true; + + extraConfig = { + url."https://invent.kde.org/".insteadOf = "kde:"; + url."ssh://git@invent.kde.org/".pushInsteadOf = "kde:"; + }; }; }; -} \ No newline at end of file +} From 361ecd917efd3129e46ca72ea5c04872a93f0b66 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 14 Jun 2024 22:27:06 +0200 Subject: [PATCH 24/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 7f6dff9..dfbc400 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1716561646, - "narHash": "sha256-UIGtLO89RxKt7RF2iEgPikSdU53r6v/6WYB0RW3k89I=", + "lastModified": 1718371084, + "narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=", "owner": "ryantm", "repo": "agenix", - "rev": "c2fc0762bbe8feb06a2e59a364fa81b3a57671c9", + "rev": "3a56735779db467538fb2e577eda28a9daacaca6", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718160348, - "narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=", + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "57d6973abba7ea108bac64ae7629e7431e0199b6", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", "type": "github" }, "original": { From 34cbb44cc10bfdc7959e751abda665f985b80895 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 18 Jun 2024 19:44:19 +0200 Subject: [PATCH 25/76] Add distrobox --- hosts/perso-desktop/configuration.nix | 1 + modules/system/server/default.nix | 1 + modules/system/server/distrobox/default.nix | 17 +++++++++++++++++ modules/system/server/docker/default.nix | 2 ++ 4 files changed, 21 insertions(+) create mode 100644 modules/system/server/distrobox/default.nix diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index ccbfaf8..3cddb29 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -37,6 +37,7 @@ server = { ollama.enable = true; + distrobox.enable = true; }; }; } diff --git a/modules/system/server/default.nix b/modules/system/server/default.nix index 84c8c31..7533a63 100644 --- a/modules/system/server/default.nix +++ b/modules/system/server/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./distrobox ./docker ./ollama ./openssh diff --git a/modules/system/server/distrobox/default.nix b/modules/system/server/distrobox/default.nix new file mode 100644 index 0000000..fec6131 --- /dev/null +++ b/modules/system/server/distrobox/default.nix @@ -0,0 +1,17 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.system.server.distrobox; +in +{ + options.modules.system.server.distrobox = { + enable = mkEnableOption '' + Enable distrobox with my custom configurations + ''; + }; + config = mkIf cfg.enable { + modules.system.server.docker.enable = true; + environment.systemPackages = with pkgs; [ distrobox ]; + }; +} \ No newline at end of file diff --git a/modules/system/server/docker/default.nix b/modules/system/server/docker/default.nix index 39c121a..317777b 100644 --- a/modules/system/server/docker/default.nix +++ b/modules/system/server/docker/default.nix @@ -15,5 +15,7 @@ in enable = true; enableNvidia = config.modules.system.hardware.nvidia.enable; }; + + users.users.florian.extraGroups = [ "docker" ]; }; } \ No newline at end of file From 624ed44bbaa68fd3a38e59d5f64d582b29eef49c Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 18 Jun 2024 23:32:47 +0200 Subject: [PATCH 26/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index dfbc400..0114ad0 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1718243258, - "narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=", + "lastModified": 1718744742, + "narHash": "sha256-kOG10gJ3zLZNiom9NXJM4/mA4/lsmR3rp74YVw+iros=", "owner": "nix-community", "repo": "home-manager", - "rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3", + "rev": "0dd1c1495af6e6424695670343236f0053bf4947", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718318537, - "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", + "lastModified": 1718530797, + "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", + "rev": "b60ebf54c15553b393d144357375ea956f89e9a9", "type": "github" }, "original": { From 80e84d19acb4119807e7be36bea10f6a707c3928 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 20 Jun 2024 09:02:32 +0200 Subject: [PATCH 27/76] pro-laptop: Add distrobox --- hosts/pro-laptop/configuration.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 1df2249..14ec850 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -37,6 +37,7 @@ server = { ollama.enable = true; + distrobox.enable = true; }; }; } From 9f21445d76486cfb61629517dfa5f11783bba043 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 20 Jun 2024 09:03:26 +0200 Subject: [PATCH 28/76] Update OS --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 0114ad0..39d4c6f 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1718744742, - "narHash": "sha256-kOG10gJ3zLZNiom9NXJM4/mA4/lsmR3rp74YVw+iros=", + "lastModified": 1718788307, + "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", "owner": "nix-community", "repo": "home-manager", - "rev": "0dd1c1495af6e6424695670343236f0053bf4947", + "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", "type": "github" }, "original": { From 6444f1842e7ca405e20d40623fcfa2f077efdb1a Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 20 Jun 2024 15:57:56 +0200 Subject: [PATCH 29/76] Update OS --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 39d4c6f..fbed266 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718530797, - "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=", + "lastModified": 1718714799, + "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b60ebf54c15553b393d144357375ea956f89e9a9", + "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", "type": "github" }, "original": { From 064530792a6362f893a7da6bbf0838aa99fad8bd Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 21 Jun 2024 21:36:18 +0200 Subject: [PATCH 30/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index fbed266..1226041 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1718788307, - "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", + "lastModified": 1718983978, + "narHash": "sha256-lp6stESwTLBZUQ5GBivxwNehShmBp4jqeX/1xahM61w=", "owner": "nix-community", "repo": "home-manager", - "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", + "rev": "c559542f0aa87971a7f4c1b3478fe33cc904b902", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718714799, - "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", + "lastModified": 1718895438, + "narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", + "rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", "type": "github" }, "original": { From 31c5516a9f52e5efd96f85281f228069038219d8 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 21 Jun 2024 21:59:22 +0200 Subject: [PATCH 31/76] Update OS: Fix hardware.opengl -> hardware.graphics migration --- modules/system/hardware/nvidia/default.nix | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index fa6625a..08d8191 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -11,41 +11,41 @@ in ''; }; config = mkIf cfg.enable { - # Enable OpenGL - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - # Load nvidia driver for Xorg and Wayland services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; + hardware = { + graphics = { + enable = true; + enable32Bit = true; + }; - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = false; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; + nvidia = { + # Modesetting is required. + modesetting.enable = true; - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + powerManagement.enable = false; + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.beta; + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.beta; + }; }; }; -} \ No newline at end of file +} From 73f00bcc14ad761a71a3dcd5825c3b7fb0a69c48 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 23 Jun 2024 12:22:47 +0200 Subject: [PATCH 32/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 1226041..18a6a19 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1718983978, - "narHash": "sha256-lp6stESwTLBZUQ5GBivxwNehShmBp4jqeX/1xahM61w=", + "lastModified": 1719037157, + "narHash": "sha256-aOKd8+mhBsLQChCu1mn/W5ww79ta5cXVE59aJFrifM8=", "owner": "nix-community", "repo": "home-manager", - "rev": "c559542f0aa87971a7f4c1b3478fe33cc904b902", + "rev": "cd886711998fe5d9ff7979fdd4b4cbd17b1f1511", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718895438, - "narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", + "lastModified": 1719075281, + "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", + "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", "type": "github" }, "original": { From 468bd046ee39df64cd62c4ec42523b3fffd619d1 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 24 Jun 2024 10:34:22 +0200 Subject: [PATCH 33/76] Add git lfs --- modules/home/shell/git/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/home/shell/git/default.nix b/modules/home/shell/git/default.nix index b73308f..85ecc0a 100644 --- a/modules/home/shell/git/default.nix +++ b/modules/home/shell/git/default.nix @@ -13,6 +13,8 @@ in config = mkIf cfg.enable { programs.git = { enable = true; + lfs.enable = true; + userName = "Florian RICHER"; userEmail = "florian.richer@protonmail.com"; From bf45f5ebe34449e48531cc5bda90c8c23f50a4d2 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 25 Jun 2024 20:07:01 +0200 Subject: [PATCH 34/76] Update home-manager + add Firefox --- flake.lock | 24 ++++++++++++--- flake.nix | 3 ++ hosts/perso-desktop/home.nix | 1 + modules/home/apps/default.nix | 3 +- modules/home/apps/firefox/default.nix | 44 +++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 modules/home/apps/firefox/default.nix diff --git a/flake.lock b/flake.lock index 18a6a19..06bcabc 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1719037157, - "narHash": "sha256-aOKd8+mhBsLQChCu1mn/W5ww79ta5cXVE59aJFrifM8=", + "lastModified": 1719180626, + "narHash": "sha256-vZAzm5KQpR6RGple1dzmSJw5kPivES2heCFM+ZWkt0I=", "owner": "nix-community", "repo": "home-manager", - "rev": "cd886711998fe5d9ff7979fdd4b4cbd17b1f1511", + "rev": "6b1f90a8ff92e81638ae6eb48cd62349c3e387bb", "type": "github" }, "original": { @@ -99,12 +99,28 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1719335339, + "narHash": "sha256-YxXZckTrfSfvUlF7sFVonFyJ5CqlWQkjuhA+/2+na9Q=", + "owner": "nix-community", + "repo": "NUR", + "rev": "c019a0ab8a21c5e84a440f34ef43947a0c9ebc34", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "home-manager": "home-manager", "nix-flatpak": "nix-flatpak", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nur": "nur" } }, "systems": { diff --git a/flake.nix b/flake.nix index 8eb11a3..e69bb9e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nur.url = github:nix-community/NUR; home-manager = { url = "github:nix-community/home-manager"; @@ -20,6 +21,7 @@ outputs = inputs@{ nixpkgs, + nur, home-manager, agenix, nix-flatpak, @@ -41,6 +43,7 @@ ./hosts/${s.name}/configuration.nix home-manager.nixosModules.home-manager agenix.nixosModules.default + { nixpkgs.overlays = [ nur.overlay ]; } { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/hosts/perso-desktop/home.nix b/hosts/perso-desktop/home.nix index 6dcf755..48642dc 100644 --- a/hosts/perso-desktop/home.nix +++ b/hosts/perso-desktop/home.nix @@ -8,6 +8,7 @@ modules.home = { apps = { chromium.enable = true; + firefox.enable = true; flatpak.enable = true; jetbrainsToolbox.enable = true; kitty.enable = true; diff --git a/modules/home/apps/default.nix b/modules/home/apps/default.nix index 888257b..981aa5c 100644 --- a/modules/home/apps/default.nix +++ b/modules/home/apps/default.nix @@ -3,8 +3,9 @@ { imports = [ ./chromium + ./firefox ./flatpak ./jetbrainsToolbox ./kitty ]; -} \ No newline at end of file +} diff --git a/modules/home/apps/firefox/default.nix b/modules/home/apps/firefox/default.nix new file mode 100644 index 0000000..4ea8d76 --- /dev/null +++ b/modules/home/apps/firefox/default.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.home.apps.firefox; +in +{ + options.modules.home.apps.firefox = { + enable = mkEnableOption '' + Enable firefox with my custom configurations + ''; + }; + config = mkIf cfg.enable { + programs.firefox = { + enable = true; + + nativeMessagingHosts = [ + pkgs.kdePackages.plasma-browser-integration + ]; + + profiles = { + perso = { + id = 0; + + name = "Perso"; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + bitwarden + floccus + plasma-integration + istilldontcareaboutcookies + darkreader + ]; + + settings = { + # Enable multi-pip + "media.videocontrols.picture-in-picture.allow-multiple" = true; + }; + }; + }; + }; + }; +} From 65be421f5326b2ca7073622fb3d9ec3297731df6 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 27 Jun 2024 13:31:38 +0200 Subject: [PATCH 35/76] pro-laptop: Add iGPU (Test triple-buffering on plasma 6.1) --- hosts/pro-laptop/configuration.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 14ec850..1aa1333 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -19,6 +19,19 @@ networking.hostName = "nixos-laptop-pro"; # Define your hostname. + hardware.nvidia.prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + + # Make sure to use the correct Bus ID values for your system! + # information bus: pci@0000:00:02.0 + intelBusId = "PCI:0:2:0"; + # information bus: pci@0000:01:00.0 + nvidiaBusId = "PCI:1:0:0"; + }; + modules.system = { desktop = { plasma.enable = true; From c2c04710975579052d8b5828814fcef1d2126ed5 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 29 Jun 2024 10:39:32 +0200 Subject: [PATCH 36/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 06bcabc..2f91c21 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1719180626, - "narHash": "sha256-vZAzm5KQpR6RGple1dzmSJw5kPivES2heCFM+ZWkt0I=", + "lastModified": 1719588253, + "narHash": "sha256-A03i8xiVgP14DCmV5P7VUv37eodCjY4e1iai0b2EuuM=", "owner": "nix-community", "repo": "home-manager", - "rev": "6b1f90a8ff92e81638ae6eb48cd62349c3e387bb", + "rev": "7e68e55d2e16d3a1e92a679430728c35a30fd24e", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719075281, - "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "lastModified": 1719254875, + "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1719335339, - "narHash": "sha256-YxXZckTrfSfvUlF7sFVonFyJ5CqlWQkjuhA+/2+na9Q=", + "lastModified": 1719645428, + "narHash": "sha256-DnSiED9cFDF+E2uekxXz5dSXOvb3IbVc0Kv8hixi9QE=", "owner": "nix-community", "repo": "NUR", - "rev": "c019a0ab8a21c5e84a440f34ef43947a0c9ebc34", + "rev": "0fb65e070b581604c93d21b74c6cd2f7fcc25bac", "type": "github" }, "original": { From e493646556d704954b1b374d46477e203c103758 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 29 Jun 2024 11:05:38 +0200 Subject: [PATCH 37/76] Update OS --- flake.lock | 12 ++++++------ modules/system/server/ollama/default.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 2f91c21..8eb5b56 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719254875, - "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", + "lastModified": 1719506693, + "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", + "rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1719645428, - "narHash": "sha256-DnSiED9cFDF+E2uekxXz5dSXOvb3IbVc0Kv8hixi9QE=", + "lastModified": 1719650693, + "narHash": "sha256-tVpBKJulLhCSljt6ys6SLN7GgAyHstN4S+xlnuL8ioI=", "owner": "nix-community", "repo": "NUR", - "rev": "0fb65e070b581604c93d21b74c6cd2f7fcc25bac", + "rev": "d31c65feeea1e5312741db8e78f68e994fef63c1", "type": "github" }, "original": { diff --git a/modules/system/server/ollama/default.nix b/modules/system/server/ollama/default.nix index 469fb96..79e1a6c 100644 --- a/modules/system/server/ollama/default.nix +++ b/modules/system/server/ollama/default.nix @@ -18,4 +18,4 @@ in acceleration = if nvidiaEnabled then "cuda" else null; }; }; -} \ No newline at end of file +} From 4e8b840830ee5ef2eb09c02f21c0d54957fba2aa Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 29 Jun 2024 11:07:30 +0200 Subject: [PATCH 38/76] Add tips --- README.md | 55 ---------------------------------- tips/debug_insecure_package.md | 30 +++++++++++++++++++ tips/how_to_test_pr.md | 34 +++++++++++++++++++++ tips/test_on_vm.md | 24 +++++++++++++++ 4 files changed, 88 insertions(+), 55 deletions(-) create mode 100644 tips/debug_insecure_package.md create mode 100644 tips/how_to_test_pr.md create mode 100644 tips/test_on_vm.md diff --git a/README.md b/README.md index 3424b58..a68b959 100644 --- a/README.md +++ b/README.md @@ -10,31 +10,6 @@ nixos-rebuild switch --flake flake_path_directory#hostname nix flake update --extra-experimental-features "nix-command flakes" ``` -## Configure VM - -Configure VM -```nix -users.users..initialPassword = ""; -virtualisation.vmVariant = { - # following configuration is added only when building VM with build-vm - virtualisation = { - memorySize = ; # Use 8192MiB memory. - cores = ; - # And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix - }; -}; -``` - -Build -```bash -nixos-rebuild build-vm --flake .#nixos-test -``` - -Run -```bash -./result/bin/run-nixos-vm-vm -``` - ## Show changements between revisions @@ -72,36 +47,6 @@ error: cached failure of attribute 'nixosConfigurations.perso-desktop.config.sys sudo rm -fr /root/.cache/nix/ ``` -## If package is marked as insecure - -Example: - -> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate. -> -> Known issues: -> - CVE-2024-27297 - -```bash -nix path-info -r /run/current-system | grep nix-2.16.2 -``` -Result: -> [...] -> -> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 -> -> [...] - -```bash -nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 -``` -Result: -> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 -> -> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev -> -> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3 - -nixd is not up to date and require nix 2.16.2 ## To limit resources use during build diff --git a/tips/debug_insecure_package.md b/tips/debug_insecure_package.md new file mode 100644 index 0000000..837ca9c --- /dev/null +++ b/tips/debug_insecure_package.md @@ -0,0 +1,30 @@ +## If package is marked as insecure + +Example: + +> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate. +> +> Known issues: +> - CVE-2024-27297 + +```bash +nix path-info -r /run/current-system | grep nix-2.16.2 +``` +Result: +> [...] +> +> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 +> +> [...] + +```bash +nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 +``` +Result: +> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2 +> +> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev +> +> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3 + +nixd is not up to date and require nix 2.16.2 diff --git a/tips/how_to_test_pr.md b/tips/how_to_test_pr.md new file mode 100644 index 0000000..4c3af1f --- /dev/null +++ b/tips/how_to_test_pr.md @@ -0,0 +1,34 @@ +# Example for ollama + +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.system.server.ollama; + nvidiaEnabled = config.modules.system.hardware.nvidia.enable; + nixpkgsPr = builtins.fetchTarball { + url = "https://github.com/abysssol/nixpkgs/archive/ollama-driver-runpath.tar.gz"; + sha256 = "1ixfvdpi2v4r9yrkvqnfk9whs8lyjhrkdph47bcznh8ak9aipr8p"; + }; +in +{ + disabledModules = [ "services/misc/ollama.nix" ]; + imports = [ + (import "${nixpkgsPr}/nixos/modules/services/misc/ollama.nix") + ]; + + options.modules.system.server.ollama = { + enable = mkEnableOption '' + Enable ollama with my custom configurations + ''; + }; + config = mkIf cfg.enable { + services.ollama = { + enable = true; + + package = (import nixpkgsPr { inherit (pkgs) system; config.allowUnfree = true; }).ollama; + + acceleration = if nvidiaEnabled then "cuda" else null; + }; + }; +} diff --git a/tips/test_on_vm.md b/tips/test_on_vm.md new file mode 100644 index 0000000..ddaab4b --- /dev/null +++ b/tips/test_on_vm.md @@ -0,0 +1,24 @@ +## Configure VM + +Configure VM +```nix +users.users..initialPassword = ""; +virtualisation.vmVariant = { + # following configuration is added only when building VM with build-vm + virtualisation = { + memorySize = ; # Use 8192MiB memory. + cores = ; + # And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix + }; +}; +``` + +Build +```bash +nixos-rebuild build-vm --flake .#nixos-test +``` + +Run +```bash +./result/bin/run-nixos-vm-vm +``` From b994549a1cb0ef9ee1e83b557d1f0249e70638f1 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 29 Jun 2024 14:57:19 +0200 Subject: [PATCH 39/76] Add nixseparatedebuginfod --- modules/system/common.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/system/common.nix b/modules/system/common.nix index 967e327..0c2a757 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -48,6 +48,10 @@ services.flatpak.enable = true; # Important can't be enabled from home-manager + # Downloads and provides debug symbols and source code for nix derivations to gdb and other debuginfod-capable debuggers as needed. + # Require https://github.com/symphorien/nixseparatedebuginfod?tab=readme-ov-file#gdb + services.nixseparatedebuginfod.enable = true; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary From f4780259a744f9ae091683463a29e2573025a20b Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 29 Jun 2024 15:03:10 +0200 Subject: [PATCH 40/76] Add tools to debug --- modules/system/common.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/system/common.nix b/modules/system/common.nix index 0c2a757..2aa17ab 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -27,6 +27,11 @@ vim nixd + # Usefull tools to debug + gdb + lldb + gammaray # QT Inspector + # Usefull for automatic informations collect software like KDE vulkan-tools # For vulkaninfo command wayland-utils # For wayland-info command From be0e89431ae68051c8ad038adbe36b37ee8f152d Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 1 Jul 2024 13:33:47 +0200 Subject: [PATCH 41/76] Update OS --- flake.lock | 18 +++++++++--------- modules/system/hardware/nvidia/default.nix | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 8eb5b56..7f7f58a 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1719588253, - "narHash": "sha256-A03i8xiVgP14DCmV5P7VUv37eodCjY4e1iai0b2EuuM=", + "lastModified": 1719827439, + "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e68e55d2e16d3a1e92a679430728c35a30fd24e", + "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719506693, - "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", + "lastModified": 1719690277, + "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a", + "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1719650693, - "narHash": "sha256-tVpBKJulLhCSljt6ys6SLN7GgAyHstN4S+xlnuL8ioI=", + "lastModified": 1719830755, + "narHash": "sha256-9VqRnwXjOgrs0joMYys+AEZ8DKJx7BOSf4UrMD0B754=", "owner": "nix-community", "repo": "NUR", - "rev": "d31c65feeea1e5312741db8e78f68e994fef63c1", + "rev": "4f69a017af9ccf0ac0aec02d72b53652bc78c93c", "type": "github" }, "original": { diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index 08d8191..64fbeed 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -44,7 +44,7 @@ in nvidiaSettings = true; # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.beta; + package = config.boot.kernelPackages.nvidiaPackages.latest; }; }; }; From f0aabeee50a25d6d8b9ff35c88123670139eb956 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 1 Jul 2024 14:08:09 +0200 Subject: [PATCH 42/76] nvidia: powerManagement.enable => true --- modules/system/hardware/nvidia/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index 64fbeed..f2eef9b 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -25,7 +25,11 @@ in modesetting.enable = true; # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = false; + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + # Fine-grained power management. Turns off GPU when not in use. # Experimental and only works on modern Nvidia GPUs (Turing or newer). powerManagement.finegrained = false; From e8fca43d0cdbb41ab87f652ae132867dfd626c8c Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 1 Jul 2024 19:29:30 +0200 Subject: [PATCH 43/76] tips(how_to_test_pr): Add content in nix block code --- tips/how_to_test_pr.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tips/how_to_test_pr.md b/tips/how_to_test_pr.md index 4c3af1f..3b4773e 100644 --- a/tips/how_to_test_pr.md +++ b/tips/how_to_test_pr.md @@ -1,5 +1,6 @@ # Example for ollama +```nix { config, pkgs, lib, ... }: with lib; @@ -32,3 +33,4 @@ in }; }; } +``` From a7be324484a01884c128d7d94990ed11d7fc9d39 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 5 Jul 2024 10:20:46 +0200 Subject: [PATCH 44/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 7f7f58a..6600f3c 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1719827439, - "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=", + "lastModified": 1720167120, + "narHash": "sha256-K9JYdlPiyaXp33JRg7CT8rMwH56e4ncXSsXW/YKnNXc=", "owner": "nix-community", "repo": "home-manager", - "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d", + "rev": "bbe6e94737289c8cb92d4d8f9199fbfe4f11c0ba", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719690277, - "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", + "lastModified": 1720031269, + "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1719830755, - "narHash": "sha256-9VqRnwXjOgrs0joMYys+AEZ8DKJx7BOSf4UrMD0B754=", + "lastModified": 1720167414, + "narHash": "sha256-V/uOOdjeQfSbqOJVEx2zj6wLh1VXYReM8FW/ivY3zH4=", "owner": "nix-community", "repo": "NUR", - "rev": "4f69a017af9ccf0ac0aec02d72b53652bc78c93c", + "rev": "56822463b8bed8166c7c44ed7ae31beb48fe05af", "type": "github" }, "original": { From da1008f661a2992a7fdb045a23c58bf0949abbca Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 11 Jul 2024 08:58:26 +0200 Subject: [PATCH 45/76] Update OS --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 6600f3c..f900587 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1718371084, - "narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=", + "lastModified": 1720546205, + "narHash": "sha256-boCXsjYVxDviyzoEyAk624600f3ZBo/DKtUdvMTpbGY=", "owner": "ryantm", "repo": "agenix", - "rev": "3a56735779db467538fb2e577eda28a9daacaca6", + "rev": "de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6", "type": "github" }, "original": { @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1720167120, - "narHash": "sha256-K9JYdlPiyaXp33JRg7CT8rMwH56e4ncXSsXW/YKnNXc=", + "lastModified": 1720646128, + "narHash": "sha256-BivO5yIQukDlJL+1875Sqf3GuOPxZDdA48dYDi3PkL8=", "owner": "nix-community", "repo": "home-manager", - "rev": "bbe6e94737289c8cb92d4d8f9199fbfe4f11c0ba", + "rev": "c085b984ff2808bf322f375b10fea5a415a9c43d", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720031269, - "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", + "lastModified": 1720542800, + "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev": "feb2849fdeb70028c70d73b848214b00d324a497", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1720167414, - "narHash": "sha256-V/uOOdjeQfSbqOJVEx2zj6wLh1VXYReM8FW/ivY3zH4=", + "lastModified": 1720676141, + "narHash": "sha256-FQFpEs6lW8EZPcUwm8kUBCMEH7MgpBSr0Yz1WQMSmgA=", "owner": "nix-community", "repo": "NUR", - "rev": "56822463b8bed8166c7c44ed7ae31beb48fe05af", + "rev": "ec00854d8d699d16e79c8f0c69260ec4d2c4e83f", "type": "github" }, "original": { From 9c105efe71d5ab12045bf4705e966b513f7a34f8 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 11 Jul 2024 09:43:45 +0200 Subject: [PATCH 46/76] pro-laptop: Disable iGPU (Low performance) --- hosts/pro-laptop/configuration.nix | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index 1aa1333..b71526e 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -19,18 +19,18 @@ networking.hostName = "nixos-laptop-pro"; # Define your hostname. - hardware.nvidia.prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - - # Make sure to use the correct Bus ID values for your system! - # information bus: pci@0000:00:02.0 - intelBusId = "PCI:0:2:0"; - # information bus: pci@0000:01:00.0 - nvidiaBusId = "PCI:1:0:0"; - }; +# hardware.nvidia.prime = { +# offload = { +# enable = true; +# enableOffloadCmd = true; +# }; +# +# # Make sure to use the correct Bus ID values for your system! +# # information bus: pci@0000:00:02.0 +# intelBusId = "PCI:0:2:0"; +# # information bus: pci@0000:01:00.0 +# nvidiaBusId = "PCI:1:0:0"; +# }; modules.system = { desktop = { From fb97c4e0d57a3cefc57bd00e3735af03fffb9875 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 11 Jul 2024 21:32:19 +0200 Subject: [PATCH 47/76] Add example to extra modprobe --- modules/system/hardware/nvidia/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index f2eef9b..75c8ba1 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -51,5 +51,9 @@ in package = config.boot.kernelPackages.nvidiaPackages.latest; }; }; + + # boot.extraModprobeConfig = '' + # options nvidia NVreg_EnableGpuFirmware=0 + # ''; }; } From 4ac5527aca41ecb833c1b74c97d9571dba803cfd Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 14 Jul 2024 20:40:20 +0200 Subject: [PATCH 48/76] Add gpg with yubikey --- modules/system/common.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/system/common.nix b/modules/system/common.nix index 2aa17ab..72c39a6 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -21,6 +21,14 @@ nixpkgs.config.allowUnfree = true; + services.udev.packages = [ pkgs.yubikey-personalization ]; + services.pcscd.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ @@ -32,6 +40,8 @@ lldb gammaray # QT Inspector + yubikey-manager + # Usefull for automatic informations collect software like KDE vulkan-tools # For vulkaninfo command wayland-utils # For wayland-info command From 9cd4e0d972634a19f1b5e3df981f22186f2edac9 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 18 Jul 2024 19:02:05 +0200 Subject: [PATCH 49/76] Update OS --- flake.lock | 18 +++++++++--------- modules/system/hardware/pipewire/default.nix | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index f900587..a8e122d 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1720646128, - "narHash": "sha256-BivO5yIQukDlJL+1875Sqf3GuOPxZDdA48dYDi3PkL8=", + "lastModified": 1721135958, + "narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", "owner": "nix-community", "repo": "home-manager", - "rev": "c085b984ff2808bf322f375b10fea5a415a9c43d", + "rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720542800, - "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", + "lastModified": 1721138476, + "narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "feb2849fdeb70028c70d73b848214b00d324a497", + "rev": "ad0b5eed1b6031efaed382844806550c3dcb4206", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1720676141, - "narHash": "sha256-FQFpEs6lW8EZPcUwm8kUBCMEH7MgpBSr0Yz1WQMSmgA=", + "lastModified": 1721308608, + "narHash": "sha256-9+sG0T06cECg/WR19qX6k0t1BQz4qMmfB7k9N+1QGS8=", "owner": "nix-community", "repo": "NUR", - "rev": "ec00854d8d699d16e79c8f0c69260ec4d2c4e83f", + "rev": "6a52aa02e9c127a4bbdee2412123b6df5caa02de", "type": "github" }, "original": { diff --git a/modules/system/hardware/pipewire/default.nix b/modules/system/hardware/pipewire/default.nix index 1f46de4..75a6a5e 100644 --- a/modules/system/hardware/pipewire/default.nix +++ b/modules/system/hardware/pipewire/default.nix @@ -12,7 +12,6 @@ in }; config = mkIf cfg.enable { # Enable sound with pipewire. - sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -28,4 +27,4 @@ in #media-session.enable = true; }; }; -} \ No newline at end of file +} From 3049f81aab16489cf2f341baeb0ff4aad04e2758 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 18 Jul 2024 21:46:04 +0200 Subject: [PATCH 50/76] home(git): Enable signing gpg --- modules/home/shell/git/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/home/shell/git/default.nix b/modules/home/shell/git/default.nix index 85ecc0a..e6eb7b1 100644 --- a/modules/home/shell/git/default.nix +++ b/modules/home/shell/git/default.nix @@ -18,11 +18,14 @@ in userName = "Florian RICHER"; userEmail = "florian.richer@protonmail.com"; - # signing.signByDefault = true; + signing = { + signByDefault = true; + key = "B19E3F4A2D806AB4793FDF2FC73D37CBED7BFC77"; + }; extraConfig = { - url."https://invent.kde.org/".insteadOf = "kde:"; - url."ssh://git@invent.kde.org/".pushInsteadOf = "kde:"; + url."https://invent.kde.org/".insteadOf = "kde:"; + url."ssh://git@invent.kde.org/".pushInsteadOf = "kde:"; }; }; }; From 19e9b330ddc254d200e196d385afeeaaafd9aff0 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 23 Jul 2024 11:15:09 +0200 Subject: [PATCH 51/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index a8e122d..e90ed98 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1721135958, - "narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", + "lastModified": 1721714663, + "narHash": "sha256-ZDW5+rlROxaOuoEfIQM7Gqhoa+WALEYdYIiZhyJjAu0=", "owner": "nix-community", "repo": "home-manager", - "rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", + "rev": "7560dc942a6fbd37ebd1310b3dbda513de2d4b82", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1721138476, - "narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=", + "lastModified": 1721562059, + "narHash": "sha256-Tybxt65eyOARf285hMHIJ2uul8SULjFZbT9ZaEeUnP8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad0b5eed1b6031efaed382844806550c3dcb4206", + "rev": "68c9ed8bbed9dfce253cc91560bf9043297ef2fe", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1721308608, - "narHash": "sha256-9+sG0T06cECg/WR19qX6k0t1BQz4qMmfB7k9N+1QGS8=", + "lastModified": 1721717193, + "narHash": "sha256-hU5VQrEOF7MaNjZfG7tLsnlm8HGIRQs59WXe83Lsp2c=", "owner": "nix-community", "repo": "NUR", - "rev": "6a52aa02e9c127a4bbdee2412123b6df5caa02de", + "rev": "a567cb05cff5358c5d412ff98dd4d65a13e9b06b", "type": "github" }, "original": { From 1c605c6665a07c005e9101be61b177b211540f36 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 23 Jul 2024 17:35:47 +0200 Subject: [PATCH 52/76] nvidia: Enable open version --- modules/system/hardware/nvidia/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index 75c8ba1..d96ea8d 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -41,7 +41,7 @@ in # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus # Only available from driver 515.43.04+ # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; + open = true; # Enable the Nvidia settings menu, # accessible via `nvidia-settings`. From eba430685fba65f8b12a7b1c8842f6c05893e1f9 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 1 Aug 2024 09:44:48 +0200 Subject: [PATCH 53/76] Update OS --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index e90ed98..9be3840 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1720546205, - "narHash": "sha256-boCXsjYVxDviyzoEyAk624600f3ZBo/DKtUdvMTpbGY=", + "lastModified": 1722339003, + "narHash": "sha256-ZeS51uJI30ehNkcZ4uKqT4ZDARPyqrHADSKAwv5vVCU=", "owner": "ryantm", "repo": "agenix", - "rev": "de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6", + "rev": "3f1dae074a12feb7327b4bf43cbac0d124488bb7", "type": "github" }, "original": { @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1721714663, - "narHash": "sha256-ZDW5+rlROxaOuoEfIQM7Gqhoa+WALEYdYIiZhyJjAu0=", + "lastModified": 1722462338, + "narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=", "owner": "nix-community", "repo": "home-manager", - "rev": "7560dc942a6fbd37ebd1310b3dbda513de2d4b82", + "rev": "6e090576c4824b16e8759ebca3958c5b09659ee8", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1721562059, - "narHash": "sha256-Tybxt65eyOARf285hMHIJ2uul8SULjFZbT9ZaEeUnP8=", + "lastModified": 1722185531, + "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=", "owner": "nixos", "repo": "nixpkgs", - "rev": "68c9ed8bbed9dfce253cc91560bf9043297ef2fe", + "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1721717193, - "narHash": "sha256-hU5VQrEOF7MaNjZfG7tLsnlm8HGIRQs59WXe83Lsp2c=", + "lastModified": 1722494317, + "narHash": "sha256-TPS7h6uaIKxXYVjep3DJdVMNlo++tMdtljjdDwDcr7E=", "owner": "nix-community", "repo": "NUR", - "rev": "a567cb05cff5358c5d412ff98dd4d65a13e9b06b", + "rev": "85c4a46c0ac51dc69cb44c0950f9ee0f2b9b1c8d", "type": "github" }, "original": { From 84c3e1ef32718d51f4c6825612d14bd238854fe2 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 9 Aug 2024 08:33:16 +0200 Subject: [PATCH 54/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 9be3840..01247e9 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1722462338, - "narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=", + "lastModified": 1723015306, + "narHash": "sha256-jQnFEtH20/OsDPpx71ntZzGdRlpXhUENSQCGTjn//NA=", "owner": "nix-community", "repo": "home-manager", - "rev": "6e090576c4824b16e8759ebca3958c5b09659ee8", + "rev": "b3d5ea65d88d67d4ec578ed11d4d2d51e3de525e", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722185531, - "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=", + "lastModified": 1722813957, + "narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d", + "rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1722494317, - "narHash": "sha256-TPS7h6uaIKxXYVjep3DJdVMNlo++tMdtljjdDwDcr7E=", + "lastModified": 1723182316, + "narHash": "sha256-X4sGnUGPZMTV/PYBLXe92uOZkj9NQoocIlG3B+ObzJ8=", "owner": "nix-community", "repo": "NUR", - "rev": "85c4a46c0ac51dc69cb44c0950f9ee0f2b9b1c8d", + "rev": "93a6eb95f8cb4eb7e60d69d3954ac384b89fb074", "type": "github" }, "original": { From 1519fb0acb08c848731a22922e2ed9be26aafcbe Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 12 Aug 2024 13:36:14 +0200 Subject: [PATCH 55/76] Update OS --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 01247e9..6df8873 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1722339003, - "narHash": "sha256-ZeS51uJI30ehNkcZ4uKqT4ZDARPyqrHADSKAwv5vVCU=", + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", "owner": "ryantm", "repo": "agenix", - "rev": "3f1dae074a12feb7327b4bf43cbac0d124488bb7", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", "type": "github" }, "original": { @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1723015306, - "narHash": "sha256-jQnFEtH20/OsDPpx71ntZzGdRlpXhUENSQCGTjn//NA=", + "lastModified": 1723399884, + "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", "owner": "nix-community", "repo": "home-manager", - "rev": "b3d5ea65d88d67d4ec578ed11d4d2d51e3de525e", + "rev": "086f619dd991a4d355c07837448244029fc2d9ab", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722813957, - "narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=", + "lastModified": 1723175592, + "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa", + "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1723182316, - "narHash": "sha256-X4sGnUGPZMTV/PYBLXe92uOZkj9NQoocIlG3B+ObzJ8=", + "lastModified": 1723461379, + "narHash": "sha256-ceA1i7qNb8Tnq9CitvU/8S9bteBZYG7EoN9GEdP9V44=", "owner": "nix-community", "repo": "NUR", - "rev": "93a6eb95f8cb4eb7e60d69d3954ac384b89fb074", + "rev": "59ce81dbfc754ce61933bb0677b531a95ada78dd", "type": "github" }, "original": { From 851a9cecacd140f20a7b7565b7e394f9607b6328 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 15 Aug 2024 16:24:09 +0200 Subject: [PATCH 56/76] fix(deprecated) : You have set virtualisation.docker.enableNvidia. This option is deprecated, please set hardware.nvidia-container-toolkit.enable instead --- modules/system/hardware/nvidia/default.nix | 2 ++ modules/system/server/docker/default.nix | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/system/hardware/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix index d96ea8d..f58b698 100644 --- a/modules/system/hardware/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -20,6 +20,8 @@ in enable32Bit = true; }; + nvidia-container-toolkit.enable = true; + nvidia = { # Modesetting is required. modesetting.enable = true; diff --git a/modules/system/server/docker/default.nix b/modules/system/server/docker/default.nix index 317777b..dfdd13b 100644 --- a/modules/system/server/docker/default.nix +++ b/modules/system/server/docker/default.nix @@ -13,7 +13,6 @@ in config = mkIf cfg.enable { virtualisation.docker = { enable = true; - enableNvidia = config.modules.system.hardware.nvidia.enable; }; users.users.florian.extraGroups = [ "docker" ]; From 86d873208169f1bdaf521b9571c537784adc1868 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 15 Aug 2024 16:25:29 +0200 Subject: [PATCH 57/76] Remove ollama for perso/pro --- hosts/perso-desktop/configuration.nix | 1 - hosts/perso-laptop/configuration.nix | 4 ---- hosts/pro-laptop/configuration.nix | 1 - 3 files changed, 6 deletions(-) diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index 3cddb29..f931f79 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -36,7 +36,6 @@ }; server = { - ollama.enable = true; distrobox.enable = true; }; }; diff --git a/hosts/perso-laptop/configuration.nix b/hosts/perso-laptop/configuration.nix index 0a25108..37c845a 100644 --- a/hosts/perso-laptop/configuration.nix +++ b/hosts/perso-laptop/configuration.nix @@ -47,9 +47,5 @@ printing.enable = true; waydroid.enable = true; }; - - server = { - ollama.enable = true; - }; }; } diff --git a/hosts/pro-laptop/configuration.nix b/hosts/pro-laptop/configuration.nix index b71526e..3c57635 100644 --- a/hosts/pro-laptop/configuration.nix +++ b/hosts/pro-laptop/configuration.nix @@ -49,7 +49,6 @@ }; server = { - ollama.enable = true; distrobox.enable = true; }; }; From 3903008b4434ed851e89ea203e479e71e5e7e081 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 15 Aug 2024 16:26:13 +0200 Subject: [PATCH 58/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 6df8873..051378b 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723175592, - "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1723461379, - "narHash": "sha256-ceA1i7qNb8Tnq9CitvU/8S9bteBZYG7EoN9GEdP9V44=", + "lastModified": 1723728459, + "narHash": "sha256-/REChCgzN10bqe4Nyd+xPHc8jfFM5YxMJvskSNt8164=", "owner": "nix-community", "repo": "NUR", - "rev": "59ce81dbfc754ce61933bb0677b531a95ada78dd", + "rev": "84e0a72d1e17aedc43da8fbe38ef654a36211e46", "type": "github" }, "original": { From 9ed4324c52a38dac90c13a640d6b7a829e02ff44 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 15 Aug 2024 16:31:30 +0200 Subject: [PATCH 59/76] Add graalvm for jetbrains-toolbox IDEs for more performance --- modules/home/apps/jetbrainsToolbox/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/home/apps/jetbrainsToolbox/default.nix b/modules/home/apps/jetbrainsToolbox/default.nix index c79f09f..c495cc2 100644 --- a/modules/home/apps/jetbrainsToolbox/default.nix +++ b/modules/home/apps/jetbrainsToolbox/default.nix @@ -11,6 +11,6 @@ in ''; }; config = mkIf cfg.enable { - home.packages = with pkgs; [jetbrains-toolbox]; + home.packages = with pkgs; [jetbrains-toolbox graalvm-ce]; }; } \ No newline at end of file From a1aa8f0b25ce7558358952f3823291b2e817d410 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 15 Aug 2024 22:00:29 +0200 Subject: [PATCH 60/76] Refactor nix experimental-features to use on home and system side --- modules/common.nix | 5 +++++ modules/home/default.nix | 2 +- modules/system/common.nix | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 modules/common.nix diff --git a/modules/common.nix b/modules/common.nix new file mode 100644 index 0000000..c7eb3e6 --- /dev/null +++ b/modules/common.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + nix.settings.experimental-features = [ "nix-command" "flakes" ]; +} \ No newline at end of file diff --git a/modules/home/default.nix b/modules/home/default.nix index 92279a8..ee5f717 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -2,6 +2,7 @@ { imports = [ + ../common.nix ./apps ./desktop ./shell @@ -15,6 +16,5 @@ }; programs.home-manager.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; } diff --git a/modules/system/common.nix b/modules/system/common.nix index 72c39a6..5838226 100644 --- a/modules/system/common.nix +++ b/modules/system/common.nix @@ -1,6 +1,10 @@ { pkgs, ... }: { + imports = [ + ../common.nix + ]; + # Set your time zone. time.timeZone = "Europe/Paris"; From 64f6f336ea12437184e1fae9d0b23ff250d934af Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 23 Aug 2024 21:07:13 +0200 Subject: [PATCH 61/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 051378b..40fbf2c 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1723399884, - "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "lastModified": 1724422166, + "narHash": "sha256-l9zifWrZe6sRTwl/Padz+a6zwGeE9eaU+0PFWtUQl2w=", "owner": "nix-community", "repo": "home-manager", - "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "rev": "5dc25356567119127f046b347c3060a8dd607365", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723637854, - "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "lastModified": 1724224976, + "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1723728459, - "narHash": "sha256-/REChCgzN10bqe4Nyd+xPHc8jfFM5YxMJvskSNt8164=", + "lastModified": 1724437005, + "narHash": "sha256-BVB8Cn7FaCn2Kssj5CJe12xKFoOPuZmZRrShOVGMHSc=", "owner": "nix-community", "repo": "NUR", - "rev": "84e0a72d1e17aedc43da8fbe38ef654a36211e46", + "rev": "d298400a803182527b3cdc7c010b7ecbdaf0dbd6", "type": "github" }, "original": { From d464f0f05367b6a121fe784a36a59d617b07978e Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 26 Aug 2024 19:46:01 +0200 Subject: [PATCH 62/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 40fbf2c..bab9b0f 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1724422166, - "narHash": "sha256-l9zifWrZe6sRTwl/Padz+a6zwGeE9eaU+0PFWtUQl2w=", + "lastModified": 1724435763, + "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", "owner": "nix-community", "repo": "home-manager", - "rev": "5dc25356567119127f046b347c3060a8dd607365", + "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724224976, - "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", + "lastModified": 1724479785, + "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", + "rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1724437005, - "narHash": "sha256-BVB8Cn7FaCn2Kssj5CJe12xKFoOPuZmZRrShOVGMHSc=", + "lastModified": 1724692714, + "narHash": "sha256-p2YqPzcKVGlL0S1K8xMYRC3xES2YBnI0/3d8eoJPy9M=", "owner": "nix-community", "repo": "NUR", - "rev": "d298400a803182527b3cdc7c010b7ecbdaf0dbd6", + "rev": "25df2f4d34e538e57f71e2a0c9cdb763ef239558", "type": "github" }, "original": { From 2aa2199cadf01cb25c8261827bbff84006f86d76 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 29 Aug 2024 09:10:10 +0200 Subject: [PATCH 63/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index bab9b0f..614a4ff 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724479785, - "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", + "lastModified": 1724819573, + "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be", + "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1724692714, - "narHash": "sha256-p2YqPzcKVGlL0S1K8xMYRC3xES2YBnI0/3d8eoJPy9M=", + "lastModified": 1724915224, + "narHash": "sha256-J8+qOoU7NADxLZkLiUCHGmZPPNJPQclYt2tVaMmxknA=", "owner": "nix-community", "repo": "NUR", - "rev": "25df2f4d34e538e57f71e2a0c9cdb763ef239558", + "rev": "52960e54d0bd04e05f7804ab9843fb0da61885fa", "type": "github" }, "original": { From 0a8a4808450830c710d17e7f629de42eab7252d6 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 30 Aug 2024 18:48:21 +0200 Subject: [PATCH 64/76] Begin work on distrobox configuration for KDE Development --- tips/distrobox/kde/distrobox.ini | 14 ++++++++++++++ tips/use_distrobox.md | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 tips/distrobox/kde/distrobox.ini create mode 100644 tips/use_distrobox.md diff --git a/tips/distrobox/kde/distrobox.ini b/tips/distrobox/kde/distrobox.ini new file mode 100644 index 0000000..6d7a3a3 --- /dev/null +++ b/tips/distrobox/kde/distrobox.ini @@ -0,0 +1,14 @@ +[kdedev] +image=quay.io/fedora/fedora:rawhide +home="${HOME}/.distrobox_home/kdedev" +nvidia=true +replace=true +root=false +pull=true +additional_packages="git python3-dbus python3-pyyaml python3-setproctitle" +init_hooks=mkdir -p ~/.local/share +init_hooks=git clone https://invent.kde.org/sdk/kde-builder.git ~/.local/share/kde-builder || git -C ~/.local/share/kde-builder pull --ff-only +init_hooks=mkdir -p ~/.local/bin +init_hooks=ln -sf ~/.local/share/kde-builder/kde-builder ~/.local/bin +init_hooks=~/.local/bin/kde-builder --generate-config +init_hooks=yes | ~/.local/bin/kde-builder --install-distro-packages \ No newline at end of file diff --git a/tips/use_distrobox.md b/tips/use_distrobox.md new file mode 100644 index 0000000..267b5ad --- /dev/null +++ b/tips/use_distrobox.md @@ -0,0 +1,8 @@ +# How use distrobox to work on common distro + +## How to develop on KDE + +1. `cd distrobox/kde` +2. `distrobox assemble` +3. `distrobox enter kdedev` +4. `kde-builder run solid` \ No newline at end of file From bbae058bcb861823f9af222418e2a3b4c565678a Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 1 Sep 2024 19:32:32 +0200 Subject: [PATCH 65/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 614a4ff..3b863c4 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1724435763, - "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", + "lastModified": 1725180166, + "narHash": "sha256-fzssXuGR/mCeGbzM1ExaTqDz7QDGta3WA4jJsZyRruo=", "owner": "nix-community", "repo": "home-manager", - "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", + "rev": "471e3eb0a114265bcd62d11d58ba8d3421ee68eb", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724819573, - "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", + "lastModified": 1725103162, + "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", + "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1724915224, - "narHash": "sha256-J8+qOoU7NADxLZkLiUCHGmZPPNJPQclYt2tVaMmxknA=", + "lastModified": 1725205518, + "narHash": "sha256-8ON8L/Rh/2jOgJSZrngL0tqIBBAguulV+LUJUPX6Kc8=", "owner": "nix-community", "repo": "NUR", - "rev": "52960e54d0bd04e05f7804ab9843fb0da61885fa", + "rev": "1f576dea9f0750f4877b012a70fb47a1c063491a", "type": "github" }, "original": { From ab869efa908dc05d3231196a919b2b556b4dc224 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 5 Sep 2024 15:08:11 +0200 Subject: [PATCH 66/76] Update OS --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 3b863c4..84bc0f8 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725103162, - "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", + "lastModified": 1725432240, + "narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", + "rev": "ad416d066ca1222956472ab7d0555a6946746a80", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1725205518, - "narHash": "sha256-8ON8L/Rh/2jOgJSZrngL0tqIBBAguulV+LUJUPX6Kc8=", + "lastModified": 1725541414, + "narHash": "sha256-2btQOiIw+yMrxAHzVCp5ou9IbWkzYhQ5dIS3vRO7Sd8=", "owner": "nix-community", "repo": "NUR", - "rev": "1f576dea9f0750f4877b012a70fb47a1c063491a", + "rev": "72c08881a42221c2de613b425b735c4cd7f85d86", "type": "github" }, "original": { From 350f85904bb7d5ba008369cf2ed94f8fd752f571 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 5 Sep 2024 15:08:25 +0200 Subject: [PATCH 67/76] pro-laptop: Add firefox --- hosts/pro-laptop/home.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/pro-laptop/home.nix b/hosts/pro-laptop/home.nix index 6dcf755..48642dc 100644 --- a/hosts/pro-laptop/home.nix +++ b/hosts/pro-laptop/home.nix @@ -8,6 +8,7 @@ modules.home = { apps = { chromium.enable = true; + firefox.enable = true; flatpak.enable = true; jetbrainsToolbox.enable = true; kitty.enable = true; From a4a651133b81baffd7162f2a82167120cb347b1b Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 5 Sep 2024 22:47:19 +0200 Subject: [PATCH 68/76] steam: Move to system instead of Flatpak - Support of gamescope for HDR - Best integration with udev devices - Add proton-ge --- hosts/perso-desktop/configuration.nix | 4 ++++ modules/home/apps/default.nix | 2 +- modules/home/apps/flatpak/default.nix | 1 - modules/system/apps/default.nix | 7 +++++++ modules/system/apps/steam/default.nix | 22 ++++++++++++++++++++++ modules/system/default.nix | 1 + 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 modules/system/apps/default.nix create mode 100644 modules/system/apps/steam/default.nix diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index f931f79..8a538d4 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -20,6 +20,10 @@ networking.hostName = "nixos-desktop-perso"; # Define your hostname. modules.system = { + apps = { + steam.enable = true; + }; + desktop = { plasma.enable = true; }; diff --git a/modules/home/apps/default.nix b/modules/home/apps/default.nix index 981aa5c..5f6f130 100644 --- a/modules/home/apps/default.nix +++ b/modules/home/apps/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ ... }: { imports = [ diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index 7084ec5..2e66e1a 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -21,7 +21,6 @@ in packages = [ # Gaming { appId = "com.discordapp.Discord"; origin = "flathub"; } - { appId = "com.valvesoftware.Steam"; origin = "flathub"; } { appId = "net.lutris.Lutris"; origin = "flathub"; } # Pro diff --git a/modules/system/apps/default.nix b/modules/system/apps/default.nix new file mode 100644 index 0000000..557c5f2 --- /dev/null +++ b/modules/system/apps/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./steam + ]; +} diff --git a/modules/system/apps/steam/default.nix b/modules/system/apps/steam/default.nix new file mode 100644 index 0000000..448421c --- /dev/null +++ b/modules/system/apps/steam/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.system.apps.steam; +in +{ + options.modules.system.apps.steam = { + enable = mkEnableOption '' + Enable steam with my custom configurations + ''; + }; + config = mkIf cfg.enable { + programs.steam = { + enable = true; + extraPackages = with pkgs; [ gamescope ]; + extraCompatPackages = with pkgs; [ proton-ge-bin ]; + }; + + hardware.steam-hardware.enable = true; + }; +} diff --git a/modules/system/default.nix b/modules/system/default.nix index 49a302c..08983d8 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./apps ./desktop ./hardware ./server From 2aa8ea01800175e1bcc034bc037c0230289920e3 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Fri, 6 Sep 2024 19:29:30 +0200 Subject: [PATCH 69/76] Update tips --- tips/distrobox/kde/configure.sh | 20 ++++++++++++++++++++ tips/distrobox/kde/distrobox.ini | 8 -------- tips/distrobox/kde/use_distrobox.md | 17 +++++++++++++++++ tips/use_distrobox.md | 8 -------- 4 files changed, 37 insertions(+), 16 deletions(-) create mode 100755 tips/distrobox/kde/configure.sh create mode 100644 tips/distrobox/kde/use_distrobox.md delete mode 100644 tips/use_distrobox.md diff --git a/tips/distrobox/kde/configure.sh b/tips/distrobox/kde/configure.sh new file mode 100755 index 0000000..9d3d952 --- /dev/null +++ b/tips/distrobox/kde/configure.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [[ $PATH != *".local/bin"* ]]; then + echo "Append .local/bin to PATH in ~/.bashrc" + echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc + echo "Reload shell" + source ~/.bashrc +fi + +echo "Installing kde-builder" +curl 'https://invent.kde.org/sdk/kde-builder/-/raw/master/scripts/initial_setup.sh?ref_type=heads' > ~/initial_setup.sh +bash ~/initial_setup.sh && rm ~/initial_setup.sh + +echo "Run initial setup from kde-builder" +kde-builder --initial-setup + +echo "Install missing dependencies" +sudo dnf install qt6-qttools-devel + +echo "Configuration DONE" \ No newline at end of file diff --git a/tips/distrobox/kde/distrobox.ini b/tips/distrobox/kde/distrobox.ini index 6d7a3a3..d5101d2 100644 --- a/tips/distrobox/kde/distrobox.ini +++ b/tips/distrobox/kde/distrobox.ini @@ -2,13 +2,5 @@ image=quay.io/fedora/fedora:rawhide home="${HOME}/.distrobox_home/kdedev" nvidia=true -replace=true root=false pull=true -additional_packages="git python3-dbus python3-pyyaml python3-setproctitle" -init_hooks=mkdir -p ~/.local/share -init_hooks=git clone https://invent.kde.org/sdk/kde-builder.git ~/.local/share/kde-builder || git -C ~/.local/share/kde-builder pull --ff-only -init_hooks=mkdir -p ~/.local/bin -init_hooks=ln -sf ~/.local/share/kde-builder/kde-builder ~/.local/bin -init_hooks=~/.local/bin/kde-builder --generate-config -init_hooks=yes | ~/.local/bin/kde-builder --install-distro-packages \ No newline at end of file diff --git a/tips/distrobox/kde/use_distrobox.md b/tips/distrobox/kde/use_distrobox.md new file mode 100644 index 0000000..910cb5a --- /dev/null +++ b/tips/distrobox/kde/use_distrobox.md @@ -0,0 +1,17 @@ +# How to develop on KDE + +## First configuration + +1. `distrobox assemble` + > You can add --replace to recreate distrobox container +2. `distrobox enter kdedev` +3. `bash configure.sh` +4. `kde-builder run solid` + +## Usefull config in ~/.config/kdesrc-buildrc + +Autogenerate editor configuration + +- generate-clion-project-config +- generate-vscode-project-config +- generate-qtcreator-project-config \ No newline at end of file diff --git a/tips/use_distrobox.md b/tips/use_distrobox.md deleted file mode 100644 index 267b5ad..0000000 --- a/tips/use_distrobox.md +++ /dev/null @@ -1,8 +0,0 @@ -# How use distrobox to work on common distro - -## How to develop on KDE - -1. `cd distrobox/kde` -2. `distrobox assemble` -3. `distrobox enter kdedev` -4. `kde-builder run solid` \ No newline at end of file From d08eb3a10779ab11b2f46a44df558a1755ed1016 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 7 Sep 2024 20:55:40 +0200 Subject: [PATCH 70/76] tips(kdedev): Add .kde_bashrc --- tips/distrobox/kde/.kde_bashrc | 24 ++++++++++++++++++++++++ tips/distrobox/kde/configure.sh | 9 ++++++++- tips/distrobox/kde/use_distrobox.md | 6 ++++-- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tips/distrobox/kde/.kde_bashrc diff --git a/tips/distrobox/kde/.kde_bashrc b/tips/distrobox/kde/.kde_bashrc new file mode 100644 index 0000000..1167121 --- /dev/null +++ b/tips/distrobox/kde/.kde_bashrc @@ -0,0 +1,24 @@ +# Required for kde-builder command +if [[ $PATH != *".local/bin"* ]]; then + export PATH="$HOME/.local/bin:$PATH" +fi + +# Workaround for NixOS +# ENVs have nix store references and made conflict during build or run of KDE Apps, Shells, Frameworks +alias new_shell="env -u PATH -u QML2_IMPORT_PATH -u QT_PLUGIN_PATH -u NIXPKGS_QT6_QML_IMPORT_PATH -u XDG_CONFIG_DIRS bash -l" + +alias build_plasma_mobile="kde-builder plasma-mobile plasma-settings plasma-desktop kactivitymanagerd" + +function run_mobile() { + source "$HOME/kde/build/plasma-mobile/prefix.sh" + + QT_QPA_PLATFORM=offscreen plasma-mobile-envmanager --apply-settings + + # Environment variables + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + export QT_QUICK_CONTROLS_MOBILE=1 + export PLASMA_PLATFORM=phone:handheld + export QT_QUICK_CONTROLS_STYLE=org.kde.breeze + + QT_QPA_PLATFORM=wayland dbus-run-session kwin_wayland --xwayland "plasmashell -p org.kde.plasma.mobileshell" --width 360 --height 720 +} \ No newline at end of file diff --git a/tips/distrobox/kde/configure.sh b/tips/distrobox/kde/configure.sh index 9d3d952..abb0ae0 100755 --- a/tips/distrobox/kde/configure.sh +++ b/tips/distrobox/kde/configure.sh @@ -7,6 +7,13 @@ if [[ $PATH != *".local/bin"* ]]; then source ~/.bashrc fi +if [[ $PATH != *"alias new_shell"* ]]; then + echo "Append new_shell alias to PATH in ~/.bashrc" + echo 'alias new_shell="env -u PATH -u QML2_IMPORT_PATH -u QT_PLUGIN_PATH -u NIXPKGS_QT6_QML_IMPORT_PATH -u XDG_CONFIG_DIRS bash -l"' >> ~/.bashrc + echo "Reload shell" + source ~/.bashrc +fi + echo "Installing kde-builder" curl 'https://invent.kde.org/sdk/kde-builder/-/raw/master/scripts/initial_setup.sh?ref_type=heads' > ~/initial_setup.sh bash ~/initial_setup.sh && rm ~/initial_setup.sh @@ -15,6 +22,6 @@ echo "Run initial setup from kde-builder" kde-builder --initial-setup echo "Install missing dependencies" -sudo dnf install qt6-qttools-devel +sudo dnf install qt6-*-devel echo "Configuration DONE" \ No newline at end of file diff --git a/tips/distrobox/kde/use_distrobox.md b/tips/distrobox/kde/use_distrobox.md index 910cb5a..deda652 100644 --- a/tips/distrobox/kde/use_distrobox.md +++ b/tips/distrobox/kde/use_distrobox.md @@ -3,10 +3,12 @@ ## First configuration 1. `distrobox assemble` - > You can add --replace to recreate distrobox container + > You can add --replace to recreate distrobox container 2. `distrobox enter kdedev` 3. `bash configure.sh` 4. `kde-builder run solid` + > You use NixOS ? It's necessary to run `new_shell` alias before. + > The alias unset all nixos env variables with nix store references to avoid conflicts with build or run of KDE Shells/Apps/Tools. ## Usefull config in ~/.config/kdesrc-buildrc @@ -14,4 +16,4 @@ Autogenerate editor configuration - generate-clion-project-config - generate-vscode-project-config -- generate-qtcreator-project-config \ No newline at end of file +- generate-qtcreator-project-config From adfe3ce6cdf3e430e206da7559242be05a6d55a7 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 8 Sep 2024 21:05:15 +0200 Subject: [PATCH 71/76] tips(kdedev): Migrate to fedora latest and fix configure.sh --- tips/distrobox/kde/configure.sh | 17 +++++------------ tips/distrobox/kde/distrobox.ini | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/tips/distrobox/kde/configure.sh b/tips/distrobox/kde/configure.sh index abb0ae0..f6e0812 100755 --- a/tips/distrobox/kde/configure.sh +++ b/tips/distrobox/kde/configure.sh @@ -1,16 +1,9 @@ #!/bin/bash -if [[ $PATH != *".local/bin"* ]]; then - echo "Append .local/bin to PATH in ~/.bashrc" - echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc - echo "Reload shell" - source ~/.bashrc -fi - -if [[ $PATH != *"alias new_shell"* ]]; then - echo "Append new_shell alias to PATH in ~/.bashrc" - echo 'alias new_shell="env -u PATH -u QML2_IMPORT_PATH -u QT_PLUGIN_PATH -u NIXPKGS_QT6_QML_IMPORT_PATH -u XDG_CONFIG_DIRS bash -l"' >> ~/.bashrc - echo "Reload shell" +if ! grep -Fxq "source ~/.kde_bashrc" ~/.bashrc +then + cp .kde_bashrc ~/.kde_bashrc + echo "source ~/.kde_bashrc" > ~/.bashrc source ~/.bashrc fi @@ -22,6 +15,6 @@ echo "Run initial setup from kde-builder" kde-builder --initial-setup echo "Install missing dependencies" -sudo dnf install qt6-*-devel +sudo dnf install qt6-*-devel librsvg2-devel echo "Configuration DONE" \ No newline at end of file diff --git a/tips/distrobox/kde/distrobox.ini b/tips/distrobox/kde/distrobox.ini index d5101d2..180ff56 100644 --- a/tips/distrobox/kde/distrobox.ini +++ b/tips/distrobox/kde/distrobox.ini @@ -1,5 +1,5 @@ [kdedev] -image=quay.io/fedora/fedora:rawhide +image=quay.io/fedora/fedora:latest home="${HOME}/.distrobox_home/kdedev" nvidia=true root=false From 02b0b569ea79937bce140d82ed933aaa250e4df0 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 11 Sep 2024 16:14:26 +0200 Subject: [PATCH 72/76] Update OS --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 84bc0f8..4d6185b 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1725180166, - "narHash": "sha256-fzssXuGR/mCeGbzM1ExaTqDz7QDGta3WA4jJsZyRruo=", + "lastModified": 1726036828, + "narHash": "sha256-ZQHbpyti0jcAKnwQY1lwmooecLmSG6wX1JakQ/eZNeM=", "owner": "nix-community", "repo": "home-manager", - "rev": "471e3eb0a114265bcd62d11d58ba8d3421ee68eb", + "rev": "8a1671642826633586d12ac3158e463c7a50a112", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725432240, - "narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=", + "lastModified": 1725983898, + "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad416d066ca1222956472ab7d0555a6946746a80", + "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", "type": "github" }, "original": { @@ -101,11 +101,11 @@ }, "nur": { "locked": { - "lastModified": 1725541414, - "narHash": "sha256-2btQOiIw+yMrxAHzVCp5ou9IbWkzYhQ5dIS3vRO7Sd8=", + "lastModified": 1726059953, + "narHash": "sha256-uuqSnIgC2g3W6wk6Of1HvOFgFvo5Q+h0469VwMzDaBI=", "owner": "nix-community", "repo": "NUR", - "rev": "72c08881a42221c2de613b425b735c4cd7f85d86", + "rev": "72296d37a29541a017e545c8f4e2c5c37dbaba59", "type": "github" }, "original": { From 1a0c925449cce67b8eaecca252f4b4552f6e2421 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 15 Sep 2024 13:54:43 +0200 Subject: [PATCH 73/76] modules: Revert vscode from flatpak to modules If needed to be installed with flatpak, it can be installed from Discover --- modules/home/apps/flatpak/default.nix | 1 - modules/home/default.nix | 1 + modules/home/editors/default.nix | 7 ++++ modules/home/editors/vscode/default.nix | 47 +++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 modules/home/editors/default.nix create mode 100644 modules/home/editors/vscode/default.nix diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index 2e66e1a..7d2aa01 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -29,7 +29,6 @@ in { appId = "org.mozilla.Thunderbird"; origin = "flathub"; } { appId = "ch.protonmail.protonmail-bridge"; origin = "flathub"; } { appId = "org.kde.neochat"; origin = "flathub"; } - { appId = "com.visualstudio.code"; origin = "flathub"; } # Loisir { appId = "com.spotify.Client"; origin = "flathub"; } diff --git a/modules/home/default.nix b/modules/home/default.nix index ee5f717..adfece8 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -4,6 +4,7 @@ imports = [ ../common.nix ./apps + ./editors ./desktop ./shell ]; diff --git a/modules/home/editors/default.nix b/modules/home/editors/default.nix new file mode 100644 index 0000000..40db812 --- /dev/null +++ b/modules/home/editors/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./vscode + ]; +} \ No newline at end of file diff --git a/modules/home/editors/vscode/default.nix b/modules/home/editors/vscode/default.nix new file mode 100644 index 0000000..13ed250 --- /dev/null +++ b/modules/home/editors/vscode/default.nix @@ -0,0 +1,47 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.home.editors.vscode; +in +{ + options.modules.home.editors.vscode = { + enable = mkEnableOption '' + Enable vscode with my custom configurations + ''; + }; + config = mkIf cfg.enable { + programs.vscode = { + enable = true; + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + + userSettings = { + "files.autoSave" = "onFocusChange"; + "emmet.includeLanguages" = { + "phoenix-heex" = "html"; + }; + "git.autofetch" = true; + }; + + userTasks = {}; + + extensions = with pkgs; with vscode-extensions; [ + # Nix + bbenoist.nix + + # Rust + rust-lang.rust-analyzer + serayuzgur.crates + tamasfe.even-better-toml + + # Phoenix + phoenixframework.phoenix + elixir-lsp.vscode-elixir-ls + + # Ruby + shopify.ruby-lsp + ]; + }; + }; +} \ No newline at end of file From de7a2753df971cd276baeacb7ec5a6b625d04e8e Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 15 Sep 2024 13:59:16 +0200 Subject: [PATCH 74/76] flatpak: Remove not use applications --- modules/home/apps/flatpak/default.nix | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index 7d2aa01..4c05680 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -12,7 +12,6 @@ in }; config = mkIf cfg.enable { - services.flatpak = { enable = true; @@ -24,18 +23,12 @@ in { appId = "net.lutris.Lutris"; origin = "flathub"; } # Pro - { appId = "com.slack.Slack"; origin = "flathub"; } - { appId = "com.skype.Client"; origin = "flathub"; } - { appId = "org.mozilla.Thunderbird"; origin = "flathub"; } { appId = "ch.protonmail.protonmail-bridge"; origin = "flathub"; } { appId = "org.kde.neochat"; origin = "flathub"; } # Loisir { appId = "com.spotify.Client"; origin = "flathub"; } - { appId = "io.gitlab.news_flash.NewsFlash"; origin = "flathub"; } { appId = "org.videolan.VLC"; origin = "flathub"; } - { appId = "com.obsproject.Studio"; origin = "flathub"; } - { appId = "io.github.achetagames.epic_asset_manager"; origin = "flathub"; } ]; }; }; From 5766455c951468a0cd47ac948ed843f65883c972 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 15 Sep 2024 14:10:34 +0200 Subject: [PATCH 75/76] vscode: Add comment for multi-profiles --- modules/home/editors/vscode/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/home/editors/vscode/default.nix b/modules/home/editors/vscode/default.nix index 13ed250..14cd380 100644 --- a/modules/home/editors/vscode/default.nix +++ b/modules/home/editors/vscode/default.nix @@ -26,6 +26,7 @@ in userTasks = {}; + # Waiting https://github.com/nix-community/home-manager/pull/5640 to support multi-profiles support extensions = with pkgs; with vscode-extensions; [ # Nix bbenoist.nix From 4ebb3aaed1243143ae84c6e7a868bff343cb8f75 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 28 May 2024 20:46:24 +0200 Subject: [PATCH 76/76] modules(editors) : Add emacs --- flake.lock | 453 ++++++++++++++++++ flake.nix | 18 + modules/home/editors/default.nix | 1 + modules/home/editors/emacs/default.nix | 19 + modules/home/editors/emacs/doom.d/config.el | 76 +++ modules/home/editors/emacs/doom.d/init.el | 195 ++++++++ modules/home/editors/emacs/doom.d/packages.el | 52 ++ 7 files changed, 814 insertions(+) create mode 100644 modules/home/editors/emacs/default.nix create mode 100644 modules/home/editors/emacs/doom.d/config.el create mode 100644 modules/home/editors/emacs/doom.d/init.el create mode 100644 modules/home/editors/emacs/doom.d/packages.el diff --git a/flake.lock b/flake.lock index 4d6185b..6726d62 100644 --- a/flake.lock +++ b/flake.lock @@ -47,6 +47,203 @@ "type": "github" } }, + "doom-emacs": { + "flake": false, + "locked": { + "lastModified": 1662497747, + "narHash": "sha256-4n7E1fqda7cn5/F2jTkOnKw1juG6XMS/FI9gqODL3aU=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + } + }, + "doom-snippets": { + "flake": false, + "locked": { + "lastModified": 1694887483, + "narHash": "sha256-KlKhruPSLPSKqUnr5/U65arm16VrY9ORzm+XKNZhpTQ=", + "owner": "doomemacs", + "repo": "snippets", + "rev": "f022984ee1318a4015d5d081b3c3dab5a60dc6ff", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "snippets", + "type": "github" + } + }, + "emacs-overlay": { + "flake": false, + "locked": { + "lastModified": 1676366521, + "narHash": "sha256-i4UAY8t9Au9SJtsgYppa3NHSVf1YkV6yqnNIQd+Km4g=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + } + }, + "emacs-so-long": { + "flake": false, + "locked": { + "lastModified": 1575031854, + "narHash": "sha256-xIa5zO0ZaToDrec1OFjBK6l39AbA4l/CE4LInVu2hi0=", + "owner": "hlissner", + "repo": "emacs-so-long", + "rev": "ed666b0716f60e8988c455804de24b55919e71ca", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "emacs-so-long", + "type": "github" + } + }, + "evil-escape": { + "flake": false, + "locked": { + "lastModified": 1588439096, + "narHash": "sha256-aB2Ge5o/93B18tPf4fN1c+O46CNh/nOqwLJbox4c8Gw=", + "owner": "hlissner", + "repo": "evil-escape", + "rev": "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-escape", + "type": "github" + } + }, + "evil-markdown": { + "flake": false, + "locked": { + "lastModified": 1626852210, + "narHash": "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=", + "owner": "Somelauw", + "repo": "evil-markdown", + "rev": "8e6cc68af83914b2fa9fd3a3b8472573dbcef477", + "type": "github" + }, + "original": { + "owner": "Somelauw", + "repo": "evil-markdown", + "type": "github" + } + }, + "evil-org-mode": { + "flake": false, + "locked": { + "lastModified": 1607203864, + "narHash": "sha256-JxwqVYDN6OIJEH15MVI6XOZAPtUWUhJQWHyzcrUvrFg=", + "owner": "hlissner", + "repo": "evil-org-mode", + "rev": "a9706da260c45b98601bcd72b1d2c0a24a017700", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-org-mode", + "type": "github" + } + }, + "evil-quick-diff": { + "flake": false, + "locked": { + "lastModified": 1575189609, + "narHash": "sha256-oGzl1ayW9rIuq0haoiFS7RZsS8NFMdEA7K1BSozgnJU=", + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "rev": "69c883720b30a892c63bc89f49d4f0e8b8028908", + "type": "github" + }, + "original": { + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "type": "github" + } + }, + "explain-pause-mode": { + "flake": false, + "locked": { + "lastModified": 1595842060, + "narHash": "sha256-++znrjiDSx+cy4okFBBXUBkRFdtnE2x+trkmqjB3Njs=", + "owner": "lastquestion", + "repo": "explain-pause-mode", + "rev": "2356c8c3639cbeeb9751744dbe737267849b4b51", + "type": "github" + }, + "original": { + "owner": "lastquestion", + "repo": "explain-pause-mode", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "format-all": { + "flake": false, + "locked": { + "lastModified": 1581716637, + "narHash": "sha256-ul7LCe60W8TIvUmUtZtZRo8489TK9iTPDsLHmzxY57M=", + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + }, + "original": { + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -67,6 +264,52 @@ "type": "github" } }, + "nix-doom-emacs": { + "inputs": { + "doom-emacs": "doom-emacs", + "doom-snippets": "doom-snippets", + "emacs-overlay": "emacs-overlay", + "emacs-so-long": "emacs-so-long", + "evil-escape": "evil-escape", + "evil-markdown": "evil-markdown", + "evil-org-mode": "evil-org-mode", + "evil-quick-diff": "evil-quick-diff", + "explain-pause-mode": "explain-pause-mode", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "format-all": "format-all", + "nix-straight": [ + "nix-straight" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nose": "nose", + "ob-racket": "ob-racket", + "org": "org", + "org-contrib": "org-contrib", + "org-yt": "org-yt", + "php-extras": "php-extras", + "revealjs": "revealjs", + "rotate-text": "rotate-text", + "sln-mode": "sln-mode", + "ts-fold": "ts-fold", + "ws-butler": "ws-butler" + }, + "locked": { + "lastModified": 1701264882, + "narHash": "sha256-MBXR7x7Ua8qystlGr+lenwjQd7dsFNFpEFmtHhh10zM=", + "owner": "nix-community", + "repo": "nix-doom-emacs", + "rev": "f7413022370f24bb53cb450bfb2803233510113e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-doom-emacs", + "type": "github" + } + }, "nix-flatpak": { "locked": { "lastModified": 1711997201, @@ -83,6 +326,23 @@ "type": "github" } }, + "nix-straight": { + "flake": false, + "locked": { + "lastModified": 1696948727, + "narHash": "sha256-6fQamWVIyeLoFSJl1WKcIl+LUdZluzFla4H+4Z5Cv2E=", + "owner": "codingkoi", + "repo": "nix-straight.el", + "rev": "c64edbf49598453bd85dae1acef9a0f9d294185d", + "type": "github" + }, + "original": { + "owner": "codingkoi", + "ref": "codingkoi/apply-librephoenixs-fix", + "repo": "nix-straight.el", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1725983898, @@ -99,6 +359,22 @@ "type": "github" } }, + "nose": { + "flake": false, + "locked": { + "lastModified": 1400604510, + "narHash": "sha256-daEi8Kta1oGaDEmUUDDQMahTTPOpvNpDKk22rlr7cB0=", + "owner": "emacsattic", + "repo": "nose", + "rev": "f8528297519eba911696c4e68fa88892de9a7b72", + "type": "github" + }, + "original": { + "owner": "emacsattic", + "repo": "nose", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1726059953, @@ -114,15 +390,145 @@ "type": "github" } }, + "ob-racket": { + "flake": false, + "locked": { + "lastModified": 1584656173, + "narHash": "sha256-rBUYDDCXb+3D4xTPQo9UocbTPZ32kWV1Uya/1DmZknU=", + "owner": "xchrishawk", + "repo": "ob-racket", + "rev": "83457ec9e1e96a29fd2086ed19432b9d75787673", + "type": "github" + }, + "original": { + "owner": "xchrishawk", + "repo": "ob-racket", + "type": "github" + } + }, + "org": { + "flake": false, + "locked": { + "lastModified": 1695726851, + "narHash": "sha256-qgbjspklSoI8M3cbCJOcUdjuijRgsL/+PSyEOW9VX4I=", + "owner": "emacs-straight", + "repo": "org-mode", + "rev": "aa9177e1a8b039c357d369c1c9aaab710bb247a9", + "type": "github" + }, + "original": { + "owner": "emacs-straight", + "repo": "org-mode", + "type": "github" + } + }, + "org-contrib": { + "flake": false, + "locked": { + "lastModified": 1694946041, + "narHash": "sha256-X/HFG6NZe5BY00KvGbcsIuf9R6Lg8x7Uhd0Y5+Q3qZU=", + "owner": "emacsmirror", + "repo": "org-contrib", + "rev": "5eabbf22bdd4523c922a30787e98ee66c24221aa", + "type": "github" + }, + "original": { + "owner": "emacsmirror", + "repo": "org-contrib", + "type": "github" + } + }, + "org-yt": { + "flake": false, + "locked": { + "lastModified": 1527381913, + "narHash": "sha256-dzQ6B7ryzatHCTLyEnRSbWO0VUiX/FHYnpHTs74aVUs=", + "owner": "TobiasZawada", + "repo": "org-yt", + "rev": "40cc1ac76d741055cbefa13860d9f070a7ade001", + "type": "github" + }, + "original": { + "owner": "TobiasZawada", + "repo": "org-yt", + "type": "github" + } + }, + "php-extras": { + "flake": false, + "locked": { + "lastModified": 1573312690, + "narHash": "sha256-r4WyVbzvT0ra4Z6JywNBOw5RxOEYd6Qe2IpebHXkj1U=", + "owner": "arnested", + "repo": "php-extras", + "rev": "d410c5af663c30c01d461ac476d1cbfbacb49367", + "type": "github" + }, + "original": { + "owner": "arnested", + "repo": "php-extras", + "type": "github" + } + }, + "revealjs": { + "flake": false, + "locked": { + "lastModified": 1695738029, + "narHash": "sha256-Z9c9Q41jMkj/DyXOiZYyIa7Gmn8VB8yauTyWrSsT+ps=", + "owner": "hakimel", + "repo": "reveal.js", + "rev": "88fbfc5751ad01e3f6adee5819eabeb9e73c3757", + "type": "github" + }, + "original": { + "owner": "hakimel", + "repo": "reveal.js", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "home-manager": "home-manager", + "nix-doom-emacs": "nix-doom-emacs", "nix-flatpak": "nix-flatpak", + "nix-straight": "nix-straight", "nixpkgs": "nixpkgs", "nur": "nur" } }, + "rotate-text": { + "flake": false, + "locked": { + "lastModified": 1322962747, + "narHash": "sha256-SOeOgSlcEIsKhUiYDJv0p+mLUb420s9E2BmvZQvZ0wk=", + "owner": "debug-ito", + "repo": "rotate-text.el", + "rev": "48f193697db996855aee1ad2bc99b38c6646fe76", + "type": "github" + }, + "original": { + "owner": "debug-ito", + "repo": "rotate-text.el", + "type": "github" + } + }, + "sln-mode": { + "flake": false, + "locked": { + "lastModified": 1423727528, + "narHash": "sha256-XqkqPyEJuTtFslOz1fpTf/Klbd/zA7IGpzpmum/MGao=", + "owner": "sensorflo", + "repo": "sln-mode", + "rev": "0f91d1b957c7d2a7bab9278ec57b54d57f1dbd9c", + "type": "github" + }, + "original": { + "owner": "sensorflo", + "repo": "sln-mode", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -137,6 +543,53 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "ts-fold": { + "flake": false, + "locked": { + "lastModified": 1695278494, + "narHash": "sha256-O4NcUC1u08W8ZslqoA/i+iTaLotKwheURXQWBxLLMFc=", + "owner": "jcs-elpa", + "repo": "ts-fold", + "rev": "70b2c79ff4daa7351d4e2917b0343b9a18d4d4f2", + "type": "github" + }, + "original": { + "owner": "jcs-elpa", + "repo": "ts-fold", + "type": "github" + } + }, + "ws-butler": { + "flake": false, + "locked": { + "lastModified": 1634511126, + "narHash": "sha256-c0y0ZPtxxICPk+eaNbbQf6t+FRCliNY54CCz9QHQ8ZI=", + "owner": "hlissner", + "repo": "ws-butler", + "rev": "572a10c11b6cb88293de48acbb59a059d36f9ba5", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "ws-butler", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index e69bb9e..5ec27f8 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,21 @@ }; nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; + + # Follow nix-doom-emacs completely when this is merged or fixed + # - https://github.com/nix-community/nix-doom-emacs/issues/409 + # - https://github.com/nix-community/nix-straight.el/pull/4 + nix-straight = { + url = "github:codingkoi/nix-straight.el?ref=codingkoi/apply-librephoenixs-fix"; + flake = false; + }; + nix-doom-emacs = { + url = "github:nix-community/nix-doom-emacs"; + inputs = { + nix-straight.follows = "nix-straight"; + nixpkgs.follows = "nixpkgs"; + }; + }; }; outputs = inputs@{ @@ -25,6 +40,7 @@ home-manager, agenix, nix-flatpak, + nix-doom-emacs, ... }: let @@ -50,6 +66,8 @@ home-manager.extraSpecialArgs = inputs; home-manager.users.florian.imports = [ nix-flatpak.homeManagerModules.nix-flatpak + nix-doom-emacs.hmModule + ./hosts/${s.name}/home.nix ]; } diff --git a/modules/home/editors/default.nix b/modules/home/editors/default.nix index 40db812..f265d2c 100644 --- a/modules/home/editors/default.nix +++ b/modules/home/editors/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./emacs ./vscode ]; } \ No newline at end of file diff --git a/modules/home/editors/emacs/default.nix b/modules/home/editors/emacs/default.nix new file mode 100644 index 0000000..5a70616 --- /dev/null +++ b/modules/home/editors/emacs/default.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.modules.home.editors.emacs; +in +{ + options.modules.home.editors.emacs = { + enable = mkEnableOption '' + Enable emacs with my custom configurations + ''; + }; + config = mkIf cfg.enable { + programs.doom-emacs = { + enable = true; + doomPrivateDir = ./doom.d; + }; + }; +} \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/config.el b/modules/home/editors/emacs/doom.d/config.el new file mode 100644 index 0000000..576a6e5 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/config.el @@ -0,0 +1,76 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. It is optional. +;; (setq user-full-name "John Doe" +;; user-mail-address "john@doe.com") + +;; Doom exposes five (optional) variables for controlling fonts in Doom: +;; +;; - `doom-font' -- the primary font to use +;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable) +;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; - `doom-symbol-font' -- for symbols +;; - `doom-serif-font' -- for the `fixed-pitch-serif' face +;; +;; See 'C-h v doom-font' for documentation and more examples of what they +;; accept. For example: +;; +;; (setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) +;; +;; If you or Emacs can't find your font, use 'M-x describe-font' to look them +;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to +;; refresh your font settings. If Emacs still can't find your font, it likely +;; wasn't installed correctly. Font issues are rarely Doom issues! + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-one) + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type t) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") + + +;; Whenever you reconfigure a package, make sure to wrap your config in an +;; `after!' block, otherwise Doom's defaults may override your settings. E.g. +;; +;; (after! PACKAGE +;; (setq x y)) +;; +;; The exceptions to this rule: +;; +;; - Setting file/directory variables (like `org-directory') +;; - Setting variables which explicitly tell you to set them before their +;; package is loaded (see 'C-h v VARIABLE' to look up their documentation). +;; - Setting doom variables (which start with 'doom-' or '+'). +;; +;; Here are some additional functions/macros that will help you configure Doom. +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces, +;; etc). +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/init.el b/modules/home/editors/emacs/doom.d/init.el new file mode 100644 index 0000000..aa00999 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/init.el @@ -0,0 +1,195 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a link to Doom's Module Index where all +;; of our modules are listed, including what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;bidi ; (tfel ot) thgir etirw uoy gnipleh + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji +unicode) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + tabs ; a tab bar for Emacs + (treemacs +lsp) ; a project drawer, like neotree but cooler + ;;unicode ; extended unicode support for various languages + (vc-gutter +pretty) ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + ;;(format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + (ibuffer +icons) ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + ;;vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;collab ; buffers with friends + (debugger +lsp) ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp ; M-x vscode + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + ;;pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + tree-sitter ; syntax and parsing, sitting in a tree... + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + (cc +lsp) ; C > C++ == 1 + ;;cloju + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + (dart +flutter +lsp) ; paint ui and not much else + ;;dhall + (elixir +lsp) ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + ;;(graphql +lsp) ; Give queries a REST + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + (java +lsp) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + (kotlin +lsp) ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;;nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + org ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + ;;python ; beautiful is better than ugly + (qt +lsp +xp) ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + (ruby +lsp +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) \ No newline at end of file diff --git a/modules/home/editors/emacs/doom.d/packages.el b/modules/home/editors/emacs/doom.d/packages.el new file mode 100644 index 0000000..be08796 --- /dev/null +++ b/modules/home/editors/emacs/doom.d/packages.el @@ -0,0 +1,52 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/radian-software/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see radian-software/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + +(package! ripgrep) \ No newline at end of file