From 30e8029a6b72ca69abf54ef02c34ff2424a65e77 Mon Sep 17 00:00:00 2001 From: Tomas Rivera Date: Sat, 23 May 2026 21:39:41 +0200 Subject: [PATCH] snapshot pre-cleanup-2026-05-23T19-39-41Z --- flake.nix | 39 +++--- modules/applications/anki.nix | 2 +- modules/applications/browser.nix | 34 +---- modules/applications/hyprland.nix | 1 + modules/applications/hyprlandScripts.nix | 36 +++--- modules/applications/kdrive.nix | 9 +- modules/applications/obsidian.nix | 9 +- modules/applications/quickshell.nix | 12 +- modules/applications/waybar.nix | 6 +- modules/hardware/battery.nix | 22 ++-- modules/hardware/bluetooth.nix | 4 +- modules/hardware/disk.nix | 4 +- modules/hosts/laptop.nix | 48 +++++-- modules/hosts/laptop.nix.save | 120 ++++++++++++++++++ modules/hosts/test.nix | 8 ++ modules/other/user.nix | 2 +- modules/packages/custom-bottom.nix | 5 +- modules/packages/custom-colorpicker.nix | 6 +- modules/packages/custom-cowsay.nix | 6 +- modules/packages/custom-librewolfprofiles.nix | 34 +++++ modules/packages/custom-syllabes.nix | 6 +- modules/packages/custom-tomato.nix | 5 +- modules/packages/custom-weather.nix | 6 +- modules/packages/dejaManuallyDerived.nix | 24 ++-- modules/packages/sbb-tuiManuallyDerived.nix | 26 ++-- modules/packages/vivifyManuallyDerived.nix | 43 +++---- modules/systems.nix | 8 ++ modules/test.nix | 9 -- modules/utilities/audioAndMedia.nix | 6 +- modules/utilities/autoCleanup.nix | 6 +- modules/utilities/autoUpdate.nix | 6 +- .../communicationAndNotification.nix | 9 +- modules/utilities/documentation.nix | 9 +- modules/utilities/nixUtils.nix | 6 +- modules/utilities/otherUtils.nix | 6 +- 35 files changed, 353 insertions(+), 229 deletions(-) create mode 100644 modules/hosts/laptop.nix.save create mode 100644 modules/hosts/test.nix create mode 100644 modules/packages/custom-librewolfprofiles.nix create mode 100644 modules/systems.nix delete mode 100644 modules/test.nix diff --git a/flake.nix b/flake.nix index 76307f2..d1236b0 100644 --- a/flake.nix +++ b/flake.nix @@ -24,22 +24,27 @@ import-tree.url = "github:vic/import-tree"; # imports ./modules recursively }; outputs = inputs @ { flake-parts, ... }: - /*@ inputs: let - unfreePkgs = [ - "hplip" - "vivify.vim" - "cheatsheet.nvim" - ]; - - mkUnfreePredicate = pkg: - builtins.elem (nixpkgs.lib.getName pkg) unfreePkgs; - - pkgs-unstable = import nixpkgs-unstable { - inherit system; - - config.allowUnfreePredicate = mkUnfreePredicate; - }; - in */ flake-parts.lib.mkFlake { inherit inputs; } - (inputs.import-tree ./modules); + ({ + flake = let + system = "x86_64-linux"; + unfreePkgs = [ + "hplip" + "vivify.vim" + "cheatsheet.nvim" + ]; + mkUnfreePredicate = pkg: + builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs; + mkPkgs = nixpkgsInput: + import nixpkgsInput { + inherit system; + config.allowUnfreePredicate = mkUnfreePredicate; + }; + pkgs = mkPkgs inputs.nixpkgs; + pkgs-unstable = mkPkgs inputs.nixpkgs-unstable; + in { + inherit pkgs pkgs-unstable; + }; + } + // (inputs.import-tree ./modules)); } diff --git a/modules/applications/anki.nix b/modules/applications/anki.nix index a5a996a..3bb3884 100644 --- a/modules/applications/anki.nix +++ b/modules/applications/anki.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: { +{ ... }: { flake.nixosModules.anki = { pkgs, ... }: { environment.systemPackages = [ (pkgs.anki.withAddons [ diff --git a/modules/applications/browser.nix b/modules/applications/browser.nix index 88ff5a6..8ea7565 100644 --- a/modules/applications/browser.nix +++ b/modules/applications/browser.nix @@ -3,8 +3,7 @@ environment.systemPackages = with pkgs; [ chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID. pkgs-unstable.tor-browser - self.packages.custom-librewolfprofiles - (pkgs.callPackage ../../modules/scripts/librewolfprofiles.nix {}) # fzf librewolf profile selector + self.packages.${pkgs.system}.custom-librewolfprofiles ]; }; flake.homeModules.librewolf = { ... }: { @@ -645,35 +644,4 @@ }; }; }; - flake.packages.custom-librewolfprofiles = { pkgs, ... }: - # fzf librewolf profile selector - pkgs.writeShellApplication { - name = "custom-librewolfprofiles"; - runtimeInputs = with pkgs; [ - zsh - fzf - ]; - text = '' - # List of profiles - profiles=("work" "other" "private window") - - # Use fzf to select - selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") - - # If user cancels, exit - [[ -z "$selected" ]] && exit 0 - - # Launch LibreWolf detached, keeping environment - if [[ "$selected" == "private window" ]]; then - setsid librewolf --private-window --no-remote >/dev/null 2>&1 & - pkill -f "kitty.*Select LibreWolf profile" - else - setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & - pkill -f "kitty.*Select LibreWolf profile" - fi - - # Exit the kitty terminal after selection - exit - ''; - }; } diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix index e26284a..defa7ba 100644 --- a/modules/applications/hyprland.nix +++ b/modules/applications/hyprland.nix @@ -11,6 +11,7 @@ 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 = { diff --git a/modules/applications/hyprlandScripts.nix b/modules/applications/hyprlandScripts.nix index 359c1f2..ab6f8e4 100644 --- a/modules/applications/hyprlandScripts.nix +++ b/modules/applications/hyprlandScripts.nix @@ -1,11 +1,17 @@ -{ self, ...}: { +{ pkgs-unstable, ...}: { # for some reason perSystem can't expose pkgs-unstable so we need to expose it here # ----------------------------------------------------- # Here are a bunch of scripts that interact with hyprland # Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools # ----------------------------------------------------- + perSystem = { pkgs, ... }: let + wallpaper1 = ../../assets/wallpaper1.jpg; + wallpaper2 = ../../assets/wallpaper2.jpg; + wallpaper3 = ../../assets/wallpaper3.jpg; + wallpaper4 = ../../assets/wallpaper4.jpg; + wallpaper5 = ../../assets/wallpaper5.jpg; + in { # kills the app, but when it's steam or custom-pomodoro - flake.packages.custom-dontkillsteam = { pkgs, ... }: - pkgs.writeShellApplication { + packages.custom-dontkillsteam = pkgs.writeShellApplication { name = "custom-dontkillsteam"; runtimeInputs = with pkgs; [ hyprland @@ -21,12 +27,11 @@ ''; }; - flake.packages.custom-killall = { pkgs, pkgs-unstable, ...}: - pkgs.writeShellApplication { + packages.custom-killall = pkgs.writeShellApplication { name = "custom-killall"; - runtimeInputs = with pkgs; [ - pkgs-unstable.hyprland - jq + runtimeInputs = [ + pkgs.hyprland # for some reason pkgs-unstable doesn't work here + pkgs.jq ]; text = '' active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') @@ -39,15 +44,7 @@ xargs -r kill ''; }; - flake.packages.custom-wallpaper = { pkgs, ... }: - let - wallpaper1 = ../../assets/wallpaper1.jpg; - wallpaper2 = ../../assets/wallpaper2.jpg; - wallpaper3 = ../../assets/wallpaper3.jpg; - wallpaper4 = ../../assets/wallpaper4.jpg; - wallpaper5 = ../../assets/wallpaper5.jpg; - in - pkgs.writeShellApplication { + packages.custom-wallpaper = pkgs.writeShellApplication { name = "custom-wallpaper"; runtimeInputs = with pkgs; [ socat @@ -84,8 +81,7 @@ socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done ''; }; - flake.packages.custom-launch = { pkgs, ... }: - pkgs.writeShellApplication { + packages.custom-launch = pkgs.writeShellApplication { # used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized # unused name = "custom-launch"; @@ -98,4 +94,4 @@ zsh ''; }; -} +};} diff --git a/modules/applications/kdrive.nix b/modules/applications/kdrive.nix index 1d974d3..9528497 100644 --- a/modules/applications/kdrive.nix +++ b/modules/applications/kdrive.nix @@ -11,8 +11,8 @@ enable = true; }; }; - flake.packages.custom-checkKdrive = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-checkKdrive = pkgs.writeShellApplication { name = "custom-checkKdrive"; runtimeInputs = with pkgs; [ rclone @@ -46,8 +46,7 @@ fi ''; }; - flake.packages.custom-mountkdrive = { pkgs, ... }: - pkgs.writeShellApplication { + packages.custom-mountkdrive = pkgs.writeShellApplication { name = "custom-mountkdrive"; runtimeInputs = with pkgs; [ rclone @@ -67,4 +66,4 @@ fi ''; }; -} +};} diff --git a/modules/applications/obsidian.nix b/modules/applications/obsidian.nix index f343224..7dc550f 100644 --- a/modules/applications/obsidian.nix +++ b/modules/applications/obsidian.nix @@ -26,8 +26,8 @@ }; }; }; - flake.packages.custom-obsidianbackup = {pkgs, ...}: - pkgs.writeShellApplication { + perSystem = {pkgs, ...}: { + packages.custom-obsidianbackup = pkgs.writeShellApplication { name = "custom-obsidianbackup"; runtimeInputs = with pkgs; [ rclone @@ -84,8 +84,7 @@ ''; }; # this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults - flake.packages.custom-obsidianvaults = {pkgs, ...}: - pkgs.writeShellApplication { + packages.custom-obsidianbvaults = pkgs.writeShellApplication { name = "custom-obsidianvaults"; runtimeInputs = with pkgs; [ zsh @@ -123,4 +122,4 @@ exit ''; }; -} +};} diff --git a/modules/applications/quickshell.nix b/modules/applications/quickshell.nix index 688d14b..0eff9de 100644 --- a/modules/applications/quickshell.nix +++ b/modules/applications/quickshell.nix @@ -13,9 +13,9 @@ recursive = true; }; }; - flake.packages.QS-notifycache = {writeShellApplication, ...}: + perSystem = {pkgs, ...}: { # creates and maintains cache file for the notification history - writeShellApplication { + packages.QS-notifycache = pkgs.writeShellApplication { name = "QS-notifycache"; text = '' CACHE="$HOME/.cache/notify_history" @@ -25,8 +25,7 @@ echo "Notification history initialized at $(date)" >> "$CACHE" ''; }; - flake.packages.QS-notifyhistory = {writeShellApplication, ...}: - writeShellApplication { + packages.QS-notifyhistory = pkgs.writeShellApplication { name = "QS-notifyhistory"; text = '' app="$1" @@ -51,8 +50,7 @@ } >> "$HOME/.cache/notify_history" ''; }; - flake.packages.QS-sysinfo = { pkgs, ... }: - pkgs.writeShellApplication { + packages.QS-sysinfo = pkgs.writeShellApplication { name = "QS-sysinfo"; runtimeInputs = with pkgs; [ ripgrep @@ -122,4 +120,4 @@ echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}" ''; }; -} +};} diff --git a/modules/applications/waybar.nix b/modules/applications/waybar.nix index f068922..5b11273 100644 --- a/modules/applications/waybar.nix +++ b/modules/applications/waybar.nix @@ -694,8 +694,8 @@ ''; }; }; - flake.packages.custom-weatherwaybar = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-weatherwaybar = pkgs.writeShellApplication { name = "custom-weatherwaybar"; runtimeInputs = with pkgs; [ curl @@ -713,4 +713,4 @@ "$TEXT1" "$TEXT2" "$TEXT3" ''; }; -} +};} diff --git a/modules/hardware/battery.nix b/modules/hardware/battery.nix index b58ed99..80c1c6e 100644 --- a/modules/hardware/battery.nix +++ b/modules/hardware/battery.nix @@ -53,10 +53,10 @@ }; # }; }; - flake.packages.batteryNotify = { pkgs, ... }: let + perSystem = { pkgs, ... }: let NotifySound = ../../assets/battery_notify.mp3; - in - pkgs.writeShellApplication { + in { + packages.custom-batterynotify = pkgs.writeShellApplication { # taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License name = "custom-batterynotify"; @@ -122,10 +122,7 @@ done ''; }; - flake.packages.batteryWarning = { pkgs, ...}: let - NotifySound = ../../assets/battery_notify.mp3; - in - pkgs.writeShellApplication { + packages.custom-batterywarning = pkgs.writeShellApplication { # taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License name = "custom-batterywarning"; runtimeInputs = with pkgs; [ @@ -165,13 +162,12 @@ done ''; }; - flake.packages.qtbatticon = { pkgs, ... }: # because cbatticon, batticonplus and other things didn't work. # chatGpt did this. # https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42 # at your risk and perils # click on the icon to get a notification with state, percentage and wattage - pkgs.stdenv.mkDerivation { + packages.qtbatticon = pkgs.stdenv.mkDerivation { pname = "qtbatticon"; version = "1.0"; @@ -336,8 +332,7 @@ ''; }; # This was replaced by caelestia shell's Game Mode - flake.packages.custom-performance = { pkgs, ...}: - pkgs.writeShellApplication { + packages.custom-performance = pkgs.writeShellApplication { name = "custom-performance"; runtimeInputs = with pkgs; [ hyprland @@ -367,8 +362,7 @@ ''; }; # Old script that was used for the battery. Might not work. - flake.packages.custom-olddeprecatedbatterynotify = { pkgs, ... }: - pkgs.writeShellApplication { + packages.custom-olddeprecatedbatterynotify = pkgs.writeShellApplication { name = "custom-olddeprecatedbatterynotify"; runtimeInputs = with pkgs; [ @@ -433,7 +427,7 @@ sleep "$INTERVAL" done ''; - }; + };}; flake.homeModules.cbatticon = { ... }: { # don't works. some GTK error. I let it here if someday, someone is interest in this shit. # ChatGPT half baked a replacement that works on my system. diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix index 4b9e416..efbc444 100644 --- a/modules/hardware/bluetooth.nix +++ b/modules/hardware/bluetooth.nix @@ -1,5 +1,5 @@ -{ inputs, ...}: { - flake.nixosModule.bluetooth = {pkgs, ...}: { +{ ...}: { + flake.nixosModules.bluetooth = {pkgs, ...}: { hardware.bluetooth.enable = true; environment.systemPackages = with pkgs; [ blueman # GTK-based Bluetooth Manager diff --git a/modules/hardware/disk.nix b/modules/hardware/disk.nix index 64fc317..3c67ecc 100644 --- a/modules/hardware/disk.nix +++ b/modules/hardware/disk.nix @@ -1,11 +1,11 @@ { ... }: { - flake.nixosModule.disk = { pkgs, ... }: { + flake.nixosModules.disk = { pkgs, ... }: { environment.systemPackages = with pkgs; [ gnome-disk-utility udiskie ]; }; - flake.nixosModule.disk-laptop = { ... }: { + flake.nixosModules.disk-laptop = { ... }: { # i found swap necessary when running nixpkgs review swapDevices = [ { diff --git a/modules/hosts/laptop.nix b/modules/hosts/laptop.nix index 509be21..a910856 100644 --- a/modules/hosts/laptop.nix +++ b/modules/hosts/laptop.nix @@ -1,7 +1,13 @@ { inputs, self, ...}: { - flake.nixosConfiguration.laptop = inputs.nixpkgs.lib.nixosSystem { + flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit (self) pkgs pkgs-unstable; + }; modules = with self.nixosModules; [ - # keep this alphabetically organised +#inputs.home-manager.nixosModules.home-manager +inputs.home-manager.nixosModules.default +# keep this alphabetically organised anki audioAndMedia autoCleanup-laptop @@ -24,6 +30,7 @@ IO kdrive latex + laptop ly mullvad networking @@ -34,11 +41,20 @@ printer udev user - ]; - }; - flake.homeConfiguration.tomasr = inputs.home-manager.lib.homeManagerConfiguration { + ];}; + flake.homeConfigurations.tomasr = inputs.home-manager.lib.homeManagerConfiguration { pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; - pkgs-unstable = import inputs.nixpkgs-unstable { system = "x86_64-linux"; }; + +# system = "x86_64-linux"; + #specialArgs = { + # inherit (self) pkgs pkgs-unstable; + #}; + extraSpecialArgs = { + pkgs-unstable = + import inputs.nixpkgs-unstable { + system = "x86_64-linux"; + }; + }; modules = with self.homeModules; [ anki cursor @@ -58,8 +74,8 @@ sbb-tui ssh thunderbird - tomasrModule - vivify + tomasr + vivify zoxide zsh zsh-laptop @@ -74,19 +90,27 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "25.11"; # Did you read the comment? - home-manager.users.USERNAME = self.homeModules.USERNAMEModule; + #home-manager.users.tomasr = self.home.Configurations.tomasr; + #home-manager.nixosModule.home-manager.users.tomasr = self.homeConfigurations.tomasr; + home-manager.users.tomasr = { + imports = [ + self.homeModules.tomasr + ]; +}; }; - flake.nixosModules.home-manager-laptop = { ... }: { + flake.nixosModules.home-manager-laptop = { pkgs, ... }: { imports = [ inputs.home-manager.nixosModules.default # import official home-manager NixOS module ]; - + + # Warning. Git is used in case I break everything up. It already saved me once + environment.systemPackages = [ pkgs.git ]; home-manager = { useGlobalPkgs = true; useUserPackages = true; }; }; - flake.homeModules.tomasrModule = { ... }: { + flake.homeModules.tomasr = { ... }: { imports = [ inputs.caelestia-shell.homeManagerModules.default ]; diff --git a/modules/hosts/laptop.nix.save b/modules/hosts/laptop.nix.save new file mode 100644 index 0000000..015ea17 --- /dev/null +++ b/modules/hosts/laptop.nix.save @@ -0,0 +1,120 @@ +}[[{ inputs, self, ...}: { + flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit (self) pkgs pkgs-unstable; + }; + modules = with self.nixosModules; [ + # keep this alphabetically organised + anki + audioAndMedia + autoCleanup-laptop + autoUpdate-laptop + battery-laptop + bluetooth + bootloader-laptop + browsers + caelestia + development + documentation + disk + disk-laptop + fonts + games + hardware-configuration-laptop + hardwareUtils-laptop + home-manager-laptop + hyprland + IO + kdrive + latex + laptop + ly + mullvad + networking + notifications + office + #ollama + otherUtils + printer + udev + user + ]; + flake.homeConfiguration.tomasr = inputs.home-manager.lib.homeManagerConfiguration { + system = "x86_64-linux"; + specialArgs = { + inherit (self) pkgs pkgs-unstable; + }; + modules = with self.homeModules; [ + anki + cursor + eza + fastfetch + git + gtk + hyprland + hyprland-laptop + kitty + librewolf + mullvad + neovim + oh-my-zsh + ripgrep + rofi + sbb-tui + ssh + thunderbird + tomasr + vivify + zoxide + zsh + zsh-laptop + ]; + }; + flake.nixosModules.laptop = { ... }: { + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "25.11"; # Did you read the comment? + + home-manager.users.tomasr = self.homeModules.tomasr; + }; + flake.nixosModules.home-manager-laptop = { ... }: { + imports = [ + inputs.home-manager.nixosModules.default # import official home-manager NixOS module + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + }; + flake.homeModules.tomasr = { ... }: { + imports = [ + inputs.caelestia-shell.homeManagerModules.default + ]; + home.username = "tomasr"; + home.homeDirectory = "/home/tomasr"; + + home.sessionVariables = { + EDITOR = "neovim"; + TERMINAL = "kitty"; + }; + + # Required for Home Manager + home.stateVersion = "25.11"; # match your Home Manager release + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + }; +} diff --git a/modules/hosts/test.nix b/modules/hosts/test.nix new file mode 100644 index 0000000..5317195 --- /dev/null +++ b/modules/hosts/test.nix @@ -0,0 +1,8 @@ +{ inputs, ... }: { + +flake.modules.nixos.common = { ... }: { + + imports = [ inputs.home-manager.nixosModules.default ]; +}; + +} diff --git a/modules/other/user.nix b/modules/other/user.nix index 884624c..1141e5d 100644 --- a/modules/other/user.nix +++ b/modules/other/user.nix @@ -1,5 +1,5 @@ { ... }: { - flake.nixModules.user = { + flake.nixosModules.user = { pkgs, pkgs-unstable, ... diff --git a/modules/packages/custom-bottom.nix b/modules/packages/custom-bottom.nix index c1e6399..e36265d 100644 --- a/modules/packages/custom-bottom.nix +++ b/modules/packages/custom-bottom.nix @@ -1,6 +1,6 @@ { ... }: { - flake.packages.custom-bottom = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-bottom = pkgs.writeShellApplication { name = "custom-bottom"; runtimeInputs = with pkgs; [ kitty @@ -10,4 +10,5 @@ kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T ''; }; +}; } diff --git a/modules/packages/custom-colorpicker.nix b/modules/packages/custom-colorpicker.nix index 5c73010..5549513 100644 --- a/modules/packages/custom-colorpicker.nix +++ b/modules/packages/custom-colorpicker.nix @@ -1,6 +1,7 @@ { ... }: { - flake.packages.custom-colorpicker = { pkgs, ... }: - pkgs.writeShellApplication { + + perSystem = { pkgs, ... }: { + packages.custom-colorpicker = pkgs.writeShellApplication { # useless. Just use hyprpicker name = "custom-colorpicker"; runtimeInputs = with pkgs; [ @@ -70,4 +71,5 @@ pkill -RTMIN+1 waybar ''; }; +}; } diff --git a/modules/packages/custom-cowsay.nix b/modules/packages/custom-cowsay.nix index c0e0588..32463ef 100644 --- a/modules/packages/custom-cowsay.nix +++ b/modules/packages/custom-cowsay.nix @@ -1,6 +1,6 @@ { ... }: { - flake.packages.custom-cowsay = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-cowsay = pkgs.writeShellApplication { name = "custom-cowsay"; runtimeInputs = with pkgs; [ cowsay @@ -80,4 +80,4 @@ ''; # reduce terminal size for actually }; -} +};} diff --git a/modules/packages/custom-librewolfprofiles.nix b/modules/packages/custom-librewolfprofiles.nix new file mode 100644 index 0000000..e2b05f8 --- /dev/null +++ b/modules/packages/custom-librewolfprofiles.nix @@ -0,0 +1,34 @@ +{ ... }: { + perSystem = { pkgs, ... }: { + # fzf librewolf profile selector + packages.custom-librewolfprofiles = pkgs.writeShellApplication { + name = "custom-librewolfprofiles"; + runtimeInputs = with pkgs; [ + zsh + fzf + ]; + text = '' + # List of profiles + profiles=("work" "other" "private window") + + # Use fzf to select + selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") + + # If user cancels, exit + [[ -z "$selected" ]] && exit 0 + + # Launch LibreWolf detached, keeping environment + if [[ "$selected" == "private window" ]]; then + setsid librewolf --private-window --no-remote >/dev/null 2>&1 & + pkill -f "kitty.*Select LibreWolf profile" + else + setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & + pkill -f "kitty.*Select LibreWolf profile" + fi + + # Exit the kitty terminal after selection + exit + ''; + }; + }; +} diff --git a/modules/packages/custom-syllabes.nix b/modules/packages/custom-syllabes.nix index e1471bb..9db1540 100644 --- a/modules/packages/custom-syllabes.nix +++ b/modules/packages/custom-syllabes.nix @@ -1,10 +1,10 @@ { ... }: { - flake.packages.custom-syllabes = { pkgs, ... }: + perSystem = { pkgs, ... }: { # counts how many syllabes in a string. # not perfect. Does not handle silents e in french # but that's what I use for writing poetry - pkgs.writers.writePython3Bin "custom-syllabes" { + packages.custom-syllabes = pkgs.writers.writePython3Bin "custom-syllabes" { libraries = with pkgs; [ python3Packages.pyphen ]; @@ -27,4 +27,4 @@ print(f"{total} ({'/'.join(chunks)})") ''; -} +};} diff --git a/modules/packages/custom-tomato.nix b/modules/packages/custom-tomato.nix index d6f0b95..74f8566 100644 --- a/modules/packages/custom-tomato.nix +++ b/modules/packages/custom-tomato.nix @@ -1,7 +1,7 @@ { ... }: { - flake.packages.custom-tomato = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ...}: { + packages.custom-tomato = pkgs.writeShellApplication { name = "custom-tomato"; runtimeInputs = with pkgs; [ kitty @@ -11,4 +11,5 @@ kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato ''; }; +}; } diff --git a/modules/packages/custom-weather.nix b/modules/packages/custom-weather.nix index fc61498..2aca925 100644 --- a/modules/packages/custom-weather.nix +++ b/modules/packages/custom-weather.nix @@ -1,7 +1,7 @@ { ... }: { - flake.packages.custom-weather = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-weather = pkgs.writeShellApplication { name = "custom-weather"; runtimeInputs = with pkgs; [ curl @@ -13,4 +13,4 @@ done ''; }; -} +};} diff --git a/modules/packages/dejaManuallyDerived.nix b/modules/packages/dejaManuallyDerived.nix index 9c8d0eb..132533e 100644 --- a/modules/packages/dejaManuallyDerived.nix +++ b/modules/packages/dejaManuallyDerived.nix @@ -1,16 +1,10 @@ { ... }: { - flake.packages.dejaManuallyDerived = { - lib, - buildGoModule, - fetchFromGitHub, - nix-update-script, - versionCheckHook, - }: - buildGoModule (finalAttrs: { + perSystem = { pkgs, pkgs-unstable, ...}: { + packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pname = "deja"; version = "0.2.6"; __structuredAttrs = true; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "Giammarco-Ferranti"; repo = "deja"; tag = "v${finalAttrs.version}"; @@ -27,17 +21,17 @@ doCheck = true; - nativeCheckInputs = [versionCheckHook]; + nativeCheckInputs = [pkgs.versionCheckHook]; - passthru.updateScript = nix-update-script {}; + passthru.updateScript = pkgs.nix-update-script {}; meta = { description = "Predictive inline shell autosuggestions for zsh"; homepage = "https://github.com/Giammarco-Ferranti/deja"; - license = lib.licenses.mit; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [tomasrivera]; + license = pkgs.lib.licenses.mit; + platforms = pkgs.lib.platforms.unix; + maintainers = with pkgs.lib.maintainers; [tomasrivera]; mainProgram = "deja"; }; }); -} +};} diff --git a/modules/packages/sbb-tuiManuallyDerived.nix b/modules/packages/sbb-tuiManuallyDerived.nix index 35e54a6..2150795 100644 --- a/modules/packages/sbb-tuiManuallyDerived.nix +++ b/modules/packages/sbb-tuiManuallyDerived.nix @@ -1,20 +1,14 @@ { ... }: { - flake.packages.sbb-tuiManuallyDerived = { - lib, - buildGoModule, - fetchFromGitHub, - nix-update-script, - versionCheckHook, - }: - buildGoModule (finalAttrs: { + perSystem = { pkgs, pkgs-unstable, ... }: { + packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pname = "sbb-tui"; version = "1.14.2"; __structuredAttrs = true; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "Necrom4"; repo = "sbb-tui"; tag = "v${finalAttrs.version}"; - hash = lib.fakeHash; + hash = pkgs.lib.fakeHash; }; vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w="; @@ -29,17 +23,17 @@ doCheck = true; - nativeCheckInputs = [versionCheckHook]; + nativeCheckInputs = [pkgs.versionCheckHook]; - passthru.updateScript = nix-update-script {}; + passthru.updateScript = pkgs.nix-update-script {}; meta = { description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app"; homepage = "https://github.com/Necrom4/sbb-tui"; - license = lib.licenses.mit; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [tomasrivera]; + license = pkgs.lib.licenses.mit; + platforms = pkgs.lib.platforms.unix; + maintainers = with pkgs.lib.maintainers; [tomasrivera]; mainProgram = "sbb-tui"; }; }); -} +}; } diff --git a/modules/packages/vivifyManuallyDerived.nix b/modules/packages/vivifyManuallyDerived.nix index 8efb058..11bc2c8 100644 --- a/modules/packages/vivifyManuallyDerived.nix +++ b/modules/packages/vivifyManuallyDerived.nix @@ -1,28 +1,17 @@ { ... }: { - flake.packages.vivifyManuallyDerived = { - lib, - stdenv, - nix-update-script, - fetchYarnDeps, - fetchFromGitHub, - yarnConfigHook, - npmHooks, - nodejs, - zip, - file, - }: - stdenv.mkDerivation (finalAttrs: { + perSystem = { pkgs, nodejs, ... }: { + packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: { pname = "vivify"; version = "0.14.0"; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "jannis-baum"; repo = "Vivify"; tag = "v${finalAttrs.version}"; hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; }; - yarnOfflineCache = fetchYarnDeps { + yarnOfflineCache = pkgs.fetchYarnDeps { yarnLock = "${finalAttrs.src}/yarn.lock"; hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; }; @@ -33,13 +22,13 @@ yarn install substituteInPlace node_modules/.bin/tsc \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' substituteInPlace node_modules/.bin/webpack \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' substituteInPlace node_modules/.bin/postject \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' make VIV_VERSION=${finalAttrs.version} linux @@ -49,14 +38,14 @@ wrapProgram $out/bin/viv \ --prefix PATH : ${ - lib.makeBinPath [ - nodejs - file + pkgs.lib.makeBinPath [ + pkgs.nodejs + pkgs.file ] } ''; - nativeBuildInputs = [ + nativeBuildInputs = with pkgs; [ yarnConfigHook npmHooks.npmInstallHook zip @@ -69,7 +58,7 @@ # (segmentation fault) dontStrip = true; - passthru.updateScript = nix-update-script {}; + passthru.updateScript = pkgs.nix-update-script {}; meta = { description = "Live Markdown viewer"; @@ -80,10 +69,10 @@ ''; homepage = "https://github.com/jannis-baum/Vivify"; changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; - license = lib.licenses.gpl3; - maintainers = with lib.maintainers; [skohtv]; - platforms = lib.platforms.linux; + license = pkgs.lib.licenses.gpl3; + maintainers = with pkgs.lib.maintainers; [skohtv]; + platforms = pkgs.lib.platforms.linux; mainProgram = "viv"; }; }); -} +};} diff --git a/modules/systems.nix b/modules/systems.nix new file mode 100644 index 0000000..34fef77 --- /dev/null +++ b/modules/systems.nix @@ -0,0 +1,8 @@ +{ + systems = [ + "x86_64-linux" + #"aarch64-linux" + #"x86_64-darwin" + #"aarch64-darwin" + ]; +} diff --git a/modules/test.nix b/modules/test.nix deleted file mode 100644 index 5d347df..0000000 --- a/modules/test.nix +++ /dev/null @@ -1,9 +0,0 @@ -{inputs, ...}: { - flake.nixosModules.test = { pkgs, ...}: { - programs.firefox.enable = true; - - environment.systemPackages = with pkgs; [ - vim - ]; - }; -} diff --git a/modules/utilities/audioAndMedia.nix b/modules/utilities/audioAndMedia.nix index 194b02b..f1a729a 100644 --- a/modules/utilities/audioAndMedia.nix +++ b/modules/utilities/audioAndMedia.nix @@ -41,8 +41,8 @@ source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; }; }; - flake.packages.custom-changeAudioOutput = { pkgs, ...}: - pkgs.writeShellApplication { + perSystem = { pkgs, ...}: { + packages.custom-changeAudioOutput = pkgs.writeShellApplication { name = "custom-changeAudioOutput"; runtimeInputs = with pkgs; [ fzf @@ -57,4 +57,4 @@ pkill -f "kitty.*Select audio output" ''; }; -} +};} diff --git a/modules/utilities/autoCleanup.nix b/modules/utilities/autoCleanup.nix index 62f0193..5ca0532 100644 --- a/modules/utilities/autoCleanup.nix +++ b/modules/utilities/autoCleanup.nix @@ -44,8 +44,8 @@ }; }; }; - flake.packages.custom-cleanNix-laptop = {pkgs, ...}: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-cleanNix-laptop = pkgs.writeShellApplication { name = "custom-cleanNix"; runtimeInputs = with pkgs; [ @@ -115,4 +115,4 @@ rm -f "$ERROR_FILE" ''; }; -} +};} diff --git a/modules/utilities/autoUpdate.nix b/modules/utilities/autoUpdate.nix index cb20673..d816702 100644 --- a/modules/utilities/autoUpdate.nix +++ b/modules/utilities/autoUpdate.nix @@ -44,8 +44,8 @@ }; }; }; - flake.packages.custom-autoupdate-laptop = {pkgs, ...}: - pkgs.writeShellApplication { + perSystem = {pkgs, ...}: { + packages.custom-autoupdate-laptop = pkgs.writeShellApplication { name = "custom-autoupdate"; runtimeInputs = with pkgs; [ @@ -106,4 +106,4 @@ rm -f "$ERROR_FILE" ''; }; -} +};} diff --git a/modules/utilities/communicationAndNotification.nix b/modules/utilities/communicationAndNotification.nix index e6c9c3e..15fd399 100644 --- a/modules/utilities/communicationAndNotification.nix +++ b/modules/utilities/communicationAndNotification.nix @@ -13,8 +13,8 @@ self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone ]; }; - flake.packages.custom-checkMatrix = { pkgs, ...}: - pkgs.writeShellApplication { + perSystem = { pkgs, ...}: { + packages.custom-checkMatrix = pkgs.writeShellApplication { name = "custom-checkMatrix"; runtimeInputs = with pkgs; [ @@ -33,8 +33,7 @@ fi ''; }; - flake.packages.custom-gitnotify = { pkgs, ...}: - pkgs.writeShellApplication { + packages.custom-gitnotify = pkgs.writeShellApplication { name = "custom-gitnotify"; runtimeInputs = with pkgs; [ git @@ -59,4 +58,4 @@ fi ''; }; -} +};} diff --git a/modules/utilities/documentation.nix b/modules/utilities/documentation.nix index 021d231..b99f82e 100644 --- a/modules/utilities/documentation.nix +++ b/modules/utilities/documentation.nix @@ -14,8 +14,8 @@ self.packages.${pkgs.system}.custom-manix ]; }; - flake.packages.custom-man = { pkgs, ... }: - pkgs.writeShellApplication { + perSystem = { pkgs, ... }: { + packages.custom-man = pkgs.writeShellApplication { name = "custom-man"; runtimeInputs = with pkgs; [ man @@ -52,8 +52,7 @@ | xargs man ''; }; - flake.packages.custom-manix = { pkgs, ... }: - pkgs.writeShellApplication { + packages.custom-manix = pkgs.writeShellApplication { name = "custom-manix"; runtimeInputs = with pkgs; [ manix @@ -90,4 +89,4 @@ | xargs manix ''; }; -} +};} diff --git a/modules/utilities/nixUtils.nix b/modules/utilities/nixUtils.nix index 54b9af2..d97bd50 100644 --- a/modules/utilities/nixUtils.nix +++ b/modules/utilities/nixUtils.nix @@ -35,10 +35,10 @@ statix ]; }; - flake.packages.custom-trimmer = { pkgs, ... }: + perSystem = { pkgs, ... }: { # https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852 # better garbage collector - pkgs.writeShellApplication { + packages.custom-trimmer = pkgs.writeShellApplication { name = "custom-trimmer"; runtimeInputs = with pkgs; [ nix @@ -298,4 +298,4 @@ ''; }; -} +};} diff --git a/modules/utilities/otherUtils.nix b/modules/utilities/otherUtils.nix index dd22c83..ef73754 100644 --- a/modules/utilities/otherUtils.nix +++ b/modules/utilities/otherUtils.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ self, ... }: { flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file { pkgs, @@ -19,8 +19,8 @@ mailcap fuzzel usbutils # used for lsusb - (pkgs.callPackage ../../modules/scripts/tomato.nix {}) - (pkgs.callPackage ../../modules/scripts/syllabes.nix {}) # python script to get number of syllabes in french + self.packages.${pkgs.system}.custom-tomato + self.packages.${pkgs.system}.custom-syllabes pkgs-unstable.bitwarden-desktop fluffychat # matrix client ];