My NixOS config Part 3: Flake-Parts Crusaders nix.ladas552.me
hjem nix nixos impermanence flake-parts nvfetcher niri noctalia

a little cleanup of structure

ladas552.me 2d46cb0d 35711133

verified
+359 -369
+1 -1
README.md
··· 10 10 I also declare configuration as packages/wrappers that you can try with `nix run 11 11 github:Ladas552/Flake-Ocean#app`, replace `app` with: 12 12 13 - - [nvf](https://github.com/NotAShelf/nvf) - Nix declared Neovim 13 + - [nvf](https://github.com/NotAShelf/nvf) - Nix declared Neovim (current daily driver) 14 14 - [nixvim](https://github.com/nix-community/nixvim) - another Nix declared Neovim 15 15 - rofi-powermenu - power menu made of Rofi with a [nice theme](https://github.com/adi1090x/rofi) 16 16 - all the other scripts in [pkgs directory](./pkgs/default.nix)
+19 -19
_sources/generated.json
··· 22 22 }, 23 23 "heirline-components": { 24 24 "cargoLock": null, 25 - "date": "2025-11-17", 25 + "date": "2026-02-25", 26 26 "extract": null, 27 27 "name": "heirline-components", 28 28 "passthru": null, ··· 34 34 "name": null, 35 35 "owner": "Zeioth", 36 36 "repo": "heirline-components.nvim", 37 - "rev": "65ff6844a6d911bd8977a106b761649d7df9a5e1", 38 - "sha256": "sha256-1HwAQ8TRVHMGz92Nta3948RrN0hIuRFIBk5lVpAHy+s=", 37 + "rev": "5ea9a16286c01b7c36d58c91903d1f8ff0b7ddeb", 38 + "sha256": "sha256-M86mP8Xr7tIFi9mM8icHWIzbWTR3W2xdSgzXhxNLMj4=", 39 39 "sparseCheckout": [], 40 40 "type": "github" 41 41 }, 42 - "version": "65ff6844a6d911bd8977a106b761649d7df9a5e1" 42 + "version": "5ea9a16286c01b7c36d58c91903d1f8ff0b7ddeb" 43 43 }, 44 44 "helium": { 45 45 "cargoLock": null, ··· 50 50 "pinned": false, 51 51 "src": { 52 52 "name": null, 53 - "sha256": "sha256-4c7tIra7SriBQe3ii4bLFTV1chLPQSNdOWNUR6dxfP0=", 53 + "sha256": "sha256-qXuDUtank46O87jASxczmVMk0iD4JaZi2j9LSBe9VCM=", 54 54 "type": "url", 55 - "url": "https://github.com/imputnet/helium-linux/releases/download/0.9.3.1/helium-0.9.3.1-x86_64_linux.tar.xz" 55 + "url": "https://github.com/imputnet/helium-linux/releases/download/0.9.4.1/helium-0.9.4.1-x86_64_linux.tar.xz" 56 56 }, 57 - "version": "0.9.3.1" 57 + "version": "0.9.4.1" 58 58 }, 59 59 "impermanence": { 60 60 "cargoLock": null, ··· 141 141 }, 142 142 "nixos-hardware": { 143 143 "cargoLock": null, 144 - "date": "2026-02-18", 144 + "date": "2026-02-24", 145 145 "extract": null, 146 146 "name": "nixos-hardware", 147 147 "passthru": null, ··· 151 151 "fetchSubmodules": false, 152 152 "leaveDotGit": false, 153 153 "name": null, 154 - "rev": "740a22363033e9f1bb6270fbfb5a9574067af15b", 155 - "sha256": "sha256-yRKJ7gpVmXbX2ZcA8nFi6CMPkJXZGjie2unsiMzj3Ig=", 154 + "rev": "41c6b421bdc301b2624486e11905c9af7b8ec68e", 155 + "sha256": "sha256-qwcDBtrRvJbrrnv1lf/pREQi8t2hWZxVAyeMo7/E9sw=", 156 156 "sparseCheckout": [], 157 157 "type": "git", 158 158 "url": "https://github.com/nixos/nixos-hardware" 159 159 }, 160 - "version": "740a22363033e9f1bb6270fbfb5a9574067af15b" 160 + "version": "41c6b421bdc301b2624486e11905c9af7b8ec68e" 161 161 }, 162 162 "nixos-wsl": { 163 163 "cargoLock": null, ··· 181 181 }, 182 182 "noctalia-dev": { 183 183 "cargoLock": null, 184 - "date": "2026-02-23", 184 + "date": "2026-02-26", 185 185 "extract": null, 186 186 "name": "noctalia-dev", 187 187 "passthru": null, ··· 191 191 "fetchSubmodules": false, 192 192 "leaveDotGit": false, 193 193 "name": null, 194 - "rev": "90e44d6edd604a0877310b01ff20006abcf67e77", 195 - "sha256": "sha256-evn+p0+T9yNtjdRr5UnYwXnhlHgFB8ilzhGQoYvgXhs=", 194 + "rev": "5137c5efcac31d9aee6952b99f1dcaec9966fe21", 195 + "sha256": "sha256-M3U3DdQo/5G88ULedS8BkafiXYL1NyIEer9YL4P9fxQ=", 196 196 "sparseCheckout": [], 197 197 "type": "git", 198 198 "url": "https://github.com/noctalia-dev/noctalia-shell" 199 199 }, 200 - "version": "90e44d6edd604a0877310b01ff20006abcf67e77" 200 + "version": "5137c5efcac31d9aee6952b99f1dcaec9966fe21" 201 201 }, 202 202 "sops-nix": { 203 203 "cargoLock": null, 204 - "date": "2026-02-23", 204 + "date": "2026-02-25", 205 205 "extract": null, 206 206 "name": "sops-nix", 207 207 "passthru": null, ··· 211 211 "fetchSubmodules": false, 212 212 "leaveDotGit": false, 213 213 "name": null, 214 - "rev": "b027513c32e5b39b59f64626b87fbe168ae02094", 215 - "sha256": "sha256-YV17Q5lEU0S9ppw08Y+cs4eEQJBuc79AzblFoHORLMU=", 214 + "rev": "334daa7c273dd8bf7a0cd370e4e16022b64e55e9", 215 + "sha256": "sha256-/wA0OaH6kZ/pFA+nXR/tvg5oupOmEDmMS5us79JT60o=", 216 216 "sparseCheckout": [], 217 217 "type": "git", 218 218 "url": "https://github.com/Mic92/sops-nix" 219 219 }, 220 - "version": "b027513c32e5b39b59f64626b87fbe168ae02094" 220 + "version": "334daa7c273dd8bf7a0cd370e4e16022b64e55e9" 221 221 } 222 222 }
+19 -19
_sources/generated.nix
··· 20 20 }; 21 21 heirline-components = { 22 22 pname = "heirline-components"; 23 - version = "65ff6844a6d911bd8977a106b761649d7df9a5e1"; 23 + version = "5ea9a16286c01b7c36d58c91903d1f8ff0b7ddeb"; 24 24 src = fetchFromGitHub { 25 25 owner = "Zeioth"; 26 26 repo = "heirline-components.nvim"; 27 - rev = "65ff6844a6d911bd8977a106b761649d7df9a5e1"; 27 + rev = "5ea9a16286c01b7c36d58c91903d1f8ff0b7ddeb"; 28 28 fetchSubmodules = false; 29 - sha256 = "sha256-1HwAQ8TRVHMGz92Nta3948RrN0hIuRFIBk5lVpAHy+s="; 29 + sha256 = "sha256-M86mP8Xr7tIFi9mM8icHWIzbWTR3W2xdSgzXhxNLMj4="; 30 30 }; 31 - date = "2025-11-17"; 31 + date = "2026-02-25"; 32 32 }; 33 33 helium = { 34 34 pname = "helium"; 35 - version = "0.9.3.1"; 35 + version = "0.9.4.1"; 36 36 src = fetchurl { 37 - url = "https://github.com/imputnet/helium-linux/releases/download/0.9.3.1/helium-0.9.3.1-x86_64_linux.tar.xz"; 38 - sha256 = "sha256-4c7tIra7SriBQe3ii4bLFTV1chLPQSNdOWNUR6dxfP0="; 37 + url = "https://github.com/imputnet/helium-linux/releases/download/0.9.4.1/helium-0.9.4.1-x86_64_linux.tar.xz"; 38 + sha256 = "sha256-qXuDUtank46O87jASxczmVMk0iD4JaZi2j9LSBe9VCM="; 39 39 }; 40 40 }; 41 41 impermanence = { ··· 90 90 }; 91 91 nixos-hardware = { 92 92 pname = "nixos-hardware"; 93 - version = "740a22363033e9f1bb6270fbfb5a9574067af15b"; 93 + version = "41c6b421bdc301b2624486e11905c9af7b8ec68e"; 94 94 src = fetchgit { 95 95 url = "https://github.com/nixos/nixos-hardware"; 96 - rev = "740a22363033e9f1bb6270fbfb5a9574067af15b"; 96 + rev = "41c6b421bdc301b2624486e11905c9af7b8ec68e"; 97 97 fetchSubmodules = false; 98 98 deepClone = false; 99 99 leaveDotGit = false; 100 100 sparseCheckout = [ ]; 101 - sha256 = "sha256-yRKJ7gpVmXbX2ZcA8nFi6CMPkJXZGjie2unsiMzj3Ig="; 101 + sha256 = "sha256-qwcDBtrRvJbrrnv1lf/pREQi8t2hWZxVAyeMo7/E9sw="; 102 102 }; 103 - date = "2026-02-18"; 103 + date = "2026-02-24"; 104 104 }; 105 105 nixos-wsl = { 106 106 pname = "nixos-wsl"; ··· 118 118 }; 119 119 noctalia-dev = { 120 120 pname = "noctalia-dev"; 121 - version = "90e44d6edd604a0877310b01ff20006abcf67e77"; 121 + version = "5137c5efcac31d9aee6952b99f1dcaec9966fe21"; 122 122 src = fetchgit { 123 123 url = "https://github.com/noctalia-dev/noctalia-shell"; 124 - rev = "90e44d6edd604a0877310b01ff20006abcf67e77"; 124 + rev = "5137c5efcac31d9aee6952b99f1dcaec9966fe21"; 125 125 fetchSubmodules = false; 126 126 deepClone = false; 127 127 leaveDotGit = false; 128 128 sparseCheckout = [ ]; 129 - sha256 = "sha256-evn+p0+T9yNtjdRr5UnYwXnhlHgFB8ilzhGQoYvgXhs="; 129 + sha256 = "sha256-M3U3DdQo/5G88ULedS8BkafiXYL1NyIEer9YL4P9fxQ="; 130 130 }; 131 - date = "2026-02-23"; 131 + date = "2026-02-26"; 132 132 }; 133 133 sops-nix = { 134 134 pname = "sops-nix"; 135 - version = "b027513c32e5b39b59f64626b87fbe168ae02094"; 135 + version = "334daa7c273dd8bf7a0cd370e4e16022b64e55e9"; 136 136 src = fetchgit { 137 137 url = "https://github.com/Mic92/sops-nix"; 138 - rev = "b027513c32e5b39b59f64626b87fbe168ae02094"; 138 + rev = "334daa7c273dd8bf7a0cd370e4e16022b64e55e9"; 139 139 fetchSubmodules = false; 140 140 deepClone = false; 141 141 leaveDotGit = false; 142 142 sparseCheckout = [ ]; 143 - sha256 = "sha256-YV17Q5lEU0S9ppw08Y+cs4eEQJBuc79AzblFoHORLMU="; 143 + sha256 = "sha256-/wA0OaH6kZ/pFA+nXR/tvg5oupOmEDmMS5us79JT60o="; 144 144 }; 145 - date = "2026-02-23"; 145 + date = "2026-02-25"; 146 146 }; 147 147 }
+7 -7
flake.lock
··· 116 116 ] 117 117 }, 118 118 "locked": { 119 - "lastModified": 1771851181, 120 - "narHash": "sha256-gFgE6mGUftwseV3DUENMb0k0EiHd739lZexPo5O/sdQ=", 119 + "lastModified": 1772060133, 120 + "narHash": "sha256-VuyRptb8v1lVGMlLp4/1vRX3Efwec0CN0S6mKmDPzLg=", 121 121 "owner": "nix-community", 122 122 "repo": "home-manager", 123 - "rev": "9a4b494b1aa1b93d8edf167f46dc8e0c0011280c", 123 + "rev": "ce9b6e52500a0ea0ec48f0bbf6d7a3e431d9dfa4", 124 124 "type": "github" 125 125 }, 126 126 "original": { ··· 430 430 "sqlite-lib-src": "sqlite-lib-src" 431 431 }, 432 432 "locked": { 433 - "lastModified": 1771904656, 434 - "narHash": "sha256-2jEyFRbbFxaQAnbUnBklYyu7pM7Vl18aidCXh5iNhdo=", 433 + "lastModified": 1772021793, 434 + "narHash": "sha256-5g82xnMus6qMTJf8FLwBhyt/zmM8eYl/rSYjFmw1odU=", 435 435 "ref": "refs/heads/master", 436 - "rev": "d82f05f871f30d065c707ec443ec2e6782eebfec", 437 - "revCount": 1979, 436 + "rev": "34d8a513e4512bc8b1443478f390319282cb6cbe", 437 + "revCount": 1987, 438 438 "type": "git", 439 439 "url": "https://tangled.org/@tangled.org/core" 440 440 },
+9 -46
flake.nix
··· 94 94 # Boilerplate 95 95 systems.url = "github:nix-systems/default-linux"; 96 96 97 - # Inputs below are either unused, or replaced with nvfetcher inputs 98 - 99 - # Secrets 100 - # sops-nix = { 101 - # url = "github:Mic92/sops-nix"; 102 - # inputs.nixpkgs.follows = "nixpkgs"; 103 - # }; 104 - 105 - # impermanence = { 106 - # url = "github:nix-community/impermanence"; 107 - # inputs.nixpkgs.follows = ""; 108 - # inputs.home-manager.follows = ""; 109 - # }; 110 - 111 - # nixos-wsl = { 112 - # url = "github:nix-community/NixOS-WSL"; 113 - # inputs.nixpkgs.follows = "nixpkgs"; 114 - # # No useless inputs 115 - # inputs.flake-compat.follows = ""; 116 - # }; 117 - 118 - # noctalia = { 119 - # url = "github:noctalia-dev/noctalia-shell"; 120 - # inputs.nixpkgs.follows = "nixpkgs"; 121 - # }; 122 - 123 - # nixos-hardware.url = "github:nixos/nixos-hardware"; 124 - 125 - # Overlays 126 - # neorg-overlay.url = "github:nvim-neorg/nixpkgs-neorg-overlay"; 127 - # emacs-overlay.url = "github:nix-community/emacs-overlay"; 128 - # helix-overlay.url = "github:helix-editor/helix"; 129 - # neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; 130 - 131 - # ghostty.url = "github:ghostty-org/ghostty"; 132 - # ghostty-shaders = { 133 - # url = "github:hackr-sh/ghostty-shaders"; 134 - # flake = false; 135 - # }; 136 - # ghostty-cursor = { 137 - # url = "github:KroneCorylus/shader-playground"; 138 - # flake = false; 139 - # }; 140 - 97 + # Also check inputs in ./nvfetcher.toml for more modules I use 141 98 }; 142 99 outputs = 143 100 inputs: 144 101 let 145 102 # Function to stop using `import-tree` by Vic. 146 103 # Just to lighten the config a bit, written by @llakala https://github.com/llakala/synaptic-standard/blob/main/demo/recursivelyImport.nix 147 - import-tree = import ./stuff/recursivelyImport.nix { lib = inputs.nixpkgs.lib; }; 104 + import-tree = import ./lib/recursivelyImport.nix { lib = inputs.nixpkgs.lib; }; 148 105 149 106 # a way to fetch nix files via nvfetcher and import them in the config 150 107 # basically parse the json crated by nvfetcher, and use fetchTarball ··· 169 126 specialArgs = { inherit modules; }; 170 127 } 171 128 { 172 - imports = import-tree [ ./modules ]; 129 + imports = import-tree [ 130 + ./modules 131 + inputs.flake-parts.flakeModules.modules 132 + ]; 173 133 flake.templates = import ./templates; 134 + # aarch64 and x86_64 Linux systems 135 + systems = import inputs.systems; 136 + 174 137 }; 175 138 }
-9
modules/flake-parts/flake-parts.nix
··· 1 - { inputs, ... }: 2 - { 3 - imports = [ 4 - inputs.flake-parts.flakeModules.modules 5 - ../../pkgs 6 - ]; 7 - # aarch64 and x86_64 Linux systems 8 - systems = import inputs.systems; 9 - }
+17
modules/wrappers/scripts/Subtitlenator.nix
··· 1 + { 2 + # Adds `ass` subtitle files to mkv files and creates subdirectory for copied mkv files. Subtitles aren't burned into mkv, just added to the pool. Nice if you don't have subtitle fuzzy find in your Media Player 3 + 4 + perSystem = 5 + { pkgs, lib, ... }: 6 + { 7 + packages.Subtitlenator = pkgs.writeShellScriptBin "Subtitlenator.sh" '' 8 + ${lib.meta.getExe' pkgs.coreutils "mkdir"} Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")" 9 + 10 + for i in *.mkv 11 + do 12 + file="$(${lib.meta.getExe' pkgs.coreutils "basename"} "$i" .mkv)" 13 + (ffmpeg -i "$file.mkv" -i "$file.ass" -map 0 -map 1 -c copy Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")/$file.mkv") 14 + done 15 + ''; 16 + }; 17 + }
+14
modules/wrappers/scripts/addcommitpush.nix
··· 1 + { 2 + # Quick git alias 3 + # gcp "your commit" to push new commit 4 + 5 + perSystem = 6 + { pkgs, lib, ... }: 7 + { 8 + packages.gcp = 9 + pkgs.writeShellScriptBin "gcp" # bash 10 + '' 11 + ${lib.meta.getExe' pkgs.git "git"} add --all && ${lib.meta.getExe' pkgs.git "git"} commit -m "$1" && ${lib.meta.getExe' pkgs.git "git"} push 12 + ''; 13 + }; 14 + }
+7
modules/wrappers/scripts/default.nix
··· 1 + { 2 + perSystem = 3 + { pkgs, ... }: 4 + { 5 + packages.default = pkgs.writeShellScriptBin "hello" ''echo "Hello World"''; 6 + }; 7 + }
+16
modules/wrappers/scripts/musnow.nix
··· 1 + { 2 + # I download songs with yt-dlp, and it embeds the url of the media into `comments` or `purl` tag, so i use ffmpeg to get the data to clipboard and share the media. 3 + 4 + perSystem = 5 + { pkgs, ... }: 6 + { 7 + packages.musnow = 8 + pkgs.writers.writeFishBin "musnow.sh" { } # fish 9 + '' 10 + #Dependencis 11 + #fish,ffmpeg,mpd,mpc 12 + #get current's song url into 'crtl+v' clipboard 13 + ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | wl-copy 14 + ''; 15 + }; 16 + }
+38
modules/wrappers/scripts/restore.nix
··· 1 + { 2 + # I have this nasty bug that corrupts my /boot, I need to fix it 3 + # but here is a script I use to not do it manually everytime 4 + # Do this all in sudo tho 5 + 6 + perSystem = 7 + { pkgs, ... }: 8 + { 9 + packages.restore = 10 + pkgs.writeShellScriptBin "restore.sh" # bash 11 + '' 12 + mkfs.vfat /dev/nvme0n1p5 -n NIXBOOT 13 + zpool import zroot -f 14 + # Need so that install doesn't run out of memory 15 + zfs create -o mountpoint=legacy zroot/root 16 + mount -t zfs zroot/root /mnt 17 + mount --mkdir /dev/nvme0n1p5 /mnt/boot 18 + mount --mkdir -t zfs zroot/nix /mnt/nix 19 + mount --mkdir -t zfs zroot/tmp /mnt/tmp 20 + mount --mkdir -t zfs zroot/cache /mnt/cache 21 + mount --mkdir -t zfs zroot/persist /mnt/persist 22 + nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort" 23 + # unmount the system, and remount it to correctly link the build 24 + umount /mnt/boot 25 + umount /mnt/nix 26 + umount /mnt/cache 27 + umount /mnt/tmp 28 + umount /mnt/persist 29 + umount /mnt 30 + mount --mkdir /dev/nvme0n1p5 /mnt/boot 31 + mount --mkdir -t zfs zroot/nix /mnt/nix 32 + mount --mkdir -t zfs zroot/tmp /mnt/tmp 33 + mount --mkdir -t zfs zroot/cache /mnt/cache 34 + mount --mkdir -t zfs zroot/persist /mnt/persist 35 + nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort" 36 + ''; 37 + }; 38 + }
+106
modules/wrappers/scripts/rofi-powermenu.nix
··· 1 + { self, ... }: 2 + { 3 + # Power Menu that uses Rofi. Can be modified to have multiple actions, for example stopping MPD before Suspend 4 + 5 + perSystem = 6 + { pkgs, lib, ... }: 7 + { 8 + packages.rofi-powermenu = pkgs.writeShellScriptBin "powermenu.sh" '' 9 + ## Author : Aditya Shakya (adi1090x) 10 + ## Github : @adi1090x 11 + # 12 + ## Rofi : Power Menu 13 + # 14 + 15 + # Current Theme 16 + dir="${self}/modules/homeModules/rofi" 17 + theme='power-manager' 18 + 19 + # CMDs 20 + uptime="`${lib.meta.getExe' pkgs.procps "uptime"} -p | sed -e 's/up //g'`" 21 + host=`hostname` 22 + 23 + # Options 24 + shutdown='Shutdown' 25 + reboot='Reboot' 26 + lock='Lock' 27 + suspend='Suspend' 28 + logout='Logout' 29 + yes='Yes' 30 + no='No' 31 + 32 + # Rofi CMD 33 + rofi_cmd() { 34 + rofi -dmenu \ 35 + -p "$host" \ 36 + -mesg "Uptime: $uptime" \ 37 + -theme $dir/$theme.rasi 38 + } 39 + 40 + # Confirmation CMD 41 + confirm_cmd() { 42 + rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \ 43 + -theme-str 'mainbox {children: [ "message", "listview" ];}' \ 44 + -theme-str 'listview {columns: 2; lines: 1;}' \ 45 + -theme-str 'element-text {horizontal-align: 0.5;}' \ 46 + -theme-str 'textbox {horizontal-align: 0.5;}' \ 47 + -dmenu \ 48 + -p 'Confirmation' \ 49 + -mesg 'Are you Sure?' \ 50 + -theme $dir/$theme.rasi 51 + } 52 + 53 + # Ask for confirmation 54 + confirm_exit() { 55 + echo -e "$yes\n$no" | confirm_cmd 56 + } 57 + 58 + # Pass variables to rofi dmenu 59 + run_rofi() { 60 + echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd 61 + } 62 + 63 + # Execute Command 64 + run_cmd() { 65 + selected="$(confirm_exit)" 66 + if [[ "$selected" == "$yes" ]]; then 67 + if [[ $1 == '--shutdown' ]]; then 68 + mpc -q pause 69 + systemctl poweroff 70 + elif [[ $1 == '--reboot' ]]; then 71 + mpc -q pause 72 + systemctl reboot 73 + elif [[ $1 == '--suspend' ]]; then 74 + mpc -q pause 75 + # amixer set Master mute 76 + systemctl suspend 77 + elif [[ $1 == '--logout' ]]; then 78 + niri msg action quit 79 + fi 80 + else 81 + exit 0 82 + fi 83 + } 84 + 85 + # Actions 86 + chosen="$(run_rofi)" 87 + case $chosen in 88 + $shutdown) 89 + run_cmd --shutdown 90 + ;; 91 + $reboot) 92 + run_cmd --reboot 93 + ;; 94 + $lock) 95 + swaylock 96 + ;; 97 + $suspend) 98 + run_cmd --suspend 99 + ;; 100 + $logout) 101 + run_cmd --logout 102 + ;; 103 + esac 104 + ''; 105 + }; 106 + }
+48
modules/wrappers/scripts/rofi-wifi.nix
··· 1 + { 2 + # It was a test script, never worked tbh. Suppose to replace nm-applet with Rofi 3 + 4 + perSystem = 5 + { pkgs, lib, ... }: 6 + { 7 + packages.rofi-wifi = 8 + pkgs.writeShellScriptBin "wifiMenu" # bash 9 + '' 10 + ${lib.getExe pkgs.libnotify} "Getting list of available Wi-Fi networks..." 11 + # Get a list of available wifi connections and morph it into a nice-looking list 12 + wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d") 13 + 14 + connected=$(nmcli -fields WIFI g) 15 + if [[ "$connected" =~ "enabled" ]]; then 16 + toggle="󰖪 Disable Wi-Fi" 17 + elif [[ "$connected" =~ "disabled" ]]; then 18 + toggle="󰖩 Enable Wi-Fi" 19 + fi 20 + 21 + # Use rofi to select wifi network 22 + chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " ) 23 + # Get name of connection 24 + read -r chosen_id <<< "''${chosen_network:3}" 25 + 26 + if [ "$chosen_network" = "" ]; then 27 + exit 28 + elif [ "$chosen_network" = "󰖩 Enable Wi-Fi" ]; then 29 + nmcli radio wifi on 30 + elif [ "$chosen_network" = "󰖪 Disable Wi-Fi" ]; then 31 + nmcli radio wifi off 32 + else 33 + # Message to show when connection is activated successfully 34 + success_message="You are now connected to the Wi-Fi network \"$chosen_id\"." 35 + # Get saved connections 36 + nmcli -g NAME connection 37 + if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then 38 + nmcli connection up id "$chosen_id" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message" 39 + else 40 + if [[ "$chosen_network" =~ "" ]]; then 41 + wifi_password=$(rofi -dmenu -p "Password: " ) 42 + fi 43 + nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message" 44 + fi 45 + fi 46 + ''; 47 + }; 48 + }
+45
modules/wrappers/scripts/word-lookup.nix
··· 1 + { 2 + # This script looks up a word in the dictionary from mouse selected word 3 + # Script is stolen from Reddit 4 + 5 + perSystem = 6 + { pkgs, lib, ... }: 7 + { 8 + packages.word-lookup = 9 + pkgs.writeShellScriptBin "word-lookup.sh" # bash 10 + '' 11 + usage(){ 12 + echo "Usage: $(basename "$0") [-h] 13 + Looks up the definition of currently selected word. 14 + -w: Use the wayland clipboard (instead of X11) " 15 + 16 + } 17 + 18 + USEWAYLAND=true 19 + 20 + while getopts 'hw' c 21 + do 22 + case $c in 23 + h) usage; exit ;; 24 + w) USEWAYLAND=true ;; 25 + *) usage; exit 1 ;; 26 + esac 27 + done 28 + 29 + shift $((OPTIND-1)) 30 + 31 + if [ $USEWAYLAND = true ] 32 + then 33 + word=$(wl-paste -p) 34 + else 35 + word=$(xclip -o) 36 + fi 37 + 38 + res=$(curl -s "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word") 39 + regex=$'"definition":"\K(.*?)(?=")' 40 + definitions=$(echo "$res" | grep -Po "$regex") 41 + separatedDefinition=$(sed ':a;N;$!ba;s/\n/\n\n/g' <<< "$definitions") 42 + ${lib.getExe pkgs.libnotify} --urgency=critical -a "word-lookup" "$word" "$separatedDefinition" 43 + ''; 44 + }; 45 + }
+13
modules/wrappers/scripts/wpick.nix
··· 1 + { 2 + # It is a one liner to replace xpick on Wayland. Compatible with Wlroots. Doesn't need dependencies outside of ImageMagick that already declared in host 3 + 4 + perSystem = 5 + { pkgs, lib, ... }: 6 + { 7 + packages.wpick = 8 + pkgs.writeShellScriptBin "wpick" # bash 9 + '' 10 + ${lib.meta.getExe' pkgs.grim "grim"} -g "$(${lib.meta.getExe' pkgs.slurp "slurp"} -p)" -t ppm - | ${lib.meta.getExe' pkgs.imagemagick "magick"} - -format '%[pixel:p{0,0}]' txt:- 11 + ''; 12 + }; 13 + }
-11
pkgs/Subtitlenator.nix
··· 1 - { pkgs, lib }: 2 - # Adds `ass` subtitle files to mkv files and creates subdirectory for copied mkv files. Subtitles aren't burned into mkv, just added to the pool. Nice if you don't have subtitle fuzzy find in your Media Player 3 - pkgs.writeShellScriptBin "Subtitlenator.sh" '' 4 - ${lib.meta.getExe' pkgs.coreutils "mkdir"} Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")" 5 - 6 - for i in *.mkv 7 - do 8 - file="$(${lib.meta.getExe' pkgs.coreutils "basename"} "$i" .mkv)" 9 - (ffmpeg -i "$file.mkv" -i "$file.ass" -map 0 -map 1 -c copy Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")/$file.mkv") 10 - done 11 - ''
-7
pkgs/addcommitpush.nix
··· 1 - { pkgs, lib }: 2 - # Quick git alias 3 - # gcp "your commit" to push new commit 4 - pkgs.writeShellScriptBin "gcp" # bash 5 - '' 6 - ${lib.meta.getExe' pkgs.git "git"} add --all && ${lib.meta.getExe' pkgs.git "git"} commit -m "$1" && ${lib.meta.getExe' pkgs.git "git"} push 7 - ''
-18
pkgs/default.nix
··· 1 - { self, ... }: 2 - { 3 - perSystem = 4 - { pkgs, ... }: 5 - { 6 - packages = { 7 - default = pkgs.writeShellScriptBin "hello" ''echo "Hello World"''; 8 - restore = pkgs.callPackage ./restore.nix { }; 9 - gcp = pkgs.callPackage ./addcommitpush.nix { }; 10 - rofi-wifi = pkgs.callPackage ./rofi-wifi.nix { }; 11 - word-lookup = pkgs.callPackage ./word-lookup.nix { }; 12 - Subtitlenator = pkgs.callPackage ./Subtitlenator.nix { }; 13 - musnow = pkgs.callPackage ./musnow.nix { }; 14 - wpick = pkgs.callPackage ./wpick.nix { }; 15 - rofi-powermenu = pkgs.callPackage ./rofi-powermenu.nix { inherit self; }; 16 - }; 17 - }; 18 - }
-12
pkgs/musnow.nix
··· 1 - { pkgs }: 2 - # I download songs with yt-dlp, and it embeds the url of the media into `comments` or `purl` tag, so i use ffmpeg to get the data to clipboard and share the media. 3 - pkgs.writers.writeFishBin "musnow.sh" { } # fish 4 - '' 5 - #Dependencis 6 - #fish,ffmpeg,mpd,mpc 7 - #get current's song url into 'crtl+v' clipboard 8 - ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | wl-copy 9 - '' 10 - 11 - # X11 version 12 - #ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | xclip -selection clipboard
-31
pkgs/restore.nix
··· 1 - { pkgs, lib }: 2 - # I have this nasty bug that corrupts my /boot, I need to fix it 3 - # but here is a script I use to not do it manually everytime 4 - # Do this all in sudo tho 5 - pkgs.writeShellScriptBin "restore.sh" # bash 6 - '' 7 - mkfs.vfat /dev/nvme0n1p5 -n NIXBOOT 8 - zpool import zroot -f 9 - # Need so that install doesn't run out of memory 10 - zfs create -o mountpoint=legacy zroot/root 11 - mount -t zfs zroot/root /mnt 12 - mount --mkdir /dev/nvme0n1p5 /mnt/boot 13 - mount --mkdir -t zfs zroot/nix /mnt/nix 14 - mount --mkdir -t zfs zroot/tmp /mnt/tmp 15 - mount --mkdir -t zfs zroot/cache /mnt/cache 16 - mount --mkdir -t zfs zroot/persist /mnt/persist 17 - nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort" 18 - # unmount the system, and remount it to correctly link the build 19 - umount /mnt/boot 20 - umount /mnt/nix 21 - umount /mnt/cache 22 - umount /mnt/tmp 23 - umount /mnt/persist 24 - umount /mnt 25 - mount --mkdir /dev/nvme0n1p5 /mnt/boot 26 - mount --mkdir -t zfs zroot/nix /mnt/nix 27 - mount --mkdir -t zfs zroot/tmp /mnt/tmp 28 - mount --mkdir -t zfs zroot/cache /mnt/cache 29 - mount --mkdir -t zfs zroot/persist /mnt/persist 30 - nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort" 31 - ''
-104
pkgs/rofi-powermenu.nix
··· 1 - { 2 - pkgs, 3 - lib, 4 - self, 5 - }: 6 - # Power Menu that uses Rofi. Can be modified to have multiple actions, for example stopping MPD before Suspend 7 - pkgs.writeShellScriptBin "powermenu.sh" '' 8 - ## Author : Aditya Shakya (adi1090x) 9 - ## Github : @adi1090x 10 - # 11 - ## Rofi : Power Menu 12 - # 13 - 14 - # Current Theme 15 - # hard code the theme for now, because flake-parts doesn't like "self" 16 - dir="${self}/modules/homeModules/rofi" 17 - theme='power-manager' 18 - 19 - # CMDs 20 - uptime="`${lib.meta.getExe' pkgs.procps "uptime"} -p | sed -e 's/up //g'`" 21 - host=`hostname` 22 - 23 - # Options 24 - shutdown='Shutdown' 25 - reboot='Reboot' 26 - lock='Lock' 27 - suspend='Suspend' 28 - logout='Logout' 29 - yes='Yes' 30 - no='No' 31 - 32 - # Rofi CMD 33 - rofi_cmd() { 34 - rofi -dmenu \ 35 - -p "$host" \ 36 - -mesg "Uptime: $uptime" \ 37 - -theme $dir/$theme.rasi 38 - } 39 - 40 - # Confirmation CMD 41 - confirm_cmd() { 42 - rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \ 43 - -theme-str 'mainbox {children: [ "message", "listview" ];}' \ 44 - -theme-str 'listview {columns: 2; lines: 1;}' \ 45 - -theme-str 'element-text {horizontal-align: 0.5;}' \ 46 - -theme-str 'textbox {horizontal-align: 0.5;}' \ 47 - -dmenu \ 48 - -p 'Confirmation' \ 49 - -mesg 'Are you Sure?' \ 50 - -theme $dir/$theme.rasi 51 - } 52 - 53 - # Ask for confirmation 54 - confirm_exit() { 55 - echo -e "$yes\n$no" | confirm_cmd 56 - } 57 - 58 - # Pass variables to rofi dmenu 59 - run_rofi() { 60 - echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd 61 - } 62 - 63 - # Execute Command 64 - run_cmd() { 65 - selected="$(confirm_exit)" 66 - if [[ "$selected" == "$yes" ]]; then 67 - if [[ $1 == '--shutdown' ]]; then 68 - mpc -q pause 69 - systemctl poweroff 70 - elif [[ $1 == '--reboot' ]]; then 71 - mpc -q pause 72 - systemctl reboot 73 - elif [[ $1 == '--suspend' ]]; then 74 - mpc -q pause 75 - # amixer set Master mute 76 - systemctl suspend 77 - elif [[ $1 == '--logout' ]]; then 78 - niri msg action quit 79 - fi 80 - else 81 - exit 0 82 - fi 83 - } 84 - 85 - # Actions 86 - chosen="$(run_rofi)" 87 - case $chosen in 88 - $shutdown) 89 - run_cmd --shutdown 90 - ;; 91 - $reboot) 92 - run_cmd --reboot 93 - ;; 94 - $lock) 95 - swaylock 96 - ;; 97 - $suspend) 98 - run_cmd --suspend 99 - ;; 100 - $logout) 101 - run_cmd --logout 102 - ;; 103 - esac 104 - ''
-41
pkgs/rofi-wifi.nix
··· 1 - { pkgs, lib }: 2 - # It was a test script, never worked tbh. Suppose to replace nm-applet with Rofi 3 - pkgs.writeShellScriptBin "wifiMenu" # bash 4 - '' 5 - ${lib.getExe pkgs.libnotify} "Getting list of available Wi-Fi networks..." 6 - # Get a list of available wifi connections and morph it into a nice-looking list 7 - wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d") 8 - 9 - connected=$(nmcli -fields WIFI g) 10 - if [[ "$connected" =~ "enabled" ]]; then 11 - toggle="󰖪 Disable Wi-Fi" 12 - elif [[ "$connected" =~ "disabled" ]]; then 13 - toggle="󰖩 Enable Wi-Fi" 14 - fi 15 - 16 - # Use rofi to select wifi network 17 - chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " ) 18 - # Get name of connection 19 - read -r chosen_id <<< "''${chosen_network:3}" 20 - 21 - if [ "$chosen_network" = "" ]; then 22 - exit 23 - elif [ "$chosen_network" = "󰖩 Enable Wi-Fi" ]; then 24 - nmcli radio wifi on 25 - elif [ "$chosen_network" = "󰖪 Disable Wi-Fi" ]; then 26 - nmcli radio wifi off 27 - else 28 - # Message to show when connection is activated successfully 29 - success_message="You are now connected to the Wi-Fi network \"$chosen_id\"." 30 - # Get saved connections 31 - saved_connections=$(nmcli -g NAME connection) 32 - if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then 33 - nmcli connection up id "$chosen_id" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message" 34 - else 35 - if [[ "$chosen_network" =~ "" ]]; then 36 - wifi_password=$(rofi -dmenu -p "Password: " ) 37 - fi 38 - nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message" 39 - fi 40 - fi 41 - ''
-38
pkgs/word-lookup.nix
··· 1 - { pkgs, lib }: 2 - # This script looks up a word in the dictionary from mouse selected word 3 - # Script is stolen from Reddit 4 - pkgs.writeShellScriptBin "word-lookup.sh" # bash 5 - '' 6 - usage(){ 7 - echo "Usage: $(basename "$0") [-h] 8 - Looks up the definition of currently selected word. 9 - -w: Use the wayland clipboard (instead of X11) " 10 - 11 - } 12 - 13 - USEWAYLAND=true 14 - 15 - while getopts 'hw' c 16 - do 17 - case $c in 18 - h) usage; exit ;; 19 - w) USEWAYLAND=true ;; 20 - *) usage; exit 1 ;; 21 - esac 22 - done 23 - 24 - shift $((OPTIND-1)) 25 - 26 - if [ $USEWAYLAND = true ] 27 - then 28 - word=$(wl-paste -p) 29 - else 30 - word=$(xclip -o) 31 - fi 32 - 33 - res=$(curl -s "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word") 34 - regex=$'"definition":"\K(.*?)(?=")' 35 - definitions=$(echo "$res" | grep -Po "$regex") 36 - separatedDefinition=$(sed ':a;N;$!ba;s/\n/\n\n/g' <<< "$definitions") 37 - ${lib.getExe pkgs.libnotify} --urgency=critical -a "word-lookup" "$word" "$separatedDefinition" 38 - ''
-6
pkgs/wpick.nix
··· 1 - { pkgs, lib }: 2 - # It is a one liner to replace xpick on Wayland. Compatible with Wlroots. Doesn't need dependencies outside of ImageMagick that already declared in host 3 - pkgs.writeShellScriptBin "wpick" # bash 4 - '' 5 - ${lib.meta.getExe' pkgs.grim "grim"} -g "$(${lib.meta.getExe' pkgs.slurp "slurp"} -p)" -t ppm - | ${lib.meta.getExe' pkgs.imagemagick "magick"} - -format '%[pixel:p{0,0}]' txt:- 6 - ''
stuff/impermanence.norg docs/impermanence.norg
stuff/recursivelyImport.nix lib/recursivelyImport.nix
stuff/zfs.norg docs/zfs.norg