diff --git a/flake.lock b/flake.lock index 90f02bc..39566af 100755 --- a/flake.lock +++ b/flake.lock @@ -11,11 +11,11 @@ ] }, "locked": { - "lastModified": 1779508871, - "narHash": "sha256-SFl2je8b423f/tIy0RTgCrWQUJiyFsAZp1Y0cccXqio=", + "lastModified": 1779768519, + "narHash": "sha256-2n/447oNfAZrl1yncafLPgXMx5tuTF6T2B+zI/zFYkI=", "owner": "caelestia-dots", "repo": "cli", - "rev": "7f300626704b7a86fe838ab58df654fa99779613", + "rev": "64a5507e74f6c7d0c29f9131964412f8f8c4dd89", "type": "github" }, "original": { @@ -33,11 +33,11 @@ "quickshell": "quickshell" }, "locked": { - "lastModified": 1779591587, - "narHash": "sha256-Ud83/zsmDSHcqQ64MRiQ7SnGkUVIpRzqwqBBU65DGXY=", + "lastModified": 1780196414, + "narHash": "sha256-iXmyWULTZuRd68xRL79e9GyYL9FZ6gfh6zl1PPlWX2A=", "owner": "caelestia-dots", "repo": "shell", - "rev": "2f7ab5e4140d9188185f6c3164e428c1eeda1fe6", + "rev": "63bb82762bb29ac9b7fcd5b97839abae721ce860", "type": "github" }, "original": { @@ -89,11 +89,11 @@ ] }, "locked": { - "lastModified": 1779726825, - "narHash": "sha256-RUkMrREjKDQrA+dA9+xZviGAxM5W1aVdyOr/bSYpHrE=", + "lastModified": 1780361225, + "narHash": "sha256-wnV9ttf4fPWNonBIQmvlrSlNpQYgx5HgWWd007mwIFA=", "owner": "nix-community", "repo": "home-manager", - "rev": "b179bde238977f7d4454fc770b1a727eaf55111c", + "rev": "e28654b71096e08c019d4861ca26acb646f583d8", "type": "github" }, "original": { @@ -183,13 +183,36 @@ "type": "github" } }, + "nixpkgs-notifier": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1780489272, + "narHash": "sha256-hMWKTal0SqG2OdtT/wB6wj9jLaES40yJlUQAjtbjTpA=", + "owner": "tomasriveral", + "repo": "nixpkgs-notifier", + "rev": "276b61aecaf9c2700e7c3cb7310bac5c6a9e5b5a", + "type": "github" + }, + "original": { + "owner": "tomasriveral", + "repo": "nixpkgs-notifier", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { - "lastModified": 1779877693, - "narHash": "sha256-NOF9NAREhxr50bbBfVcVOq+ArCMSoe8dP79Pk2uyARk=", + "lastModified": 1780336545, + "narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4100e830e085863741bc69b156ec4ccd53ab5be0", + "rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f", "type": "github" }, "original": { @@ -201,11 +224,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1779971959, - "narHash": "sha256-R5nauXyqyfRUFiZycFFZdkF7wl6eaUpPLst35+2nJQY=", + "lastModified": 1780203844, + "narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ec942ba042dad5ef097e2ef3a3effc034241f011", + "rev": "b51242d7d43689db2f3be91bd05d5b24fbb469c4", "type": "github" }, "original": { @@ -217,18 +240,19 @@ }, "notewrapper": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs-unstable" - ], - "notewrapper": "notewrapper_2" + ] }, "locked": { - "lastModified": 1779896579, - "narHash": "sha256-ngPHJ7W36atwMLVQTzP4i5VlS1Lqj9nSt7mKDD6xGiw=", + "lastModified": 1780404062, + "narHash": "sha256-XZziB7gcLwkhNyMoH8xDpwFktxBtzHx7zULyE4dHQfo=", "owner": "tomasriveral", "repo": "notewrapper", - "rev": "7af79c76b1cdbbf3f516aa76a5ffe7ca169b1cfd", + "rev": "0f9ec32bfcfc4c111eaefe9e44d416afc79940ee", "type": "github" }, "original": { @@ -237,22 +261,6 @@ "type": "github" } }, - "notewrapper_2": { - "flake": false, - "locked": { - "lastModified": 1779896337, - "narHash": "sha256-Xw5vkiN4ei2dkzIRXP0DLSYG8QRjQ0MLvFx2akt96kk=", - "owner": "tomasriveral", - "repo": "NoteWrapper", - "rev": "4d228fb9118f22264863716ac2d74c4ad67edbf8", - "type": "github" - }, - "original": { - "owner": "tomasriveral", - "repo": "NoteWrapper", - "type": "github" - } - }, "quickshell": { "inputs": { "nixpkgs": [ @@ -278,11 +286,13 @@ "inputs": { "caelestia-shell": "caelestia-shell", "flake-parts": "flake-parts", + "flake-utils": "flake-utils", "home-manager": "home-manager", "import-tree": "import-tree", "microPlugins-vivify": "microPlugins-vivify", "nixos-grub-themes": "nixos-grub-themes", "nixpkgs": "nixpkgs_2", + "nixpkgs-notifier": "nixpkgs-notifier", "nixpkgs-unstable": "nixpkgs-unstable", "notewrapper": "notewrapper" } diff --git a/flake.nix b/flake.nix index 806f1a1..5d51296 100644 --- a/flake.nix +++ b/flake.nix @@ -9,10 +9,19 @@ url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + flake-utils = { + url = "github:numtide/flake-utils"; + }; notewrapper = { url = "github:tomasriveral/notewrapper"; inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.flake-utils.follows = "flake-utils"; }; + nixpkgs-notifier = { + url = "github:tomasriveral/nixpkgs-notifier"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; caelestia-shell = { # based on quickshell. See https://github.com/caelestia-dots/shell url = "github:caelestia-dots/shell"; diff --git a/modules/applications/browser.nix b/modules/applications/browser.nix index 0dc2666..fe79cf6 100644 --- a/modules/applications/browser.nix +++ b/modules/applications/browser.nix @@ -160,6 +160,10 @@ install_url = "https://addons.mozilla.org/firefox/downloads/file/4749958/bitwarden_password_manager-latest.xpi"; installation_mode = "force_installed"; }; + "@crw-extension-firefox" = { + install_url = "https://addons.mozilla.org/firefox/downloads/file/4790089/consumer_rights_wiki-latest.xpi"; + installation_mode = "force_installed"; + }; }; DisableTelemetry = true; DisableFirefoxStudies = true; @@ -304,6 +308,12 @@ bookmarks = { force = true; settings = [ + { + name = "Nixpkgs PRs"; + tags = ["nixpkgs" "PR" "github"]; + keyword = "nixpkgs prs"; + url = "https://github.com/NixOS/nixpkgs/pulls"; + } { name = "Nixos Config"; tags = ["github"]; @@ -354,25 +364,25 @@ } { name = "nixpkgs' failing and orphan packages"; - tags = [ "nixpkgs" "fail" "orphan" "ZH" "zero hydra failure"]; + tags = ["nixpkgs" "fail" "orphan" "ZH" "zero hydra failure"]; keyword = "Zero hydra failure orphan packages"; url = "https://zh.fail/failed/by-maintainer/_.html"; } { name = "NixOS Manual - Unstable"; - tags = [ "nixos" "manual" "unstable"]; + tags = ["nixos" "manual" "unstable"]; keyword = "NixOS manual"; url = "https://nixos.org/manual/nixos/unstable/"; } { name = "Nixpgks Reference Manual - Unstable"; - tags = [ "nixpkgs" "manual" "reference" "unstable" ]; + tags = ["nixpkgs" "manual" "reference" "unstable"]; keyword = "nixpkgs reference manual"; url = "https://nixos.org/manual/nixpkgs/unstable/"; } { name = "Nix Reference Manual - 2.34."; - tags = [ "nix" "manual" "reference" "2.34"]; + tags = ["nix" "manual" "reference" "2.34"]; keyword = "nix reference manual"; url = "https://nix.dev/manual/nix/2.34/nix-2.34.html"; } diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix index 2638d2c..c4de24a 100644 --- a/modules/applications/hyprland.nix +++ b/modules/applications/hyprland.nix @@ -15,7 +15,6 @@ self.packages.${pkgs.system}.custom-dontkillsteam # kill app (if not steam or tomato-c self.packages.${pkgs.system}.custom-killall # kill all windows except focused window xdg-utils - home-manager ]; # enable hyprland WM programs.hyprland = { @@ -42,6 +41,7 @@ wayland.windowManager.hyprland.settings = { exec-once = [ "qtbatticon" # custom battery tray + "nixpkgs-notifier listen" # tracks PR merge in nixos-unstable ]; monitor = [ "eDP-1, highres@highrr, 0x0, 1" @@ -58,9 +58,10 @@ home.sessionVariables.NIXOS_OZONE_WL = "1"; wayland.windowManager.hyprland.plugins = [ #pkgs-unstable.hyprlandPlugins.hyprspace # currently broken + #self.packages.${pkgs-unstable.system}.hypr-dynamic-cursors-manual #pkgs-unstable.hyprlandPlugins.hypr-dynamic-cursors # currently broken ]; - wayland.windowManager.hyprland.configType = "hyprlang"; + wayland.windowManager.hyprland.configType = "hyprlang"; wayland.windowManager.hyprland.settings = { "$mod" = "SUPER"; "$term" = "kitty"; diff --git a/modules/applications/kdrive.nix b/modules/applications/kdrive.nix index 16e517b..6aeb742 100644 --- a/modules/applications/kdrive.nix +++ b/modules/applications/kdrive.nix @@ -1,9 +1,9 @@ {self, ...}: { - flake.nixosModules.kdrive = {pkgs-unstable, ...}: { + flake.nixosModules.kdrive-laptop = {pkgs-unstable, ...}: { environment.systemPackages = with pkgs-unstable; [ rclone self.packages.${pkgs.system}.custom-checkKdrive - self.packages.${pkgs.system}.custom-mountkdrive + self.packages.${pkgs.system}.custom-mountkdrive-laptop ]; # removes rclone error programs.fuse = { @@ -46,7 +46,7 @@ fi ''; }; - packages.custom-mountkdrive = pkgs.writeShellApplication { + packages.custom-mountkdrive-laptop = pkgs.writeShellApplication { name = "custom-mountkdrive"; runtimeInputs = with pkgs; [ rclone diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 8c3858a..c405449 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -318,7 +318,7 @@ _: { }) vim.lsp.config("pylsp", { cmd = { "pylsp" }, - filetypes = { "python" }, + filetypes = { "python", "py" }, on_attach = on_attach, settings = { pylsp = { diff --git a/modules/applications/notewrapper.nix b/modules/applications/notewrapper.nix index 0bb4cf0..764504e 100644 --- a/modules/applications/notewrapper.nix +++ b/modules/applications/notewrapper.nix @@ -1,4 +1,4 @@ -{inputs, ... }: { +{inputs, ...}: { flake.homeModules.notewrapper = {pkgs, ...}: { home.packages = [ inputs.notewrapper.packages.${pkgs.system}.default @@ -7,24 +7,24 @@ enable = true; force = true; text = '' -{ - "directory": ["~/Documents/Notes/", "~/test/"], - "render": true, - "jumpToEndOfFileOnLaunch": true, - "editor": "neovim", - "journalRegex": ".*journal.*", - "dateEntry": "# %Y %m %d %a", - "newLineOnOpening": true, - "backup": { - "enable": true, - "directory": { - "~/Documents/Notes/": "~/kdrive/Notes/", - "~/test/": "~/backupTest/" - }, - "interval": "daily", - "rsyncArgs": ["-Lqah", "--update"] - } -} + { + "directory": ["~/Documents/Notes/", "~/test/"], + "render": true, + "jumpToEndOfFileOnLaunch": true, + "editor": "neovim", + "journalRegex": ".*journal.*", + "dateEntry": "# %Y %m %d %a", + "newLineOnOpening": true, + "backup": { + "enable": true, + "directory": { + "~/Documents/Notes/": "~/kdrive/Notes/", + "~/test/": "~/backupTest/" + }, + "interval": "daily", + "rsyncArgs": ["-Lqah", "--update"] + } + } ''; }; }; diff --git a/modules/applications/ssh.nix b/modules/applications/ssh.nix index 7d56ea4..bc56af6 100644 --- a/modules/applications/ssh.nix +++ b/modules/applications/ssh.nix @@ -3,7 +3,8 @@ _: { programs.ssh = { enable = true; enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning - /*settings = { + /* + settings = { # equivalent to the default config #forwardAgent = false; # give errors in home-manager 26.05 @@ -16,7 +17,8 @@ _: { #controlMaster = "no"; #controlPath = "~/.ssh/master-%r@%n:%p"; #controlPersist = "no"; - };*/ + }; + */ }; services.ssh-agent.enable = true; home.file.".ssh/config".text = '' diff --git a/modules/applications/zsh.nix b/modules/applications/zsh.nix index c374757..b63a7db 100644 --- a/modules/applications/zsh.nix +++ b/modules/applications/zsh.nix @@ -25,7 +25,7 @@ command cat "$@" fi } - + custom-eza() { # behaves differently if we just call it or if we pipe initContent if [[ -t 1 ]]; then eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" diff --git a/modules/hosts/laptop.nix b/modules/hosts/laptop.nix index f681313..059dc38 100644 --- a/modules/hosts/laptop.nix +++ b/modules/hosts/laptop.nix @@ -28,12 +28,12 @@ disk disk-laptop fonts - games + gitBackup hardware-configuration-laptop hardwareUtils-laptop hyprland IO - kdrive + kdrive-laptop latex ly mullvad @@ -54,6 +54,7 @@ anki caelestia cursor + development eza fastfetch git diff --git a/modules/other/user.nix b/modules/other/user.nix index fa950cc..5f3b20b 100644 --- a/modules/other/user.nix +++ b/modules/other/user.nix @@ -27,24 +27,29 @@ _: { services.upower.enable = true; # removes need for password for nixos-rebuild - security.sudo.extraRules = [ - { - users = ["tomasr"]; - commands = [ - { - command = "/run/current-system/sw/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - { - command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - { - command = "${pkgs-unstable.nixos-rebuild}/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - ]; - } - ]; + security.sudo = { + extraRules = [ + { + users = ["tomasr"]; + commands = [ + { + command = "/run/current-system/sw/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + { + command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + { + command = "${pkgs-unstable.nixos-rebuild}/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + ]; + } + ]; + extraConfig = '' + Defaults pwfeedback + ''; + }; }; } diff --git a/modules/packages/hyprlandPlugins.nix b/modules/packages/hyprlandPlugins.nix new file mode 100644 index 0000000..db288c8 --- /dev/null +++ b/modules/packages/hyprlandPlugins.nix @@ -0,0 +1,42 @@ +_: { + perSystem = _: { + packages.hypr-dynamic-cursors-manual = { + lib, + mkHyprlandPlugin, + fetchFromGitHub, + nix-update-script, + }: + mkHyprlandPlugin { + pluginName = "hypr-dynamic-cursors"; + version = "0-unstable-2026-05-29"; + + src = fetchFromGitHub { + owner = "VirtCode"; + repo = "hypr-dynamic-cursors"; + rev = "1de08deb7d495124ce88b342fecc7e7542d0672f"; + hash = "sha256-Ck9dFUfj/zDSab16CzsGWEMNeSNDhhDOB0JWeHzVvjk="; + }; + + dontUseCmakeConfigure = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib + mv out/dynamic-cursors.so $out/lib/libhypr-dynamic-cursors.so + + runHook postInstall + ''; + + passthru.updateScript = nix-update-script {extraArgs = ["--version=branch"];}; + + meta = { + description = "Plugin to make your Hyprland cursor more realistic"; + homepage = "https://github.com/VirtCode/hypr-dynamic-cursors"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [donovanglover]; + platforms = lib.platforms.linux; + }; + }; + }; +} diff --git a/modules/utilities/development.nix b/modules/utilities/development.nix index 5a454ed..5fff03a 100644 --- a/modules/utilities/development.nix +++ b/modules/utilities/development.nix @@ -1,4 +1,4 @@ -_: { +{inputs, ...}: { flake.nixosModules.development = { pkgs, pkgs-unstable, @@ -31,6 +31,26 @@ _: { ltex-ls-plus pylint black + inputs.nixpkgs-notifier.packages.${pkgs.system}.default ]; }; + flake.homeModules.development = _: { + home.file.".config/nixpkgs-notifier/config.json" = { + enable = true; + text = '' + { + "configTime": 3600, + "configFetchTime": 1, + "localNotify": true, + "matrix": { + "enable": true, + "room": "!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU", + "ping": true, + "userPing": "@notificationbot_0000", + "userPingServer": "matrix.org" + } + } + ''; + }; + }; } diff --git a/modules/utilities/gitBackup.nix b/modules/utilities/gitBackup.nix new file mode 100644 index 0000000..25eb7c8 --- /dev/null +++ b/modules/utilities/gitBackup.nix @@ -0,0 +1,102 @@ +{self, ...}: { + flake.nixosModules.gitBackup = {pkgs, ...}: { + environment.systemPackages = [ + self.packages.${pkgs.system}.custom-gitBackup + ]; + + systemd.user.services.custom-gitBackup = { + description = "Backup selected git repos"; + + serviceConfig = { + Type = "oneshot"; + + ExecStart = "/run/current-system/sw/bin/custom-gitBackup"; + + TimeoutStartSec = "45min"; + TimeoutStopSec = "10min"; + + RemainAfterExit = true; + + Nice = 10; + IOSchedulingClass = "best-effort"; + IOSchedulingPriority = 7; + }; + }; + + # Systemd USER timer + systemd.user.timers.custom-gitBackup = { + wantedBy = ["timers.target"]; + + timerConfig = { + OnCalendar = "Thu *-*-* 12:00:00"; + + Persistent = true; # if it happens during shutted down + + RandomizedDelaySec = "20min"; + }; + }; + }; + perSystem = {pkgs, ...}: { + packages.custom-gitBackup = pkgs.writeShellApplication { + name = "custom-gitBackup"; + runtimeInputs = with pkgs; [ + rsync + matrix-commander-rs + libnotify + self.packages.${pkgs.system}.custom-checkKdrive + ]; + text = '' + # checks if kdrive is available + custom-checkKdrive + + REPOS=( + "https://github.com/tomasriveral/nixos.git" + "https://github.com/tomasriveral/notewrapper.git" + "https://github.com/tomasriveral/fractal-cli.git" + "https://github.com/tomasriveral/boids.git" + "https://github.com/tomasriveral/Nixpkgs-tracker-notifier.git" + ) + + LOCAL_BACKUP_DIR="$HOME/.gitBackups" + CLOUD_DIR="$HOME/kdrive/Code/gitBackups" + + # Create backup directories if they don't exist + mkdir -p "$LOCAL_BACKUP_DIR" + mkdir -p "$CLOUD_DIR" + + notify_error() { + local message="$1" + notify-send "Git Backup Failed" "$message" + matrix-commander-rs --verbose -m "Git Backup Failed: $message
@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + + } + + for REPO in "''${REPOS[@]}"; do + # Extract repo name (without .git) + REPO_NAME=$(basename "$REPO" .git) + LOCAL_REPO_PATH="$LOCAL_BACKUP_DIR/$REPO_NAME.git" + + if [ ! -d "$LOCAL_REPO_PATH" ]; then + # Clone mirror if it doesn't exist + echo "Cloning $REPO..." + git clone --mirror "$REPO" "$LOCAL_REPO_PATH" || { notify_error "Failed to clone $REPO"; continue; } + else + # Update existing mirror + echo "Updating $REPO..." + cd "$LOCAL_REPO_PATH" || { notify_error "Cannot enter $LOCAL_REPO_PATH"; continue; } + git remote update || { notify_error "Failed to update $REPO"; continue; } + fi + + # Rsync to cloud directory (only changes, preserve permissions) + echo "Syncing $REPO_NAME to cloud..." + rsync -a --delete "$LOCAL_REPO_PATH/" "$CLOUD_DIR/$REPO_NAME/" || { notify_error "Failed to rsync $REPO_NAME"; continue; } + + done + + echo "All backups completed." + ''; + }; + }; +} diff --git a/modules/utilities/nixUtils.nix b/modules/utilities/nixUtils.nix index 5cf3ac8..a7c4531 100644 --- a/modules/utilities/nixUtils.nix +++ b/modules/utilities/nixUtils.nix @@ -6,10 +6,18 @@ nix.settings.cores = 6; }; flake.nixosModules.nixUtils = {pkgs-unstable, ...}: { + # Optimise the nix store + nix.optimise = { + automatic = true; + persistent = true; + randomDelaySec = "30min"; + dates = "Thu *-*-* 16:00:00"; + }; # Garbage collector of generations nix.gc = { automatic = true; - dates = "weekly"; + dates = "Wed *-*-* 16:00:00"; + persistent = true; options = "--delete-older-than 7d"; # every week delete generations older than a month }; diff --git a/modules/utilities/otherUtils.nix b/modules/utilities/otherUtils.nix index d5097ff..e0f4a1a 100644 --- a/modules/utilities/otherUtils.nix +++ b/modules/utilities/otherUtils.nix @@ -1,11 +1,7 @@ -{self, inputs, ...}: { +{self, ...}: { flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file - { - pkgs, - pkgs-unstable, - ... - }: { + {pkgs, ...}: { environment.systemPackages = with pkgs; [ gnome-calculator snapshot @@ -22,7 +18,8 @@ usbutils # used for lsusb self.packages.${pkgs.system}.custom-tomato self.packages.${pkgs.system}.custom-syllabes - pkgs-unstable.bitwarden-desktop + # Electron 39 EOL. https://github.com/bitwarden/clients/pull/20448 should move it to 41. For the moment use the browser extension + #pkgs-unstable.bitwarden-desktop fluffychat # matrix client ]; };