From 82e26ee498a19cd9870c60b12f24f5df55982ed4 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Thu, 17 Jul 2025 18:10:37 +0200 Subject: [PATCH] many improvements --- .gitmodules | 3 + .sops.yaml | 14 + README.md | 8 +- flake.lock | 182 +++--- flake.nix | 44 +- hosts/lenovo-yoga-usb/configuration.nix | 52 -- hosts/mobile-usb/configuration.nix | 10 + .../default.nix | 13 + .../hardware-configuration.nix | 4 +- hosts/yoga-7-pro/README.md | 14 + hosts/yoga-7-pro/configuration.nix | 27 + hosts/yoga-7-pro/default.nix | 37 ++ hosts/yoga-7-pro/hardware-configuration.nix | 59 ++ modules/home-manager/backup.nix | 25 - modules/home-manager/browser.nix | 6 +- modules/home-manager/code.nix | 321 ++++++----- modules/home-manager/directories.nix | 22 + modules/home-manager/documents.nix | 4 + modules/home-manager/fish.nix | 7 +- modules/home-manager/flatpaks.nix | 2 + modules/home-manager/hypr/cursor.nix | 7 - modules/home-manager/hypr/default.nix | 4 +- modules/home-manager/hypr/hypridle.nix | 26 +- .../hypr/hyprland-customization.nix | 251 -------- .../home-manager/hypr/hyprland/autostart.nix | 30 + .../home-manager/hypr/hyprland/default.nix | 9 + .../home-manager/hypr/hyprland/general.nix | 133 +++++ .../home-manager/hypr/hyprland/keybinds.nix | 135 +++++ .../home-manager/hypr/hyprland/layouts.nix | 57 ++ .../home-manager/hypr/hyprland/packages.nix | 20 + modules/home-manager/hypr/hyprlock.nix | 8 +- modules/home-manager/hypr/hyprpaper.nix | 49 +- modules/home-manager/hypr/waybar.nix | 543 ++++++++++-------- modules/home-manager/kubectl.nix | 9 +- modules/home-manager/launcher.nix | 112 ++++ modules/home-manager/notifications.nix | 110 ++++ modules/home-manager/ssh.nix | 3 + modules/home-manager/stylix.nix | 8 +- modules/home-manager/uxplay.nix | 9 + modules/home-manager/wofi.nix | 192 ++++--- modules/home-manager/xdg-portals.nix | 10 + modules/nixos/agenix.nix | 7 + modules/nixos/backup.nix | 88 +++ modules/nixos/bluetooth.nix | 16 + modules/nixos/hyprland.nix | 15 +- modules/nixos/language.nix | 11 + modules/nixos/networking.nix | 42 +- modules/nixos/pipewire.nix | 2 +- modules/nixos/power.nix | 93 ++- modules/nixos/user.nix | 27 + secrets | 1 + secrets/secrets.nix | 11 - secrets/wifi.age | Bin 809 -> 0 bytes users/remy.nix | 9 - users/{remy_yoga-usb => remy_usb}/default.nix | 5 +- users/remy_yoga/default.nix | 40 ++ utils/unfree.nix | 4 + variable.nix | 25 - 58 files changed, 1970 insertions(+), 1005 deletions(-) create mode 100644 .gitmodules create mode 100644 .sops.yaml delete mode 100644 hosts/lenovo-yoga-usb/configuration.nix create mode 100644 hosts/mobile-usb/configuration.nix rename hosts/{lenovo-yoga-usb => mobile-usb}/default.nix (77%) rename hosts/{lenovo-yoga-usb => mobile-usb}/hardware-configuration.nix (94%) create mode 100644 hosts/yoga-7-pro/README.md create mode 100644 hosts/yoga-7-pro/configuration.nix create mode 100644 hosts/yoga-7-pro/default.nix create mode 100644 hosts/yoga-7-pro/hardware-configuration.nix delete mode 100644 modules/home-manager/backup.nix create mode 100644 modules/home-manager/directories.nix delete mode 100644 modules/home-manager/hypr/cursor.nix delete mode 100644 modules/home-manager/hypr/hyprland-customization.nix create mode 100644 modules/home-manager/hypr/hyprland/autostart.nix create mode 100644 modules/home-manager/hypr/hyprland/default.nix create mode 100644 modules/home-manager/hypr/hyprland/general.nix create mode 100644 modules/home-manager/hypr/hyprland/keybinds.nix create mode 100644 modules/home-manager/hypr/hyprland/layouts.nix create mode 100644 modules/home-manager/hypr/hyprland/packages.nix create mode 100644 modules/home-manager/launcher.nix create mode 100644 modules/home-manager/notifications.nix create mode 100644 modules/home-manager/uxplay.nix create mode 100644 modules/nixos/agenix.nix create mode 100644 modules/nixos/backup.nix create mode 100644 modules/nixos/language.nix create mode 100644 modules/nixos/user.nix create mode 160000 secrets delete mode 100644 secrets/secrets.nix delete mode 100644 secrets/wifi.age rename users/{remy_yoga-usb => remy_usb}/default.nix (92%) create mode 100644 users/remy_yoga/default.nix create mode 100644 utils/unfree.nix delete mode 100644 variable.nix diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f85e299 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "secrets"] + path = secrets + url = ssh://git@git.kluster.moll.re:2222/remoll/nixos-secrets.git diff --git a/.sops.yaml b/.sops.yaml new file mode 100644 index 0000000..cdc46e0 --- /dev/null +++ b/.sops.yaml @@ -0,0 +1,14 @@ +# This example uses YAML anchors which allows reuse of multiple keys +# without having to repeat yourself. +# Also see https://github.com/Mic92/dotfiles/blob/d6114726d859df36ccaa32891c4963ae5717ef7f/nixos/.sops.yaml +# for a more complex example. +keys: + - &remy_usb age1027e2vu808mvf95m4f0am3aeg88n8vgzt56s04ndpkgm7awzeajspxl6tu + - &remy_yoga age1t2stzdjfwrtekk23w43623fdvt9awdujth765f8l6mu9g6l4537q4gw8d0 + # - &admin_bob age12zlz6lvcdk6eqaewfylg35w0syh58sm7gh53q5vvn7hd7c6nngyseftjxl +creation_rules: + - path_regex: secrets/[^/]+\.(yaml|json|env|ini)$ + key_groups: + - age: + - *remy_usb + - *remy_yoga diff --git a/README.md b/README.md index 71d3b18..2e1f9c0 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ TODO - disable root user - https://github.com/anotherhadi/nixy - https://github.com/Numb-0/nix-0 - https://github.com/Frost-Phoenix/nixos-config -- https://github.com/elifouts/Dotfiles - https://github.com/nomadics9/nixcfg - https://github.com/Daholli/nixos-config - https://github.com/khaneliman/khanelinix @@ -78,3 +77,10 @@ TODO - disable root user - https://github.com/luisnquin/nixos-config - https://gitlab.com/fisuri/dotfiles - https://github.com/NobbZ/nixos-config +- https://code.maralorn.de/maralorn/config/ +- https://github.com/sameemul-haque/dotfiles + + +#### Hyprland specific +- https://github.com/elifouts/Dotfiles +- https://github.com/Abhra00/hyprdots diff --git a/flake.lock b/flake.lock index 7f21752..0dfaad1 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1745357003, - "narHash": "sha256-jYwzQkv1r7HN/4qrAuKp+NR4YYNp2xDrOX5O9YVqkWo=", + "lastModified": 1749155310, + "narHash": "sha256-t0HfHg/1+TbSra5s6nNM0o4tnb3uqWedShSpZXsUMYY=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "a19cf76ee1a15c1c12083fa372747ce46387289f", + "rev": "94981cf75a9f11da0b6dd6a1abbd7c50a36ab2d3", "type": "github" }, "original": { @@ -279,16 +279,16 @@ ] }, "locked": { - "lastModified": 1747331121, - "narHash": "sha256-3MmiUN/jOHBHQUnjqzg6qKArc17j2OS6jisEppDY4g8=", + "lastModified": 1749154018, + "narHash": "sha256-gjN3j7joRvT3a8Zgcylnd4NFsnXeDBumqiu4HmY1RIg=", "owner": "nix-community", "repo": "home-manager", - "rev": "1eec32f0efe3b830927989767a9e6ece0d82d608", + "rev": "7aae0ee71a17b19708b93b3ed448a1a0952bf111", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-24.11", + "ref": "release-25.05", "repo": "home-manager", "type": "github" } @@ -323,11 +323,11 @@ ] }, "locked": { - "lastModified": 1747747328, - "narHash": "sha256-3Gc5CqAJqpvI4gIU1Oxbl5w440b+rY9HvDzs5C0ChBA=", + "lastModified": 1743604125, + "narHash": "sha256-ZD61DNbsBt1mQbinAaaEqKaJk2RFo9R/j+eYWeGMx7A=", "owner": "nix-community", "repo": "home-manager", - "rev": "65d2282ff6cf560f54997013bd1e575fbd0a7ebf", + "rev": "180fd43eea296e62ae68e079fcf56aba268b9a1a", "type": "github" }, "original": { @@ -352,11 +352,11 @@ ] }, "locked": { - "lastModified": 1745948457, - "narHash": "sha256-lzTV10FJTCGNtMdgW5YAhCAqezeAzKOd/97HbQK8GTU=", + "lastModified": 1749155331, + "narHash": "sha256-XR9fsI0zwLiFWfqi/pdS/VD+YNorKb3XIykgTg4l1nA=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "ac903e80b33ba6a88df83d02232483d99f327573", + "rev": "45fcc10b4c282746d93ec406a740c43b48b4ef80", "type": "github" }, "original": { @@ -381,11 +381,11 @@ ] }, "locked": { - "lastModified": 1745015490, - "narHash": "sha256-apEJ9zoSzmslhJ2vOKFcXTMZLUFYzh1ghfB6Rbw3Low=", + "lastModified": 1749238452, + "narHash": "sha256-8qiKEWcxUrjpUpK+WyFNg/72C8rp70LUuyTD23T+SdQ=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "60754910946b4e2dc1377b967b7156cb989c5873", + "rev": "c7225d73755a6c4c7c72f4d4f3925ea426e325a8", "type": "github" }, "original": { @@ -410,11 +410,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1747503792, - "narHash": "sha256-Okd5cu0jxGa+x4xpfMX9S8QH/zddaFUQvw97V6H2W3E=", + "lastModified": 1750106438, + "narHash": "sha256-zaTFR6NLaXkveEGl2kdl4UlvT7eHm3cYSbgSkibCO+M=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "705b97c4ac93148820012c701fe39445cf76a590", + "rev": "0ece4af36a988ad06b28ed666011d84372d9e4dc", "type": "github" }, "original": { @@ -435,11 +435,11 @@ ] }, "locked": { - "lastModified": 1743714874, - "narHash": "sha256-yt8F7NhMFCFHUHy/lNjH/pjZyIDFNk52Q4tivQ31WFo=", + "lastModified": 1749046714, + "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "3a5c2bda1c1a4e55cc1330c782547695a93f05b2", + "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330", "type": "github" }, "original": { @@ -467,11 +467,11 @@ ] }, "locked": { - "lastModified": 1737634706, - "narHash": "sha256-nGCibkfsXz7ARx5R+SnisRtMq21IQIhazp6viBU8I/A=", + "lastModified": 1749154592, + "narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=", "owner": "hyprwm", "repo": "hyprland-qt-support", - "rev": "8810df502cdee755993cb803eba7b23f189db795", + "rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074", "type": "github" }, "original": { @@ -503,11 +503,11 @@ ] }, "locked": { - "lastModified": 1745951494, - "narHash": "sha256-2dModE32doiyQMmd6EDAQeZnz+5LOs6KXyE0qX76WIg=", + "lastModified": 1749155776, + "narHash": "sha256-t1PM0wxQLQwv2F2AW23uA7pm5giwmcgYEWbNIRct9r4=", "owner": "hyprwm", "repo": "hyprland-qtutils", - "rev": "4be1d324faf8d6e82c2be9f8510d299984dfdd2e", + "rev": "396e8aa1c06274835b69da7f9a015fff9a9b7522", "type": "github" }, "original": { @@ -532,11 +532,11 @@ ] }, "locked": { - "lastModified": 1746655412, - "narHash": "sha256-kVQ0bHVtX6baYxRWWIh4u3LNJZb9Zcm2xBeDPOGz5BY=", + "lastModified": 1749145882, + "narHash": "sha256-qr0KXeczF8Sma3Ae7+dR2NHhvG7YeLBJv19W4oMu6ZE=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "557241780c179cf7ef224df392f8e67dab6cef83", + "rev": "1bfb84f54d50c7ae6558c794d3cfd5f6a7e6e676", "type": "github" }, "original": { @@ -557,11 +557,11 @@ ] }, "locked": { - "lastModified": 1746635225, - "narHash": "sha256-W9G9bb0zRYDBRseHbVez0J8qVpD5QbizX67H/vsudhM=", + "lastModified": 1749819919, + "narHash": "sha256-7F/KG8dwSH9JXdlpOVrEEArS+PJSn0iEnx5eVCk89/I=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "674ea57373f08b7609ce93baff131117a0dfe70d", + "rev": "57ab2a867d8b554ad89f29060c15efd11631db91", "type": "github" }, "original": { @@ -582,11 +582,11 @@ ] }, "locked": { - "lastModified": 1739870480, - "narHash": "sha256-SiDN5BGxa/1hAsqhgJsS03C3t2QrLgBT8u+ENJ0Qzwc=", + "lastModified": 1749145760, + "narHash": "sha256-IHaGWpGrv7seFWdw/1A+wHtTsPlOGIKMrk1TUIYJEFI=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "206367a08dc5ac4ba7ad31bdca391d098082e64b", + "rev": "817918315ea016cc2d94004bfb3223b5fd9dfcc6", "type": "github" }, "original": { @@ -613,11 +613,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747327360, - "narHash": "sha256-LSmTbiq/nqZR9B2t4MRnWG7cb0KVNU70dB7RT4+wYK4=", + "lastModified": 1749794982, + "narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e06158e58f3adee28b139e9c2bcfcc41f8625b46", + "rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81", "type": "github" }, "original": { @@ -629,11 +629,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1747327360, - "narHash": "sha256-LSmTbiq/nqZR9B2t4MRnWG7cb0KVNU70dB7RT4+wYK4=", + "lastModified": 1749794982, + "narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e06158e58f3adee28b139e9c2bcfcc41f8625b46", + "rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81", "type": "github" }, "original": { @@ -645,16 +645,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1747335874, - "narHash": "sha256-IKKIXTSYJMmUtE+Kav5Rob8SgLPnfnq4Qu8LyT4gdqQ=", + "lastModified": 1750005367, + "narHash": "sha256-h/aac1dGLhS3qpaD2aZt25NdKY7b+JT0ZIP2WuGsJMU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ba8b70ee098bc5654c459d6a95dfc498b91ff858", + "rev": "6c64dabd3aa85e0c02ef1cdcb6e1213de64baee3", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.11", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } @@ -685,11 +685,11 @@ ] }, "locked": { - "lastModified": 1747372754, - "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", + "lastModified": 1749636823, + "narHash": "sha256-WUaIlOlPLyPgz9be7fqWJA5iG6rHcGRtLERSCfUDne4=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", + "rev": "623c56286de5a3193aa38891a6991b28f9bab056", "type": "github" }, "original": { @@ -705,11 +705,32 @@ "nix-flatpak": "nix-flatpak", "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", + "sops-nix": "sops-nix", "stylix": "stylix", - "superfreq": "superfreq", + "watt": "watt", "zen-browser": "zen-browser" } }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750119275, + "narHash": "sha256-Rr7Pooz9zQbhdVxux16h7URa6mA80Pb/G07T4lHvh0M=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "77c423a03b9b2b79709ea2cb63336312e78b72e2", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -729,11 +750,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1747543250, - "narHash": "sha256-NuT/y8zMRFG0I3KeMSLxCXCO/d9TEEB0ZTXcYdYENWw=", + "lastModified": 1747771231, + "narHash": "sha256-DYdmj22ZvkN5x9/VtdV5Wnze+UaPuboYraCPnOWn6u4=", "owner": "danth", "repo": "stylix", - "rev": "5ff94fe0108bb361bddfbe1541713c93f369554a", + "rev": "66f554e4e32d804bcf2c007a7b7efef04a3773b0", "type": "github" }, "original": { @@ -743,26 +764,6 @@ "type": "github" } }, - "superfreq": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1747578749, - "narHash": "sha256-MR8NuCe3Xq2MNLPdKE3+4VVw2e+UlwwDTM3U3RMJRig=", - "owner": "NotAShelf", - "repo": "superfreq", - "rev": "6bdbc7e0ecd06866b940765942c6abe2fbad5ec7", - "type": "github" - }, - "original": { - "owner": "NotAShelf", - "repo": "superfreq", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1689347949, @@ -843,6 +844,27 @@ "type": "github" } }, + "watt": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749377316, + "narHash": "sha256-hw3rL4rlIlYJMTeE7DlQ3lRhQDJURAhE+PC/NT4VAAQ=", + "owner": "NotAShelf", + "repo": "watt", + "rev": "154724c7b1bd49654ea55df719e1eb3219ec2000", + "type": "github" + }, + "original": { + "owner": "NotAShelf", + "ref": "v0.3.2", + "repo": "watt", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": [ @@ -871,11 +893,11 @@ ] }, "locked": { - "lastModified": 1745871725, - "narHash": "sha256-M24SNc2flblWGXFkGQfqSlEOzAGZnMc9QG3GH4K/KbE=", + "lastModified": 1749490041, + "narHash": "sha256-R9Dn9IyUdPaJHD2Oqd7XJnnxpka6M6UYw4Ld0iA46HM=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "76bbf1a6b1378e4ab5230bad00ad04bc287c969e", + "rev": "3cf35e178bc192ee51e3fddfd69e531e2c106a30", "type": "github" }, "original": { @@ -892,11 +914,11 @@ ] }, "locked": { - "lastModified": 1747747949, - "narHash": "sha256-Ax1S/YaEovDKz9M71AweVpDxqJiTn/tHowbbUTb4gSo=", + "lastModified": 1750130285, + "narHash": "sha256-fauK56RkWQcNaDOehxxE2lcmNG0Vi++4KWlFQIJm4QE=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "5f7f77c79f1e7512ead0bed4e8b4bbcef8d80b38", + "rev": "00b7edda741d3380fa123f053efd59774361d888", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 97fb5f2..cf2c51b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,10 @@ description = "Nix config entry point"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Home manager - home-manager.url = "github:nix-community/home-manager/release-24.11"; + home-manager.url = "github:nix-community/home-manager/release-25.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # Managing flatpak apps nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; @@ -19,10 +19,14 @@ zen-browser.inputs.nixpkgs.follows = "nixpkgs"; # power management - superfreq = { - url = "github:NotAShelf/superfreq"; + watt = { + url = "github:NotAShelf/watt/?ref=v0.3.2"; inputs.nixpkgs.follows = "nixpkgs"; }; + + # secrets + sops-nix.url = "github:Mic92/sops-nix"; + sops-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { @@ -30,6 +34,7 @@ nixpkgs, home-manager, stylix, + sops-nix, ... } @ inputs: let @@ -45,7 +50,7 @@ modules = [ ./hosts/spectre-x360-2018 stylix.nixosModules.stylix - inputs.superfreq.nixosModules.default + inputs.watt.nixosModules.default home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; @@ -66,9 +71,9 @@ specialArgs = { inherit inputs; }; modules = [ - ./hosts/lenovo-yoga-usb + ./hosts/mobile-usb stylix.nixosModules.stylix - inputs.superfreq.nixosModules.default + inputs.watt.nixosModules.default home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; @@ -76,7 +81,7 @@ home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.users.remy.imports = [ - ./users/remy_yoga-usb + ./users/remy_usb inputs.nix-flatpak.homeManagerModules.nix-flatpak ]; } @@ -84,6 +89,29 @@ }; + nixosConfigurations.nyx = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + + modules = [ + ./hosts/yoga-7-pro + sops-nix.nixosModules.sops + stylix.nixosModules.stylix + inputs.watt.nixosModules.default + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + + home-manager.users.remy.imports = [ + ./users/remy_yoga + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + } + ]; + }; + # nixosConfigurations.raspberry-pi = nixpkgs.lib.nixosSystem { # system = "aarch64-linux"; # modules = [ diff --git a/hosts/lenovo-yoga-usb/configuration.nix b/hosts/lenovo-yoga-usb/configuration.nix deleted file mode 100644 index f2b979a..0000000 --- a/hosts/lenovo-yoga-usb/configuration.nix +++ /dev/null @@ -1,52 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # Use the "experimental" flakes for cleaner config - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nixpkgs.config.allowUnfree = true; - - - # Use latest kernel. - boot.kernelPackages = pkgs.linuxPackages_latest; - - networking.hostName = "nichts"; - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - # i18n.supportedLocales = [ "en_US.UTF-8" "de_DE.UTF-8" ]; - - - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.remy = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - }; - - - networking.networkmanager.wifi.powersave = true; - - - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "24.05"; # Did you read the comment? -} - diff --git a/hosts/mobile-usb/configuration.nix b/hosts/mobile-usb/configuration.nix new file mode 100644 index 0000000..9c8a973 --- /dev/null +++ b/hosts/mobile-usb/configuration.nix @@ -0,0 +1,10 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +{ + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.05"; # Did you read the comment? +} diff --git a/hosts/lenovo-yoga-usb/default.nix b/hosts/mobile-usb/default.nix similarity index 77% rename from hosts/lenovo-yoga-usb/default.nix rename to hosts/mobile-usb/default.nix index 3c3f940..783faf1 100644 --- a/hosts/lenovo-yoga-usb/default.nix +++ b/hosts/mobile-usb/default.nix @@ -1,15 +1,24 @@ {lib, config, options, pkgs, ...}: { + config = { + nix-config = { + networking.hostName = "nichts"; + + userName = "remy"; + }; + }; # Merge the configuration and hardware configuration imports = [ ./configuration.nix ./hardware-configuration.nix + ../../modules/nixos/bluetooth.nix ../../modules/nixos/flakes.nix ../../modules/nixos/flatpak.nix ../../modules/nixos/fonts.nix ../../modules/nixos/hyprland.nix + ../../modules/nixos/language.nix ../../modules/nixos/ld.nix ../../modules/nixos/monitoring.nix ../../modules/nixos/networking.nix @@ -19,7 +28,11 @@ ../../modules/nixos/power.nix ../../modules/nixos/stylix.nix ../../modules/nixos/usb_config.nix + ../../modules/nixos/user.nix + + ../../utils/binary-cache.nix ../../utils/garbage-collection.nix + ../../utils/unfree.nix ]; } diff --git a/hosts/lenovo-yoga-usb/hardware-configuration.nix b/hosts/mobile-usb/hardware-configuration.nix similarity index 94% rename from hosts/lenovo-yoga-usb/hardware-configuration.nix rename to hosts/mobile-usb/hardware-configuration.nix index 7861dd8..2c0ee72 100644 --- a/hosts/lenovo-yoga-usb/hardware-configuration.nix +++ b/hosts/mobile-usb/hardware-configuration.nix @@ -8,9 +8,9 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; + boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; fileSystems."/" = diff --git a/hosts/yoga-7-pro/README.md b/hosts/yoga-7-pro/README.md new file mode 100644 index 0000000..239183f --- /dev/null +++ b/hosts/yoga-7-pro/README.md @@ -0,0 +1,14 @@ +Installed using +``` +> sudo nixos-install --root /tmp/new-install/ --flake .#nyx --impure --no-root-passwd +``` + +where `/tmp/new-install` was the moint point of the target FS. + +The root user is effectively deactivated, hence the additional setup: +- users are part of the `wheel` group +- password needs to be set before first boot: + - `nix-enter --root /tmp/new-install` + - `passwd ` + + diff --git a/hosts/yoga-7-pro/configuration.nix b/hosts/yoga-7-pro/configuration.nix new file mode 100644 index 0000000..5572347 --- /dev/null +++ b/hosts/yoga-7-pro/configuration.nix @@ -0,0 +1,27 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +{ + + boot.loader = { + systemd-boot.enable = true; + timeout = 0; + efi.canTouchEfiVariables = true; + }; + + # cause it is so inconveniently located + services.logind.powerKey = "ignore"; + services.logind.lidSwitch = "sleep"; + services.logind.lidSwitchDocked = "ignore"; + + # requires too many shenanigans so I just install using --no-root-passwd + # users.users.root.hashedPassword = "!"; + + nixpkgs.config.allowUnfree = true; + + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.05"; # Did you read the comment? +} diff --git a/hosts/yoga-7-pro/default.nix b/hosts/yoga-7-pro/default.nix new file mode 100644 index 0000000..a3c9fd4 --- /dev/null +++ b/hosts/yoga-7-pro/default.nix @@ -0,0 +1,37 @@ +{ + config = { + nix-config = { + networking.hostName = "nyx"; + + userName = "remy"; + }; + }; + + # Merge the configuration and hardware configuration + imports = [ + ./configuration.nix + ./hardware-configuration.nix + + ../../modules/nixos/backup.nix + ../../modules/nixos/bluetooth.nix + ../../modules/nixos/flakes.nix + ../../modules/nixos/flatpak.nix + ../../modules/nixos/fonts.nix + ../../modules/nixos/hyprland.nix + ../../modules/nixos/language.nix + ../../modules/nixos/ld.nix + ../../modules/nixos/monitoring.nix + ../../modules/nixos/networking.nix + ../../modules/nixos/nh.nix + ../../modules/nixos/pipewire.nix + ../../modules/nixos/podman.nix + ../../modules/nixos/power.nix + ../../modules/nixos/stylix.nix + ../../modules/nixos/user.nix + + ../../utils/binary-cache.nix + ../../utils/garbage-collection.nix + ../../utils/unfree.nix + ]; +} + diff --git a/hosts/yoga-7-pro/hardware-configuration.nix b/hosts/yoga-7-pro/hardware-configuration.nix new file mode 100644 index 0000000..69add7d --- /dev/null +++ b/hosts/yoga-7-pro/hardware-configuration.nix @@ -0,0 +1,59 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1ea0784c-4eeb-46f1-a0ae-f6b311b27bd1"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."luks-root" = { + device = "/dev/disk/by-uuid/8832c090-9ca7-4a9c-8cfd-cf43cb59b3d3"; + crypttabExtraOpts = [ "fido2-token=auto" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/86C2-FD4D"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/1ea0784c-4eeb-46f1-a0ae-f6b311b27bd1"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + # TODO - only enable this if the user remy exists + fileSystems."/home/${config.nix-config.userName}/scratch" = + { device = "/dev/disk/by-uuid/1ea0784c-4eeb-46f1-a0ae-f6b311b27bd1"; + fsType = "btrfs"; + options = [ "subvol=@scratch" ]; + # TODO make it owned by the user + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wireguard-home.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp192s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/home-manager/backup.nix b/modules/home-manager/backup.nix deleted file mode 100644 index c843f07..0000000 --- a/modules/home-manager/backup.nix +++ /dev/null @@ -1,25 +0,0 @@ -{pkgs, ...}: -{ - # Add a udev rule that launches a backup using restic when a specific USB device (the backup drive) is plugged in - - environment.systemPackages = with pkgs; [ - restic - ]; - - # the udev rule: - services.udev.extraRules = '' - ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="backup-restic", TAG+="systemd", ENV{SYSTEMD_WANTS}="backup-restic.service" - ''; - - # the systemd service: - systemd.services.backup-restic = { - description = "Backup using restic (triggered when USB drive is plugged in)"; - after = [ "local-fs.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - # TODO: adapt command - ExecStart = "${pkgs.restic}/bin/restic backup /home/username"; - }; - }; -} diff --git a/modules/home-manager/browser.nix b/modules/home-manager/browser.nix index 2788486..9f7b73d 100644 --- a/modules/home-manager/browser.nix +++ b/modules/home-manager/browser.nix @@ -28,9 +28,9 @@ profiles.default = { search = { force = true; - default = "DuckDuckGo"; - privateDefault = "DuckDuckGo"; - order = ["DuckDuckGo" "Google"]; + default = "ddg"; + privateDefault = "ddg"; + order = ["ddg" "google"]; }; settings = { "browser.startup.homepage" = "about:home"; diff --git a/modules/home-manager/code.nix b/modules/home-manager/code.nix index 4b5a8d8..d2f1ebc 100644 --- a/modules/home-manager/code.nix +++ b/modules/home-manager/code.nix @@ -1,153 +1,192 @@ {pkgs, ...}: +let + baseExtensions = with pkgs.vscode-extensions; [ + # QOL + mhutchie.git-graph + redhat.vscode-yaml + github.copilot + github.copilot-chat + + # Nix environment selector + arrterian.nix-env-selector + ]; + baseSettings = { + # visual + "window.menuBarVisibility" = "toggle"; + + "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'monospace', monospace"; + "terminal.integrated.fontFamily" = "FiraCode Nerd Font Mono"; + "workbench.iconTheme" = "vs-seti"; + + # telemetry + "telemetry.enableCrashReporter" = false; + "telemetry.enableTelemetry" = false; + "redhat.telemetry.enabled" = false; + + # editor QOL + "security.workspace.trust.untrustedFiles" = "open"; + "editor.wordWrap" = "on"; + "editor.suggestSelection" = "first"; + "editor.renderWhitespace" = "none"; + "editor.acceptSuggestionOnEnter" = "off"; + "editor.fontLigatures" = true; + "editor.inlineSuggest.enabled" = true; + "editor.bracketPairColorization.enabled" = true; + "editor.unicodeHighlight.nonBasicASCII" = false; + "editor.unicodeHighlight.invisibleCharacters" = false; + "editor.unicodeHighlight.ambiguousCharacters" = false; + + "files.autoSave" = "onWindowChange"; + "files.autoSaveDelay" = 1000; + "files.insertFinalNewline" = true; + "files.trimTrailingWhitespace" = true; + + "explorer.confirmDelete" = false; + "explorer.confirmDragAndDrop" = false; + "terminal.integrated.enableMultiLinePasteWarning" = false; + "update.showReleaseNotes" = false; + "terminal.external.linuxExec" = "kitty"; + "workbench.startupEditor" = "newUntitledFile"; + + # Extension management + "extensions.autoCheckUpdates" = false; + "extensions.autoUpdate" = false; + "extensions.ignoreRecommendations" = true; + + # git + "git.ignoreMissingGitWarning" = true; + "git.confirmSync" = false; + "git.enableSmartCommit" = true; + "git.autofetch" = true; + "diffEditor.renderSideBySide" = false; + "diffEditor.hideUnchangedRegions.enabled" = true; + "diffEditor.ignoreTrimWhitespace" = false; + + # Copilot + "github.copilot.editor.enableAutoCompletions" = true; + "github.copilot.advanced" = {}; + "github.copilot.enable" = { + "*" = true; + }; + + # Python + "python.terminal.activateEnvironment" = false; # let nix-shell handle this + }; + + baseKeybindings = [ + # comment/uncomment line + { + key = "ctrl+[Backslash]"; # was ctrl+# but vscode reads the key differently apparently + command = "editor.action.commentLine"; + when = "editorTextFocus"; + } + ]; + +in { programs.vscode = { enable = true; # install vscode in a FHS environment to allow extensions with prebuilt binaries # package = pkgs.vscode.fhs; - # profiles = { - # default = { - extensions = with pkgs.vscode-extensions; [ - # QOL - mhutchie.git-graph - redhat.vscode-yaml - github.copilot - - # python - ms-python.python - ms-python.isort - ms-python.debugpy - ms-python.vscode-pylance - # ms-toolsai.jupyter - # ms-toolsai.vscode-jupyter-slideshow - # ms-toolsai.jupyter-renderers - - # Nix language - jnoortheen.nix-ide - - # typst - myriad-dreamin.tinymist - ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2025.3.2025032101"; - sha256 = "sha256-s2qEUl9J6EOije6MasZOnHErYs3NYXBqLSfMT03vEH0="; - } - { - name = "jupyter-hub"; - publisher = "ms-toolsai"; - version = "2024.10.1002831100"; - sha256 = "sha256-5IRczwXbYkDdYEOXvQnnH+HJNLvsRsrZ6fnoVCveqrs="; - } - ]; - - keybindings = [ - # comment/uncomment line - { - key = "ctrl+#"; - command = "editor.action.commentLine"; - when = "editorTextFocus"; - } - # run code cell in jupyter - { - key = "ctrl+enter"; - command = "jupyter.runCell"; - when = "editorTextFocus && editorHasSelection && jupyter.notebookEditorFocused"; - } - ]; - - userSettings = { - # visual - "window.menuBarVisibility" = "toggle"; - - "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'monospace', monospace"; - "terminal.integrated.fontFamily" = "FiraCode Nerd Font Mono"; - "workbench.iconTheme" = "vs-seti"; - - # telemetry - "telemetry.enableCrashReporter" = false; - "telemetry.enableTelemetry" = false; - "redhat.telemetry.enabled" = false; - - - # editor QOL - "security.workspace.trust.untrustedFiles" = "open"; - "editor.wordWrap" = "on"; - "editor.suggestSelection" = "first"; - "editor.renderWhitespace" = "none"; - "editor.acceptSuggestionOnEnter" = "off"; - "editor.fontLigatures" = true; - "editor.inlineSuggest.enabled" = true; - "editor.bracketPairColorization.enabled" = true; - "editor.unicodeHighlight.nonBasicASCII" = false; - "editor.unicodeHighlight.invisibleCharacters" = false; - "editor.unicodeHighlight.ambiguousCharacters" = false; - - "files.autoSave" = "onWindowChange"; - "files.autoSaveDelay" = 1000; - "files.insertFinalNewline" = true; - "files.trimTrailingWhitespace" = true; - - "explorer.confirmDelete" = false; - "explorer.confirmDragAndDrop" = false; - "terminal.integrated.enableMultiLinePasteWarning" = false; - "update.showReleaseNotes" = false; - "terminal.external.linuxExec" = "kitty"; - "workbench.startupEditor" = "newUntitledFile"; - # "workbench.colorTheme" = "Default Light+"; - - # Extension management - "extensions.autoCheckUpdates" = false; - "extensions.autoUpdate" = false; - "extensions.ignoreRecommendations" = true; - - - # git - "git.ignoreMissingGitWarning" = true; - "git.confirmSync" = false; - "git.enableSmartCommit" = true; - "git.autofetch" = true; - "diffEditor.renderSideBySide" = false; - "diffEditor.hideUnchangedRegions.enabled" = true; - "diffEditor.ignoreTrimWhitespace" = false; - - # Copilot - "github.copilot.editor.enableAutoCompletions" = true; - "github.copilot.advanced" = {}; - "github.copilot.enable" = { - "*" = true; + profiles.default = { + userSettings = baseSettings // { + "window.newWindowProfile" = "development"; }; - - # Python - "python.terminal.activateEnvironment" = false; # let nix-shell handle this - "jupyter.disableJupyterAutoStart" = true; - "jupyter.askForKernelRestart" = false; - "workbench.editorAssociations" = { - "*.ipynb" = "jupyter-notebook"; - }; - "notebook.cellToolbarLocation" = { - "default" = "right"; - "jupyter-notebook" = "left"; - }; - "jupyter.widgetScriptSources" = [ - "jsdelivr.com" - "unpkg.com" - ]; - - - # Typst - "[typst]" = { - "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"; - }; - "[typst-code]" = { - "git.openRepositoryInParentFolders" = "never"; - "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"; - }; - "tinymist.fontPaths" = [ - "./font" - ]; }; + + profiles.development = { + extensions = baseExtensions ++ (with pkgs.vscode-extensions; [ + # python + ms-python.python + ms-python.isort + ms-python.debugpy + ms-python.vscode-pylance + + # nix language + jnoortheen.nix-ide + + # Flutter and co + dart-code.flutter + dart-code.dart-code + + ]); + + keybindings = baseKeybindings; + + userSettings = baseSettings; + }; + + + profiles.science = { + extensions = baseExtensions ++ (with pkgs.vscode-extensions; [ + # python + jupyter + ms-python.python + ms-python.isort + ms-python.debugpy + ms-python.vscode-pylance + ms-toolsai.vscode-jupyter-slideshow + ms-toolsai.jupyter-renderers + + # Typst + myriad-dreamin.tinymist + ]) ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2025.3.2025032101"; + sha256 = "sha256-s2qEUl9J6EOije6MasZOnHErYs3NYXBqLSfMT03vEH0="; + } + { + name = "jupyter-hub"; + publisher = "ms-toolsai"; + version = "2024.10.1002831100"; + sha256 = "sha256-5IRczwXbYkDdYEOXvQnnH+HJNLvsRsrZ6fnoVCveqrs="; + } + ]; + + keybindings = baseKeybindings ++ [ + # run code cell in jupyter + { + key = "ctrl+enter"; + command = "jupyter.runcurrentcell"; + when = "editorTextFocus && isWorkspaceTrusted && jupyter.hascodecells && !editorHasSelection && !isCompositeNotebook && !notebookEditorFocused"; + } + ]; + + userSettings = baseSettings // { + "jupyter.disableJupyterAutoStart" = true; + "jupyter.askForKernelRestart" = false; + "workbench.editorAssociations" = { + "*.ipynb" = "jupyter-notebook"; + }; + "notebook.cellToolbarLocation" = { + "default" = "right"; + "jupyter-notebook" = "left"; + }; + "jupyter.widgetScriptSources" = [ + "jsdelivr.com" + "unpkg.com" + ]; + + # Typst + "[typst]" = { + "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"; + }; + "[typst-code]" = { + "git.openRepositoryInParentFolders" = "never"; + "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"; + }; + "tinymist.fontPaths" = [ + "./font" + ]; + "workbench.colorCustomizations" = { + "statusBar.background" = "#003f9293"; + }; + + }; + }; + }; } diff --git a/modules/home-manager/directories.nix b/modules/home-manager/directories.nix new file mode 100644 index 0000000..bdc27f2 --- /dev/null +++ b/modules/home-manager/directories.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: +{ + # Set up essential directories in the home directory + # TODO + # home.file."Dev".directory = true; + # home.file."owncloud".directory = true; + + # Set XDG user directories + xdg.userDirs = { + enable = true; + createDirectories = true; + documents = "${config.home.homeDirectory}/Documents"; + download = "${config.home.homeDirectory}/Downloads"; + pictures = "${config.home.homeDirectory}/Pictures";# + # do not create the following + desktop = null; + music = null; + publicShare = null; + templates = null; + videos = null; + }; +} diff --git a/modules/home-manager/documents.nix b/modules/home-manager/documents.nix index 4cc6854..5d69ff1 100644 --- a/modules/home-manager/documents.nix +++ b/modules/home-manager/documents.nix @@ -3,5 +3,9 @@ home.packages = [ # pdf viewer pkgs.papers + # image viewer + pkgs.loupe + # video player + pkgs.showtime ]; } diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index d5dbb08..7499e58 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -11,8 +11,6 @@ ]; - - programs.fish = { enable = true; # enableCompletion = true; @@ -28,6 +26,11 @@ } # add others here ]; + + functions = { + # disable the fish greeting + fish_greeting = ""; + }; }; diff --git a/modules/home-manager/flatpaks.nix b/modules/home-manager/flatpaks.nix index ac8d4ff..14690ba 100644 --- a/modules/home-manager/flatpaks.nix +++ b/modules/home-manager/flatpaks.nix @@ -14,5 +14,7 @@ "io.podman_desktop.PodmanDesktop" "org.pipewire.Helvum" "im.riot.Riot" + "com.valvesoftware.Steam" + "org.prismlauncher.PrismLauncher" ]; } diff --git a/modules/home-manager/hypr/cursor.nix b/modules/home-manager/hypr/cursor.nix deleted file mode 100644 index 05ab959..0000000 --- a/modules/home-manager/hypr/cursor.nix +++ /dev/null @@ -1,7 +0,0 @@ -{inputs, pkgs, ...}: -{ - # Put a cursor theme to the location expected by the hyprland window manager - # TODO - - -} diff --git a/modules/home-manager/hypr/default.nix b/modules/home-manager/hypr/default.nix index 970f01a..e1f030a 100644 --- a/modules/home-manager/hypr/default.nix +++ b/modules/home-manager/hypr/default.nix @@ -1,8 +1,6 @@ { imports = [ - # ./better-control.nix - ./cursor.nix - ./hyprland-customization.nix + ./hyprland ./hyprpaper.nix ./hyprlock.nix ./hypridle.nix diff --git a/modules/home-manager/hypr/hypridle.nix b/modules/home-manager/hypr/hypridle.nix index 921c06b..64b62a7 100644 --- a/modules/home-manager/hypr/hypridle.nix +++ b/modules/home-manager/hypr/hypridle.nix @@ -4,29 +4,37 @@ enable = true; settings = { general = { - lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances. + # avoid starting multiple hyprlock instances. + before_sleep_cmd = "pidof hyprlock || hyprlock --immediate-render --no-fade-in"; + lock_cmd = "pidof hyprlock || hyprlock --immediate-render --no-fade-in"; after_sleep_cmd = "hyprctl dispatch dpms on"; ignore_dbus_inhibit = false; }; listener = [ { - # dim screen after 4 minutes - timeout = 240; - on-timeout = "brightnessctl -s set 10"; - # set monitor backlight to minimum, avoid 0 on OLED monitor. + # turn off keyboard backlight after 20 seconds + timeout = 10; + on-timeout = "brightnessctl -d platform::kbd_backlight -s set 0"; + # restore keyboard backlight on resume to previous level. + on-resume = "brightnessctl -d platform::kbd_backlight -r"; + } + { + # dim screen after 2 minutes + timeout = 120; + on-timeout = "brightnessctl -s set 2"; on-resume = "brightnessctl -r"; # monitor backlight restore. } { - # lock screen after 5 minutes - timeout = 300; + # lock screen after 10 minutes + timeout = 600; on-timeout = "loginctl lock-session && hyprctl dispatch dpms off"; on-resume = "hyprctl dispatch dpms on"; } { - # suspend after 10 minutes - timeout = 600; + # suspend after 15 minutes + timeout = 900; on-timeout = "systemctl suspend"; on-resume = "hyprctl dispatch dpms on"; } diff --git a/modules/home-manager/hypr/hyprland-customization.nix b/modules/home-manager/hypr/hyprland-customization.nix deleted file mode 100644 index 2a77320..0000000 --- a/modules/home-manager/hypr/hyprland-customization.nix +++ /dev/null @@ -1,251 +0,0 @@ -{inputs, pkgs, lib, config, ...}: -let - cfg = config.nix-config.hypr; -in -{ - - options = { - nix-config.hypr.internal-screen.resolution = lib.mkOption { type = lib.types.str; }; - nix-config.hypr.internal-screen.scale = lib.mkOption { type = lib.types.str; }; - nix-config.hypr.browser = lib.mkOption { - type = lib.types.str; - default = "firefox"; - description = "The browser to use in Hyprland."; - }; - nix-config.hypr.launcher-cmd = lib.mkOption { - type = lib.types.str; - default = "wofi --show drun -n"; - description = "The command to launch the application launcher in Hyprland."; - }; - nix-config.hypr.ide = lib.mkOption { - type = lib.types.str; - default = "code"; - description = "The IDE to use in Hyprland."; - }; - }; - - config = { - home.packages = [ - pkgs.hyprshot - pkgs.nautilus - pkgs.gnome-control-center - pkgs.gnome-bluetooth # needed by gnome-control-center to manage bluetooth - pkgs.brightnessctl - pkgs.cliphist - pkgs.wl-clipboard - pkgs.gcr # Provides org.gnome.keyring.SystemPrompter - ]; - - - # Also use gnome keyring - services.gnome-keyring.enable = true; - - - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - settings = { - "$mod" = "SUPER"; - - # Global bindings - bind = [ - # Launch applications - "$mod, space, exec, ${cfg.launcher-cmd}" - "$mod, return, exec, kitty" - "$mod, b, exec, ${cfg.browser}" - "$mod, s, exec, ${cfg.ide}" - "$mod, e, exec, nautilus" - - # Lock screen - "$mod, l, exec, hyprlock" - - # Clipboard management - "$mod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" - - # Close window - "$mod, Q, killactive," - "$mod+Shift, Q, exit," # this is the true kill - - # Toggle Floating and reduce size - "$mod, f, togglefloating," - "$mod, f, resizeactive, 50% 50%," - # Toggle fullscreen - "$mod+Shift, f, fullscreen," - - # Alt-tab alternative - "$mod, Tab, cyclenext," - "$mod, Tab, bringactivetotop," - - # Move the window - "$mod+Shift, left, movewindow, l" - "$mod+Shift, right, movewindow, r" - "$mod+Shift, up, movewindow, u" - "$mod+Shift, down, movewindow, d" - - "$mod+Ctrl, left, movetoworkspace, -1" - "$mod+Ctrl, right, movetoworkspace, +1" - - # Switch workspace - "$mod+Alt, left, workspace, -1" - "$mod+Alt, right, workspace, +1" - - # Screenshot - "$mod, Print, exec, hyprshot -m region -o ~/Pictures/Screenshots" - "$mod+Shift, Print, exec, hyprshot -m window -o ~/Pictures/Screenshots" - - ]; - - # repeatable bindings - binde = [ - # Fn keys - ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" - ", XF86MonBrightnessUp, exec, brightnessctl set +5%" - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - - # Reshape the window in focus - "$mod, MINUS, resizeactive, -2% -2%" - "$mod, KP_Subtract, resizeactive, -2% -2%" - "$mod, PLUS, resizeactive, 2% 2%" - "$mod, KP_Add, resizeactive, 2% 2%" - ]; - - # lock-screen bindings - bindl = [ - # on lid close, lock the screen - # if another monitor is connected, only turn the internal monitor off and don't lock the screen - ", switch:on:Lid Switch, exec, hyprctl dispatch dpms off eDP-1" - # if there is no active monitor, perform a screen lock - ", switch:on:Lid Switch, exec, hyprctl monitors | grep 'dpmsStatus: 1' || hyprlock" - ", switch:off:Lid Switch, exec, hyprctl dispatch dpms on eDP-1" - ]; - - # bindr = [ - # # Overview - # "$mod, , overview:toggle" - # ]; - - bindm = [ - # move the window - "$mod, mouse:272, movewindow" - ]; - - exec-once = [ - "gnome-keyring-daemon --start --components=secrets" - # "${pkgs.hyprpaper}/bin/hyprpaper" - # hyprpaper is handled as its own service - "${pkgs.waybar}/bin/waybar" - # listen to clipboard events and send them to cliphist - "wl-paste --watch cliphist store" - "${pkgs.waybar}/bin/hypridle" - "hyprpaper" - # # Fixes cursor themes in gnome apps under hyprland - # "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'" - # "gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}" - "${pkgs.owncloud-client}" - ]; - - general = { - resize_on_border = true; - gaps_in = 5; - gaps_out = 5; - border_size = 1; - "col.active_border" = "rgb(98971A) rgb(CC241D) 45deg"; - layout = "master"; - }; - - misc = { - # disable refreshs when nothing is going on - vfr = false; - disable_hyprland_logo = true; - }; - - input = { - kb_layout = "de"; - # remap caps lock to ctrl - kb_options = "ctrl:nocaps"; - numlock_by_default = true; - # mouse input should be unchanged - natural_scroll = false; - sensitivity = 0.3; - touchpad = { - disable_while_typing = false; - natural_scroll = true; - }; - }; - - device = { - name = "syna329a:00-06cb:cd4f-touchpad"; - sensitivity = 0.5; - }; - - gestures = { - workspace_swipe = true; - workspace_swipe_fingers = 4; - workspace_swipe_touch = true; - }; - - decoration = { - rounding = 7; - # active_opacity = 0.95; - inactive_opacity = 0.9; - - shadow = { - enabled = false; - }; - - # blur is set on a per-program basis - windowrulev2 = [ - # kitty should behave like a floating window - "animation popin, class:kitty" - "move cursor -50% -50%, class:kitty" - "float, class:kitty" - "size 50% 50%, class:kitty" - - # some more floating windows - "float, class:org.gnome.Settings" - "float, class:desktopclient.owncloud.com" - "float, class:org.keepassxc.KeePassXC" - - ]; - }; - - monitor = [ - # the internal monitor, always at the "center" - "eDP-1, ${cfg.internal-screen.resolution}, 0x0, ${cfg.internal-screen.scale}" - - # Samsung monitors at irchel (matching the description) - # "desc:Samsung Electric Company LS27D80xU HK7X800803, 3840x2160, auto-up, 1.8" - "desc:Samsung Electric Company LS27D80xU HNAX600169, 2560x1440@59.95, auto-up, 1" - - ", preferred, auto-up, auto" # automatically add any newly detected monitor - ]; - - xwayland = { - enabled = false; - }; - - env = [ - # force apps to use wayland - "NIXOS_OZONE_WL, 1" - "ELECTRON_OZONE_PLATFORM_HINT, wayland" - # set the scale factor for GDK apps - "GDK_SCALE, 1.7" - # set the scale factor for QT apps - "QT_SCALE_FACTOR, 1.7" - # set the scale factor for GTK apps - ]; - }; - - plugins = [ - # Global overview - pkgs.hyprlandPlugins.hyprspace - # Touch gestures - pkgs.hyprlandPlugins.hyprgrass - ]; - }; - - services.swaync.enable = true; - }; -} diff --git a/modules/home-manager/hypr/hyprland/autostart.nix b/modules/home-manager/hypr/hyprland/autostart.nix new file mode 100644 index 0000000..c0da5e3 --- /dev/null +++ b/modules/home-manager/hypr/hyprland/autostart.nix @@ -0,0 +1,30 @@ +{inputs, pkgs, lib, config, ...}: +let + cfg = config.nix-config.hypr; +in +{ + options = { + nix-config.hypr.autostartApps = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + "gnome-keyring-daemon --start --components=secrets" + "wl-paste --watch cliphist store" + "${lib.getExe pkgs.waybar}" + "${lib.getExe pkgs.hypridle}" + "${pkgs.owncloud-client}" + "${lib.getExe pkgs.keepassxc}" + ]; + description = "List of applications to start automatically in Hyprland."; + }; + }; + + config = { + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + settings = { + exec-once = cfg.autostartApps; + }; + }; + }; +} diff --git a/modules/home-manager/hypr/hyprland/default.nix b/modules/home-manager/hypr/hyprland/default.nix new file mode 100644 index 0000000..6524ed2 --- /dev/null +++ b/modules/home-manager/hypr/hyprland/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ + ./autostart.nix + ./general.nix + ./keybinds.nix + ./layouts.nix + ./packages.nix + ]; +} diff --git a/modules/home-manager/hypr/hyprland/general.nix b/modules/home-manager/hypr/hyprland/general.nix new file mode 100644 index 0000000..98e75bf --- /dev/null +++ b/modules/home-manager/hypr/hyprland/general.nix @@ -0,0 +1,133 @@ +{inputs, pkgs, lib, config, ...}: +let + cfg = config.nix-config.hypr; +in +{ + options = { + nix-config.hypr.internal-screen.resolution = lib.mkOption { type = lib.types.str; }; + nix-config.hypr.internal-screen.scale = lib.mkOption { type = lib.types.str; }; + nix-config.hypr.browser = lib.mkOption { + type = lib.types.str; + default = "firefox"; + description = "The browser to use in Hyprland."; + }; + nix-config.hypr.ide = lib.mkOption { + type = lib.types.str; + default = "code"; + description = "The IDE to use in Hyprland."; + }; + }; + + config = { + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + settings = { + general = { + resize_on_border = true; + gaps_in = 5; + gaps_out = 5; + border_size = 1; + "col.active_border" = "rgb(98971A) rgb(CC241D) 45deg"; + layout = "master"; + }; + + input = { + kb_layout = "de"; + # remap caps lock to ctrl + kb_options = "ctrl:nocaps"; + numlock_by_default = true; + # mouse input should be unchanged + natural_scroll = false; + sensitivity = 0.3; + touchpad = { + disable_while_typing = false; + natural_scroll = true; + }; + }; + + device = { + name = "syna329a:00-06cb:cd4f-touchpad"; + sensitivity = 0.5; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 4; + workspace_swipe_touch = true; + }; + + decoration = { + rounding = 7; + # active_opacity = 0.95; + inactive_opacity = 0.9; + + shadow = { + enabled = false; + }; + + # blur = { + # enabled = true; + # size = 5; + # passes = 2; + # }; + + # blur is set on a per-program basis + windowrulev2 = [ + # kitty should behave like a floating window + "animation popin, class:kitty" + "move cursor -50% -50%, class:kitty" + "float, class:kitty" + "size 50% 50%, class:kitty" + + # blur the launcher background + # "blur 10, class:${config.nix-config.launcher.name}" + + # some more floating windows + "float, class:org.gnome.Settings" + "float, class:desktopclient.owncloud.com" + "float, class:org.keepassxc.KeePassXC" + "float, title:^(Picture-in-Picture)$" + "float, class:org.gnome.Nautilus" + # when there is a single window, deactivate border and gaps + # "border_size 0, onworkspace:w[tv1], " + ]; + }; + + monitor = [ + # the internal monitor, always at the "center" + "eDP-1, ${cfg.internal-screen.resolution}, 0x0, ${cfg.internal-screen.scale}" + + # Samsung monitors at irchel (matching the description) + "desc:Samsung Electric Company LS27D80xU, 2560x1440@59.95, auto-up, 1" + + ", preferred, auto-up, auto" # automatically add any newly detected monitor + ]; + + xwayland = { + enabled = true; + force_zero_scaling = true; + }; + + env = [ + # force apps to use wayland + "NIXOS_OZONE_WL, 1" + "ELECTRON_OZONE_PLATFORM_HINT, wayland" + # set the scale factor for GDK apps + "GDK_SCALE, ${cfg.internal-screen.scale}" + # set the scale factor for QT apps + # "QT_SCALE_FACTOR, ${cfg.internal-screen.scale}" + "QT_SCALE_FACTOR, 1.1" + # set the scale factor for GTK apps + ]; + }; + + plugins = [ + # Global overview + pkgs.hyprlandPlugins.hyprspace + # Touch gestures + pkgs.hyprlandPlugins.hyprgrass + ]; + }; + }; +} diff --git a/modules/home-manager/hypr/hyprland/keybinds.nix b/modules/home-manager/hypr/hyprland/keybinds.nix new file mode 100644 index 0000000..63f6bdd --- /dev/null +++ b/modules/home-manager/hypr/hyprland/keybinds.nix @@ -0,0 +1,135 @@ +{inputs, pkgs, lib, config, ...}: +let + cfg = config.nix-config.hypr; +in +{ + config = { + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + settings = { + "$mod" = "SUPER"; + + # Global bindings + bind = [ + # Launch applications + "$mod, space, exec, ${lib.getExe config.nix-config.launcher}" + "$mod, return, exec, kitty" + "$mod, b, exec, ${cfg.browser}" + "$mod, s, exec, ${cfg.ide}" + "$mod, e, exec, nautilus" + + # Lock screen + "$mod, l, exec, loginctl lock-session" + + # Clipboard management + "$mod, V, exec, cliphist list | ${lib.getExe config.nix-config.launcher} --dmenu | cliphist decode | wl-copy" + + # Close window + "$mod, Q, killactive," + # Force close window + # "$mod+Shift, Q, forcekillactive," + + # Toggle Floating and reduce size + "$mod, f, togglefloating," + "$mod, f, resizeactive, 50% 50%," + + # "$mod, P, pseudo, " # dwindle + # "$mod, J, togglesplit, " # dwindle + # Toggle fullscreen + "$mod+Shift, f, fullscreen," + + # Alt-tab alternative + "$mod, Tab, cyclenext," + "$mod, Tab, bringactivetotop," + + # Move the window + "$mod+Shift, left, movewindow, l" + "$mod+Shift, right, movewindow, r" + "$mod+Shift, up, movewindow, u" + "$mod+Shift, down, movewindow, d" + + "$mod+Ctrl, left, movetoworkspace, -1" + "$mod+Ctrl, right, movetoworkspace, +1" + + # Switch workspace + "$mod+Alt, left, workspace, -1" + "$mod+Alt, right, workspace, +1" + "$mod, mouse_down, workspace, -1" + "$mod, mouse_up, workspace, +1" + + # move to scratch workspace + "$mod+Ctrl, up, movetoworkspace, special:magic" + "$mod+Ctrl, down, movetoworkspace, 1" + # toggle scratch workspace + "$mod+Alt, up, togglespecialworkspace, magic" + "$mod+Alt, down, togglespecialworkspace, magic" + + # Screenshot + "$mod, Print, exec, hyprshot -m region -o ~/Pictures/Screenshots" + "$mod+Shift, Print, exec, hyprshot -m window -o ~/Pictures/Screenshots" + # # somehow logitech calls this SUPER_L but we refer to it by its code + "SUPER_L&Shift_L, S, exec, hyprshot -m region -o ~/Pictures/Screenshots" + "Shift&SUPER_L&Shift_L, S, exec, hyprshot -m window -o ~/Pictures/Screenshots" + # when there is a dedicated screenshot button + ", XF86Cut, exec, hyprshot -m region -o ~/Pictures/Screenshots" + "Shift, XF86Cut, exec, hyprshot -m window -o ~/Pictures/Screenshots" + + # Power menu + ", XF86PowerOff, exec, ${lib.getExe config.nix-config.powerMenu}" + + # Other pickers using the same launcher + "$mod+Ctrl, space, exec, ${lib.getExe config.nix-config.filePicker}" + + ]; + + # repeatable bindings + binde = [ + # Fn keys + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ", XF86MonBrightnessUp, exec, brightnessctl set +5%" + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + + # Reshape the window in focus + "$mod, MINUS, resizeactive, -2% -2%" + "$mod, KP_Subtract, resizeactive, -2% -2%" + "$mod, PLUS, resizeactive, 2% 2%" + "$mod, KP_Add, resizeactive, 2% 2%" + ]; + + # lock-screen bindings + bindl = [ + ## depending on the setup: lock screen or switch to clamshell mode + # in any case, the internal screen is turned off + # ", switch:on:Lid Switch, exec, loginctl lock-session" + + + # if an additional monitor is detected, simply deactivate the internal screen and continue working on the external monitor + ", switch:on:Lid Switch, exec, hyprctl dispatch dpms off eDP-1" + ", switch:on:Lid Switch, exec, sleep 0.5; hyprctl monitors | grep 'dpmsStatus: 1' && hyprctl keyword monitor 'eDP-1,disable'" + # # if no external monitor is detected, lock the screen + # ", switch:on:Lid Switch, exec, sleep 0.5; hyprctl monitors | grep 'dpmsStatus: 1' || loginctl lock-session" + + ## on reopening the lid, turn the internal screen back on + ", switch:off:Lid Switch, exec, hyprctl dispatch dpms on eDP-1" + # if an external monitor was connected, then we need to reload the monitor configuration + ", switch:off:Lid Switch, exec, hyprctl monitors | grep 'ID 1' && hyprctl reload" + ]; + + # bindr = [ + # # Overview + # "$mod, , overview:toggle" + # ]; + + bindm = [ + # move the window using left click + "$mod, mouse:272, movewindow" + # resize the window using right click + "$mod, mouse:273, resizewindow" + ]; + }; + }; + }; +} diff --git a/modules/home-manager/hypr/hyprland/layouts.nix b/modules/home-manager/hypr/hyprland/layouts.nix new file mode 100644 index 0000000..5b80174 --- /dev/null +++ b/modules/home-manager/hypr/hyprland/layouts.nix @@ -0,0 +1,57 @@ +{inputs, pkgs, lib, config, ...}: +let + cfg = config.nix-config.hypr; +in +{ + config = { + wayland.windowManager.hyprland = { + settings = { + + master = { + # TODO - I am not yet happy about the layout + toggle keybinds + orientation = "center"; + # equivalent toalways_center_master = true; + slave_count_for_center_master = 0; + # new_is_master = false; + # allow_small_split = true; + # special_scale_factor = 0.80; + mfact = 0.34; + inherit_fullscreen = false; + # always_center_master = false; + # allow a maximum of 3 windows in the master area for 3-column layout + }; + + #create special workspaces with no gaps + workspace = [ + "w[t1], gapsout:0, gapsin:0" + "w[tg1], gapsout:0, gapsin:0" + "f[1], gapsout:0, gapsin:0" + ]; + + # automatically assign windows to workspaces when there is only one window + windowrulev2 = [ + "bordersize 0, floating:0, onworkspace:w[t1]" + "rounding 0, floating:0, onworkspace:w[t1]" + "bordersize 0, floating:0, onworkspace:w[tg1]" + "rounding 0, floating:0, onworkspace:w[tg1]" + "bordersize 0, floating:0, onworkspace:f[1]" + "rounding 0, floating:0, onworkspace:f[1]" + ]; + + misc = { + vfr = false; + disable_hyprland_logo = true; + }; + + # Keybind to toggle between 2 and 3 column master layout + bind = [ + # Toggle master layout between 2 and 3 columns + "$mod, m, exec, hyprctl dispatch layoutmsg orientationleft" + "$mod, m, exec, hyprctl dispatch layoutmsg mfact exact 0.5" + # "SUPER_SHIFT,C,exec,hyprctl dispatch layoutmsg swap_master_count 2 3" + ]; + + }; + }; + }; +} diff --git a/modules/home-manager/hypr/hyprland/packages.nix b/modules/home-manager/hypr/hyprland/packages.nix new file mode 100644 index 0000000..a638791 --- /dev/null +++ b/modules/home-manager/hypr/hyprland/packages.nix @@ -0,0 +1,20 @@ +{inputs, pkgs, lib, config, ...}: +let + cfg = config.nix-config.hypr; +in +{ + # packages required by the current hyprland setup + home.packages = [ + pkgs.hyprshot + pkgs.nautilus + pkgs.gnome-control-center + pkgs.gnome-bluetooth # needed by gnome-control-center to manage bluetooth + pkgs.brightnessctl + pkgs.cliphist + pkgs.wl-clipboard + pkgs.gcr # Provides org.gnome.keyring.SystemPrompter + ]; + + # Also use gnome keyring + services.gnome-keyring.enable = true; +} diff --git a/modules/home-manager/hypr/hyprlock.nix b/modules/home-manager/hypr/hyprlock.nix index c21cb34..6c7ae71 100644 --- a/modules/home-manager/hypr/hyprlock.nix +++ b/modules/home-manager/hypr/hyprlock.nix @@ -5,10 +5,10 @@ settings = { - # prevent the screen being shown for a split second - animations = { - animation = "fadeIn, 0, 0, linear"; - }; + # # prevent the screen being shown for a split second + # animations = { + # animation = "fadeIn, 0, 0, linear"; + # }; general = { # immediately lock the screen diff --git a/modules/home-manager/hypr/hyprpaper.nix b/modules/home-manager/hypr/hyprpaper.nix index 2d9b032..285028a 100644 --- a/modules/home-manager/hypr/hyprpaper.nix +++ b/modules/home-manager/hypr/hyprpaper.nix @@ -3,37 +3,40 @@ lib, ... }: -with lib; let - # # load the wallpapers from the wallpapers directory - this gives a set with the folder content - # dirContent = builtins.readDir ../../../wallpapers; - # wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers; - # # # load each wallpaper and keep its path (now in the nix store) as an array - # # wallpapers = map (x: builtins.readDir "${../../../wallpapers}/${x.value}") dirContent; - # # wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers; +let - # # script that picks a random wallpaper from the array and sets it as the desktop background - # monitor = ""; # leave empty to set the wallpaper on all monitors + wallpapers = [ + ../../../wallpapers/codioful-formerly-gradienta-lweK7Wme_jo-unsplash.jpg + ../../../wallpapers/codioful-formerly-gradienta-n2XqPm7Bqhk-unsplash.jpg + ../../../wallpapers/luke-chesser-eICUFSeirc0-unsplash.jpg + ../../../wallpapers/luke-chesser-pJadQetzTkI-unsplash.jpg + ../../../wallpapers/magicpattern-87PP9Zd7MNo-unsplash.jpg + ]; - # wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" '' - # wallpaper=$(shuf -n 1 -e ${wallpaperString}) - # hyprctl hyprpaper unload all - # hyprctl hyprpaper preload $wallpaper - # hyprctl hyprpaper wallpaper "${monitor},$wallpaper" - # ''; + monitor = ""; # leave empty to set the wallpaper on all monitors + + wallpaperPicker = pkgs.writeShellScriptBin "wallpaper-picker" '' + #!/usr/bin/env bash + # use an array of wallpapers to randomly select one + wallpapers=(${pkgs.lib.concatStringsSep " " (map (p: "${p}") wallpapers)}) + # select a random wallpaper from the array + index=$((RANDOM % ${toString (builtins.length wallpapers)})) + wallpaper="''${wallpapers[index]}" + echo "Setting wallpaper to: $wallpaper" + + hyprctl hyprpaper unload all + hyprctl hyprpaper reload "${monitor},$wallpaper" + ''; in { - # home.packages = [wallpaperRandomizer]; - - + home.packages = [wallpaperPicker]; services.hyprpaper = { enable = true; + settings = { + ipc = "on"; + }; }; - # settings = { - # ipc = "off"; - # splash = false; - # }; - # }; # systemd.user = { # services.wallpaperRandomizer = { diff --git a/modules/home-manager/hypr/waybar.nix b/modules/home-manager/hypr/waybar.nix index c1499ce..97d2329 100644 --- a/modules/home-manager/hypr/waybar.nix +++ b/modules/home-manager/hypr/waybar.nix @@ -3,252 +3,327 @@ let cfg = config.nix-config.style; in { - # required to autoload fonts from packages installed via Home Manager - fonts.fontconfig.enable = true; + options.nix-config.waybar = { + burninPrevention = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Enable burn-in prevention for Waybar"; + example = '' + burninPrevention = true; + ''; - # waybar requires font-awesome - home.packages = [ - pkgs.pavucontrol - ]; + }; + }; - # enable waybar - programs.waybar.enable = true; - programs.waybar = { - settings = { - - mainBar = { - layer = "top"; - position = "top"; - - margin-top = 5; - # margin-bottom = 2; - # margin-left = 5; - # margin-right = 5; - - # margin between the modules - spacing = 2; - - modules-left = [ - "hyprland/workspaces" - "hyprland/window" - ]; - - modules-center = [ - "clock" - "custom/notification" - ]; - - modules-right = [ - "tray" - "privacy" - "network" - "wireplumber" - "battery" - "backlight" - "idle_inhibitor" - ]; + config = { - # module specific settings - "hyprland/workspaces" = { - format = "{icon}"; - format-icons = { - active = "●"; - default = "○"; - }; - }; - "hyprland/window"= { - "icon" = true; - "separate-outputs" = true; - "format" = "{}"; - "rewrite" = { - "(.*) — Mozilla Firefox" = "$1"; - "(.*) — Zen Browser" = "$1"; - "(.*) - fish" = "> [$1]"; - "(.*) - Visual Studio Code" = "$1"; - }; - }; - "clock" = { - format = "{:%H:%M}"; - interval = 1; - tooltip-format = "{calendar}"; - calendar = { - "format" = { - "today" = "{}"; + # required to autoload fonts from packages installed via Home Manager + fonts.fontconfig.enable = true; + + # waybar requires font-awesome + home.packages = [ + pkgs.pavucontrol + ]; + + # enable waybar + programs.waybar.enable = true; + programs.waybar = { + settings = { + + mainBar = { + layer = "top"; + position = "top"; + + margin-top = 5; + # margin-bottom = 2; + # margin-left = 5; + # margin-right = 5; + + # margin between the modules + spacing = 2; + + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; + + modules-center = [ + "clock" + "custom/notification" + ]; + + modules-right = [ + "tray" + "privacy" + "network" + "bluetooth" + "wireplumber" + "battery" + "backlight" + "idle_inhibitor" + ]; + + + # module specific settings + "hyprland/workspaces" = { + format = "{icon}"; + format-icons = { + active = "●"; + default = "○"; }; }; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + "hyprland/window"= { + "icon" = true; + "separate-outputs" = true; + "format" = "{}"; + "rewrite" = { + "(.*) — Mozilla Firefox" = "$1"; + "(.*) — Zen Browser" = "$1"; + "(.*) - fish" = "> [$1]"; + "(.*) - Visual Studio Code" = "$1"; + }; }; - tooltip = "true"; - }; - "bluetooth" = { - format-on = "󰂯"; - format-off = "BT-off"; - format-disabled = "󰂲"; - format-connected-battery = "{device_battery_percentage}% 󰂯"; - format-alt = "{device_alias} 󰂯"; - tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; - tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; - tooltip-formaenumeratet-enumerate-connected = "{device_alias}\n{device_address}"; - tooltip-format-enumerate-connected-battery = "{device_alias}\n{device_address}\n{device_battery_percentage}%"; - on-click-right = "blueman-manager"; - }; - "battery" = { - interval = 60; - states = { - good = 80; - warning = 30; - critical = 10; + "clock" = { + format = " {:%H:%M}"; + interval = 1; + tooltip-format = "{calendar}"; + calendar = { + "format" = { + "today" = "{}"; + }; + }; }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% 󰂄"; - format-plugged = "{capacity}% 󰂄 "; - format-icons = [ "󰁻" "󰁼" "󰁾" "󰂀" "󰂂" "󰁹" ]; - }; - "backlight" = { - "format" = "{percent}% {icon}"; - "format-icons" = ["" "" "" "" "" "" "" "" ""]; - }; - "wireplumber" = { - scroll-step = 10; - format = "{icon} {volume}%";# {format_source}"; - format-bluetooth = "{volume}% {icon}";# {format_source}"; - format-bluetooth-muted = " {icon}";# {format_source}"; - format-muted = " Muted";# {format_source}"; - # format-source = " {volume}%"; - # format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - default = [ - "" - "" - "" + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = "☕"; + }; + tooltip = "true"; + }; + "bluetooth" = { + format-on = "󰂯"; + format-off = "BT-off"; + format-disabled = "󰂲"; + format-connected-battery = "{device_battery_percentage}% 󰂯"; + format-alt = "{device_alias} 󰂯"; + tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; + tooltip-format-enumerate-connected = "{device_alias}\n{device_address}"; + tooltip-format-enumerate-connected-battery = "{device_alias}\n{device_address}\n{device_battery_percentage}%"; + on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center bluetooth"; + }; + "battery" = { + interval = 60; + states = { + good = 80; + warning = 30; + critical = 10; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% 󰂄"; + format-plugged = "{capacity}% 󰂄"; + format-icons = [ "󰁻" "󰁼" "󰁾" "󰂀" "󰂂" "󰁹" ]; + }; + "backlight" = { + # format = "{percent}% {icon}"; + format = "{icon}"; + tooltip-format = "{percent}%"; + format-icons = [ "" "" "" "" "" "" "" "" "" ]; + }; + "wireplumber" = { + scroll-step = 1; + format = "{volume}% {icon}";# {format_source}"; + format-bluetooth = "{volume}% {icon}";# {format_source}"; + format-bluetooth-muted = " {icon}";# {format_source}"; + format-muted = "🔇";# {format_source}"; + format-alt = "{format_source} {icon}"; + # format-source = " {volume}%"; + # format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center sound"; + }; + "memory" = { + interval = 5; + format = "󰍛 {}%"; + max-length = 10; + }; + "tray" = { + spacing = 5; + }; + "custom/notification" = { + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "swaync-client -t -sw"; + on-click-right = "swaync-client -d -sw"; + escape = true; + }; + "network" = { + format = "󰤭"; + format-ethernet = " {ipaddr}"; + format-wifi = "{icon}"; + format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; + format-disconnected = "󰤭"; + tooltip-format = " {ifname} via {gwaddr}"; + tooltip-format-wifi = '' + 󰤨 {essid}({signalStrength}%), {frequency} GHz (Interface: {ifname}) + IP: {ipaddr} GW: {gwaddr} + + {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} + ''; + tooltip-format-ethernet = '' +  {ifname} - {ipaddr}/{cidr} + + {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} + ''; + tooltip-format-disconnected = "Disconnected"; + on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi"; + }; + "privacy" = { + icon-spacing = 4; + # icon-size" = 18; + transition-duration = 250; + modules = [ + { + type = "screenshare"; + tooltip = true; + # tooltip-icon-size = 24 + } + { + type = "audio-out"; + tooltip = true; + # tooltip-icon-size = 24 + } + { + type = "audio-in"; + tooltip = true; + # tooltip-icon-size = 24 + } ]; }; - on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center sound"; - }; - "tray" = { - spacing = 5; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; - }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "swaync-client -t -sw"; - on-click-right = "swaync-client -d -sw"; - escape = true; - }; - "network" = { - format = "󰤭"; - format-ethernet = " {ipaddr}"; - format-wifi = "{icon}"; - format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - format-disconnected = "󰤭"; - tooltip-format = " {ifname} via {gwaddr}"; - # TODO - don't escape the strings in the tooltip - tooltip-format-wifi = '' - 󰤨 {essid}({signalStrength}%), {frequency} GHz\nInterface: {ifname} - IP: {ipaddr} GW: {gwaddr} - - {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} - ''; - tooltip-format-ethernet = '' -  {ifname} - {ipaddr}/{cidr} - - {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} - ''; - tooltip-format-disconnected = "Disconnected"; - on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi"; - }; - "privacy" = { - icon-spacing = 4; - # icon-size" = 18; - transition-duration = 250; - modules = [ - { - type = "screenshare"; - tooltip = true; - # tooltip-icon-size = 24 - } - { - type = "audio-out"; - tooltip = true; - # tooltip-icon-size = 24 - } - { - type = "audio-in"; - tooltip = true; - # tooltip-icon-size = 24 - } - ]; }; }; + + style = '' + * { + font-family: "${cfg.monospaceFont}"; + font-weight: bold; + font-size: ${builtins.toString (cfg.fontSizes.desktop + 5)}px; + } + + window#waybar { + background-color: transparent; + } + + .module { + background: rgba(0, 0, 0, 0.6); + color: white; + border-radius: 7px; + margin: 1px 3px; + padding: 1px 6px; + animation: bgFade 3600s infinite alternate, textColorFade 3600s infinite alternate; + } + + box.module button:hover { + box-shadow: inset 0 -3px #ffffff; + } + + /*.modules-left { + padding: 3px; + } + + .modules-right { + padding: 3px; + } + + .modules-center { + padding: 3px; + }*/ + + #workspaces button { + color: white; + background: none; + animation: textColorFade 3600s infinite alternate; + } + + #battery.warning { + background:rgba(240, 165, 0, 0.6); + } + #battery.critical { + background:rgba(255, 0, 0, 0.6); + } + #battery.charging { + background-color:rgba(14, 173, 0, 0.6); + } + + + #privacy { + color: #ffffff; + background:rgba(240, 165, 0, 0.6); + border-radius: 7px; + margin: 1px 3px; + padding: 1px 6px; + + } + + + + + + @keyframes bgFade { + 0% { + background-color: white; + } + 100% { + background-color: black; + } + } + + @keyframes textColorFade { + 0% { + color: black; + } + /* 45% { + color: black; + } */ + 60% { + color: rgb(29, 38, 96); + } + /* 55% { + color: white; + } */ + 100% { + color: white; + } + } + + ''; }; - - style = '' - * { - font-family: "${cfg.monospaceFont}"; - font-weight: bold; - font-size: ${builtins.toString (cfg.fontSizes.desktop + 7)}px; - } - - window#waybar { - background-color: transparent; - } - - .module { - background: rgba(0, 0, 0, 0.6); - color: white; - border-radius: 7px; - padding: 5px 5px 5px 5px; - } - box.module button:hover { - box-shadow: inset 0 -3px #ffffff; - } - - .modules-left { - padding: 3px; - } - - .modules-right { - padding: 3px; - } - - .modules-center { - padding: 3px; - } - - #workspaces button { - color: #ffffff; - } - - #battery.warning { - background:rgba(240, 165, 0, 0.6); - } - #battery.critical { - background:rgba(255, 0, 0, 0.6); - } - ''; }; } + diff --git a/modules/home-manager/kubectl.nix b/modules/home-manager/kubectl.nix index aa02f78..fb53a44 100644 --- a/modules/home-manager/kubectl.nix +++ b/modules/home-manager/kubectl.nix @@ -1,8 +1,13 @@ -{pkgs, ...}: +{pkgs, ...}: { home.packages = [ pkgs.kubie pkgs.kubectl ]; - + + # Add the shell alias + programs.fish.shellAliases = { + k = "kubectl"; + }; + } diff --git a/modules/home-manager/launcher.nix b/modules/home-manager/launcher.nix new file mode 100644 index 0000000..3716dfb --- /dev/null +++ b/modules/home-manager/launcher.nix @@ -0,0 +1,112 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.nix-config.style; + + powerMenu = pkgs.writeShellScriptBin "power-menu" '' + options=" Power Off\n Reboot\n Lock\n Suspend" + selected=$(echo -e "$options" | fuzzel --dmenu --prompt "Power Menu" --lines 4 --width 20) + + case "$selected" in + " Power Off") systemctl poweroff ;; + " Reboot") systemctl reboot ;; + " Lock") hyprlock ;; + " Suspend") systemctl suspend ;; + *) exit 1 ;; + esac + ''; + + filePicker = pkgs.writeShellScriptBin "file-picker" '' + files=$(${lib.getExe pkgs.fd} . $HOME --type f) + filesShortened=$(echo "$files" | sed "s|$HOME|~|g" | awk -F/ '{print $(NF)" ("$0")"}') + + selected=$(echo "$filesShortened" | fuzzel --dmenu --prompt "🔎 " --placeholder "File search" --index) + + + if [ -n "$selected" ]; then + # Since fuzzel was launched with the --index option the actual path is now files[selected] + selectedPlusOne=$((selected + 1)) + file=$(echo "$files" | sed -n "''${selectedPlusOne}p") + xdg-open "$file" + # plus one + else + echo "No file selected" + exit 1 + fi + ''; +in +{ + + options.nix-config = { + powerMenu = lib.mkOption { + description = "Package to use as a power menu"; + type = lib.types.package; + default = powerMenu; + }; + + launcher = lib.mkOption { + description = "Configuration for the launcher"; + type = lib.types.package; + default = pkgs.fuzzel; + }; + + filePicker = lib.mkOption { + description = "Package to use as a file picker"; + type = lib.types.package; + default = filePicker; + }; + }; + + config = { + programs.fuzzel = { + enable = true; + + settings = { + main = { + font = "monospace:size=${builtins.toString (cfg.fontSizes.applications - 1)}"; + terminal = "${lib.getExe pkgs.kitty}"; + layer = "overlay"; #or top? + use-bold = true; + dpi-aware = true; + icons-enabled = true; + match-mode = "fzf"; + horizontal-pad = cfg.fontSizes.applications + 5; + vertical-pad = cfg.fontSizes.applications + 5; + inner-pad = cfg.fontSizes.applications; + show-actions = true; + lines = 12; + width = 50; + }; + + colors = { + background = "000000aa"; + text = "ffffffaa"; + + # prompt + + # placeholder + + # input + + match = "ffffffaa"; + + selection = "00000000"; + + selection-text = "ffffffbb"; + + selection-match = "ffffffaa"; + }; + + border = { + width = 0; + radius = 15; + }; + }; + }; + + + home.packages = with pkgs; [ + powerMenu + filePicker + ]; + }; +} diff --git a/modules/home-manager/notifications.nix b/modules/home-manager/notifications.nix new file mode 100644 index 0000000..c451f1a --- /dev/null +++ b/modules/home-manager/notifications.nix @@ -0,0 +1,110 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.nix-config.style; +in +{ + services.swaync = { + enable = true; + + settings = { + control-center-margin-top = 13; + control-center-margin-bottom = 0; + control-center-margin-right = 14; + control-center-margin-left = 0; + notification-2fa-action = true; + notification-inline-replies = true; + notification-icon-size = 48; + notification-body-image-height = 160; + notification-body-image-width = 200; + notification-window-width = 400; + timeout = 6; + timeout-low = 3; + timeout-critical = 0; + + image-visibility = "when-available"; + transition-time = 200; + hide-on-clear = false; + hide-on-action = true; + script-fail-notify = true; + widgets = [ + "dnd" + "buttons-grid" + "mpris" + "volume" + "backlight" + "title" + "notifications" + ]; + widget-config = { + title = { + text = "Notifications"; + clear-all-button = true; + button-text = ""; + }; + dnd = { + text = "Do Not Disturb"; + }; + label = { + max-lines = 1; + text = "Notification"; + }; + mpris = { + image-size = 50; + image-radius = 0; + }; + volume = { + label = ""; + }; + backlight = { + label = "󰃠"; + device = "amdgpu_bl2"; + }; + buttons-grid = { + actions = [ + { + label = ""; + command = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + type = "toggle"; + } + { + label = ""; + command = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + type = "toggle"; + } + { + label = "󰤨"; + command = "nm-connection-editor"; + } + { + label = "󰂯"; + command = "blueman-manager"; + } + { + label = "󱡽"; + command = "bash -c $HOME/.config/hypr/scripts/airplaneMode.sh"; + type = "toggle"; + } + { + label = ""; + command = "shutdown now"; + } + { + label = ""; + command = "hyprlock"; + } + { + label = ""; + command = "~/.config/hypr/scripts/wlogout.sh"; + } + ]; + }; + }; + }; + + style = '' + * { + font-family: "monospace"; + } + ''; + }; +} diff --git a/modules/home-manager/ssh.nix b/modules/home-manager/ssh.nix index ecf43bc..33df549 100644 --- a/modules/home-manager/ssh.nix +++ b/modules/home-manager/ssh.nix @@ -2,6 +2,9 @@ { programs.ssh.enable = true; programs.ssh.matchBlocks = { + "*" = { + identityFile = "${config.home.homeDirectory}/.ssh/main_key"; + }; ela = lib.hm.dag.entryBefore ["eiger"] { hostname = "ela.cscs.ch"; user = "rmoll"; diff --git a/modules/home-manager/stylix.nix b/modules/home-manager/stylix.nix index 15c7506..8c8c04f 100644 --- a/modules/home-manager/stylix.nix +++ b/modules/home-manager/stylix.nix @@ -7,7 +7,7 @@ in cursor = { size = lib.mkOption { type = lib.types.int; - default = 35; + default = 22; description = "Size of the cursor in pixels."; }; }; @@ -57,8 +57,8 @@ in autoEnable = false; cursor = { - package = pkgs.apple-cursor; - name = "macOS"; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; size = cfg.cursor.size; }; @@ -84,7 +84,7 @@ in }; monospace = { - package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }; + package = pkgs.nerd-fonts.fira-code; name = cfg.monospaceFont; }; diff --git a/modules/home-manager/uxplay.nix b/modules/home-manager/uxplay.nix new file mode 100644 index 0000000..83b8215 --- /dev/null +++ b/modules/home-manager/uxplay.nix @@ -0,0 +1,9 @@ +{ + lib, pkgs, ... +}: +{ + # requires avahi or similar + + home.packages = with pkgs; [ uxplay ]; + +} diff --git a/modules/home-manager/wofi.nix b/modules/home-manager/wofi.nix index cb6ff9c..f650185 100644 --- a/modules/home-manager/wofi.nix +++ b/modules/home-manager/wofi.nix @@ -1,95 +1,139 @@ { config, pkgs, lib, ... }: let cfg = config.nix-config.style; + + wofiPowerMenu = pkgs.writeShellScriptBin "wofi-power-menu" '' + #!/usr/bin/env bash + + options=" Power Off\n Reboot\n Lock\n Suspend" + selected=$(echo -e "$options" | wofi --dmenu --prompt "Power Menu") + # --width 300 --height 250 + + case "$selected" in + " Power Off") systemctl poweroff ;; + " Reboot") systemctl reboot ;; + " Lock") hyprlock ;; + " Suspend") systemctl suspend ;; + *) exit 1 ;; + esac + ''; + + wofiFilePicker = pkgs.writeShellScriptBin "wofi-file-picker" '' + #!/usr/bin/env bash + initial=$(find $HOME -maxdepth 2 -type f) + selected=$(printf "%s\n" $initial | wofi --dmenu --prompt "Select a file") + + if [ -n "$selected" ]; then + xdg-open "$selected" + else + echo "No file selected" + exit 1 + fi + ''; in { - home.packages = with pkgs; [ wofi-emoji ]; + options.nix-config = { + powerMenu = lib.mkOption { + description = "Package to use as a power menu"; + type = lib.types.package; + default = wofiPowerMenu; + }; + }; - programs.wofi = { - enable = true; + config = { + programs.wofi = { + enable = true; - settings = { - # global layout - width = "50%"; - height = "50%"; - orientation = "vertical"; - hide_scroll = true; - line_wrap = "off"; - dynamic_lines = true; + settings = { + # global layout + width = "50%"; + height = "50%"; + orientation = "vertical"; + hide_scroll = true; + line_wrap = "off"; + dynamic_lines = true; - # search behaviour - matching = "fuzzy"; - single_click = true; + # search behaviour + matching = "fuzzy"; + single_click = true; - show = "drun"; - prompt = "Launch..."; - # normal_window = true; - layer = "top"; - term = "foot"; - halign = "fill"; + show = "drun"; + prompt = "Launch..."; + # normal_window = true; + layer = "top"; + term = "foot"; + halign = "fill"; - # Rich rendering - allow_markup = true; - allow_images = true; - image_size = 24; + # Rich rendering + allow_markup = true; + allow_images = true; + image_size = 24; - exec_search = false; - hide_search = false; - parse_search = false; - insensitive = true; - no_actions = true; + exec_search = false; + hide_search = false; + parse_search = false; + insensitive = true; + no_actions = true; - filter_rate = 100; - key_expand = "Tab"; - key_exit = "Escape"; + filter_rate = 100; + key_expand = "Tab"; + key_exit = "Escape"; + }; + + + style = '' + * { + font-family: ${cfg.monospaceFont}; + font-size: ${builtins.toString (cfg.fontSizes.desktop + 8)}px; + color: white; + background: transparent; + } + + #window { + background: rgba(1, 1, 1, 0.5); + margin: auto; + padding: 10px; + } + + #input { + padding: 10px; + margin-bottom: 10px; + border-radius: 15px; + } + + #outer-box { + padding: 20px; + } + + #img { + margin-right: 6px; + } + + #entry { + padding: 10px; + border-radius: 15px; + } + + #entry:selected { + background-color: #2e3440; + outline: none; + border: none; + } + + #text { + margin: 2px; + } + ''; }; - - style = '' - * { - font-family: ${cfg.monospaceFont}; - font-size: ${builtins.toString (cfg.fontSizes.desktop + 8)}px; - color: white; - background: transparent; - } - - #window { - background: rgba(1, 1, 1, 0.5); - margin: auto; - padding: 10px; - } - - #input { - padding: 10px; - margin-bottom: 10px; - border-radius: 15px; - } - - #outer-box { - padding: 20px; - } - - #img { - margin-right: 6px; - } - - #entry { - padding: 10px; - border-radius: 15px; - } - - #entry:selected { - background-color: #2e3440; - } - - #text { - margin: 2px; - } - ''; + home.packages = with pkgs; [ + wofiPowerMenu + wofi-emoji + ]; }; } diff --git a/modules/home-manager/xdg-portals.nix b/modules/home-manager/xdg-portals.nix index 446788c..3bcbb0c 100644 --- a/modules/home-manager/xdg-portals.nix +++ b/modules/home-manager/xdg-portals.nix @@ -19,4 +19,14 @@ ]; }; + + xdg.mimeApps.defaultApplications = { + "text/*" = [ "code" ]; + "application/x-yaml" = [ "code" ]; + + "application/pdf" = [ "papers" ]; + "image/*" = [ "loupe" ]; + "video/*" = [ "showtime" ]; + }; + } diff --git a/modules/nixos/agenix.nix b/modules/nixos/agenix.nix new file mode 100644 index 0000000..4bce12d --- /dev/null +++ b/modules/nixos/agenix.nix @@ -0,0 +1,7 @@ +{ config, pkgs, lib, inputs, ... }: +{ + # agenix client + environment.systemPackages = [ + inputs.agenix.packages."${system}".default + ]; +} diff --git a/modules/nixos/backup.nix b/modules/nixos/backup.nix new file mode 100644 index 0000000..6395cd9 --- /dev/null +++ b/modules/nixos/backup.nix @@ -0,0 +1,88 @@ +{pkgs, lib, ...}: +let + snapshotsDir = "/snapshots/home"; +in +{ + + environment.systemPackages = with pkgs; [ + restic + btrbk + libnotify + ]; + + + # btrbk systemd service and timer for daily home snapshots + systemd.services.btrbk-home-snapshot = { + description = "Create daily btrbk snapshot of the home subvolume"; + serviceConfig = { + Type = "oneshot"; + User = "remy"; + ExecStartPre = "${lib.getExe pkgs.libnotify} \"Backup\" \"Creating BTRBK snapshot of /home.\""; + # run the btrbk command as superuser + ExecStart = "+${lib.getExe pkgs.btrbk} -c /etc/btrbk/home.conf run"; + Environment = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"; # ensure the notification is sent to the correct display + ExecStartPost = "${lib.getExe pkgs.libnotify} \"Backup\" \"Snapshot of /home created successfully.\""; + }; + }; + + systemd.timers.btrbk-home-snapshot = { + enable = true; + description = "Daily timer for btrbk home snapshot"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-* 12:00"; + Persistent = true; # ensures missed runs are triggered after resume + }; + }; + # ensure the target directory exists + systemd.tmpfiles.settings = { + "btrbk snapshots" = { + "${snapshotsDir}" = { + d = { + group = "root"; + user = "root"; + mode = "0770"; + }; + }; + }; + }; + + # btrbk config for home snapshots + environment.etc."btrbk/home.conf".text = '' + timestamp_format long + # keep snapshots for 2 days independently of the call + snapshot_preserve_min 2d + # retain daily snapshots for 14 days + snapshot_preserve 14d + + subvolume /home + snapshot_dir ${snapshotsDir} + ''; + + # Now create a restic backup off the newest btrbk snapshot + systemd.services.restic-backup-latest-snapshot = { + description = "Backup home subvolume using restic"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.restic} -r /home/snapshots/restic-backup backup /home/snapshots/home-$(date +%Y-%m-%d_%H-%M-%S)"; + # send a notification when the service is done + ExecStartPost = "su remy -c 'notify-send \"Restic Backup\" \"Home backup created successfully.\"'"; + }; + }; + # # the udev rule: + # services.udev.extraRules = '' + # ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="backup-restic", TAG+="systemd", ENV{SYSTEMD_WANTS}="backup-restic.service" + # ''; + + # # the systemd service: + # systemd.services.backup-restic = { + # description = "Backup using restic (triggered when USB drive is plugged in)"; + # after = [ "local-fs.target" ]; + # wantedBy = [ "multi-user.target" ]; + # serviceConfig = { + # Type = "oneshot"; + # # TODO: adapt command + # ExecStart = "${lib.getExe pkgs.restic} backup /home/username"; + # }; + # }; +} diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix index 6d609a3..248377c 100644 --- a/modules/nixos/bluetooth.nix +++ b/modules/nixos/bluetooth.nix @@ -7,7 +7,23 @@ { environment.systemPackages = [ pkgs.bluez + # bluez-qt + # gnome.gnome-control-center + pkgs.gnome-bluetooth ]; + + services.dbus.packages = with pkgs; [ + gnome-bluetooth + bluez + ]; + + + users.users.remy.extraGroups = [ + "networkmanager" + + ]; + + hardware.bluetooth = { enable = true; # powerOnBoot = true; diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index dc1d73b..4727ec2 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -14,7 +14,7 @@ in # Use hyprland as the main desktop environment but use gdm as desktop manager programs.hyprland = { enable = true; - xwayland.enable = false; + xwayland.enable = true; }; @@ -26,10 +26,23 @@ in enable = true; wayland = true; }; + + services.gvfs.enable = true; + + security.pam.services.hyprlock = {}; security.pam.services.gdm.enableGnomeKeyring = true; + # Enable RTKit for real-time audio processing, ... + # improving audio performance and reducing dropouts. + security.rtkit.enable = true; + # Enable D-Bus for inter-process communication + services.dbus.enable = true; + + + programs.dconf.enable = true; + }; } diff --git a/modules/nixos/language.nix b/modules/nixos/language.nix new file mode 100644 index 0000000..abfb360 --- /dev/null +++ b/modules/nixos/language.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: +{ + + # Configure console keymap + console.keyMap = "de"; + + i18n.defaultLocale = "en_US.UTF-8"; + # i18n.supportedLocales = [ "en_US.UTF-8" "de_DE.UTF-8" ]; + + time.timeZone = "Europe/Berlin"; +} diff --git a/modules/nixos/networking.nix b/modules/nixos/networking.nix index b649823..936b397 100644 --- a/modules/nixos/networking.nix +++ b/modules/nixos/networking.nix @@ -1,7 +1,35 @@ -{lib, ...}:{ - networking.networkmanager.enable = true; - networking.networkmanager.wifi.powersave = lib.mkDefault true; - users.users.remy.extraGroups = [ - "networkmanager" - ]; -} \ No newline at end of file +{ + lib, + config, + ... +}: +let + cfg = config.nix-config.networking; +in +{ + + options = { + nix-config.networking.hostName = lib.mkOption { + type = lib.types.str; + default = "nixos"; + }; + }; + + config = { + networking.hostName = cfg.hostName; + + networking.networkmanager.enable = true; + networking.networkmanager.wifi.powersave = lib.mkDefault true; + users.users.${config.nix-config.userName}.extraGroups = [ + "networkmanager" + ]; + services.avahi.enable = true; + services.avahi.openFirewall = true; + + # networking.firewall = { + # enable = false; + # }; + + }; + +} diff --git a/modules/nixos/pipewire.nix b/modules/nixos/pipewire.nix index 8bc4419..17f2307 100644 --- a/modules/nixos/pipewire.nix +++ b/modules/nixos/pipewire.nix @@ -6,7 +6,7 @@ }: { # Needs to be explicitly set to false... - hardware.pulseaudio.enable = false; + services.pulseaudio.enable = false; # OR services.pipewire = { enable = true; diff --git a/modules/nixos/power.nix b/modules/nixos/power.nix index 5274303..a88740b 100644 --- a/modules/nixos/power.nix +++ b/modules/nixos/power.nix @@ -5,25 +5,53 @@ ... }: { - services.tlp = { - enable = true; - settings = { - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - - CPU_MIN_PERF_ON_AC = 0; - CPU_MAX_PERF_ON_AC = 100; - CPU_MIN_PERF_ON_BAT = 0; - CPU_MAX_PERF_ON_BAT = 50; + options.nix-config = { + power = { + batteryThresholds = lib.mkOption { + type = lib.types.listOf lib.types.int; + default = [ 60 80 ]; + description = "Battery charge thresholds for power management."; + }; }; }; + config = { + + services.tlp = { + enable = true; + settings = { + # processor chooses frequencies itself + CPU_DRIVER_OPMODE_ON_AC = "active"; + CPU_DRIVER_OPMODE_ON_BAT = "active"; + + # governor dictates global behavior of the CPU + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + + # energy performance policy (EPP) sets the energy/performance balance + CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + # CPU_MIN_PERF_ON_AC = 0; + # CPU_MAX_PERF_ON_AC = 100; + # CPU_MIN_PERF_ON_BAT = 0; + # CPU_MAX_PERF_ON_BAT = 50; + + # enable battery charge thresholds on the default battery + STOP_CHARGE_THRESH_BAT0 = 1; - # services.superfreq = { + # STOP_CHARGE_THRESH_BAT0 = 80; + + # CPU_BOOST_ON_AC = 1; + # CPU_BOOST_ON_BAT = 0; + # CPU_HWP_DYN_BOOST_ON_AC = 1; + # CPU_HWP_DYN_BOOST_ON_BAT = 0; + }; + }; + + + # services.watt = { # enable = true; # settings = { # charger = { @@ -32,6 +60,15 @@ # epp = "performance"; # epb = "balance_performance"; # platform_profile = "performance"; + + # enable_auto_turbo = true; + # # Custom thresholds for auto turbo management + # turbo_auto_settings = { + # load_threshold_high = 70.0; + # load_threshold_low = 30.0; + # temp_threshold_high = 75.0; + # initial_turbo_state = false; # whether turbo should be initially enabled (false = disabled) + # }; # }; # battery = { @@ -40,8 +77,15 @@ # epp = "power"; # epb = "balance_power"; # platform_profile = "low-power"; - # min_freq_mhz = 800; - # max_freq_mhz = 2500; + + # enable_auto_turbo = true; + # # Custom thresholds for auto turbo management + # turbo_auto_settings = { + # load_threshold_high = 80.0; + # load_threshold_low = 40.0; + # temp_threshold_high = 65.0; + # initial_turbo_state = false; # whether turbo should be initially enabled (false = disabled) + # }; # }; @@ -51,18 +95,21 @@ # min_poll_interval_sec = 1; # max_poll_interval_sec = 30; # throttle_on_battery = true; + # stats_file_path = "/var/run/watt-stats"; # }; - # battery_charge_thresholds = [50 90]; + # # battery_charge_thresholds = [50 90]; # }; # # logind.lidSwitchExternalPower = "ignore"; # prevent lid switch from triggering a suspend # }; - systemd.sleep.extraConfig = '' - AllowSuspend=yes - AllowHibernation=yes - AllowHybridSleep=yes - AllowSuspendThenHibernate=yes - ''; + systemd.sleep.extraConfig = '' + AllowSuspend=yes + AllowHibernation=yes + AllowHybridSleep=yes + AllowSuspendThenHibernate=yes + ''; + }; + } diff --git a/modules/nixos/user.nix b/modules/nixos/user.nix new file mode 100644 index 0000000..657d79d --- /dev/null +++ b/modules/nixos/user.nix @@ -0,0 +1,27 @@ +{ + lib, + config, + ... +}: +let + cfg = config.nix-config; +in +{ + options = { + nix-config.userName = lib.mkOption { + type = lib.types.str; + default = "remy"; + }; + }; + + config = { + + users.users.${cfg.userName} = { + isNormalUser = true; + extraGroups = [ + "wheel" # Enable ‘sudo’ for the user. + # other groups are added as needed, eg. networkmanager + ]; + }; + }; +} diff --git a/secrets b/secrets new file mode 160000 index 0000000..2aef0ad --- /dev/null +++ b/secrets @@ -0,0 +1 @@ +Subproject commit 2aef0ad374282d35c756504d940beeb75bd485b1 diff --git a/secrets/secrets.nix b/secrets/secrets.nix deleted file mode 100644 index 1e51465..0000000 --- a/secrets/secrets.nix +++ /dev/null @@ -1,11 +0,0 @@ -let - - remy-nix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMU7pWZfs7GfFTvqljA99pJV9DGJIPH+eK6DvGqBs4pG"; - remy-arch = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOP0PZqY8/YfV0NnVbFs2fZLj+nXXVJ8bDo03TyYDfW1"; - - users = [remy-arch remy-nix]; - -in { - "secret1.age".publicKeys = users; - "wifi.age".publicKeys = users; -} \ No newline at end of file diff --git a/secrets/wifi.age b/secrets/wifi.age deleted file mode 100644 index b7ef7ae2fb1457fc9acb57176e3b778fdb01a417..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 809 zcmV+^1J?XuXJsvAZewzJaCB*JZZ2Gm-GEg-|GDIt6 zK|wNdcy~iaXl_w$a7B7rF?euhWNAcYMN3&LF=u2?He(7cJ|J^*Xf0)AGBq_ZIUrP4 zNJ=wNAXsI3Q+Qb~RWU?sa&K8mXk%$^WJxqsHFZ!#QZ#mTcY1bYFL+c&F;PP}3N=Yh zF*9p6NK0x zXNbo)Ls;flKdk;eZSqxbHXb;%b@XUAq(S$Z&BRxjVtGnv$p7?P2lKG9Y5VA6RR0UZ zG&DYdj|`_!Om{7q9DHk$Oz9fMJ`|Yx$X+B-&=;^mEni|UEIr#;g+Sh#^&$EDG%kF% zWu-B>=_~$-u6^#6{SdJcg3#5j{P8dNJ>J+6lMPs_vI}k9nTrk}i7N}ctMzVDO4}r! zWazgbyR$9<1;|?6D`KfJE0xPL-O>V?{lq0i+bW~1f#e+S&x+XM{XAQNYZKtqNG#9! z*wkNL0i@87r!D14B_gL!o7YS+qht?L9BwPD+Z0%F0Tp3%?R*UbM^(1{aj)kxutvZs zw6cCY>BBZpeFEBtm}F%&IP`MIpf={>lsN@8XXgmZe&bKHD_f#&gN}zb4zh^InQlVe zCSgTHJkfjT!60ooZP#a(eZRUdF4Hs{qWZ#f=RRKXcjBbOw=&A(o@P#|x|Ts*Xi#*i zH*$0DvMGUv*f3m)(y-Jnoc~93prMyxGVIhP_+D#-AW1%3PxyX8%qTL%ycPWrXy@l>tHG#0x%9Lb6d9Q_PEC$D