├── .envrc ├── .git-blame-ignore-revs ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── build-packages.yml │ └── update-hash.yml ├── .gitignore ├── .gitsecret ├── keys │ ├── pubring.kbx │ ├── pubring.kbx~ │ └── trustdb.gpg └── paths │ └── mapping.cfg ├── .nixd.json ├── .vscode ├── settings.json └── tasks.json ├── LICENSE.md ├── README.md ├── default.nix ├── flake.lock ├── flake.nix ├── home ├── configurations │ ├── _options.nix │ ├── custom.nix │ └── weathercold │ │ ├── _base.nix.secret │ │ ├── nixos-disk.nix │ │ ├── nixos-inspiron.nix │ │ └── nixos-redmibook.nix ├── flake-module.nix ├── flake.lock ├── flake.nix └── modules │ ├── accounts │ └── email.nix │ ├── i18n │ └── input-method │ │ └── fcitx5.nix │ ├── profiles │ ├── base.nix │ ├── build-config.nix │ ├── full.nix │ ├── hyprland.nix │ └── niri.nix │ ├── programs │ ├── btop.nix │ ├── carapace.nix │ ├── direnv.nix │ ├── dotdrop.nix │ ├── firefox.nix │ ├── fish.nix │ ├── foot.nix │ ├── git.nix │ ├── helix.nix │ ├── hyprlock.nix │ ├── jujutsu.nix │ ├── nushell.nix │ ├── thunderbird.nix │ ├── wayland │ │ ├── hyprland.nix │ │ └── niri.nix │ ├── yazi │ │ ├── default.nix │ │ ├── keymap.toml │ │ └── yazi.toml │ └── zoxide.nix │ ├── services │ ├── desktop-managers │ │ └── plasma6.nix │ ├── gpg-agent.nix │ ├── scheduling │ │ └── darkman.nix │ └── wayland │ │ └── hypridle.nix │ └── themes │ ├── base │ ├── cursors.nix │ ├── fastfetch │ │ ├── config.json │ │ └── default.nix │ ├── firefox-vertical-tabs │ │ ├── default.nix │ │ ├── lock.json │ │ ├── update-shell.nix │ │ └── update.sh │ ├── foot.nix │ ├── ghostty.nix │ ├── hyprland-dynamic-cursors.nix │ ├── nushell.nix │ └── starship.nix │ ├── catppuccin │ ├── cursors.nix │ ├── discord.nix │ ├── fcitx5.nix │ ├── fonts.nix │ ├── foot.nix │ ├── ghostty.nix │ ├── gtk.nix │ ├── hyprland.nix │ ├── hyprpaper │ │ ├── _options.nix │ │ ├── nixos-logo.nix │ │ ├── xppen-chan.nix │ │ └── xppen-chan.png │ ├── niri.nix │ └── plasma6.nix │ └── colloid │ ├── fcitx5.nix │ ├── firefox.nix │ ├── fonts.nix │ ├── gtk.nix │ └── plasma6.nix ├── lib ├── default.nix ├── flake-module.nix ├── flake.lock ├── flake.nix ├── haumea │ ├── LICENSE │ ├── default.nix │ └── src │ │ ├── __parsePath.nix │ │ ├── load.nix │ │ ├── loadEvalTests.nix │ │ ├── loaders │ │ ├── __defaultWith.nix │ │ ├── callPackage.nix │ │ ├── default.nix │ │ ├── path.nix │ │ ├── scoped.nix │ │ └── verbatim.nix │ │ ├── matchers │ │ ├── always.nix │ │ ├── extension.nix │ │ ├── json.nix │ │ ├── nix.nix │ │ ├── regex.nix │ │ └── toml.nix │ │ └── transformers │ │ ├── __utils │ │ └── concatMapAttrsWith.nix │ │ ├── hoistAttrs.nix │ │ ├── hoistLists.nix │ │ ├── liftDefault.nix │ │ └── prependUnderscore.nix ├── modules │ ├── config │ │ └── abszero.nix │ └── themes │ │ └── catppuccin │ │ ├── catppuccin.nix │ │ └── palette.json └── src │ ├── attrsets.nix │ ├── filesystem.nix │ ├── modules.nix │ ├── partials.nix │ ├── strings.nix │ └── trivial.nix ├── nixos ├── configurations │ ├── _options.nix │ ├── fracture-ray │ │ ├── default.nix │ │ └── proxy.json.secret │ ├── nixos-disk.nix │ ├── nixos-inspiron.nix │ └── nixos-redmibook.nix ├── flake-module.nix ├── flake.lock ├── flake.nix └── modules │ ├── config │ ├── users.nix │ └── zram.nix │ ├── hardware │ ├── dell-inspiron-7405.nix │ ├── keyboard │ │ └── halo65.nix │ ├── vultr-cc-intel-regular.nix │ └── xiaomi-redmibook-16-pro-2024.nix │ ├── i18n │ └── input-method │ │ └── fcitx5.nix │ ├── profiles │ ├── base.nix │ ├── desktop.nix │ ├── full.nix │ └── server.nix │ ├── programs │ ├── neovim.nix │ ├── pot.nix │ ├── steam.nix │ ├── wayland │ │ ├── hyprland.nix │ │ └── niri.nix │ └── wireshark.nix │ ├── services │ ├── desktop-managers │ │ └── plasma6.nix │ ├── display-managers │ │ ├── sddm.nix │ │ └── tuigreet.nix │ ├── hardware │ │ └── kanata.nix │ ├── networking │ │ ├── v2raya.nix │ │ ├── wpa_supplicant.nix │ │ └── xray │ │ │ ├── blackhole-adblock.nix │ │ │ ├── default.nix │ │ │ ├── vless-tcp-xtls-reality-client.nix │ │ │ └── vless-tcp-xtls-reality-server.nix │ ├── printing │ │ └── cupsd.nix │ └── rclone │ │ ├── default.nix │ │ └── file-systems.nix.secret │ ├── system │ └── boot │ │ ├── lanzaboote │ │ ├── default.nix │ │ └── pki │ │ │ ├── GUID │ │ │ └── keys │ │ │ ├── KEK │ │ │ ├── KEK.key.secret │ │ │ └── KEK.pem │ │ │ ├── PK │ │ │ ├── PK.key.secret │ │ │ └── PK.pem │ │ │ └── db │ │ │ ├── db.key.secret │ │ │ └── db.pem │ │ ├── plymouth.nix │ │ └── quiet.nix │ ├── themes │ ├── base │ │ └── plymouth-rings_2.nix │ └── catppuccin │ │ ├── fonts.nix │ │ ├── plymouth.nix │ │ └── sddm.nix │ └── virtualisation │ ├── act.nix │ ├── docker.nix │ └── libvirtd.nix ├── nur.nix ├── pkgs ├── an │ ├── anki-bin-wayland │ │ └── package.nix │ └── anki-wayland │ │ └── package.nix ├── ca │ ├── catppuccin-discord-git │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh │ └── catppuccin-wallpapers │ │ └── package.nix ├── co │ └── colloid-gtk-theme-git │ │ ├── lock.json │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh ├── default.nix ├── flake-module.nix ├── flake.lock ├── flake.nix ├── io │ └── iosevka-inconsolata │ │ └── package.nix ├── no │ └── noita_save_manager │ │ └── package.nix ├── nu │ └── nu_scripts-git │ │ ├── lock.json │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh ├── ob │ └── obsidian-ime │ │ └── package.nix ├── pa │ └── palgen │ │ └── package.nix ├── v2 │ └── v2ray-rules-dat │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh ├── vs │ ├── vscode-insiders │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh │ └── vscodium-insiders │ │ ├── package.nix │ │ ├── update-shell.nix │ │ └── update.sh └── wi │ └── win2xcur │ └── package.nix └── shell.nix /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Run the following command to set this file as the default ignore file for 2 | # git blame: `git config blame.ignoreRevsFile .git-blame-ignore-revs` 3 | 4 | # *: use nixfmt-rfc-style 5 | 480edcda80daee18a9ab5c3e653fba38540b0989 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.secret linguist-generated 2 | flake.lock linguist-generated 3 | 4 | /.gitsecret/** linguist-generated 5 | /lib/haumea/** linguist-vendored 6 | 7 | /.gitsecret/paths/mapping.cfg linguist-language=INI 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: weekly 7 | -------------------------------------------------------------------------------- /.github/workflows/build-packages.yml: -------------------------------------------------------------------------------- 1 | name: Build Packages 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | paths: 8 | - "pkgs/**" 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | env: 14 | NIXPKGS_ALLOW_UNFREE: 1 15 | NIXPKGS_ALLOW_INSECURE: 1 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - uses: cachix/install-nix-action@v31 20 | with: 21 | nix_path: nixpkgs=channel:nixos-unstable 22 | extra_nix_config: experimental-features = nix-command flakes 23 | 24 | - uses: cachix/cachix-action@v16 25 | with: 26 | name: abszero 27 | authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} 28 | 29 | - name: Build package 30 | run: nix build --impure .#checks.x86_64-linux.buildPackages 31 | -------------------------------------------------------------------------------- /.github/workflows/update-hash.yml: -------------------------------------------------------------------------------- 1 | name: Update Hash 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 */4 * * *" 7 | 8 | env: 9 | BRANCH: update-${{ github.run_number }} 10 | 11 | jobs: 12 | get-update-scripts: 13 | runs-on: ubuntu-latest 14 | outputs: 15 | update-scripts: ${{ steps.get-update-scripts.outputs.update-scripts }} 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Get update scripts 20 | id: get-update-scripts 21 | shell: bash # Set pipefail 22 | run: echo "update-scripts=$(find . -name "update.sh" | jq -cnR '[inputs]')" >> "$GITHUB_OUTPUT" 23 | 24 | update: 25 | runs-on: ubuntu-latest 26 | needs: get-update-scripts 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | update-script: ${{ fromJson(needs.get-update-scripts.outputs.update-scripts) }} 31 | steps: 32 | - uses: actions/checkout@v4 33 | 34 | - uses: cachix/install-nix-action@v31 35 | with: 36 | nix_path: nixpkgs=channel:nixos-unstable 37 | extra_nix_config: experimental-features = nix-command flakes 38 | 39 | - name: Run update script 40 | continue-on-error: true 41 | run: |- 42 | ${{ matrix.update-script }} 43 | git stash 44 | git pull 45 | git stash pop 46 | 47 | - uses: stefanzweifel/git-auto-commit-action@v5 48 | continue-on-error: true 49 | with: 50 | commit_message: | 51 | pkgs: autoupdate 52 | 53 | uwu 54 | commit_author: github-actions[bot] 55 | branch: ${{ env.BRANCH }} 56 | push_options: --atomic 57 | create_branch: true 58 | 59 | squash-to-master: 60 | if: always() 61 | runs-on: ubuntu-latest 62 | needs: update 63 | steps: 64 | - uses: actions/checkout@v4 65 | with: 66 | fetch-depth: 0 67 | token: ${{ secrets.UPDATE_HASH_TOKEN }} 68 | 69 | - name: Check if branch exists 70 | id: check-branch 71 | run: '! git branch -r | grep $BRANCH; echo exists=$? >> "$GITHUB_OUTPUT"' 72 | 73 | - name: Squash commits to master 74 | if: steps.check-branch.outputs.exists == '1' 75 | run: git merge --squash origin/$BRANCH 76 | 77 | - uses: stefanzweifel/git-auto-commit-action@v5 78 | if: steps.check-branch.outputs.exists == '1' 79 | with: 80 | commit_message: | 81 | pkgs: autoupdate 82 | 83 | uwu 84 | commit_author: github-actions[bot] 85 | 86 | - name: Delete temporary branch 87 | if: always() && steps.check-branch.outputs.exists == '1' 88 | run: git push origin -d $BRANCH 89 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | source 2 | outputs 3 | result* 4 | temp 5 | 6 | /.direnv 7 | 8 | /.gitsecret/keys/random_seed 9 | /home/configurations/weathercold/_base.nix 10 | /nixos/configurations/fracture-ray/proxy.json 11 | /nixos/modules/services/rclone/file-systems.nix 12 | /nixos/modules/system/boot/lanzaboote/pki/keys/db/db.key 13 | /nixos/modules/system/boot/lanzaboote/pki/keys/KEK/KEK.key 14 | /nixos/modules/system/boot/lanzaboote/pki/keys/PK/PK.key 15 | -------------------------------------------------------------------------------- /.gitsecret/keys/pubring.kbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/.gitsecret/keys/pubring.kbx -------------------------------------------------------------------------------- /.gitsecret/keys/pubring.kbx~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/.gitsecret/keys/pubring.kbx~ -------------------------------------------------------------------------------- /.gitsecret/keys/trustdb.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/.gitsecret/keys/trustdb.gpg -------------------------------------------------------------------------------- /.gitsecret/paths/mapping.cfg: -------------------------------------------------------------------------------- 1 | home/configurations/weathercold/_base.nix:07504ae7f8535d6c2cae63c02d5d43e8c6524d65e4145d7dc7e98c789f69c523 2 | nixos/modules/services/rclone/file-systems.nix:66b43b9fcc8bd55b28a333a57d48d6e8c5c95e7436876d06fe4cf0c5e9f0ee81 3 | nixos/configurations/fracture-ray/proxy.json:361e92348562878260d189f0649841b0599eb5398c038496028c21563b93d97a 4 | nixos/modules/system/boot/lanzaboote/pki/keys/db/db.key:ea2c930bb7570ccb76621cc4b85af9c122e43f1c9c28d294945d89abf4aa8188 5 | nixos/modules/system/boot/lanzaboote/pki/keys/KEK/KEK.key:e7f511f084eb1d808aaeff870b45f45cafabaeb369a9d8bbf829254671726893 6 | nixos/modules/system/boot/lanzaboote/pki/keys/PK/PK.key:5ff26de28a7d4ef877765783241de7f2d91748b82db5c21a7f4ab63e6566d4b2 7 | -------------------------------------------------------------------------------- /.nixd.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/nix-community/nixd/main/nixd/docs/nixd-schema.json", 3 | "nixpkgs": { 4 | "expr": "import (builtins.getFlake (toString ./.)).inputs.nixpkgs { }" 5 | }, 6 | "formatting": { 7 | "command": "nixfmt" 8 | }, 9 | "options": { 10 | "nixos": { 11 | "expr": "(builtins.getFlake (toString ./.)).nixosConfigurations.nixos-inspiron.options" 12 | }, 13 | "home-manager": { 14 | "expr": "(builtins.getFlake (toString ./.)).homeConfigurations.\"weathercold@nixos-inspiron\".options" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix", 3 | "git.blame.statusBarItem.enabled": false 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "system-rebuild", 8 | "type": "shell", 9 | "command": "sudo nh os switch", 10 | "group": { 11 | "kind": "build" 12 | } 13 | }, 14 | { 15 | "label": "home-rebuild", 16 | "type": "shell", 17 | "command": "nh home switch -b bak", 18 | "group": { 19 | "kind": "build", 20 | "isDefault": true 21 | } 22 | }, 23 | { 24 | "label": "flake-update", 25 | "type": "shell", 26 | "command": "nix flake update; nix flake update --flake ./nixos; nix flake update --flake ./home; nix flake update --flake ./pkgs; nix flake update --flake ./lib", 27 | "problemMatcher": [] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2022 Weathercold 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | lock = with builtins; (fromJSON (readFile ./flake.lock)).nodes.flake-compat.locked; 3 | in 4 | (import (fetchTarball { 5 | url = "https://github.com/edolstra/flake-compat/archive/${lock.rev}.tar.gz"; 6 | sha256 = lock.narHash; 7 | }) { src = ./.; }).defaultNix 8 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Weathercold's NixOS Flake"; 3 | 4 | inputs = { 5 | # Repos 6 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 7 | niri = { 8 | url = "github:sodiboo/niri-flake"; 9 | inputs = { 10 | nixpkgs.follows = "nixpkgs"; 11 | nixpkgs-stable.follows = "nixpkgs"; 12 | }; 13 | }; 14 | zen-browser = { 15 | url = "github:0xc000022070/zen-browser-flake"; 16 | inputs = { 17 | nixpkgs.follows = "nixpkgs"; 18 | home-manager.follows = "home-manager"; 19 | }; 20 | }; 21 | # bocchi-cursors = { 22 | # url = "github:Weathercold/Bocchi-Cursors"; 23 | # inputs = { 24 | # nixpkgs.follows = "nixpkgs"; 25 | # flake-parts.follows = "flake-parts"; 26 | # }; 27 | # }; 28 | 29 | # Utils 30 | flake-compat = { 31 | url = "github:edolstra/flake-compat"; 32 | flake = false; 33 | }; 34 | flake-parts = { 35 | url = "github:hercules-ci/flake-parts"; 36 | inputs.nixpkgs-lib.follows = "nixpkgs"; 37 | }; 38 | deploy-rs = { 39 | url = "github:serokell/deploy-rs"; 40 | inputs = { 41 | nixpkgs.follows = "nixpkgs"; 42 | flake-compat.follows = "flake-compat"; 43 | }; 44 | }; 45 | disko = { 46 | url = "github:nix-community/disko"; 47 | inputs.nixpkgs.follows = "nixpkgs"; 48 | }; 49 | nixos-hardware.url = "github:NixOS/nixos-hardware"; 50 | lanzaboote = { 51 | # Fork that adds an UKI mode 52 | url = "github:linyinfeng/lanzaboote/uki"; 53 | inputs = { 54 | nixpkgs.follows = "nixpkgs"; 55 | flake-compat.follows = "flake-compat"; 56 | flake-parts.follows = "flake-parts"; 57 | }; 58 | }; 59 | home-manager = { 60 | url = "github:nix-community/home-manager"; 61 | inputs.nixpkgs.follows = "nixpkgs"; 62 | }; 63 | catppuccin.url = "github:catppuccin/nix"; 64 | nix-index-database = { 65 | url = "github:nix-community/nix-index-database"; 66 | inputs.nixpkgs.follows = "nixpkgs"; 67 | }; 68 | }; 69 | 70 | outputs = 71 | { 72 | self, 73 | nixpkgs, 74 | flake-parts, 75 | ... 76 | }@inputs: 77 | 78 | let 79 | lib = import ./lib { inherit (nixpkgs) lib; }; 80 | extLib = nixpkgs.lib.extend (_: _: { abszero = lib; }); 81 | in 82 | 83 | flake-parts.lib.mkFlake 84 | { 85 | inherit inputs; 86 | specialArgs.lib = extLib; 87 | } 88 | { 89 | imports = [ 90 | ./pkgs/flake-module.nix 91 | ./nixos/flake-module.nix 92 | ./home/flake-module.nix 93 | ]; 94 | 95 | # Expose flake-parts options for nixd 96 | debug = true; 97 | 98 | flake = { 99 | # FIXME: This is suboptimal, would be better to put checks where 100 | # deploy is defined. 101 | checks.x86_64-linux = inputs.deploy-rs.lib.x86_64-linux.deployChecks self.deploy; 102 | inherit lib; 103 | }; 104 | 105 | systems = [ 106 | "x86_64-linux" 107 | "x86_64-darwin" 108 | "aarch64-darwin" 109 | "aarch64-linux" 110 | ]; 111 | 112 | perSystem = 113 | { pkgs, ... }: 114 | with pkgs; 115 | { 116 | formatter = nixfmt-tree; 117 | 118 | devShells.default = mkShell { 119 | packages = [ 120 | cachix 121 | deploy-rs 122 | markdown-oxide 123 | nixd 124 | nixfmt-rfc-style 125 | nixfmt-tree 126 | nixos-anywhere 127 | nix-init 128 | nix-prefetch-github # Somehow not in nix-prefetch-scripts 129 | nix-prefetch-scripts 130 | taplo # TOML language server 131 | yaml-language-server 132 | vscode-langservers-extracted # For vscode-json-language-server 133 | ]; 134 | shellHook = '' 135 | export NIXPKGS_ALLOW_BROKEN=1 136 | ''; 137 | }; 138 | }; 139 | }; 140 | } 141 | -------------------------------------------------------------------------------- /home/configurations/_options.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | lib, 5 | withSystem, 6 | ... 7 | }: 8 | 9 | let 10 | inherit (inputs) home-manager; 11 | inherit (lib) 12 | types 13 | mkOption 14 | mapAttrs 15 | flatten 16 | splitString 17 | ; 18 | inherit (builtins) head; 19 | inherit (lib.abszero.filesystem) toModuleList; 20 | cfg = config.homeConfigurations; 21 | 22 | configModule = 23 | { name, config, ... }: 24 | { 25 | options = { 26 | system = mkOption { 27 | type = types.nonEmptyStr; 28 | description = "System architecture"; 29 | }; 30 | username = mkOption { 31 | type = types.nonEmptyStr; 32 | default = head (splitString "@" name); 33 | description = "Username"; 34 | }; 35 | homeDirectory = mkOption { 36 | type = types.nonEmptyStr; 37 | default = "/home/${config.username}"; 38 | description = "Absolute path to user's home"; 39 | }; 40 | modules = mkOption { 41 | type = with types; listOf deferredModule; 42 | default = [ ]; 43 | description = "List of modules specific to this home configuration"; 44 | }; 45 | }; 46 | }; 47 | in 48 | 49 | { 50 | options.homeConfigurations = mkOption { 51 | type = with types; attrsOf (submodule configModule); 52 | description = "Abstracted home configuration options"; 53 | }; 54 | 55 | config.flake.homeConfigurations = mapAttrs ( 56 | _: c: 57 | withSystem c.system ( 58 | { pkgs, ... }: 59 | home-manager.lib.homeManagerConfiguration { 60 | inherit pkgs lib; 61 | extraSpecialArgs = { 62 | inherit inputs; 63 | }; 64 | modules = flatten [ 65 | # We do want to install niri for portals (even though it's already installed in NixOS). 66 | # For some reason this is required to get gtk apps to automatically switch themes. 67 | # See https://github.com/ghostty-org/ghostty/discussions/6017#discussioncomment-12357838 68 | inputs.niri.homeModules.niri 69 | inputs.nix-index-database.hmModules.nix-index 70 | inputs.catppuccin.homeModules.catppuccin 71 | (toModuleList ../../lib/modules) 72 | (toModuleList ../modules) 73 | c.modules 74 | { 75 | abszero.enableExternalModulesByDefault = false; 76 | nixpkgs.overlays = [ 77 | (_: prev: import ../../pkgs { pkgs = prev; }) 78 | inputs.niri.overlays.niri 79 | ]; 80 | home = { 81 | inherit (c) username homeDirectory; 82 | }; 83 | } 84 | ]; 85 | } 86 | ) 87 | ) cfg; 88 | } 89 | -------------------------------------------------------------------------------- /home/configurations/custom.nix: -------------------------------------------------------------------------------- 1 | # Example configuration 2 | { lib, ... }: 3 | 4 | let 5 | inherit (lib) mkIf singleton; 6 | 7 | system = "x86_64-linux"; # System architecture 8 | username = "custom"; 9 | hostName = "custom"; 10 | homeDirectory = null; # Default is "/home/${username}" 11 | # For firefox, put your firefox profile name here. 12 | firefoxProfile = null; # Default is username 13 | in 14 | 15 | { 16 | imports = [ ./_options.nix ]; 17 | 18 | homeConfigurations."${username}@${hostName}" = { 19 | inherit system; 20 | homeDirectory = mkIf (homeDirectory != null) homeDirectory; 21 | modules = singleton { 22 | abszero = { 23 | profiles.buildConfig.enable = true; 24 | programs.firefox.profile = mkIf (firefoxProfile != null) firefoxProfile; 25 | themes.base = { 26 | fastfetch.enable = true; 27 | firefox.verticalTabs = true; 28 | foot.enable = true; 29 | ghostty.enable = true; 30 | hyprland.dynamicCursors.enable = true; 31 | nushell.enable = true; 32 | starship.enable = true; 33 | }; 34 | }; 35 | 36 | specialisation = { 37 | colloid.configuration = { 38 | abszero.themes.colloid = { 39 | fcitx5.enable = true; 40 | firefox.enable = true; 41 | fonts.enable = true; 42 | gtk.enable = true; 43 | plasma6.enable = true; 44 | }; 45 | xdg.dataFile."home-manager/specialisation".text = "colloid"; 46 | }; 47 | 48 | catppuccin.configuration = { 49 | abszero.themes.catppuccin = { 50 | enable = true; 51 | cursors.enable = true; 52 | discord.enable = true; 53 | fcitx5.enable = true; 54 | fonts.enable = true; 55 | foot.enable = true; 56 | ghostty.enable = true; 57 | gtk.enable = true; 58 | hyprland.enable = true; 59 | hyprpaper = { 60 | enable = true; 61 | wallpaper = "nixos-logo"; 62 | }; 63 | plasma6.enable = true; 64 | }; 65 | xdg.dataFile."home-manager/specialisation".text = "catppuccin"; 66 | }; 67 | }; 68 | }; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /home/configurations/weathercold/_base.nix.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/home/configurations/weathercold/_base.nix.secret -------------------------------------------------------------------------------- /home/configurations/weathercold/nixos-disk.nix: -------------------------------------------------------------------------------- 1 | let 2 | inherit (builtins) readDir warn; 3 | 4 | mainModule = { 5 | abszero = { 6 | profiles.hyprland.enable = true; 7 | themes = { 8 | base = { 9 | fastfetch.enable = true; 10 | firefox.verticalTabs = true; 11 | hyprland.dynamicCursors.enable = true; 12 | nushell.enable = true; 13 | starship.enable = true; 14 | }; 15 | catppuccin = { 16 | cursors.enable = true; 17 | fcitx5.enable = true; 18 | ghostty.enable = true; 19 | gtk.enable = true; 20 | hyprland.enable = true; 21 | hyprpaper = { 22 | enable = true; 23 | wallpaper = "nixos-logo"; 24 | }; 25 | }; 26 | }; 27 | }; 28 | 29 | catppuccin = { 30 | accent = "pink"; 31 | gtk.icon.enable = true; 32 | }; 33 | 34 | wayland.windowManager.hyprland.settings.monitor = "eDP-1, preferred, auto, 1.25"; 35 | 36 | programs.man.enable = false; # Speed up builds 37 | 38 | manual.manpages.enable = false; 39 | }; 40 | in 41 | 42 | { 43 | imports = [ ../_options.nix ]; 44 | 45 | homeConfigurations."weathercold@nixos-disk" = { 46 | system = "x86_64-linux"; 47 | modules = [ 48 | # inputs.bocchi-cursors.homeModules.bocchi-cursors-shadowBlack 49 | ( 50 | if (readDir ./. ? "_base.nix") then 51 | ./_base.nix 52 | else 53 | warn "_base.nix is hidden, home configuration is incomplete" { } 54 | ) 55 | mainModule 56 | ]; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /home/configurations/weathercold/nixos-inspiron.nix: -------------------------------------------------------------------------------- 1 | let 2 | inherit (builtins) readDir warn; 3 | 4 | modules = { 5 | main = { 6 | imports = [ 7 | ({ config, lib, ... }: lib.mkIf (config.specialisation != { }) modules.hyprland-latte-pink) 8 | ]; 9 | 10 | abszero.profiles.full.enable = true; 11 | 12 | specialisation.plasma6-latte-pink.configuration = modules.plasma6-latte-pink; 13 | }; 14 | 15 | hyprland-latte-pink = { 16 | abszero = { 17 | profiles.hyprland.enable = true; 18 | themes = { 19 | base = { 20 | fastfetch.enable = true; 21 | firefox.verticalTabs = true; 22 | hyprland.dynamicCursors.enable = true; 23 | nushell.enable = true; 24 | starship.enable = true; 25 | }; 26 | catppuccin = { 27 | cursors.enable = true; 28 | fcitx5.enable = true; 29 | ghostty.enable = true; 30 | gtk.enable = true; 31 | hyprland.enable = true; 32 | hyprpaper = { 33 | enable = true; 34 | wallpaper = "nixos-logo"; 35 | }; 36 | }; 37 | }; 38 | }; 39 | 40 | catppuccin = { 41 | accent = "pink"; 42 | gtk.icon.enable = true; 43 | }; 44 | 45 | wayland.windowManager.hyprland.settings.monitor = "eDP-1, preferred, auto, 1.25"; 46 | }; 47 | 48 | plasma6-latte-pink = { 49 | abszero = { 50 | services.desktopManager.plasma6.enable = true; 51 | themes = { 52 | base = { 53 | fastfetch.enable = true; 54 | firefox.verticalTabs = true; 55 | nushell.enable = true; 56 | starship.enable = true; 57 | }; 58 | catppuccin = { 59 | ghostty.enable = true; 60 | gtk.enable = true; 61 | plasma.enable = true; 62 | }; 63 | colloid.fcitx5.enable = true; 64 | }; 65 | }; 66 | 67 | catppuccin.accent = "pink"; 68 | 69 | xdg.dataFile."home-manager/specialisation".text = "plasma6-latte-pink"; 70 | 71 | gtk.catppuccin.icon.enable = true; 72 | }; 73 | }; 74 | in 75 | 76 | { 77 | imports = [ ../_options.nix ]; 78 | 79 | homeConfigurations."weathercold@nixos-inspiron" = { 80 | system = "x86_64-linux"; 81 | modules = [ 82 | # inputs.bocchi-cursors.homeModules.bocchi-cursors-shadowBlack 83 | ( 84 | if (readDir ./. ? "_base.nix") then 85 | ./_base.nix 86 | else 87 | warn "_base.nix is hidden, home configuration is incomplete" { } 88 | ) 89 | modules.main 90 | ]; 91 | }; 92 | } 93 | -------------------------------------------------------------------------------- /home/configurations/weathercold/nixos-redmibook.nix: -------------------------------------------------------------------------------- 1 | let 2 | inherit (builtins) readDir warn; 3 | 4 | mainModule = { 5 | abszero = { 6 | profiles.niri.enable = true; 7 | 8 | services.darkman = { 9 | enable = true; 10 | lightSpecialisation = "catppuccin-latte-pink"; 11 | darkSpecialisation = "catppuccin-macchiato-pink"; 12 | }; 13 | 14 | themes = { 15 | base = { 16 | fastfetch.enable = true; 17 | nushell.enable = true; 18 | starship.enable = true; 19 | }; 20 | catppuccin = { 21 | cursors.enable = true; 22 | fcitx5.enable = true; 23 | foot.enable = true; 24 | gtk.enable = true; 25 | hyprpaper = { 26 | enable = true; 27 | wallpaper = "xppen-chan"; 28 | }; 29 | niri.enable = true; 30 | }; 31 | }; 32 | }; 33 | 34 | catppuccin = { 35 | accent = "pink"; 36 | gtk.icon.enable = true; 37 | }; 38 | 39 | specialisation = { 40 | # Hint nh to autoswitch to the current specialisation 41 | catppuccin-latte-pink.configuration.xdg.dataFile."home-manager/specialisation".text = 42 | "catppuccin-latte-pink"; 43 | catppuccin-macchiato-pink.configuration = { 44 | abszero.themes.catppuccin.polarity = "dark"; 45 | xdg.dataFile."home-manager/specialisation".text = "catppuccin-macchiato-pink"; 46 | }; 47 | }; 48 | }; 49 | in 50 | 51 | { 52 | imports = [ ../_options.nix ]; 53 | 54 | homeConfigurations."weathercold@nixos-redmibook" = { 55 | system = "x86_64-linux"; 56 | modules = [ 57 | # inputs.bocchi-cursors.homeModules.bocchi-cursors-shadowBlack 58 | ( 59 | if (readDir ./. ? "_base.nix") then 60 | ./_base.nix 61 | else 62 | warn "_base.nix is hidden, configuration is incomplete" { } 63 | ) 64 | mainModule 65 | ]; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /home/flake-module.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | let 4 | inherit (lib.abszero.filesystem) toModuleAttr toModuleAttr' toModuleList; 5 | in 6 | 7 | { 8 | imports = toModuleList ./configurations; 9 | 10 | flake.homeModules = 11 | toModuleAttr ../lib/modules/themes 12 | // toModuleAttr' ./modules/profiles 13 | // toModuleAttr ./modules/themes; 14 | } 15 | -------------------------------------------------------------------------------- /home/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Weathercold's home-manager modules"; 3 | 4 | inputs = { 5 | # Repos 6 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 7 | niri = { 8 | url = "github:sodiboo/niri-flake"; 9 | inputs = { 10 | nixpkgs.follows = "nixpkgs"; 11 | nixpkgs-stable.follows = "nixpkgs"; 12 | }; 13 | }; 14 | # bocchi-cursors = { 15 | # url = "github:Weathercold/Bocchi-Cursors"; 16 | # inputs = { 17 | # nixpkgs.follows = "nixpkgs"; 18 | # flake-parts.follows = "flake-parts"; 19 | # }; 20 | # }; 21 | 22 | # Utils 23 | flake-parts = { 24 | url = "github:hercules-ci/flake-parts"; 25 | inputs.nixpkgs-lib.follows = "nixpkgs"; 26 | }; 27 | home-manager = { 28 | url = "github:nix-community/home-manager"; 29 | inputs.nixpkgs.follows = "nixpkgs"; 30 | }; 31 | catppuccin.url = "github:catppuccin/nix"; 32 | nix-index-database = { 33 | url = "github:nix-community/nix-index-database"; 34 | inputs.nixpkgs.follows = "nixpkgs"; 35 | }; 36 | }; 37 | 38 | outputs = 39 | { 40 | nixpkgs, 41 | flake-parts, 42 | ... 43 | }@inputs: 44 | let 45 | extendedLib = nixpkgs.lib.extend ( 46 | _: _: { 47 | abszero = import ../lib { 48 | inherit (nixpkgs) lib; 49 | }; 50 | } 51 | ); 52 | in 53 | flake-parts.lib.mkFlake 54 | { 55 | inherit inputs; 56 | specialArgs.lib = extendedLib; 57 | } 58 | { 59 | imports = [ ./flake-module.nix ]; 60 | 61 | systems = [ "x86_64-linux" ]; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /home/modules/accounts/email.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) types mkOption; 5 | cfg = config.abszero; 6 | in 7 | 8 | { 9 | options.abszero.emails = mkOption { 10 | type = types.attrs; 11 | default = { }; 12 | }; 13 | 14 | config.accounts.email.accounts = cfg.emails; 15 | } 16 | -------------------------------------------------------------------------------- /home/modules/i18n/input-method/fcitx5.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.i18n.inputMethod.fcitx5; 6 | in 7 | 8 | { 9 | options.abszero.i18n.inputMethod.fcitx5.enable = 10 | mkEnableOption "next-generation input method framework. Complementary to the NixOS module"; 11 | 12 | # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland 13 | # Use fcitx im module for XWayland Gtk applications 14 | # Wayland Gtk applications will still use wayland im module 15 | config.gtk = mkIf cfg.enable { 16 | gtk3.extraConfig.gtk-im-module = "fcitx"; 17 | gtk4.extraConfig.gtk-im-module = "fcitx"; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/modules/profiles/base.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) 5 | mkIf 6 | mkDefault 7 | removePrefix 8 | ; 9 | inherit (lib.abszero.modules) mkExternalEnableOption; 10 | cfg = config.abszero.profiles.base; 11 | in 12 | 13 | { 14 | imports = [ ../../../lib/modules/config/abszero.nix ]; 15 | 16 | options.abszero.profiles.base.enable = mkExternalEnableOption config "base profile"; 17 | 18 | config = mkIf cfg.enable { 19 | nixpkgs.config.allowUnfree = true; 20 | 21 | home = { 22 | stateVersion = "25.11"; 23 | preferXdgDirectories = true; 24 | # NOTE: this doesn't enable pointerCursor by default. 25 | pointerCursor = { 26 | gtk.enable = mkDefault true; 27 | hyprcursor.enable = mkDefault true; 28 | x11.enable = mkDefault true; 29 | }; 30 | # Create .profile so that greetd sets session variables before starting 31 | # the session, since it only sources .profile, not .zprofile nor 32 | # .bash_profile. 33 | # NOTE: hm-session-vars.sh makes sure it's only sourced once. 34 | file.".profile".text = '' 35 | . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" 36 | ''; 37 | }; 38 | 39 | xdg = { 40 | enable = true; 41 | autostart.enable = true; 42 | mimeApps.enable = true; 43 | }; 44 | 45 | programs = { 46 | # NOTE: most of gpg config is in user's configuration 47 | gpg = { 48 | mutableKeys = mkDefault false; 49 | mutableTrust = mkDefault false; 50 | }; 51 | home-manager.enable = true; 52 | nh = { 53 | enable = true; 54 | flake = "path:/home/weathercold/src/nixfiles"; 55 | clean = { 56 | enable = true; 57 | extraArgs = "--keep 3 --keep-since 1w"; 58 | }; 59 | }; 60 | zsh = { 61 | enable = true; 62 | # Hack since `dotDir` is relative to home 63 | dotDir = "${removePrefix "${config.home.homeDirectory}/" config.xdg.configHome}/zsh"; 64 | autocd = true; 65 | }; 66 | }; 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /home/modules/profiles/build-config.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf optionalAttrs; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.profiles.buildConfig; 12 | in 13 | 14 | { 15 | imports = [ ./base.nix ]; 16 | 17 | options.abszero.profiles.buildConfig.enable = 18 | mkExternalEnableOption config "profile that disables every package"; 19 | 20 | config = mkIf cfg.enable { 21 | abszero.profiles.base.enable = true; 22 | 23 | programs = builtins.mapAttrs ( 24 | _: v: optionalAttrs (v ? package) { package = pkgs.emptyDirectory; } 25 | ) config.programs; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /home/modules/profiles/full.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkDefault mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.profiles.full; 7 | in 8 | 9 | { 10 | imports = [ ./base.nix ]; 11 | 12 | options.abszero.profiles.full.enable = mkExternalEnableOption config "full profile"; 13 | 14 | config = mkIf cfg.enable { 15 | abszero = { 16 | profiles.base.enable = true; 17 | i18n.inputMethod.fcitx5.enable = true; 18 | services.gpg-agent.enable = true; 19 | programs = { 20 | btop.enable = true; 21 | carapace.enable = true; 22 | direnv.enable = true; 23 | dotdrop.enable = true; 24 | git.enable = true; 25 | helix.enable = true; 26 | jujutsu.enable = true; 27 | nushell.enable = true; 28 | thunderbird.enable = true; 29 | yazi.enable = true; 30 | zoxide.enable = true; 31 | }; 32 | }; 33 | 34 | home.shellAliases = { 35 | "..." = "cd ../.."; 36 | "...." = "cd ../../.."; 37 | ani = "ani-cli"; 38 | c = "clear"; 39 | cat = "bat"; 40 | lns = "ln -s"; 41 | f = "fastfetch"; 42 | nvl = "lightnovel.sh"; 43 | }; 44 | 45 | services = { 46 | arrpc.enable = true; 47 | wluma.enable = true; 48 | }; 49 | 50 | gtk.enable = true; 51 | qt = { 52 | enable = true; 53 | style.name = mkDefault "kvantum"; 54 | platformTheme.name = mkDefault "kvantum"; 55 | }; 56 | 57 | programs = { 58 | bat.enable = true; 59 | eza = { 60 | enable = true; 61 | git = true; 62 | icons = "auto"; 63 | }; 64 | fastfetch.enable = true; 65 | fzf.enable = true; 66 | nix-index-database.comma.enable = true; 67 | starship.enable = true; 68 | zsh = { 69 | syntaxHighlighting.enable = true; 70 | autosuggestion.enable = true; 71 | enableVteIntegration = true; 72 | }; 73 | }; 74 | }; 75 | } 76 | -------------------------------------------------------------------------------- /home/modules/profiles/hyprland.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.profiles.hyprland; 12 | in 13 | 14 | { 15 | imports = [ ./full.nix ]; 16 | 17 | options.abszero.profiles.hyprland.enable = mkExternalEnableOption config "hyprland profile"; 18 | 19 | config = mkIf cfg.enable { 20 | abszero = { 21 | profiles.full.enable = true; 22 | services.hypridle.enable = true; 23 | programs = { 24 | foot.enable = true; 25 | hyprland.enable = true; 26 | hyprlock.enable = true; 27 | }; 28 | }; 29 | 30 | home.packages = with pkgs; [ 31 | albert 32 | grimblast 33 | brillo 34 | ]; 35 | 36 | wayland.windowManager.hyprland.settings = { 37 | bind = [ 38 | ", XF86MonBrightnessDown, exec, sudo brillo -qu 200000 -U 5" 39 | ", XF86MonBrightnessUp, exec, sudo brillo -qu 200000 -A 5" 40 | 41 | "$mod, Slash, exec, albert show" 42 | "$mod, t, exec, foot" 43 | ", Print, exec, grimblast copysave area" 44 | "SHIFT, Print, exec, grimblast copysave output" 45 | ]; 46 | 47 | windowrule = [ 48 | "float, title:Albert" 49 | "pin, title:Albert" 50 | "noblur, title:Albert" 51 | "noborder, title:Albert" 52 | 53 | "pseudo, title:.* - Anki" 54 | "size 666 560, title:.* - Anki" 55 | 56 | "float, title:CollectorMainWindow" 57 | 58 | "size 600 500, class:foot" 59 | 60 | "size 600 500, class:com\\.mitchellh\\.ghostty" 61 | 62 | "pseudo, title:KDE Connect" 63 | "size 350 350, title:KDE Connect" 64 | 65 | "immediate, class:osu!" # Enable tearing 66 | 67 | "float, class:it\\.mijorus\\.smile" 68 | 69 | "pseudo, class:org\\.gnome\\.Solanum" 70 | "size 370 370, class:org\\.gnome\\.Solanum" 71 | 72 | "maximize, title:Waydroid" # Full ui 73 | 74 | "float, class:zen, title:^$" # Notification popups 75 | 76 | "float, class:Zotero, title: Error" 77 | ]; 78 | 79 | exec-once = [ "albert" ]; 80 | }; 81 | 82 | services.hyprpaper.enable = true; 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /home/modules/profiles/niri.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.profiles.niri; 12 | in 13 | 14 | { 15 | imports = [ ./full.nix ]; 16 | 17 | options.abszero.profiles.niri.enable = mkExternalEnableOption config "niri profile"; 18 | 19 | config = mkIf cfg.enable { 20 | abszero = { 21 | profiles.full.enable = true; 22 | programs = { 23 | foot.enable = true; 24 | niri.enable = true; 25 | }; 26 | }; 27 | 28 | home.packages = with pkgs; [ 29 | albert 30 | brillo 31 | smile 32 | ]; 33 | 34 | services.hyprpaper.enable = true; 35 | 36 | programs.niri.settings = { 37 | binds = with config.lib.niri.actions; { 38 | XF86MonBrightnessDown.action = spawn "sudo" "brillo" "-qu" "200000" "-U" "5"; 39 | XF86MonBrightnessUp.action = spawn "sudo" "brillo" "-qu" "200000" "-A" "5"; 40 | 41 | "Mod+Ctrl+t".action = spawn "foot"; 42 | "Mod+Ctrl+slash".action = spawn "albert" "show"; 43 | "Mod+Ctrl+b".action = spawn "zen"; 44 | "Mod+Ctrl+period".action = spawn "smile"; 45 | }; 46 | 47 | window-rules = [ 48 | { 49 | open-floating = true; 50 | matches = [ 51 | { app-id = "it\\.mijorus\\.smile"; } 52 | ]; 53 | } 54 | ]; 55 | 56 | spawn-at-startup = [ 57 | { command = [ "albert" ]; } 58 | ]; 59 | }; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /home/modules/programs/btop.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.btop; 6 | in 7 | 8 | { 9 | options.abszero.programs.btop.enable = mkEnableOption "system resources monitor"; 10 | 11 | config.programs.btop = mkIf cfg.enable { 12 | enable = true; 13 | settings = { 14 | proc_sorting = "memory"; 15 | io_mode = true; 16 | show_battery = false; 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/modules/programs/carapace.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.carapace; 6 | in 7 | 8 | { 9 | options.abszero.programs.carapace.enable = mkEnableOption "carapace"; 10 | 11 | config = mkIf cfg.enable { 12 | home.sessionVariables.CARAPACE_BRIDGES = "zsh,fish,bash,inshellisense"; 13 | programs.carapace.enable = true; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /home/modules/programs/direnv.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.direnv; 6 | in 7 | 8 | { 9 | options.abszero.programs.direnv.enable = mkEnableOption "Per-directory environment manager"; 10 | 11 | config = mkIf cfg.enable { 12 | programs.direnv = { 13 | enable = true; 14 | nix-direnv.enable = true; 15 | config.global.warn_timeout = "1m"; 16 | }; 17 | home.sessionVariables.DIRENV_LOG_FORMAT = ""; # Disable logging 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/modules/programs/dotdrop.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (pkgs) fetchurl; 10 | inherit (lib) mkEnableOption mkIf; 11 | cfg = config.abszero.programs.dotdrop; 12 | 13 | dotdropFishComp = fetchurl { 14 | url = "https://raw.githubusercontent.com/deadc0de6/dotdrop/master/completion/dotdrop.fish"; 15 | hash = "sha256-msoL+TmqNJl3i4QGFPEnmSK1OsMhpBNWe4BDVihhQw4="; 16 | }; 17 | in 18 | 19 | { 20 | options.abszero.programs.dotdrop.enable = mkEnableOption "dotfiles manager"; 21 | 22 | config = mkIf cfg.enable { 23 | home.shellAliases = { 24 | dotdrop = "~/src/dotfiles/scripts/dotdrop.sh"; 25 | dotsync = "~/src/dotfiles/scripts/dotsync.sh"; 26 | sysdrop = "~/src/sysfiles/scripts/dotdrop.sh"; 27 | syssync = "~/src/sysfiles/scripts/dotsync.sh"; 28 | }; 29 | xdg.configFile."fish/completions/dotdrop.fish".source = dotdropFishComp; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /home/modules/programs/firefox.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | types 11 | mkEnableOption 12 | mkOption 13 | mkIf 14 | ; 15 | cfg = config.abszero.programs.firefox; 16 | in 17 | 18 | { 19 | options.abszero.programs.firefox = { 20 | enable = mkEnableOption "managing Firefox"; 21 | profile = mkOption { 22 | type = types.nonEmptyStr; 23 | default = config.home.username; 24 | }; 25 | }; 26 | 27 | config = mkIf cfg.enable { 28 | # Make dev edition use the same profile as the normal Firefox. 29 | home.file.".mozilla/firefox/ignore-dev-edition-profile".text = ""; 30 | 31 | programs.firefox = { 32 | enable = true; 33 | package = pkgs.firefox-devedition-bin; 34 | profiles.${cfg.profile}.settings = { 35 | "browser.aboutConfig.showWarning" = false; 36 | }; 37 | }; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /home/modules/programs/fish.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.fish; 6 | in 7 | 8 | { 9 | options.abszero.programs.fish.enable = mkEnableOption "managing fish"; 10 | 11 | config.programs = mkIf cfg.enable { 12 | fish = { 13 | enable = true; 14 | interactiveShellInit = '' 15 | set fish_greeting "" 16 | ''; 17 | functions = { 18 | qcomm = "qfile (which $argv)"; 19 | fetchhash = "nix flake prefetch --json $argv | jq -r .hash"; 20 | }; 21 | }; 22 | 23 | foot.settings.main.shell = "fish"; 24 | ghostty.settings.command = "fish"; 25 | nix-your-shell.enable = true; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /home/modules/programs/foot.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.foot; 6 | in 7 | 8 | { 9 | options.abszero.programs.foot.enable = mkEnableOption "foot Wayland terminal emulator"; 10 | 11 | config.programs.foot = mkIf cfg.enable { 12 | enable = true; 13 | settings = { 14 | main.resize-delay-ms = 0; 15 | mouse.hide-when-typing = true; 16 | touch.long-press-delay = 300; 17 | key-bindings = { 18 | scrollback-up-page = "Alt+Page_Up"; 19 | scrollback-down-page = "Alt+Page_Down"; 20 | scrollback-home = "Alt+Home"; 21 | scrollback-end = "Alt+End"; 22 | prompt-prev = "Alt+Up"; 23 | prompt-next = "Alt+Down"; 24 | search-start = "Control+Alt+f"; 25 | show-urls-launch = "Control+Alt+o"; 26 | }; 27 | search-bindings = { 28 | find-prev = "Alt+comma"; 29 | find-next = "Alt+period"; 30 | }; 31 | }; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /home/modules/programs/git.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf mkDefault; 5 | inherit (lib.abszero.attrsets) findValue; 6 | cfg = config.abszero.programs.git; 7 | 8 | primaryEmail = findValue (_: v: v.primary) config.accounts.email.accounts; 9 | in 10 | 11 | { 12 | options.abszero.programs.git.enable = mkEnableOption "stupid content tracker"; 13 | 14 | config.programs.git = mkIf cfg.enable { 15 | enable = true; 16 | userName = mkDefault primaryEmail.realName; 17 | userEmail = mkDefault primaryEmail.address; 18 | signing = { 19 | signByDefault = true; 20 | format = "openpgp"; 21 | key = null; 22 | }; 23 | extraConfig = { 24 | pull.ff = "only"; 25 | }; 26 | delta = { 27 | enable = true; 28 | options.hyperlinks = true; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /home/modules/programs/helix.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.programs.helix; 6 | in 7 | 8 | { 9 | options.abszero.programs.helix.enable = mkEnableOption "post-modern text editor"; 10 | 11 | config.programs.helix = mkIf cfg.enable { 12 | enable = true; 13 | defaultEditor = true; 14 | 15 | settings = { 16 | editor = { 17 | text-width = 100; 18 | rulers = [ 19 | 100 20 | 120 21 | ]; 22 | bufferline = "multiple"; 23 | 24 | lsp.display-inlay-hints = true; 25 | 26 | file-picker.hidden = false; 27 | 28 | auto-save = { 29 | focus-lost = true; 30 | after-delay = { 31 | enable = true; 32 | timeout = 300; 33 | }; 34 | }; 35 | 36 | whitespace = { 37 | render = { 38 | tab = "all"; 39 | nbsp = "all"; 40 | nnbsp = "all"; 41 | }; 42 | characters.tabpad = " "; 43 | }; 44 | 45 | indent-guides = { 46 | render = true; 47 | character = "⎸"; # Default bar is in the middle 48 | }; 49 | }; 50 | 51 | keys = { 52 | normal = { 53 | # Movement 54 | home = "goto_first_nonwhitespace"; 55 | 56 | # Selection 57 | A-n = "select_prev_sibling"; 58 | A-e = "shrink_selection"; 59 | A-i = "expand_selection"; 60 | A-a = "select_next_sibling"; 61 | 62 | A-S-e = "select_all_children"; 63 | A-S-a = "select_all_siblings"; 64 | 65 | A-p = "no_op"; # select_prev_sibling 66 | A-o = "no_op"; # expand_selection 67 | A-S-i = "no_op"; # select_all_children 68 | 69 | # Window 70 | n = "@"; 71 | C-w = { 72 | n = "jump_view_left"; 73 | e = "jump_view_down"; 74 | i = "jump_view_up"; 75 | a = "jump_view_right"; 76 | 77 | S-n = "swap_view_left"; 78 | S-e = "swap_view_down"; 79 | S-i = "swap_view_up"; 80 | S-a = "swap_view_right"; 81 | 82 | h = "hsplit"; 83 | 84 | j = "no_op"; # jump_view_down 85 | k = "no_op"; # jump_view_up 86 | l = "no_op"; # jump_view_right 87 | S-h = "no_op"; # swap_view_left 88 | S-j = "no_op"; # swap_view_down 89 | S-k = "no_op"; # swap_view_up 90 | S-l = "no_op"; # swap_view_right 91 | s = "no_op"; # hsplit 92 | }; 93 | }; 94 | }; 95 | }; 96 | 97 | languages = { 98 | language = [ 99 | { 100 | name = "devicetree"; 101 | file-types = [ 102 | "dts" 103 | "dtsi" 104 | "overlay" 105 | "keymap" 106 | ]; 107 | } 108 | ]; 109 | 110 | language-server.nixd = { 111 | config = { 112 | nixpkgs.expr = "import (builtins.getFlake (toString ./.)).inputs.nixpkgs { }"; 113 | options = { 114 | nixos.expr = "(builtins.getFlake (toString ./.)).nixosConfigurations.nixos-redmibook.options"; 115 | home-manager.expr = ''(builtins.getFlake (toString ./.)).homeConfigurations."weathercold@nixos-redmibook".options''; 116 | flake-parts.expr = "(builtins.getFlake (toString ./.)).debug.options"; 117 | flake-parts2.expr = "(builtins.getFlake (toString ./.)).currentSystem.options"; 118 | }; 119 | }; 120 | }; 121 | }; 122 | }; 123 | } 124 | -------------------------------------------------------------------------------- /home/modules/programs/hyprlock.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf singleton; 5 | cfg = config.abszero.programs.hyprlock; 6 | in 7 | 8 | { 9 | options.abszero.programs.hyprlock.enable = mkEnableOption "wayland screen locker"; 10 | 11 | # https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock 12 | config = mkIf cfg.enable { 13 | assertions = singleton { 14 | assertion = config.abszero.services.hypridle.enable; 15 | message = "hyprlock requires hypridle to be enabled"; 16 | }; 17 | programs.hyprlock = { 18 | enable = true; 19 | settings = { 20 | general = { 21 | grace = 60; # 1min 22 | ignore_empty_input = true; 23 | }; 24 | }; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /home/modules/programs/jujutsu.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf mkDefault; 5 | inherit (lib.abszero.attrsets) findValue; 6 | cfg = config.abszero.programs.jujutsu; 7 | 8 | primaryEmail = findValue (_: v: v.primary) config.accounts.email.accounts; 9 | in 10 | 11 | { 12 | options.abszero.programs.jujutsu.enable = mkEnableOption "simple and powerful VCS"; 13 | 14 | config = mkIf cfg.enable { 15 | abszero.programs.git.enable = true; 16 | programs.jujutsu = { 17 | enable = true; 18 | settings = { 19 | user = { 20 | name = mkDefault primaryEmail.realName; 21 | email = mkDefault primaryEmail.address; 22 | }; 23 | signing = { 24 | behavior = "own"; 25 | backend = mkIf config.programs.gpg.enable "gpg"; 26 | key = mkDefault primaryEmail.address; 27 | }; 28 | ui = { 29 | default-command = "log"; 30 | pager = "delta"; 31 | diff.format = "git"; 32 | }; 33 | }; 34 | }; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /home/modules/programs/nushell.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf mkOrder; 5 | cfg = config.abszero.programs.nushell; 6 | in 7 | 8 | { 9 | options.abszero.programs.nushell.enable = mkEnableOption "a new type of shell"; 10 | 11 | config.programs = mkIf cfg.enable { 12 | foot.settings.main.shell = "nu"; 13 | ghostty.settings.command = "nu"; 14 | nix-your-shell.enable = true; 15 | 16 | nushell = { 17 | enable = true; 18 | 19 | shellAliases = { 20 | "..." = "cd ../.."; 21 | "...." = "cd ../../.."; 22 | ani = "ani-cli"; 23 | c = "clear"; 24 | cat = "bat"; 25 | f = "fastfetch"; 26 | lns = "ln -s"; 27 | }; 28 | 29 | # https://www.nushell.sh/book/configuration.html 30 | # https://github.com/amtoine/nushell/blob/main/crates/nu-utils/src/sample_config/default_config.nu 31 | configFile.text = '' 32 | $env.config = { 33 | use_kitty_protocol: true 34 | show_banner: false 35 | } 36 | ''; 37 | 38 | # Order of overrides of completer: 39 | # Carapace <-- Zoxide <-- Expand alias 40 | # Expand alias 41 | extraConfig = mkOrder 2000 '' 42 | let prev_completer = $env.config?.completions?.external?.completer? | default echo 43 | let next_completer = {|spans: list| 44 | let expansion = scope aliases 45 | | where name == $spans.0 46 | | get -i 0.expansion 47 | | default $spans.0 48 | | split row " " 49 | 50 | do $prev_completer ($spans | skip 1 | prepend $expansion) 51 | } 52 | $env.config = ($env.config? 53 | | default {} 54 | | merge { completions: { external: { completer: $next_completer } } }) 55 | ''; 56 | }; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /home/modules/programs/thunderbird.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) 5 | types 6 | mkOption 7 | mkEnableOption 8 | mkIf 9 | attrNames 10 | genAttrs 11 | const 12 | ; 13 | cfg = config.abszero.programs.thunderbird; 14 | in 15 | 16 | { 17 | options.abszero.programs.thunderbird = { 18 | enable = mkEnableOption "Mozilla's mail client"; 19 | profile = mkOption { 20 | type = types.nonEmptyStr; 21 | default = config.home.username; 22 | }; 23 | }; 24 | 25 | config = mkIf cfg.enable { 26 | programs.thunderbird = { 27 | enable = true; 28 | profiles.${cfg.profile}.isDefault = true; 29 | }; 30 | # TODO: Configure email when chat and calendar can be configured 31 | accounts.email.accounts = genAttrs (attrNames config.abszero.emails) (const { 32 | thunderbird.enable = false; 33 | }); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home/modules/programs/wayland/hyprland.nix: -------------------------------------------------------------------------------- 1 | # NOTE: The hyprland option in home-manager is `wayland.windowManager.hyprland`, however we use 2 | # `programs.hyprland` to be consistent with NixOS. 3 | { 4 | config, 5 | pkgs, 6 | lib, 7 | ... 8 | }: 9 | 10 | let 11 | inherit (lib) mkEnableOption mkIf; 12 | inherit (builtins) concatMap; 13 | cfg = config.abszero.programs.hyprland; 14 | in 15 | 16 | { 17 | # imports = [ ./mosaic-tiling.nix ]; 18 | 19 | options.abszero.programs.hyprland.enable = mkEnableOption "Wayland compositor"; 20 | 21 | config.wayland.windowManager.hyprland = mkIf cfg.enable { 22 | enable = true; 23 | settings = { 24 | "$mod" = "SUPER"; 25 | 26 | general = { 27 | allow_tearing = true; 28 | resize_on_border = true; 29 | }; 30 | 31 | input = { 32 | repeat_rate = 50; 33 | repeat_delay = 200; 34 | follow_mouse = 2; # Detach cursor focus from keyboard focus 35 | touchpad = { 36 | natural_scroll = true; 37 | drag_lock = true; # Don't interrupt drag on short breaks 38 | }; 39 | }; 40 | 41 | cursor = { 42 | persistent_warps = true; # Remember cursor position for each window 43 | warp_on_change_workspace = true; 44 | }; 45 | 46 | gestures = { 47 | workspace_swipe = true; 48 | workspace_swipe_distance = 200; 49 | workspace_swipe_direction_lock = false; 50 | workspace_swipe_forever = true; 51 | }; 52 | 53 | render.direct_scanout = true; 54 | 55 | # Do not scale xwayland windows 56 | xwayland.force_zero_scaling = true; 57 | 58 | ecosystem = { 59 | no_update_news = true; 60 | # no_donation_nag = true; 61 | }; 62 | 63 | misc = { 64 | vrr = 1; 65 | # Allow screen locker to restart after crash 66 | allow_session_lock_restore = true; 67 | focus_on_activate = true; # Focus windows that request to be focused 68 | middle_click_paste = false; 69 | }; 70 | 71 | experimental.xx_color_management_v4 = true; 72 | 73 | bind = 74 | [ 75 | # https://wiki.hyprland.org/Configuring/Dispatchers 76 | "$mod, q, exec, uwsm stop" 77 | "$mod, w, killactive" 78 | "$mod, Page_Up, fullscreen, 0" 79 | "$mod, Page_Down, fullscreen, 1" 80 | "$mod, Space, togglefloating" 81 | 82 | "$mod, Left, movefocus, l" 83 | "$mod, Right, movefocus, r" 84 | "$mod, Up, movefocus, u" 85 | "$mod, Down, movefocus, d" 86 | "$mod+SHIFT, Left, movewindow, l" 87 | "$mod+SHIFT, Right, movewindow, r" 88 | "$mod+SHIFT, Up, movewindow, u" 89 | "$mod+SHIFT, Down, movewindow, d" 90 | 91 | ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" 92 | ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" 93 | ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" 94 | ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" 95 | ] 96 | ++ concatMap 97 | (i: [ 98 | "$mod, ${i}, workspace, ${i}" 99 | "$mod+SHIFT, ${i}, movetoworkspace, ${i}" 100 | ]) 101 | [ 102 | "1" 103 | "2" 104 | "3" 105 | "4" 106 | "5" 107 | ]; 108 | 109 | bindm = "$mod, mouse:272, movewindow"; 110 | 111 | exec-once = [ 112 | # "fcitx5 -d" 113 | # Polkit authentication agent 114 | "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 &" 115 | ]; 116 | }; 117 | }; 118 | } 119 | -------------------------------------------------------------------------------- /home/modules/programs/yazi/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf mkEnableOption importTOML; 10 | cfg = config.abszero.programs.yazi; 11 | in 12 | 13 | { 14 | options.abszero.programs.yazi.enable = mkEnableOption "blazing fast terminal file manager"; 15 | 16 | config.programs.yazi = mkIf cfg.enable { 17 | enable = true; 18 | shellWrapperName = "y"; 19 | 20 | plugins = with pkgs.yaziPlugins; { 21 | inherit git sudo; 22 | }; 23 | 24 | settings = importTOML ./yazi.toml; 25 | keymap = importTOML ./keymap.toml; 26 | 27 | initLua = '' 28 | require("git"):setup() 29 | ''; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /home/modules/programs/yazi/keymap.toml: -------------------------------------------------------------------------------- 1 | "$schema" = "https://yazi-rs.github.io/schemas/keymap.json" 2 | 3 | [manager] 4 | 5 | prepend_keymap = [ 6 | { on = [ "l", "a" ], run = "link", desc = "Abs link" }, 7 | { on = [ "l", "r" ], run = "link --relative", desc = "Rel link" }, 8 | { on = [ "l", "h" ], run = "hardlink", desc = "Hard link" }, 9 | { on = [ "L", "a" ], run = "link --force", desc = "Abs link" }, 10 | { on = [ "L", "r" ], run = "link --relative --force", desc = "Rel link" }, 11 | { on = [ "L", "h" ], run = "hardlink --force", desc = "Hard link" }, 12 | 13 | { on = [ "R", "a" ], run = "plugin sudo -- create", desc = "sudo create" }, 14 | { on = [ "R", "r" ], run = "plugin sudo -- rename", desc = "sudo rename" }, 15 | { on = [ "R", "d" ], run = "plugin sudo -- remove", desc = "sudo trash" }, 16 | { on = [ "R", "D" ], run = "plugin sudo -- remove --permanently", desc = "sudo delete" }, 17 | { on = [ "R", "p" ], run = "plugin sudo -- paste", desc = "sudo paste" }, 18 | { on = [ "R", "P" ], run = "plugin sudo -- paste --force", desc = "sudo paste with overwrite" }, 19 | { on = [ "R", "l", "a" ], run = "plugin sudo -- link", desc = "sudo abs link" }, 20 | { on = [ "R", "l", "r" ], run = "plugin sudo -- link --relative", desc = "sudo rel link" }, 21 | { on = [ "R", "l", "h" ], run = "plugin sudo -- hardlink", desc = "sudo hard link" }, 22 | { on = [ "R", "L", "a" ], run = "plugin sudo -- link --force", desc = "sudo abs link with overwrite" }, 23 | { on = [ "R", "L", "r" ], run = "plugin sudo -- link --relative --force", desc = "sudo rel link with overwrite" }, 24 | { on = [ "R", "L", "h" ], run = "plugin sudo -- hardlink --force", desc = "sudo hard link with overwrite" }, 25 | ] 26 | -------------------------------------------------------------------------------- /home/modules/programs/yazi/yazi.toml: -------------------------------------------------------------------------------- 1 | "$schema" = "https://yazi-rs.github.io/schemas/yazi.json" 2 | 3 | [manager] 4 | 5 | show_hidden = true 6 | sort_by = "natural" 7 | sort_translit = true 8 | linemode = "size" 9 | 10 | [preview] 11 | 12 | image_delay = 0 13 | 14 | [input] 15 | 16 | cursor_blink = true 17 | 18 | [plugin] 19 | 20 | prepend_fetchers = [ 21 | { id = "git", name = "*", run = "git" }, 22 | { id = "git", name = "*/", run = "git" } 23 | ] 24 | -------------------------------------------------------------------------------- /home/modules/programs/zoxide.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf mkAfter; 5 | cfg = config.abszero.programs.zoxide; 6 | in 7 | 8 | { 9 | options.abszero.programs.zoxide = { 10 | enable = mkEnableOption "zoxide"; 11 | enableNushellIntegration = mkEnableOption "directory history completion" // { 12 | default = true; 13 | }; 14 | }; 15 | 16 | config = mkIf cfg.enable { 17 | programs = { 18 | zoxide.enable = true; 19 | 20 | nushell = { 21 | shellAliases.zz = "z -"; 22 | # After carapace sets up completions 23 | # https://www.nushell.sh/cookbook/external_completers.html 24 | extraConfig = mkIf cfg.enableNushellIntegration (mkAfter '' 25 | let prev_completer = $env.config?.completions?.external?.completer? | default echo 26 | let next_completer = {|spans| 27 | if $spans.0 in [__zoxide_z __zoxide_zi] { 28 | $spans | skip 1 | zoxide query -l ...$in | lines | where $it != $env.PWD 29 | } else if $spans.0 == zoxide and $spans.1? == remove { 30 | $spans | get 2 | zoxide query -l $in | lines | where $it != $env.PWD 31 | } else { 32 | do $prev_completer $spans 33 | } 34 | } 35 | $env.config = ($env.config? 36 | | default {} 37 | | merge { completions: { external: { completer: $next_completer } } }) 38 | ''); 39 | }; 40 | }; 41 | 42 | home.shellAliases.zz = "z -"; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /home/modules/services/desktop-managers/plasma6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.services.desktopManager.plasma6; 11 | in 12 | 13 | { 14 | options.abszero.services.desktopManager.plasma6.enable = 15 | mkEnableOption "the next generation desktop for Linux. Complementary to the NixOS module"; 16 | 17 | config = mkIf cfg.enable { 18 | qt = { 19 | platformTheme.name = "kde"; 20 | style.name = null; 21 | }; 22 | services.gpg-agent.pinentryPackage = pkgs.pinentry-qt; 23 | programs.firefox.nativeMessagingHosts = with pkgs.kdePackages; [ plasma-browser-integration ]; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /home/modules/services/gpg-agent.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf mkDefault; 10 | cfg = config.abszero.services.gpg-agent; 11 | in 12 | 13 | { 14 | options.abszero.services.gpg-agent.enable = mkEnableOption "GnuPG private key agent"; 15 | 16 | config.services.gpg-agent = mkIf cfg.enable { 17 | enable = true; 18 | enableSshSupport = true; 19 | pinentry.package = mkDefault pkgs.pinentry-gnome3; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/modules/services/scheduling/darkman.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | types 11 | mkOption 12 | mkEnableOption 13 | mkIf 14 | ; 15 | cfg = config.abszero.services.darkman; 16 | 17 | switch-hm-specialisation = 18 | spec: 19 | pkgs.writeShellApplication { 20 | name = "switch-hm-specialisation-${spec}"; 21 | 22 | runtimeInputs = with pkgs; [ 23 | nixVersions.latest 24 | toybox 25 | ]; 26 | 27 | inheritPath = false; 28 | excludeShellChecks = [ "SC2086" ]; 29 | bashOptions = [ 30 | "errexit" 31 | "nounset" 32 | "pipefail" 33 | "xtrace" 34 | ]; 35 | 36 | text = '' 37 | hm_gens=$(nix-store -q --referrers ~/.local/state/nix/profiles/home-manager) 38 | "$(find $hm_gens -maxdepth 1 -type d -name specialisation)/${spec}/activate" 39 | ''; 40 | } 41 | + "/bin/switch-hm-specialisation-${spec}"; 42 | in 43 | 44 | { 45 | options.abszero.services.darkman = { 46 | enable = mkEnableOption "darkman day/night command scheduler"; 47 | lightSpecialisation = mkOption { 48 | type = types.nonEmptyStr; 49 | }; 50 | darkSpecialisation = mkOption { 51 | type = types.nonEmptyStr; 52 | }; 53 | }; 54 | 55 | config.services.darkman = mkIf cfg.enable { 56 | enable = true; 57 | lightModeScripts.switch-hm-specialisation = switch-hm-specialisation cfg.lightSpecialisation; 58 | darkModeScripts.switch-hm-specialisation = switch-hm-specialisation cfg.darkSpecialisation; 59 | settings.usegeoclue = true; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /home/modules/services/wayland/hypridle.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf singleton; 5 | cfg = config.abszero.services.hypridle; 6 | in 7 | 8 | { 9 | options.abszero.services.hypridle.enable = mkEnableOption "wayland idle daemon"; 10 | 11 | # https://wiki.hyprland.org/Hypr-Ecosystem/hypridle 12 | config = mkIf cfg.enable { 13 | assertions = singleton { 14 | assertion = config.abszero.programs.hyprlock.enable; 15 | message = "hypridle requires hyprlock to be enabled"; 16 | }; 17 | services.hypridle = { 18 | enable = true; 19 | settings = { 20 | general = { 21 | # lock_cmd = "pidof hyprlock || hyprlock"; 22 | lock_cmd = "true"; 23 | before_sleep_cmd = "loginctl lock-session"; 24 | # To avoid having to press a key twice to turn on the display 25 | after_sleep_cmd = "hyprctl dispatch dpms on"; 26 | }; 27 | listener = [ 28 | { 29 | timeout = 300; # 5min 30 | on-timeout = "loginctl lock-session"; 31 | } 32 | { 33 | timeout = 360; # 6min 34 | on-timeout = "hyprctl dispatch dpms off"; 35 | on-resume = "hyprctl dispatch dpms on"; 36 | } 37 | ]; 38 | }; 39 | }; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /home/modules/themes/base/cursors.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.base.pointerCursor; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.themes.base.pointerCursor.enable = 13 | mkExternalEnableOption config "base cursor theme"; 14 | 15 | config.programs.niri.settings.cursor = mkIf cfg.enable { 16 | theme = config.home.pointerCursor.name; 17 | size = config.home.pointerCursor.size; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/modules/themes/base/fastfetch/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", 3 | "logo": { 4 | "source": "nixos_small", 5 | "padding": { 6 | "right": 1 7 | }, 8 | "color": { 9 | "2": "magenta" 10 | } 11 | }, 12 | "modules": [ 13 | { 14 | "type": "uptime", 15 | "key": "runt", 16 | "format": "{1}d {2}h {3}m" 17 | }, 18 | { 19 | "type": "localip", 20 | "key": "addr", 21 | "compact": true 22 | }, 23 | { 24 | "type": "os", 25 | "key": "dist", 26 | "format": "{10} {11}" 27 | }, 28 | { 29 | "type": "kernel", 30 | "key": "kern", 31 | "format": "{2}" 32 | }, 33 | { 34 | "type": "packages", 35 | "key": "pkgs" 36 | }, 37 | "break", 38 | { 39 | "type": "colors", 40 | "symbol": "circle" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /home/modules/themes/base/fastfetch/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (builtins) fromJSON readFile; 6 | inherit (lib.abszero.modules) mkExternalEnableOption; 7 | cfg = config.abszero.themes.base.fastfetch; 8 | in 9 | 10 | { 11 | imports = [ ../../../../../lib/modules/config/abszero.nix ]; 12 | 13 | options.abszero.themes.base.fastfetch.enable = mkExternalEnableOption config "base fastfetch theme"; 14 | 15 | config.programs.fastfetch.settings = mkIf cfg.enable (fromJSON (readFile ./config.json)); 16 | } 17 | -------------------------------------------------------------------------------- /home/modules/themes/base/firefox-vertical-tabs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (pkgs) fetchgit; 10 | inherit (lib) 11 | mkBefore 12 | mkIf 13 | pipe 14 | filterAttrs 15 | ; 16 | inherit (lib.abszero.modules) mkExternalEnableOption; 17 | cfg = config.abszero.themes.base.firefox; 18 | firefoxCfg = config.abszero.programs.firefox; 19 | 20 | firefox-vertical-tabs = 21 | with builtins; 22 | pipe ./lock.json [ 23 | readFile 24 | fromJSON 25 | (filterAttrs ( 26 | n: _: 27 | elem n [ 28 | "url" 29 | "rev" 30 | "hash" 31 | ] 32 | )) 33 | fetchgit 34 | ]; 35 | in 36 | 37 | { 38 | imports = [ 39 | ../../../../../lib/modules/config/abszero.nix 40 | ../../../programs/firefox.nix 41 | ]; 42 | 43 | options.abszero.themes.base.firefox.verticalTabs = 44 | mkExternalEnableOption config "firefox vertical tabs"; 45 | 46 | config.programs.firefox.profiles.${firefoxCfg.profile}.userChrome = mkIf cfg.verticalTabs ( 47 | mkBefore ''@import "${firefox-vertical-tabs}/userChrome.css";'' 48 | ); 49 | } 50 | -------------------------------------------------------------------------------- /home/modules/themes/base/firefox-vertical-tabs/lock.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/home/modules/themes/base/firefox-vertical-tabs/lock.json -------------------------------------------------------------------------------- /home/modules/themes/base/firefox-vertical-tabs/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | nix-prefetch-git 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /home/modules/themes/base/firefox-vertical-tabs/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | 8 | nix-prefetch-git https://codeberg.org/ranmaru22/firefox-vertical-tabs.git \ 9 | > "$ROOT/lock.json" 10 | -------------------------------------------------------------------------------- /home/modules/themes/base/foot.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.base.foot; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.themes.base.foot.enable = mkExternalEnableOption config "base foot theme"; 13 | 14 | config.programs.foot.settings = mkIf cfg.enable { 15 | main.pad = "8x8center"; 16 | cursor = { 17 | style = "beam"; 18 | blink = "yes"; 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/modules/themes/base/ghostty.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.base.ghostty; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.themes.base.ghostty.enable = mkExternalEnableOption config "base ghostty theme"; 13 | 14 | config.programs.ghostty.settings = mkIf cfg.enable { 15 | window-padding-x = 8; 16 | window-padding-y = 8; 17 | window-padding-balance = true; 18 | window-padding-color = "extend"; 19 | cursor-style = "bar"; 20 | adjust-cursor-thickness = 4; 21 | selection-invert-fg-bg = true; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /home/modules/themes/base/hyprland-dynamic-cursors.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.base.hyprland.dynamicCursors; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.base.hyprland.dynamicCursors.enable = 18 | mkExternalEnableOption config "hypr-dynamic-cursors"; 19 | 20 | config.wayland.windowManager.hyprland = mkIf cfg.enable { 21 | plugins = with pkgs.hyprlandPlugins; [ hypr-dynamic-cursors ]; 22 | settings.plugin.dynamic-cursors = { 23 | # mode = "stretch"; 24 | shake = { 25 | threshold = 4; # Shake threshold 26 | base = 1; # Min magnification level 27 | speed = 2; # Magnification increase per second 28 | influence = 2; # Magnification increase by intensity 29 | limit = 2; # Max magnification level 30 | timeout = 1000; 31 | }; 32 | hyprcursor.resolution = 96; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home/modules/themes/base/nushell.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.base.nushell; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.themes.base.nushell.enable = mkExternalEnableOption config "base nushell theme"; 13 | 14 | config.programs.nushell.extraConfig = mkIf cfg.enable '' 15 | $env.config = ($env.config? | default {} | merge { 16 | table: { 17 | mode: light 18 | # header_on_separator: true 19 | } 20 | }); 21 | ''; 22 | } 23 | -------------------------------------------------------------------------------- /home/modules/themes/base/starship.nix: -------------------------------------------------------------------------------- 1 | # https://starship.rs/config 2 | { config, lib, ... }: 3 | 4 | let 5 | inherit (lib) mkEnableOption mkIf; 6 | cfg = config.abszero.themes.base.starship; 7 | in 8 | 9 | { 10 | options.abszero.themes.base.starship.enable = mkEnableOption "managing Starship"; 11 | 12 | config.programs.starship.settings = mkIf cfg.enable { 13 | format = '' 14 | ($directory )($git_branch )($jobs )($cmd_duration)$fill($git_state)( $nodejs)( $rust)( $nix_shell) 15 | ($username$hostname )$character 16 | ''; 17 | 18 | # region Head Left 19 | 20 | directory = { 21 | format = "[[($read_only )$path]($style inverted)]($style)"; 22 | # Different format for git repos 23 | repo_root_format = "[[($read_only ) $repo_root$path]($repo_root_style inverted)]($repo_root_style)"; 24 | read_only = "󰍁"; 25 | truncation_symbol = "…/"; 26 | # Set these two options so repo_root_format takes effect 27 | before_repo_root_style = ""; 28 | repo_root_style = "bold yellow"; 29 | }; 30 | git_branch = { 31 | format = "[[$symbol $branch]($style inverted)]($style)"; 32 | symbol = "󰘬"; 33 | style = "bold red"; 34 | ignore_branches = [ 35 | "HEAD" 36 | "master" 37 | "main" 38 | ]; 39 | }; 40 | jobs = { 41 | format = "[[$symbol $number]($style inverted)]($style)"; 42 | symbol = "󱓺"; 43 | style = "bold pink"; 44 | }; 45 | cmd_duration = { 46 | format = "[[󰅐 $duration]($style inverted)]($style)"; 47 | style = "bold blue"; 48 | show_milliseconds = true; 49 | min_time = 1000; 50 | show_notifications = true; 51 | min_time_to_notify = 60000; 52 | }; 53 | 54 | # endregion 55 | 56 | fill.symbol = " "; 57 | 58 | # region Head Right 59 | 60 | git_state = { 61 | format = "[[󰘭 $state( $progress_current/$progress_total)]($style inverted)]($style)"; 62 | rebase = "rebasing"; 63 | merge = "merging"; 64 | revert = "reverting"; 65 | cherry_pick = "cherry-picking"; 66 | bisect = "bisecting"; 67 | am = "am'ing"; 68 | am_or_rebase = "am/rebasing"; 69 | style = "bold red"; 70 | }; 71 | nodejs = { 72 | format = "[[$symbol( $version)]($style inverted)]($style)"; 73 | symbol = "󰎙"; 74 | }; 75 | rust = { 76 | format = "[[$symbol( $version)]($style inverted)]($style)"; 77 | symbol = "󱘗"; 78 | }; 79 | nix_shell = { 80 | # NOTE: state doesn't display if wrapped in parentheses 81 | format = "[[$symbol $state]($style inverted)]($style)"; 82 | symbol = ""; 83 | unknown_msg = "env"; 84 | }; 85 | # FIXME: invalid allow status - possibly due to nix-direnv? 86 | # direnv = { 87 | # # disabled = false; 88 | # format = "$allowed$loaded"; 89 | # allowed_msg = ""; 90 | # denied_msg = "[󱏵](bold red)"; 91 | # loaded_msg = "[󰂖](bold purple)"; 92 | # unloaded_msg = "[󰂕](bold yellow)"; 93 | # }; 94 | 95 | # endregion 96 | # region Prompt Left 97 | 98 | username.format = "[$user]($style)"; 99 | hostname.format = "@[$hostname]($style)"; 100 | character = { 101 | success_symbol = "[󰘧](bold green)"; 102 | error_symbol = "[󰘧](bold red)"; 103 | }; 104 | 105 | # endregion 106 | }; 107 | } 108 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/cursors.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ 11 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 12 | ../base/cursors.nix 13 | ]; 14 | 15 | options.abszero.themes.catppuccin.cursors = { 16 | enable = mkExternalEnableOption config "catppuccin cursor theme. Complementary to catppuccin/nix"; 17 | monochromeAccent = mkEnableOption "using polarity for accent"; 18 | }; 19 | 20 | config = mkIf cfg.cursors.enable { 21 | abszero.themes = { 22 | base.pointerCursor.enable = true; 23 | catppuccin.enable = true; 24 | }; 25 | catppuccin.cursors = { 26 | enable = true; 27 | accent = mkIf cfg.cursors.monochromeAccent cfg.polarity; 28 | }; 29 | home.pointerCursor.size = 48; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/discord.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (builtins) readFile; 11 | inherit (lib.abszero.modules) mkExternalEnableOption; 12 | cfg = config.abszero.themes.catppuccin; 13 | ctpCfg = config.catppuccin; 14 | 15 | cssDir = 16 | pkgs.catppuccin-discord-git.override { 17 | themes0 = 18 | if cfg.useSystemPolarity then 19 | [ 20 | "${cfg.lightFlavor}-${ctpCfg.accent}" 21 | "${cfg.darkFlavor}-${ctpCfg.accent}" 22 | ] 23 | else 24 | [ "${ctpCfg.flavor}-${ctpCfg.accent}" ]; 25 | } 26 | + "/share/catppuccin-discord"; 27 | in 28 | 29 | { 30 | imports = [ ../../../../lib/modules/themes/catppuccin/catppuccin.nix ]; 31 | 32 | options.abszero.themes.catppuccin.discord.enable = 33 | mkExternalEnableOption config "catppuccin discord theme"; 34 | 35 | config = mkIf cfg.discord.enable { 36 | abszero.themes.catppuccin.enable = true; 37 | programs.discocss.css = 38 | if cfg.useSystemPolarity then 39 | '' 40 | ${readFile (cssDir + "/catppuccin-${cfg.lightFlavor}-${ctpCfg.accent}.theme.css")} 41 | 42 | @media (prefers-color-scheme: dark) { 43 | ${readFile (cssDir + "/catppuccin-${cfg.darkFlavor}-${ctpCfg.accent}.theme.css")} 44 | } 45 | '' 46 | else 47 | readFile (cssDir + "/catppuccin-${ctpCfg.flavor}-${ctpCfg.accent}.theme.css"); 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/fcitx5.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.generators) toINIWithGlobalSection mkKeyValueDefault mkValueStringDefault; 6 | inherit (lib.abszero.modules) mkExternalEnableOption; 7 | cfg = config.abszero.themes.catppuccin; 8 | ctpCfg = config.catppuccin; 9 | in 10 | 11 | { 12 | imports = [ 13 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 14 | ./fonts.nix 15 | ]; 16 | 17 | options.abszero.themes.catppuccin.fcitx5.enable = 18 | mkExternalEnableOption config "catppuccin fcitx5 theme. Complementary to catppuccin/nix"; 19 | 20 | # We don't enable catppuccin.fcitx.enable because we use the NixOS module 21 | config = mkIf cfg.fcitx5.enable { 22 | abszero.themes.catppuccin = { 23 | enable = true; 24 | fonts.enable = true; 25 | }; 26 | xdg.configFile."fcitx5/conf/classicui.conf".text = 27 | toINIWithGlobalSection 28 | { 29 | # Capitalize boolean values 30 | mkKeyValue = mkKeyValueDefault { 31 | mkValueString = 32 | v: 33 | if v == true then 34 | "True" 35 | else if v == false then 36 | "False" 37 | else 38 | mkValueStringDefault { } v; 39 | } "="; 40 | } 41 | { 42 | globalSection = { 43 | Theme = "catppuccin-${ 44 | if cfg.useSystemPolarity then cfg.lightFlavor else ctpCfg.flavor 45 | }-${ctpCfg.accent}"; 46 | DarkTheme = "catppuccin-${cfg.darkFlavor}-${ctpCfg.accent}"; 47 | UseDarkTheme = cfg.useSystemPolarity; 48 | "Vertical Candidate List" = true; 49 | Font = "Noto Sans 14"; 50 | MenuFont = "Open Sans 14"; 51 | TrayFont = "Open Sans 14"; 52 | TrayOutlineColor = "#ffffff00"; 53 | TrayTextColor = "#000000"; 54 | PreferTextIcon = true; 55 | }; 56 | }; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/fonts.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.catppuccin; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.catppuccin.fonts.enable = 18 | mkExternalEnableOption config "fonts to use with catppuccin theme"; 19 | 20 | config = mkIf cfg.fonts.enable { 21 | fonts.fontconfig = { 22 | enable = true; 23 | defaultFonts = { 24 | sansSerif = [ 25 | "Open Sans" 26 | "Noto Sans CJK" 27 | ]; 28 | serif = [ "Iosevka Etoile" ]; 29 | monospace = [ 30 | "Iosevka Inconsolata" 31 | "Ligconsolata" 32 | "Fira Code" 33 | ]; 34 | emoji = [ "Noto Color Emoji" ]; 35 | }; 36 | }; 37 | 38 | home.packages = with pkgs; [ 39 | open-sans 40 | noto-fonts-cjk-sans 41 | (iosevka-bin.override { variant = "Etoile"; }) 42 | fira-code 43 | inconsolata 44 | iosevka-inconsolata 45 | nerd-fonts.departure-mono 46 | ]; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/foot.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ 11 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 12 | ../base/foot.nix 13 | ./fonts.nix 14 | ]; 15 | 16 | options.abszero.themes.catppuccin.foot.enable = 17 | mkExternalEnableOption config "catppuccin foot theme. Complementary to catppuccin/nix"; 18 | 19 | config = mkIf cfg.foot.enable { 20 | abszero.themes = { 21 | base.foot.enable = true; 22 | catppuccin = { 23 | enable = true; 24 | fonts.enable = true; 25 | }; 26 | }; 27 | catppuccin.foot.enable = true; 28 | programs.foot = { 29 | settings.main.font = "Iosevka Inconsolata:size=13, DepartureMono Nerd Font:size=12"; 30 | }; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/ghostty.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf mkForce; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ 11 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 12 | ../base/ghostty.nix 13 | ./fonts.nix 14 | ]; 15 | 16 | options.abszero.themes.catppuccin.ghostty.enable = 17 | mkExternalEnableOption config "Ghostty terminal emulator"; 18 | 19 | config = mkIf cfg.ghostty.enable { 20 | abszero.themes = { 21 | base.ghostty.enable = true; 22 | catppuccin = { 23 | enable = true; 24 | fonts.enable = true; 25 | }; 26 | }; 27 | catppuccin.ghostty.enable = true; 28 | programs.ghostty = { 29 | settings = { 30 | theme = mkIf cfg.useSystemPolarity ( 31 | mkForce "light:catppuccin-${cfg.lightFlavor}, dark:catppuccin-${cfg.darkFlavor}" 32 | ); 33 | font-family = "Iosevka Inconsolata"; 34 | font-size = 13; 35 | }; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/gtk.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | types 11 | mkOption 12 | mkEnableOption 13 | mkIf 14 | optional 15 | optionalString 16 | ; 17 | inherit (builtins) elem; 18 | inherit (lib.abszero.modules) mkExternalEnableOption; 19 | inherit (config.lib.catppuccin) toTitleCase; 20 | cfg = config.abszero.themes.catppuccin; 21 | ctpCfg = config.catppuccin; 22 | 23 | mkSuffix = s: "-${toTitleCase s}"; 24 | 25 | accents = [ 26 | "default" 27 | "purple" 28 | "pink" 29 | "red" 30 | "orange" 31 | "yellow" 32 | "green" 33 | "teal" 34 | "grey" 35 | ]; 36 | 37 | polarity = if cfg.gtk.flavor == "latte" then "light" else "dark"; 38 | 39 | flavorTweak = optionalString ( 40 | cfg.gtk.flavor == "frappe" || cfg.gtk.flavor == "macchiato" 41 | ) cfg.gtk.flavor; 42 | in 43 | 44 | { 45 | imports = [ ../../../../lib/modules/themes/catppuccin/catppuccin.nix ]; 46 | 47 | options.abszero.themes.catppuccin.gtk = { 48 | enable = mkExternalEnableOption config "magnetic-catppuccin-gtk theme"; 49 | 50 | gnomeShellTheme = mkEnableOption "Whether to use the gnome shell theme."; 51 | 52 | flavor = mkOption { 53 | type = types.enum [ 54 | "latte" 55 | "frappe" 56 | "macchiato" 57 | "mocha" 58 | ]; 59 | default = ctpCfg.flavor; 60 | description = "Flavor of the theme."; 61 | }; 62 | 63 | accent = mkOption { 64 | type = types.enum accents; 65 | default = if elem ctpCfg.accent accents then ctpCfg.accent else "default"; 66 | description = "Accent of the theme. Not all accents are supported."; 67 | }; 68 | 69 | size = mkOption { 70 | type = types.enum [ 71 | "standard" 72 | "compact" 73 | ]; 74 | default = "standard"; 75 | description = "Size of the theme."; 76 | }; 77 | 78 | tweaks = mkOption { 79 | type = 80 | with types; 81 | listOf (enum [ 82 | "black" 83 | "float" 84 | "outline" 85 | "macos" 86 | ]); 87 | default = [ ]; 88 | description = "Tweaks of the theme."; 89 | }; 90 | }; 91 | 92 | config = mkIf cfg.gtk.enable { 93 | abszero.themes.catppuccin.enable = true; 94 | 95 | gtk.theme = { 96 | name = 97 | "Catppuccin-GTK" 98 | + optionalString (cfg.gtk.accent != "default") (mkSuffix cfg.gtk.accent) 99 | + mkSuffix polarity 100 | + optionalString (cfg.gtk.size == "compact") "-Compact" 101 | + optionalString (flavorTweak != "") (mkSuffix flavorTweak); 102 | package = pkgs.magnetic-catppuccin-gtk.override { 103 | accent = [ cfg.gtk.accent ]; 104 | shade = polarity; 105 | inherit (cfg.gtk) size; 106 | tweaks = cfg.gtk.tweaks ++ optional (flavorTweak != "") flavorTweak; 107 | }; 108 | }; 109 | 110 | home.packages = with pkgs; mkIf cfg.gtk.gnomeShellTheme [ gnomeExtensions.user-themes ]; 111 | 112 | dconf.settings = mkIf cfg.gtk.gnomeShellTheme { 113 | "org/gnome/shell" = { 114 | disable-user-extensions = false; 115 | enabled-extensions = [ "user-theme@gnome-shell-extensions.gcampax.github.com" ]; 116 | }; 117 | "org/gnome/shell/extensions/user-theme" = { 118 | inherit (config.gtk.theme) name; 119 | }; 120 | "org/gnome/desktop/interface" = { 121 | color-scheme = if cfg.polarity == "light" then "default" else "prefer-dark"; 122 | }; 123 | }; 124 | }; 125 | } 126 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/hyprland.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/themes/catppuccin/catppuccin.nix ]; 11 | 12 | options.abszero.themes.catppuccin.hyprland.enable = 13 | mkExternalEnableOption config "catppuccin hyprland theme"; 14 | 15 | config = mkIf cfg.hyprland.enable { 16 | abszero.themes.catppuccin.enable = true; 17 | 18 | catppuccin.hyprland.enable = true; 19 | 20 | # Catppuccin color variables: 21 | # https://github.com/catppuccin/hyprland/blob/main/themes/frappe.conf 22 | wayland.windowManager.hyprland.settings = { 23 | general = { 24 | border_size = 4; 25 | gaps_in = 8; 26 | "col.inactive_border" = "$surface0"; 27 | "col.active_border" = "$accent"; 28 | }; 29 | 30 | decoration = { 31 | rounding = 8; 32 | blur.enabled = false; 33 | shadow = { 34 | range = 8; 35 | render_power = 2; 36 | color = "$accent"; 37 | }; 38 | }; 39 | 40 | misc = { 41 | disable_hyprland_logo = true; # Disable default wallpaper 42 | disable_splash_rendering = true; 43 | background_color = "$accent"; 44 | animate_manual_resizes = true; 45 | }; 46 | 47 | # https://easings.net 48 | animation = "global, 1, 5, easeOutQuint"; 49 | bezier = "easeOutQuint, 0.22, 1, 0.36, 1"; 50 | }; 51 | 52 | # Remove minimize, maximize, close buttons 53 | dconf.settings."org/gnome/desktop/wm/preferences".button-layout = ""; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/hyprpaper/_options.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) types mkOption mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ ../../../../../lib/modules/themes/catppuccin/catppuccin.nix ]; 11 | 12 | options.abszero.themes.catppuccin.hyprpaper = { 13 | enable = mkExternalEnableOption config "catppuccin hyprpaper theme"; 14 | wallpaper = mkOption { 15 | type = types.enum [ 16 | "nixos-logo" 17 | "xppen-chan" 18 | ]; 19 | description = "Wallpaper to use"; 20 | }; 21 | }; 22 | 23 | config.abszero.themes.catppuccin.enable = mkIf cfg.hyprpaper.enable true; 24 | } 25 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/hyprpaper/nixos-logo.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | cfg = config.abszero.themes.catppuccin; 11 | ctpCfg = config.catppuccin; 12 | 13 | wallpaperName = 14 | if ctpCfg.accent == "magenta" || ctpCfg.accent == "pink" then 15 | "nix-magenta-pink-1920x1080" 16 | else if ctpCfg.accent == "blue" then 17 | "nix-magenta-blue-1920x1080" 18 | else 19 | "nix-black-4k"; 20 | wallpaper = 21 | pkgs.catppuccin-wallpapers.override { wallpapers = [ wallpaperName ]; } 22 | + "/share/wallpapers/catppuccin/${wallpaperName}.png"; 23 | in 24 | 25 | { 26 | imports = [ ./_options.nix ]; 27 | 28 | config.services.hyprpaper.settings = 29 | mkIf (cfg.hyprpaper.enable && cfg.hyprpaper.wallpaper == "nixos-logo") 30 | { 31 | preload = wallpaper; 32 | wallpaper = ",${wallpaper}"; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/hyprpaper/xppen-chan.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | cfg = config.abszero.themes.catppuccin; 11 | 12 | # https://www.pixiv.net/en/artworks/124691157 13 | wallpaper = ./xppen-chan.png; 14 | in 15 | 16 | { 17 | imports = [ ./_options.nix ]; 18 | 19 | config.services.hyprpaper.settings = 20 | mkIf (cfg.hyprpaper.enable && cfg.hyprpaper.wallpaper == "xppen-chan") 21 | { 22 | # For some reason toString returns a different path 23 | preload = "${wallpaper}"; 24 | wallpaper = ", ${wallpaper}"; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/hyprpaper/xppen-chan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/home/modules/themes/catppuccin/hyprpaper/xppen-chan.png -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/niri.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | ctpCfg = config.catppuccin; 8 | 9 | palette = config.lib.catppuccin.palette.${ctpCfg.flavor}.colors; 10 | in 11 | 12 | { 13 | imports = [ ../../../../lib/modules/themes/catppuccin/catppuccin.nix ]; 14 | 15 | options.abszero.themes.catppuccin.niri.enable = 16 | mkExternalEnableOption config "catppuccin niri theme"; 17 | 18 | config = mkIf cfg.niri.enable { 19 | abszero.themes.catppuccin.enable = true; 20 | 21 | # Remove minimize, maximize, close buttons 22 | dconf.settings."org/gnome/desktop/wm/preferences".button-layout = ""; 23 | 24 | programs.niri.settings = { 25 | layout = { 26 | tab-indicator = { 27 | place-within-column = true; 28 | gap = 8; 29 | gaps-between-tabs = 4; 30 | corner-radius = 100; 31 | }; 32 | 33 | focus-ring = { 34 | active.gradient = { 35 | from = palette.pink.hex; 36 | to = palette.mauve.hex; 37 | in' = "oklab"; 38 | angle = 135; # Top left to bottom right 39 | }; 40 | inactive.gradient = { 41 | from = palette.lavender.hex; 42 | to = palette.blue.hex; 43 | in' = "oklab"; 44 | angle = 135; 45 | }; 46 | }; 47 | 48 | shadow.enable = true; 49 | 50 | gaps = 24; 51 | struts = rec { 52 | top = 24; 53 | right = top; 54 | bottom = top; 55 | left = top; 56 | }; 57 | }; 58 | 59 | window-rules = [ 60 | { 61 | geometry-corner-radius = rec { 62 | top-left = 8.0; 63 | top-right = top-left; 64 | bottom-right = top-left; 65 | bottom-left = top-left; 66 | }; 67 | clip-to-geometry = true; 68 | } 69 | ]; 70 | }; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /home/modules/themes/catppuccin/plasma6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.catppuccin; 12 | ctpCfg = config.catppuccin; 13 | 14 | theme = pkgs.catppuccin-kde.override { 15 | flavour = [ ctpCfg.flavor ]; 16 | accents = [ ctpCfg.accent ]; 17 | }; 18 | in 19 | 20 | { 21 | imports = [ 22 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 23 | ../../services/desktop-managers/plasma6.nix 24 | ]; 25 | 26 | options.abszero.themes.catppuccin.plasma6.enable = 27 | mkExternalEnableOption config "catppuccin plasma 6 theme"; 28 | 29 | config = mkIf cfg.plasma6.enable { 30 | abszero = { 31 | services.desktopManager.plasma6.enable = true; 32 | themes.catppuccin.enable = true; 33 | }; 34 | home.packages = [ theme ]; 35 | # Disable kvantum since we use the plasma theme 36 | catppuccin.kvantum.enable = false; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /home/modules/themes/colloid/fcitx5.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.colloid.fcitx5; 7 | in 8 | 9 | { 10 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.themes.colloid.fcitx5.enable = mkExternalEnableOption config "colloid fcitx5 theme"; 13 | 14 | config.xdg.configFile."fcitx5/conf/classicui.conf".text = mkIf cfg.enable '' 15 | Theme=plasma 16 | Vertical Candidate List=True 17 | Font="Noto Sans 13" 18 | MenuFont="Open Sans 13" 19 | TrayFont="Open Sans 13" 20 | TrayOutlineColor=#ffffff00 21 | TrayTextColor=#000000 22 | PreferTextIcon=True 23 | ''; 24 | } 25 | -------------------------------------------------------------------------------- /home/modules/themes/colloid/firefox.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkMerge mkBefore mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.colloid.firefox; 12 | firefoxCfg = config.abszero.programs.firefox; 13 | 14 | tme = pkgs.colloid-gtk-theme.src + "/src/other/firefox/chrome/Colloid"; 15 | in 16 | 17 | { 18 | imports = [ ../base/firefox-vertical-tabs ]; 19 | 20 | options.abszero.themes.colloid.firefox.enable = 21 | mkExternalEnableOption config "colloid firefox theme"; 22 | 23 | config = mkIf cfg.enable { 24 | abszero.themes.base.firefox.verticalTabs = true; 25 | 26 | programs.firefox.profiles.${firefoxCfg.profile} = { 27 | userChrome = mkMerge [ 28 | (mkBefore ''@import "${tme}/theme.css";'') 29 | '' 30 | 31 | /* Fix placement of window decorations */ 32 | * { 33 | --uc-win-ctrl-vertical-offset: 0; 34 | } 35 | 36 | /* Fix findbar padding */ 37 | .findbar-container { 38 | height: inherit !important; 39 | } 40 | 41 | /* Fix border and size of extension icons */ 42 | toolbaritem.unified-extensions-item > toolbarbutton:not(#n):not(#n):not(#n) { 43 | border-radius: 6px !important; 44 | padding: 0 1px !important; 45 | margin: 0 3px !important; 46 | } 47 | 48 | /* Fix navigation bar height */ 49 | toolbar#nav-bar.browser-toolbar { 50 | height: 46px !important; 51 | } 52 | '' 53 | ]; 54 | 55 | userContent = mkBefore '' 56 | @import "${tme}/colors/light.css"; 57 | @import "${tme}/colors/dark.css"; 58 | 59 | @import "${tme}/pages/newtab.css"; 60 | @import "${tme}/pages/privatebrowsing.css"; 61 | 62 | @import "${tme}/parts/video-player.css"; 63 | ''; 64 | 65 | settings = { 66 | "toolkit.legacyUserProfileCustomizations.stylesheets" = true; 67 | "browser.uidensity" = 2; 68 | "svg.context-properties.content.enabled" = true; 69 | "browser.tabs.inTitlebar" = 1; 70 | }; 71 | }; 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /home/modules/themes/colloid/fonts.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.colloid.fonts; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.colloid.fonts.enable = 18 | mkExternalEnableOption config "fonts to use with colloid theme"; 19 | 20 | config = mkIf cfg.enable { 21 | fonts.fontconfig.enable = true; 22 | 23 | home.packages = with pkgs; [ 24 | inconsolata 25 | iosevka-inconsolata 26 | nerd-fonts.symbols-only 27 | noto-fonts-cjk-sans 28 | ]; 29 | 30 | gtk.font = { 31 | package = pkgs.open-sans; 32 | name = "Open Sans"; 33 | size = 14; 34 | }; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /home/modules/themes/colloid/gtk.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.colloid.gtk; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.colloid.gtk.enable = mkExternalEnableOption config "colloid gtk theme"; 18 | 19 | config.gtk = mkIf cfg.enable { 20 | theme = { 21 | package = pkgs.colloid-gtk-theme-git; 22 | name = "Colloid-Light"; 23 | }; 24 | iconTheme = { 25 | package = pkgs.colloid-icon-theme; 26 | name = "Colloid"; 27 | }; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /home/modules/themes/colloid/plasma6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.colloid.plasma6; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.colloid.plasma6.enable = 18 | mkExternalEnableOption config "colloid plasma 6 theme"; 19 | 20 | config.home.packages = 21 | with pkgs; 22 | mkIf cfg.enable [ 23 | colloid-kde 24 | qtstyleplugin-kvantum 25 | ]; 26 | } 27 | -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | # NUR disallows IFD, which means we can't fetch haumea and then use it during 4 | # evaluation. The solution is to vendor haumea. 5 | let 6 | haumea = { 7 | lib = import ./haumea { inherit lib; }; 8 | }; 9 | in 10 | 11 | haumea.lib.load { 12 | src = ./src; 13 | inputs = { 14 | inherit lib haumea; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /lib/flake-module.nix: -------------------------------------------------------------------------------- 1 | # TODO: Actually use this module 2 | { lib, ... }: 3 | { 4 | flake.lib = import ./. { inherit lib; }; 5 | } 6 | -------------------------------------------------------------------------------- /lib/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs-lib": { 4 | "locked": { 5 | "dir": "lib", 6 | "lastModified": 1748026106, 7 | "narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=", 8 | "owner": "NixOS", 9 | "repo": "nixpkgs", 10 | "rev": "063f43f2dbdef86376cc29ad646c45c46e93234c", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "dir": "lib", 15 | "owner": "NixOS", 16 | "ref": "nixos-unstable", 17 | "repo": "nixpkgs", 18 | "type": "github" 19 | } 20 | }, 21 | "root": { 22 | "inputs": { 23 | "nixpkgs-lib": "nixpkgs-lib" 24 | } 25 | } 26 | }, 27 | "root": "root", 28 | "version": 7 29 | } 30 | -------------------------------------------------------------------------------- /lib/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Weathercold's utility library"; 3 | 4 | inputs.nixpkgs-lib.url = "github:NixOS/nixpkgs/nixos-unstable?dir=lib"; 5 | 6 | outputs = 7 | { self, nixpkgs-lib }: 8 | { 9 | lib = import ./. { inherit (nixpkgs-lib) lib; }; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /lib/haumea/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib ? import , 3 | }: 4 | 5 | let 6 | load = import ./src/load.nix { 7 | inherit lib; 8 | root = { 9 | loaders.default = import ./src/loaders { 10 | super.defaultWith = import ./src/loaders/__defaultWith.nix { 11 | inherit lib; 12 | }; 13 | }; 14 | matchers.nix = import ./src/matchers/nix.nix { 15 | super.extension = import ./src/matchers/extension.nix { 16 | inherit lib; 17 | }; 18 | }; 19 | parsePath = import ./src/__parsePath.nix { 20 | inherit lib; 21 | }; 22 | }; 23 | }; 24 | in 25 | 26 | load { 27 | src = ./src; 28 | inputs = { 29 | inherit lib; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /lib/haumea/src/__parsePath.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (builtins) 5 | filter 6 | genList 7 | stringLength 8 | substring 9 | tail 10 | ; 11 | inherit (lib) 12 | hasPrefix 13 | hasSuffix 14 | id 15 | pipe 16 | last 17 | removePrefix 18 | ; 19 | in 20 | 21 | path: type: 22 | 23 | let 24 | stripped = removePrefix "_" (removePrefix "_" path); 25 | in 26 | 27 | if stripped == "" then 28 | null 29 | else 30 | { 31 | inherit stripped; 32 | 33 | name = 34 | { 35 | directory = stripped; 36 | 37 | regular = 38 | let 39 | dots = pipe stripped [ 40 | stringLength 41 | (genList id) 42 | tail 43 | (filter (i: substring i 1 stripped == ".")) 44 | ]; 45 | in 46 | if hasSuffix "." stripped || dots == [ ] then stripped else substring 0 (last dots) stripped; 47 | } 48 | .${type}; 49 | 50 | visibility = 51 | if hasPrefix "__" path then 52 | "super" 53 | else if hasPrefix "_" path then 54 | "root" 55 | else 56 | "public"; 57 | } 58 | -------------------------------------------------------------------------------- /lib/haumea/src/load.nix: -------------------------------------------------------------------------------- 1 | { lib, root }: 2 | 3 | let 4 | inherit (builtins) 5 | all 6 | attrValues 7 | filter 8 | foldl' 9 | head 10 | length 11 | mapAttrs 12 | readDir 13 | ; 14 | inherit (lib) 15 | concatMapAttrs 16 | fix 17 | flatten 18 | flip 19 | getAttrFromPath 20 | isFunction 21 | nameValuePair 22 | optionalAttrs 23 | pipe 24 | remove 25 | take 26 | ; 27 | 28 | entry = { isDir, path, ... }: "${if isDir then "directory" else "file"} '${path}'"; 29 | 30 | view = 31 | { 32 | cursor ? [ ], 33 | node, 34 | pov, 35 | transformer, 36 | }: 37 | if node.isDir then 38 | transformer cursor ( 39 | flip concatMapAttrs node.children ( 40 | name: node: 41 | optionalAttrs 42 | { 43 | public = true; 44 | root = pov != "external"; 45 | super = pov != "external" && take (length cursor) pov == cursor; 46 | } 47 | .${node.visibility} 48 | { 49 | ${name} = view { 50 | cursor = cursor ++ [ name ]; 51 | inherit node pov transformer; 52 | }; 53 | } 54 | ) 55 | ) 56 | else 57 | node.content; 58 | 59 | aggregate = 60 | { 61 | src, 62 | matchers, 63 | inputs, 64 | tree, 65 | }: 66 | let 67 | aggregateEntry = 68 | path: type: 69 | let 70 | parsed = root.parsePath path type; 71 | inherit (parsed) name visibility stripped; 72 | matches = filter (m: m.matches stripped) matchers; 73 | in 74 | if parsed == null then 75 | null 76 | else if type == "directory" then 77 | nameValuePair name { 78 | inherit path visibility; 79 | isDir = true; 80 | children = aggregate { 81 | inherit inputs matchers; 82 | src = src + "/${path}"; 83 | tree = tree // { 84 | pov = tree.pov ++ [ name ]; 85 | }; 86 | }; 87 | } 88 | else if type == "regular" && matches != [ ] then 89 | nameValuePair name { 90 | inherit path visibility; 91 | isDir = false; 92 | content = fix ( 93 | self: 94 | (head matches).loader ( 95 | inputs 96 | // { 97 | inherit self; 98 | super = getAttrFromPath tree.pov (view tree); 99 | root = view tree; 100 | } 101 | ) (src + "/${path}") 102 | ); 103 | } 104 | else 105 | null; 106 | in 107 | pipe src [ 108 | readDir 109 | (mapAttrs aggregateEntry) 110 | attrValues 111 | (remove null) 112 | (flip foldl' { } ( 113 | acc: 114 | { name, value }: 115 | if acc ? ${name} then 116 | throw '' 117 | haumea failed when traversing ${toString src} 118 | - ${entry acc.${name}} conflicts with ${entry value} 119 | '' 120 | else 121 | acc 122 | // { 123 | ${name} = value; 124 | } 125 | )) 126 | ]; 127 | in 128 | 129 | { 130 | src, 131 | loader ? root.loaders.default, 132 | inputs ? { }, 133 | transformer ? [ ], 134 | }: 135 | 136 | let 137 | transformer' = cursor: flip pipe (map (t: t cursor) (flatten transformer)); 138 | in 139 | 140 | assert all (name: inputs ? ${name} -> throw "'${name}' cannot be used as the name of an input") [ 141 | "self" 142 | "super" 143 | "root" 144 | ]; 145 | 146 | view { 147 | pov = "external"; 148 | transformer = transformer'; 149 | node = fix (node: { 150 | isDir = true; 151 | children = aggregate { 152 | inherit src inputs; 153 | matchers = if isFunction loader then [ (root.matchers.nix loader) ] else loader; 154 | tree = { 155 | pov = [ ]; 156 | transformer = transformer'; 157 | inherit node; 158 | }; 159 | }; 160 | }); 161 | } 162 | -------------------------------------------------------------------------------- /lib/haumea/src/loadEvalTests.nix: -------------------------------------------------------------------------------- 1 | { lib, root }: 2 | 3 | args: 4 | 5 | let 6 | inherit (builtins) 7 | attrNames 8 | ; 9 | inherit (lib) 10 | generators 11 | runTests 12 | ; 13 | 14 | tests = root.load args; 15 | 16 | results = runTests ( 17 | tests 18 | // { 19 | tests = attrNames tests; 20 | } 21 | ); 22 | in 23 | 24 | assert tests ? tests -> "'tests' cannot be used as the name of a test"; 25 | 26 | assert results != [ ] -> throw (generators.toPretty { } results); 27 | 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/__defaultWith.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (builtins) 5 | mapAttrs 6 | ; 7 | inherit (lib) 8 | functionArgs 9 | pipe 10 | toFunction 11 | ; 12 | in 13 | 14 | importer: 15 | 16 | inputs: path: 17 | 18 | let 19 | f = toFunction (importer path); 20 | in 21 | 22 | pipe f [ 23 | functionArgs 24 | (mapAttrs (name: _: inputs.${name})) 25 | f 26 | ] 27 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/callPackage.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (lib) 5 | callPackageWith 6 | ; 7 | in 8 | 9 | inputs: path: callPackageWith inputs path { } 10 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/default.nix: -------------------------------------------------------------------------------- 1 | { super }: 2 | 3 | super.defaultWith import 4 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/path.nix: -------------------------------------------------------------------------------- 1 | _: 2 | 3 | _: path: 4 | path 5 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/scoped.nix: -------------------------------------------------------------------------------- 1 | { super }: 2 | 3 | inputs: 4 | 5 | super.defaultWith (scopedImport inputs) inputs 6 | -------------------------------------------------------------------------------- /lib/haumea/src/loaders/verbatim.nix: -------------------------------------------------------------------------------- 1 | _: 2 | 3 | _: 4 | import 5 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/always.nix: -------------------------------------------------------------------------------- 1 | _: 2 | 3 | f: { 4 | matches = _: true; 5 | loader = f; 6 | } 7 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/extension.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (builtins) 5 | stringLength 6 | ; 7 | inherit (lib) 8 | hasSuffix 9 | ; 10 | in 11 | 12 | ext: f: { 13 | matches = file: hasSuffix ".${ext}" file && stringLength file > (stringLength ext + 1); 14 | loader = f; 15 | } 16 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/json.nix: -------------------------------------------------------------------------------- 1 | { lib, super }: 2 | 3 | super.extension "json" (_: lib.importJSON) 4 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/nix.nix: -------------------------------------------------------------------------------- 1 | { super }: 2 | 3 | super.extension "nix" 4 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/regex.nix: -------------------------------------------------------------------------------- 1 | _: 2 | 3 | let 4 | inherit (builtins) match; 5 | in 6 | 7 | re: f: 8 | 9 | { 10 | matches = file: match re file != null; 11 | loader = inputs: path: f (match re (baseNameOf path)) inputs path; 12 | } 13 | -------------------------------------------------------------------------------- /lib/haumea/src/matchers/toml.nix: -------------------------------------------------------------------------------- 1 | { lib, super }: 2 | 3 | super.extension "toml" (_: lib.importTOML) 4 | -------------------------------------------------------------------------------- /lib/haumea/src/transformers/__utils/concatMapAttrsWith.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | # map each attribute in the given set into 4 | # a list of attributes and subsequently merge them into 5 | # a new attribute set with the specified mergeFun. 6 | 7 | # Type: ({ ... } -> { ... } -> { ... }) -> (String -> a -> { ... }) -> { ... } -> { ... } 8 | 9 | # Example: 10 | # concatMapAttrsWith (mergeAttrsButConcatOn "mykey") 11 | # (name: value: { 12 | # ${name} = value; 13 | # ${key} = value ++ value; 14 | # }) 15 | # { x = "a"; y = "b"; } 16 | # => { x = "a"; y = "b"; mykey = [ "aa" "bb"]; } 17 | 18 | let 19 | inherit (builtins) 20 | attrValues 21 | foldl' 22 | mapAttrs 23 | ; 24 | inherit (lib) 25 | flip 26 | pipe 27 | ; 28 | in 29 | 30 | merge: f: 31 | flip pipe [ 32 | (mapAttrs f) 33 | attrValues 34 | (foldl' merge { }) 35 | ] 36 | -------------------------------------------------------------------------------- /lib/haumea/src/transformers/hoistAttrs.nix: -------------------------------------------------------------------------------- 1 | { lib, super }: 2 | 3 | from: to: 4 | 5 | # Example from / to 6 | # - Lifting `options` from: _api, to: options 7 | # 8 | # Note: 9 | # underscore used as mere convention to signalling to the user the "private" 10 | # nature, they won't be part of the final view presented to the user 11 | 12 | let 13 | inherit (lib) 14 | recursiveUpdate 15 | ; 16 | inherit (super.utils) 17 | concatMapAttrsWith 18 | ; 19 | in 20 | 21 | cursor: 22 | 23 | let 24 | toplevel = cursor == [ ]; 25 | in 26 | concatMapAttrsWith recursiveUpdate ( 27 | file: value: 28 | if !value ? ${from} then 29 | { ${file} = value; } 30 | else 31 | { 32 | ${file} = removeAttrs value [ from ]; 33 | # top level ${from} declarations are omitted from merging 34 | ${if toplevel then to else from} = { 35 | ${file} = value.${from}; 36 | }; 37 | } 38 | ) 39 | -------------------------------------------------------------------------------- /lib/haumea/src/transformers/hoistLists.nix: -------------------------------------------------------------------------------- 1 | { lib, super }: 2 | 3 | from: to: 4 | 5 | # Example from / to 6 | # - Lifting `imports` from: _imports, to: imports 7 | # 8 | # Note: 9 | # underscore used as mere convention to signalling to the user the "private" 10 | # nature, they won't be part of the final view presented to the user 11 | 12 | let 13 | inherit (builtins) 14 | removeAttrs 15 | ; 16 | inherit (lib) 17 | catAttrs 18 | concatLists 19 | ; 20 | inherit (super.utils) 21 | concatMapAttrsWith 22 | ; 23 | 24 | # merge attributes shallowly, but concat values of a specific key into a list in that key 25 | # Type: ((key : String) -> { ... } -> { ... }) -> { ${key} : [ a ], ... } 26 | mergeAttrsButConcatOn = 27 | key: x: y: 28 | x 29 | // y 30 | // { 31 | ${key} = concatLists ( 32 | catAttrs key [ 33 | x 34 | y 35 | ] 36 | ); 37 | }; 38 | in 39 | 40 | cursor: 41 | 42 | let 43 | toplevel = cursor == [ ]; 44 | in 45 | concatMapAttrsWith (mergeAttrsButConcatOn (if toplevel then to else from)) ( 46 | file: value: 47 | if !value ? ${from} then 48 | { ${file} = value; } 49 | else 50 | { 51 | ${file} = removeAttrs value [ from ]; 52 | # top level ${from} declarations are omitted from merging 53 | ${if toplevel then to else from} = value.${from}; 54 | } 55 | ) 56 | -------------------------------------------------------------------------------- /lib/haumea/src/transformers/liftDefault.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (lib.attrsets) 5 | unionOfDisjoint 6 | ; 7 | in 8 | 9 | _: mod: 10 | 11 | unionOfDisjoint (removeAttrs mod [ "default" ]) (mod.default or { }) 12 | -------------------------------------------------------------------------------- /lib/haumea/src/transformers/prependUnderscore.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (builtins) 5 | substring 6 | elem 7 | ; 8 | inherit (lib) 9 | mapAttrs' 10 | stringToCharacters 11 | nameValuePair 12 | ; 13 | 14 | start = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"; 15 | in 16 | 17 | _: mapAttrs' (name: nameValuePair (if elem (substring 0 1 name) start then name else "_${name}")) 18 | -------------------------------------------------------------------------------- /lib/modules/config/abszero.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption; 5 | in 6 | 7 | { 8 | options.abszero.enableExternalModulesByDefault = 9 | mkEnableOption "external modules exposed through `self.homeModules` and `self.nixosModules` by default when they are imported" 10 | // { 11 | default = true; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /lib/modules/themes/catppuccin/catppuccin.nix: -------------------------------------------------------------------------------- 1 | # Options on top of catppuccin/nix 2 | # Accent and default flavor options are added by catppuccin/nix 3 | { config, lib, ... }: 4 | 5 | let 6 | inherit (lib) 7 | types 8 | mkOption 9 | mkDefault 10 | mkIf 11 | toUpper 12 | ; 13 | inherit (builtins) substring; 14 | inherit (lib.abszero.modules) mkExternalEnableOption; 15 | cfg = config.abszero.themes.catppuccin; 16 | in 17 | 18 | { 19 | imports = [ ../../config/abszero.nix ]; 20 | 21 | options.abszero.themes.catppuccin = { 22 | enable = mkExternalEnableOption config "configuration for catppuccin/nix"; 23 | 24 | polarity = mkOption { 25 | type = types.enum [ 26 | "light" 27 | "dark" 28 | ]; 29 | default = "light"; 30 | description = '' 31 | Whether to use light or dark theme for modules that don't support 32 | automatic theme switching, or when useSystemPolarity is turned off. 33 | ''; 34 | }; 35 | 36 | useSystemPolarity = mkOption { 37 | type = types.bool; 38 | default = true; 39 | description = '' 40 | Whether to automatically switch between light and dark themes based 41 | on the system theme polarity. 42 | ''; 43 | }; 44 | 45 | lightFlavor = mkOption { 46 | type = types.enum [ 47 | "frappe" 48 | "latte" 49 | "macchiato" 50 | "mocha" 51 | ]; 52 | default = "latte"; 53 | description = '' 54 | The light theme flavor (latte, frappe, macchiato, mocha). 55 | ''; 56 | }; 57 | 58 | darkFlavor = mkOption { 59 | type = types.enum [ 60 | "frappe" 61 | "latte" 62 | "macchiato" 63 | "mocha" 64 | ]; 65 | default = "macchiato"; 66 | description = '' 67 | The dark theme flavor (latte, frappe, macchiato, mocha). 68 | ''; 69 | }; 70 | }; 71 | 72 | config = mkIf cfg.enable { 73 | catppuccin = { 74 | # Enable all modules by default 75 | enable = mkDefault true; 76 | flavor = cfg."${cfg.polarity}Flavor"; 77 | }; 78 | 79 | lib.catppuccin = { 80 | toTitleCase = s: toUpper (substring 0 1 s) + substring 1 100 s; 81 | palette = builtins.fromJSON (builtins.readFile ./palette.json); 82 | }; 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /lib/src/attrsets.nix: -------------------------------------------------------------------------------- 1 | { super, lib }: 2 | 3 | let 4 | inherit (lib) 5 | collect 6 | filterAttrs 7 | zipAttrsWith 8 | last 9 | ; 10 | inherit (builtins) 11 | isAttrs 12 | isList 13 | attrNames 14 | attrValues 15 | all 16 | head 17 | concatLists 18 | ; 19 | inherit (super.trivial) notf; 20 | in 21 | 22 | rec { 23 | /** 24 | Recursively collects all values. 25 | */ 26 | attrValuesRecursive = collect (notf isAttrs); 27 | 28 | /** 29 | Recursively merge attribute sets and lists. 30 | This assumes that overriden options are of the same type. 31 | */ 32 | recursiveMerge = zipAttrsWith ( 33 | _: vs: 34 | if all isAttrs vs then 35 | recursiveMerge vs 36 | else if all isList vs then 37 | concatLists vs 38 | else 39 | last vs 40 | ); 41 | 42 | /** 43 | Find the first attribute verified by the predicate and return the name. 44 | */ 45 | findName = pred: attrs: head (attrNames (filterAttrs pred attrs)); 46 | /** 47 | Find the first attribute verified by the predicate and return the value. 48 | */ 49 | findValue = pred: attrs: head (attrValues (filterAttrs pred attrs)); 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/modules.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | { 3 | mkExternalEnableOption = 4 | cfg: s: lib.mkEnableOption s // { default = cfg.abszero.enableExternalModulesByDefault; }; 5 | } 6 | -------------------------------------------------------------------------------- /lib/src/partials.nix: -------------------------------------------------------------------------------- 1 | { super }: 2 | 3 | let 4 | inherit (super.attrsets) recursiveMerge; 5 | in 6 | 7 | { 8 | partialFunc = 9 | f: args1: args2: 10 | f (recursiveMerge [ 11 | args1 12 | args2 13 | ]); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/strings.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | { 3 | # Hacky but works 4 | isEncrypted = str: !lib.hasInfix " " str; 5 | } 6 | -------------------------------------------------------------------------------- /lib/src/trivial.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | 3 | let 4 | inherit (builtins) isString; 5 | in 6 | 7 | { 8 | /** 9 | Double const 10 | */ 11 | const2 = 12 | a: b: c: 13 | a; 14 | 15 | /** 16 | Inverse of a boolean function 17 | */ 18 | notf = f: n: !f n; 19 | 20 | /** 21 | The builtin function is deprecated, but it can still be useful in certain 22 | situations. 23 | */ 24 | isNull = a: a == null; 25 | 26 | /** 27 | String join op 28 | */ 29 | join = a: b: lib.throwIfNot (isString a && isString b) "Argument(s) not string: ${a} ${b}" a + b; 30 | } 31 | -------------------------------------------------------------------------------- /nixos/configurations/_options.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | lib, 5 | withSystem, 6 | ... 7 | }: 8 | 9 | let 10 | inherit (inputs) nixpkgs; 11 | inherit (lib) 12 | types 13 | mkOption 14 | mapAttrs 15 | flatten 16 | ; 17 | inherit (lib.abszero.filesystem) toModuleList; 18 | cfg = config.nixosConfigurations; 19 | 20 | configModule = 21 | { name, ... }: 22 | { 23 | options = { 24 | system = mkOption { 25 | type = types.nonEmptyStr; 26 | description = "System architecture"; 27 | }; 28 | hostName = mkOption { 29 | type = types.nonEmptyStr; 30 | default = name; 31 | description = '' 32 | Name of the computer. Defaults to the name of the NixOS configuration. 33 | ''; 34 | }; 35 | modules = mkOption { 36 | type = with types; listOf deferredModule; 37 | default = [ ]; 38 | description = "List of modules specific to this NixOS configuration"; 39 | }; 40 | }; 41 | }; 42 | in 43 | 44 | { 45 | options.nixosConfigurations = mkOption { 46 | type = with types; attrsOf (submodule configModule); 47 | description = "Abstracted home configuration options"; 48 | }; 49 | 50 | config.flake.nixosConfigurations = mapAttrs ( 51 | _: c: 52 | withSystem c.system ( 53 | { system, inputs', ... }: 54 | nixpkgs.lib.nixosSystem { 55 | inherit system lib; 56 | specialArgs = { 57 | inherit inputs; 58 | }; 59 | modules = flatten [ 60 | inputs.disko.nixosModules.disko 61 | inputs.lanzaboote.nixosModules.lanzaboote 62 | inputs.niri.nixosModules.niri 63 | inputs.catppuccin.nixosModules.catppuccin 64 | (toModuleList ../../lib/modules) 65 | (toModuleList ../modules) 66 | c.modules 67 | { 68 | abszero.enableExternalModulesByDefault = false; 69 | nixpkgs.overlays = [ 70 | (_: prev: import ../../pkgs { pkgs = prev; }) 71 | inputs.niri.overlays.niri 72 | (_: _: { zen-browser = inputs'.zen-browser.packages.beta; }) 73 | ]; 74 | networking = { 75 | inherit (c) hostName; 76 | }; 77 | } 78 | ]; 79 | } 80 | ) 81 | ) cfg; 82 | } 83 | -------------------------------------------------------------------------------- /nixos/configurations/fracture-ray/default.nix: -------------------------------------------------------------------------------- 1 | # Xray server deployed to Vultr 2 | # Install: 3 | # 1. Upload NixOS ISO 4 | # 2. Boot from ISO 5 | # 3. Set root password 6 | # 4. `nixos-anywhere --flake #fracture-ray root@` 7 | # Deploy: `deploy -s path:.#fracture-ray` 8 | { 9 | self, 10 | inputs, 11 | lib, 12 | ... 13 | }: 14 | 15 | let 16 | inherit (builtins) 17 | fromJSON 18 | readDir 19 | readFile 20 | warn 21 | ; 22 | inherit (lib) recursiveUpdate; 23 | 24 | proxySettings = 25 | if (readDir ./. ? "proxy.json") then 26 | fromJSON (readFile ./proxy.json) 27 | else 28 | warn "proxy.json is hidden, configuration is incomplete" { }; 29 | 30 | mainModule = { 31 | abszero = { 32 | profiles.server.enable = true; 33 | users.admins = [ "weathercold" ]; 34 | hardware.vultr-cc-intel-regular.enable = true; 35 | services.xray = recursiveUpdate proxySettings { 36 | enable = true; 37 | preset = "vless-tcp-xtls-reality-server"; 38 | }; 39 | }; 40 | 41 | disko.devices.disk.vda = { 42 | type = "disk"; 43 | device = "/dev/vda"; 44 | content = { 45 | type = "gpt"; 46 | partitions = { 47 | bios = { 48 | label = "bios"; 49 | size = "1M"; 50 | type = "EF02"; # BIOS boot partition for GRUB 51 | }; 52 | nixos = { 53 | label = "nixos"; 54 | size = "100%"; 55 | content = { 56 | type = "btrfs"; 57 | extraArgs = [ "-f" ]; # Override existing partition 58 | subvolumes = { 59 | root = { 60 | mountpoint = "/"; 61 | mountOptions = [ 62 | "compress-force=zstd" 63 | "noatime" 64 | ]; 65 | }; 66 | swap = { 67 | mountpoint = "/swap"; 68 | mountOptions = [ 69 | "noatime" 70 | "nodev" 71 | "noexec" 72 | "nosuid" 73 | ]; 74 | }; 75 | }; 76 | }; 77 | }; 78 | }; 79 | }; 80 | }; 81 | swapDevices = [ 82 | { 83 | device = "/swap/swapfile"; 84 | size = 4096; 85 | discardPolicy = "pages"; 86 | } 87 | ]; 88 | 89 | users.users = rec { 90 | weathercold = { 91 | description = "Weathercold"; 92 | isNormalUser = true; 93 | hashedPassword = "$6$QOTimFq0v8u6oN.I$.m0BQc/tC6/8nluwwQT7AmkbJbfNoh2PnO9biVL4wgWA22zlb/0HheieexWgISAB67r/7floX3bQpZrUjZv9v."; 94 | openssh.authorizedKeys.keys = [ 95 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDNpRiJBIfsEXVgHQ7NuJ7uk9TEEq97EG6bISYZp+Zt+ Weathercold" 96 | ]; 97 | }; 98 | root = { 99 | inherit (weathercold) hashedPassword openssh; 100 | }; 101 | }; 102 | }; 103 | in 104 | 105 | { 106 | imports = [ ../_options.nix ]; 107 | 108 | nixosConfigurations.fracture-ray = { 109 | system = "x86_64-linux"; 110 | modules = [ 111 | inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only 112 | mainModule 113 | ]; 114 | }; 115 | 116 | flake.deploy.nodes.fracture-ray = { 117 | hostname = proxySettings.address; 118 | sshOpts = [ 119 | "-p" 120 | "1337" 121 | ]; 122 | profiles.system = { 123 | user = "root"; 124 | path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.fracture-ray; 125 | }; 126 | }; 127 | } 128 | -------------------------------------------------------------------------------- /nixos/configurations/fracture-ray/proxy.json.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/nixos/configurations/fracture-ray/proxy.json.secret -------------------------------------------------------------------------------- /nixos/flake-module.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | let 4 | inherit (lib.abszero.filesystem) toModuleAttr toModuleAttr' toModuleList; 5 | in 6 | 7 | { 8 | imports = toModuleList ./configurations; 9 | 10 | flake.nixosModules = 11 | toModuleAttr ../lib/modules/themes 12 | // toModuleAttr' ./modules/profiles 13 | // toModuleAttr' ./modules/hardware 14 | // toModuleAttr ./modules/themes 15 | // { 16 | xray = ./modules/services/networking/xray/default.nix; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /nixos/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Weathercold's NixOS modules"; 3 | 4 | inputs = { 5 | # Repos 6 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 7 | niri = { 8 | url = "github:sodiboo/niri-flake"; 9 | inputs = { 10 | nixpkgs.follows = "nixpkgs"; 11 | nixpkgs-stable.follows = "nixpkgs"; 12 | }; 13 | }; 14 | zen-browser = { 15 | url = "github:0xc000022070/zen-browser-flake"; 16 | inputs.nixpkgs.follows = "nixpkgs"; 17 | }; 18 | 19 | # Utils 20 | flake-parts = { 21 | url = "github:hercules-ci/flake-parts"; 22 | inputs.nixpkgs-lib.follows = "nixpkgs"; 23 | }; 24 | deploy-rs = { 25 | url = "github:serokell/deploy-rs"; 26 | inputs.nixpkgs.follows = "nixpkgs"; 27 | }; 28 | disko = { 29 | url = "github:nix-community/disko"; 30 | inputs.nixpkgs.follows = "nixpkgs"; 31 | }; 32 | nixos-hardware.url = "github:NixOS/nixos-hardware"; 33 | lanzaboote = { 34 | # Fork that adds an UKI mode 35 | url = "github:linyinfeng/lanzaboote/uki"; 36 | inputs = { 37 | nixpkgs.follows = "nixpkgs"; 38 | flake-parts.follows = "flake-parts"; 39 | }; 40 | }; 41 | catppuccin.url = "github:catppuccin/nix"; 42 | }; 43 | 44 | outputs = 45 | { 46 | nixpkgs, 47 | flake-parts, 48 | ... 49 | }@inputs: 50 | let 51 | extendedLib = nixpkgs.lib.extend ( 52 | _: _: { 53 | abszero = import ../lib { 54 | inherit (nixpkgs) lib; 55 | }; 56 | } 57 | ); 58 | in 59 | flake-parts.lib.mkFlake 60 | { 61 | inherit inputs; 62 | specialArgs.lib = extendedLib; 63 | } 64 | { 65 | imports = [ ./flake-module.nix ]; 66 | 67 | systems = [ "x86_64-linux" ]; 68 | }; 69 | } 70 | -------------------------------------------------------------------------------- /nixos/modules/config/users.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) 5 | types 6 | mkOption 7 | const 8 | genAttrs 9 | ; 10 | cfg = config.abszero.users; 11 | in 12 | 13 | { 14 | options.abszero.users.admins = mkOption { 15 | type = with types; listOf nonEmptyStr; 16 | description = "List of admin users"; 17 | }; 18 | 19 | config.users.users = genAttrs cfg.admins (const { 20 | extraGroups = [ "wheel" ]; 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /nixos/modules/config/zram.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.zramSwap; 6 | in 7 | 8 | { 9 | options.abszero.zramSwap.enable = mkEnableOption "compressed ram swap device"; 10 | 11 | config = mkIf cfg.enable { 12 | zramSwap = { 13 | enable = true; 14 | memoryPercent = 200; 15 | }; 16 | # https://wiki.archlinux.org/title/Zram#Optimizing_swap_on_zram 17 | boot.kernel.sysctl = { 18 | "vm.swappiness" = 180; 19 | "vm.watermark_boost_factor" = 0; 20 | "vm.watermark_scale_factor" = 125; 21 | "vm.page-cluster" = 0; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /nixos/modules/hardware/keyboard/halo65.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.hardware.keyboard.halo65; 7 | 8 | keyboardCfg = { 9 | extraDefCfg = '' 10 | danger-enable-cmd yes 11 | process-unmapped-keys yes 12 | log-layer-changes no 13 | ''; 14 | config = '' 15 | (defsrc 16 | esc 1 2 3 4 5 6 7 8 9 0 - = bspc del 17 | tab q w e r t y u i o p [ ] \ pgup 18 | caps a s d f g h j k l ; ' ret pgdn 19 | lsft z x c v b n m , . / rsft up end 20 | lctl lmet lalt spc ralt left down rght) 21 | 22 | (deflayer canary 23 | @>q _ _ _ _ _ _ _ _ _ _ _ + _ _ 24 | _ w l y p k z x o u ; _ _ _ _ 25 | @esc c r s t b f n e i a _ _ _ 26 | @ls j v d g q m h / , . @rs _ _ 27 | _ _ _ _ _ _ _ _) 28 | 29 | (deflayer qwerty 30 | @>c _ _ _ _ _ _ _ _ _ _ _ + _ _ 31 | _ q w e r t y u i o p _ _ _ _ 32 | @esc a s d f g h j k l ; _ _ _ 33 | @ls z x c v b n m , . / @rs _ _ 34 | _ _ _ _ _ _ _ _) 35 | 36 | (deflayer shift 37 | _ _ _ _ _ _ _ _ _ _ _ _ @= _ _ 38 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 39 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ 40 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ 41 | _ _ _ _ _ _ _ _) 42 | 43 | (deflayer lower 44 | _ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 _ ins 45 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 46 | _ _ _ _ _ _ _ left down up rght _ _ _ 47 | _ _ _ _ _ _ _ _ _ _ _ _ _ home 48 | _ _ _ _ _ _ _ _) 49 | 50 | (defalias 51 | >q (tap-dance 150 (` (layer-switch qwerty))) 52 | >c (tap-dance 150 (` (layer-switch canary))) 53 | esc (tap-hold-press 150 150 esc (layer-while-held lower)) 54 | ls (multi lsft (layer-while-held shift)) 55 | rs (multi rsft (layer-while-held shift)) 56 | = (unshift =)) 57 | ''; 58 | }; 59 | in 60 | 61 | { 62 | imports = [ 63 | ../../../../lib/modules/config/abszero.nix 64 | ../../services/hardware/kanata.nix 65 | ]; 66 | 67 | options.abszero.hardware.keyboard.halo65.enable = 68 | mkExternalEnableOption config "halo65 configuration"; 69 | 70 | config = mkIf cfg.enable { 71 | abszero.services.kanata.enable = true; 72 | 73 | services = { 74 | # Add permanent static name when connected via Bluetooth 75 | udev.extraRules = '' 76 | KERNEL=="event[0-9]*", SUBSYSTEM=="input", \ 77 | ATTRS{phys}=="b4:0e:de:c7:65:27", ACTION=="add", \ 78 | SYMLINK+="input/bt-halo65" 79 | ''; 80 | 81 | # It is not possible to put all three devices in one config because the 82 | # service is only activated when all devices are found 83 | kanata.keyboards = { 84 | halo65-wired = keyboardCfg // { 85 | devices = [ "/dev/input/by-id/usb-BY_Tech_NuPhy_Halo65-event-kbd" ]; 86 | }; 87 | halo65-wifi = keyboardCfg // { 88 | devices = [ "/dev/input/by-id/usb-CX_2.4G_Wireless_Receiver-event-kbd" ]; 89 | }; 90 | halo65-bt = keyboardCfg // { 91 | devices = [ "/dev/input/bt-halo65" ]; 92 | }; 93 | }; 94 | }; 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /nixos/modules/hardware/vultr-cc-intel-regular.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.hardware.vultr-cc-intel-regular; 7 | in 8 | 9 | { 10 | imports = [ ../../../lib/modules/config/abszero.nix ]; 11 | 12 | options.abszero.hardware.vultr-cc-intel-regular.enable = mkExternalEnableOption config '' 13 | Vultr Cloud Compute - Intel - Regular Performance configuration complementary 14 | to `inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only`. Due to 15 | the nixos-hardware module being effective on import, it is not imported by 16 | this module; you have to import it yourself 17 | ''; 18 | 19 | config = mkIf cfg.enable { 20 | hardware.enableRedistributableFirmware = lib.mkDefault true; 21 | 22 | boot.initrd.availableKernelModules = [ 23 | "ata_piix" 24 | "uhci_hcd" 25 | "virtio_pci" 26 | "sr_mod" 27 | "virtio_blk" 28 | ]; 29 | 30 | virtualisation.hypervGuest.enable = true; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /nixos/modules/i18n/input-method/fcitx5.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | mkIf 11 | mkEnableOption 12 | reverseList 13 | concatStringsSep 14 | ; 15 | cfg = config.abszero.i18n.inputMethod.fcitx5; 16 | in 17 | 18 | { 19 | options.abszero.i18n.inputMethod.fcitx5.enable = 20 | mkEnableOption "next-generation input method framework"; 21 | 22 | config = mkIf cfg.enable { 23 | i18n.inputMethod = { 24 | enable = true; 25 | type = "fcitx5"; 26 | fcitx5 = { 27 | waylandFrontend = true; # Do not set `GTK_IM_MODULE` and `QT_IM_MODULE` 28 | plasma6Support = true; # Use Qt6 versions of fcitx5 packages 29 | addons = with pkgs; [ 30 | fcitx5-gtk 31 | fcitx5-mozc-ut # Mozc with UT dictionaries 32 | fcitx5-pinyin-moegirl 33 | fcitx5-pinyin-zhwiki 34 | kdePackages.fcitx5-chinese-addons 35 | kdePackages.fcitx5-qt 36 | ]; 37 | }; 38 | }; 39 | 40 | # `XMODIFIERS` is automatically set 41 | environment.sessionVariables = { 42 | # https://github.com/NixOS/nixpkgs/issues/129442#issuecomment-875972207 43 | NIX_PROFILES = "${concatStringsSep " " (reverseList config.environment.profiles)}"; 44 | QT_IM_MODULES = "wayland;fcitx"; # For Qt6.7+ 45 | SDL_IM_MODULE = "fcitx"; 46 | }; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /nixos/modules/profiles/base.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | mkDefault 11 | mkIf 12 | const 13 | genAttrs 14 | ; 15 | inherit (lib.abszero.modules) mkExternalEnableOption; 16 | cfg = config.abszero.profiles.base; 17 | in 18 | 19 | { 20 | imports = [ ../../../lib/modules/config/abszero.nix ]; 21 | 22 | options.abszero.profiles.base.enable = mkExternalEnableOption config "base profile"; 23 | 24 | config = mkIf cfg.enable { 25 | abszero.boot.quiet = true; 26 | 27 | nix = { 28 | package = pkgs.nixVersions.latest; 29 | 30 | channel.enable = false; 31 | 32 | settings = { 33 | trusted-users = [ 34 | "root" 35 | "@wheel" 36 | ]; 37 | # substituters = [ 38 | # # CN mirrors of https://cache.nixos.org 39 | # "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" 40 | # "https://mirrors.ustc.edu.cn/nix-channels/store" 41 | # ]; 42 | extra-substituters = [ 43 | "https://abszero.cachix.org" 44 | "https://nix-community.cachix.org" 45 | ]; 46 | trusted-public-keys = [ 47 | "abszero.cachix.org-1:HXOydaS51jSWrM07Ko8AVtGdoBRT9F+QhdYQBiNDaM0=" 48 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 49 | ]; 50 | auto-optimise-store = true; 51 | }; 52 | 53 | extraOptions = '' 54 | experimental-features = nix-command flakes auto-allocate-uids no-url-literals 55 | keep-outputs = true 56 | keep-derivations = true 57 | connect-timeout = 10 58 | ''; 59 | }; 60 | 61 | nixpkgs.config.allowUnfree = true; 62 | 63 | system.stateVersion = "25.11"; 64 | 65 | boot = { 66 | loader = { 67 | timeout = 0; 68 | # Whether the installation process can modify EFI boot variables. 69 | efi.canTouchEfiVariables = true; 70 | # Disable kernel command line editor for security 71 | systemd-boot.editor = false; 72 | }; 73 | 74 | kernelPackages = pkgs.linuxKernel.packages.linux_zen; 75 | kernel.sysctl."vm.swappiness" = mkDefault 20; 76 | 77 | tmp.useTmpfs = true; 78 | }; 79 | 80 | users = { 81 | mutableUsers = false; 82 | users = genAttrs config.abszero.users.admins (const { 83 | extraGroups = [ 84 | "audio" # For pipeire 85 | "video" # For brillo 86 | "networkmanager" 87 | ]; 88 | }); 89 | defaultUserShell = pkgs.zsh; 90 | }; 91 | 92 | i18n = { 93 | defaultLocale = "en_US.UTF-8"; 94 | supportedLocales = [ 95 | "C.UTF-8/UTF-8" 96 | # "en_CA.UTF-8/UTF-8" 97 | "en_US.UTF-8/UTF-8" 98 | # "fr_CA.UTF-8/UTF-8" 99 | # "zh_CN.UTF-8/UTF-8" 100 | "ja_JP.UTF-8/UTF-8" 101 | ]; 102 | extraLocaleSettings = { 103 | # LC_TIME = "en_US.UTF-8"; 104 | LC_NUMERIC = "C.UTF-8"; 105 | }; 106 | }; 107 | 108 | console = { 109 | font = "ter-u22b"; 110 | packages = with pkgs; [ terminus_font ]; 111 | }; 112 | 113 | # Certain services freeze on stop which prevents shutdown. 114 | systemd.extraConfig = '' 115 | DefaultTimeoutStopSec=10s 116 | ''; 117 | 118 | security = { 119 | rtkit.enable = true; 120 | sudo-rs = { 121 | enable = true; 122 | wheelNeedsPassword = mkDefault false; 123 | execWheelOnly = true; 124 | }; 125 | }; 126 | 127 | services = { 128 | dbus.implementation = "broker"; 129 | journald.console = "/dev/tty1"; 130 | }; 131 | 132 | programs.zsh.enable = true; 133 | 134 | # Allow unfree packages 135 | environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = "1"; 136 | }; 137 | } 138 | -------------------------------------------------------------------------------- /nixos/modules/profiles/desktop.nix: -------------------------------------------------------------------------------- 1 | # Desktop essentials 2 | { 3 | config, 4 | pkgs, 5 | lib, 6 | ... 7 | }: 8 | 9 | let 10 | inherit (lib) mkIf; 11 | inherit (lib.abszero.modules) mkExternalEnableOption; 12 | cfg = config.abszero.profiles.desktop; 13 | in 14 | 15 | { 16 | imports = [ ./base.nix ]; 17 | 18 | options.abszero.profiles.desktop.enable = mkExternalEnableOption config "desktop profile"; 19 | 20 | config = mkIf cfg.enable { 21 | abszero = { 22 | profiles.base.enable = true; 23 | boot.lanzaboote.enable = true; 24 | }; 25 | 26 | console.useXkbConfig = true; # use xkbOptions in tty. 27 | 28 | fonts.fontconfig = { 29 | hinting.style = "medium"; 30 | subpixel.rgba = "rgb"; 31 | }; 32 | 33 | networking = { 34 | nameservers = [ 35 | "1.1.1.1" # Cloudflare 36 | "1.0.0.1" # Cloudflare 37 | "9.9.9.9" # Quad9 38 | "149.112.112.112" # Quad9 39 | ]; 40 | search = [ "~." ]; # Always use global name servers (shouldn't affect VPNs) 41 | dhcpcd.enable = false; 42 | # networkmanager = { 43 | # enable = true; 44 | # wifi = { 45 | # backend = "iwd"; 46 | # macAddress = "random"; 47 | # }; 48 | # }; 49 | wireless.iwd = { 50 | enable = true; 51 | settings = { 52 | General = { 53 | EnableNetworkConfiguration = true; 54 | AddressRandomization = "network"; 55 | DisableANQP = false; # Use Hotspot 2.0 56 | }; 57 | Network.NameResolvingService = "systemd"; # Use resolved 58 | Settings.AlwaysRandomizeAddress = true; 59 | }; 60 | }; 61 | }; 62 | 63 | services = { 64 | automatic-timezoned.enable = true; 65 | libinput = { 66 | enable = true; 67 | touchpad = { 68 | clickMethod = "clickfinger"; 69 | naturalScrolling = true; 70 | disableWhileTyping = true; 71 | }; 72 | }; 73 | pipewire = { 74 | enable = true; 75 | alsa = { 76 | enable = true; 77 | support32Bit = true; 78 | }; 79 | pulse.enable = true; 80 | }; 81 | resolved = { 82 | enable = true; 83 | fallbackDns = [ ]; # disable fallback DNS 84 | dnsovertls = "true"; 85 | dnssec = "true"; 86 | llmnr = "false"; 87 | }; 88 | system76-scheduler.enable = true; 89 | upower = { 90 | enable = true; 91 | percentageLow = 30; 92 | percentageCritical = 10; 93 | # Disable polling for hardware that pushes events 94 | noPollBatteries = true; 95 | }; 96 | }; 97 | 98 | xdg = { 99 | portal = { 100 | enable = true; 101 | extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; 102 | }; 103 | terminal-exec = { 104 | enable = true; 105 | settings.default = [ "foot.desktop" ]; 106 | }; 107 | }; 108 | 109 | programs.xwayland.enable = true; 110 | 111 | environment.sessionVariables = { 112 | # Enable running commands without installation 113 | # Currently not needed because nix-index is enabled in home-manager 114 | # NIX_AUTO_RUN = "1"; 115 | # Make Electron apps run in Wayland native mode 116 | NIXOS_OZONE_WL = "1"; 117 | }; 118 | }; 119 | } 120 | -------------------------------------------------------------------------------- /nixos/modules/profiles/full.nix: -------------------------------------------------------------------------------- 1 | # Full desktop 2 | { 3 | config, 4 | pkgs, 5 | lib, 6 | ... 7 | }: 8 | 9 | let 10 | inherit (lib) mkIf; 11 | inherit (lib.abszero.modules) mkExternalEnableOption; 12 | cfg = config.abszero.profiles.full; 13 | in 14 | 15 | { 16 | imports = [ ./desktop.nix ]; 17 | 18 | options.abszero.profiles.full.enable = mkExternalEnableOption config "full profile"; 19 | 20 | config = mkIf cfg.enable { 21 | abszero = { 22 | profiles.desktop.enable = true; 23 | hardware.keyboard.halo65.enable = true; 24 | boot.plymouth.enable = true; 25 | virtualisation = { 26 | act.enable = true; 27 | libvirtd.enable = true; 28 | }; 29 | i18n.inputMethod.fcitx5.enable = true; 30 | services = { 31 | kanata.enable = true; 32 | printing.enable = true; 33 | rclone = { 34 | enable = true; 35 | enableFileSystems = true; 36 | }; 37 | }; 38 | programs = { 39 | pot.enable = true; 40 | steam.enable = true; 41 | wireshark.enable = true; 42 | }; 43 | }; 44 | 45 | nixpkgs.config.permittedInsecurePackages = [ 46 | "ventoy-qt5-1.1.05" 47 | ]; 48 | 49 | virtualisation.waydroid.enable = true; 50 | 51 | services = { 52 | flatpak.enable = true; 53 | gnome.gnome-keyring.enable = true; # For storing vscode auth token 54 | protonmail-bridge.enable = true; 55 | }; 56 | 57 | xdg.portal.config.common."org.freedesktop.impl.portal.FileChooser" = [ "gnome" ]; 58 | 59 | programs = { 60 | dconf.enable = true; 61 | kdeconnect.enable = true; 62 | nix-ld.enable = true; 63 | }; 64 | 65 | environment = { 66 | defaultPackages = [ ]; 67 | systemPackages = with pkgs; [ 68 | anki-wayland 69 | aseprite 70 | collector 71 | ffmpeg-full 72 | gh 73 | git-absorb 74 | git-secret 75 | gnome-solanum 76 | goldendict-ng 77 | hyperfine 78 | inkscape 79 | inotify-tools 80 | jetbrains.idea-community 81 | jq 82 | kooha 83 | libreoffice-qt 84 | lutris 85 | nudoku 86 | obsidian-ime 87 | osu-lazer-bin 88 | proton-pass 89 | protonvpn-gui 90 | taisei 91 | tenacity 92 | unzip 93 | ventoy-full-qt 94 | vesktop 95 | vscode 96 | wev 97 | wget 98 | win2xcur 99 | xorg.xeyes 100 | zen-browser 101 | zip 102 | zotero 103 | ]; 104 | }; 105 | }; 106 | } 107 | -------------------------------------------------------------------------------- /nixos/modules/profiles/server.nix: -------------------------------------------------------------------------------- 1 | # Headless server 2 | { config, lib, ... }: 3 | 4 | let 5 | inherit (lib) mkIf; 6 | inherit (lib.abszero.modules) mkExternalEnableOption; 7 | cfg = config.abszero.profiles.server; 8 | in 9 | 10 | { 11 | imports = [ ./base.nix ]; 12 | 13 | options.abszero.profiles.server.enable = mkExternalEnableOption config "server profile"; 14 | 15 | config = mkIf cfg.enable { 16 | abszero.profiles.base.enable = true; 17 | 18 | # UTC is the default but we explicitly set it to disallow imperative changing. 19 | time.timeZone = "UTC"; 20 | 21 | fonts.fontconfig.enable = false; 22 | 23 | security.sudo.wheelNeedsPassword = true; 24 | 25 | services.openssh = { 26 | enable = true; 27 | startWhenNeeded = true; 28 | # Obfuscate the port. However, for a proxy server, according to 29 | # https://geneva.cs.umd.edu/posts/fully-encrypted-traffic/en/, this won't 30 | # make it less detectable by the GFW. 31 | ports = [ 1337 ]; 32 | }; 33 | 34 | environment.noXlibs = true; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /nixos/modules/programs/neovim.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.programs.neovim; 11 | in 12 | 13 | { 14 | options.abszero.programs.neovim.enable = mkEnableOption "Neovim"; 15 | 16 | config = mkIf cfg.enable { 17 | programs.neovim = { 18 | enable = true; 19 | withNodeJs = true; 20 | viAlias = true; 21 | vimAlias = true; 22 | defaultEditor = true; 23 | }; 24 | environment.systemPackages = with pkgs; [ 25 | neovide 26 | clang # C compiler 27 | wl-clipboard # Clipboard support 28 | tree-sitter # For nvim-treesitter 29 | ripgrep # For Telescope 30 | nodePackages.prettier # For null-ls 31 | ]; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /nixos/modules/programs/pot.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.programs.pot; 11 | in 12 | 13 | { 14 | options.abszero.programs.pot.enable = mkEnableOption "cross-platform translation software"; 15 | 16 | config.environment.systemPackages = 17 | with pkgs; 18 | mkIf cfg.enable [ 19 | pot 20 | # tesseract 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /nixos/modules/programs/steam.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.programs.steam; 11 | in 12 | 13 | { 14 | options.abszero.programs.steam.enable = mkEnableOption "Steam client"; 15 | 16 | config.programs = mkIf cfg.enable { 17 | steam = { 18 | enable = true; 19 | package = pkgs.steam.override { 20 | # extraArgs = "-forcedesktopscaling=2"; 21 | # https://github.com/YaLTeR/niri/wiki/Application-Issues#steam 22 | extraArgs = "-system-composer"; 23 | }; 24 | extest.enable = true; # Support Steam Input 25 | remotePlay.openFirewall = true; 26 | gamescopeSession.enable = true; 27 | }; 28 | 29 | # Let gamescope renice itself 30 | gamescope.capSysNice = true; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /nixos/modules/programs/wayland/hyprland.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf mkDefault; 5 | cfg = config.abszero.programs.hyprland; 6 | in 7 | 8 | { 9 | options.abszero.programs.hyprland.enable = mkEnableOption "Wayland compositor"; 10 | 11 | # Most of the config is in home-manager 12 | config.programs = mkIf cfg.enable { 13 | hyprland = { 14 | enable = true; 15 | withUWSM = true; 16 | }; 17 | hyprlock.enable = mkDefault true; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /nixos/modules/programs/wayland/niri.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.programs.niri; 11 | in 12 | 13 | { 14 | options.abszero.programs.niri.enable = mkEnableOption "scrolling wayland compositor"; 15 | 16 | # Most of the config is in home-manager 17 | config.programs.niri = mkIf cfg.enable { 18 | enable = true; 19 | package = pkgs.niri-unstable; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /nixos/modules/programs/wireshark.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | mkEnableOption 11 | mkIf 12 | const 13 | genAttrs 14 | ; 15 | cfg = config.abszero.programs.wireshark; 16 | in 17 | 18 | { 19 | options.abszero.programs.wireshark.enable = mkEnableOption "network protocol analyzer"; 20 | 21 | config = mkIf cfg.enable { 22 | programs.wireshark = { 23 | enable = true; 24 | package = pkgs.wireshark; 25 | }; 26 | users.users = genAttrs config.abszero.users.admins (const { 27 | extraGroups = [ "wireshark" ]; 28 | }); 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /nixos/modules/services/desktop-managers/plasma6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) 10 | mkEnableOption 11 | mkIf 12 | mkDefault 13 | mkMerge 14 | ; 15 | cfg = config.abszero.services.desktopManager.plasma6; 16 | in 17 | 18 | { 19 | options.abszero.services.desktopManager.plasma6.enable = 20 | mkEnableOption "the next generation desktop for Linux"; 21 | 22 | config = mkIf cfg.enable { 23 | services.desktopManager.plasma6.enable = true; 24 | 25 | # Package is set by nixos module 26 | programs.ssh.enableAskPassword = mkDefault true; 27 | 28 | environment.systemPackages = 29 | with pkgs; 30 | mkMerge [ 31 | # SDDM integration 32 | (mkIf config.abszero.services.displayManager.sddm.enable [ kdePackages.sddm-kcm ]) 33 | [ 34 | clinfo # For Plasma Info Center 35 | glxinfo # For Plasma Info Center 36 | pciutils # For Plasma Info Center 37 | vulkan-tools # For Plasma Info Center 38 | wayland-utils # For Plasma Info Center 39 | ] 40 | ]; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /nixos/modules/services/display-managers/sddm.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf mkDefault; 10 | cfg = config.abszero.services.displayManager.sddm; 11 | in 12 | 13 | { 14 | options.abszero.services.displayManager.sddm.enable = mkEnableOption "sddm as the display manager"; 15 | 16 | config.services.displayManager.sddm = mkIf cfg.enable { 17 | enable = true; 18 | # Use Qt6 SDDM 19 | package = mkDefault pkgs.kdePackages.sddm; 20 | wayland.enable = true; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /nixos/modules/services/display-managers/tuigreet.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf getExe; 10 | cfg = config.abszero.services.displayManager.tuigreet; 11 | in 12 | 13 | { 14 | options.abszero.services.displayManager.tuigreet.enable = mkEnableOption "tui greetd frontend"; 15 | 16 | config.services.greetd = mkIf cfg.enable { 17 | enable = true; 18 | vt = 2; 19 | settings.default_session.command = '' 20 | ${getExe pkgs.greetd.tuigreet} \ 21 | -rt --asterisks \ 22 | --window-padding 1 \ 23 | --power-shutdown 'systemctl poweroff' \ 24 | --power-reboot 'systemctl reboot' 25 | ''; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /nixos/modules/services/hardware/kanata.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkDefault mkIf; 10 | cfg = config.abszero.services.kanata; 11 | in 12 | 13 | { 14 | options.abszero.services.kanata.enable = mkEnableOption "advanced software keyboard remapper"; 15 | 16 | # Keyboard config is in ../hardware 17 | config.services.kanata = mkIf cfg.enable { 18 | enable = true; 19 | package = mkDefault pkgs.kanata-with-cmd; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /nixos/modules/services/networking/v2raya.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (pkgs) v2ray-rules-dat; 10 | inherit (lib) mkEnableOption mkIf; 11 | cfg = config.abszero.services.v2raya; 12 | in 13 | 14 | { 15 | options.abszero.services.v2raya.enable = mkEnableOption "cross-platform v2ray client"; 16 | 17 | config = mkIf cfg.enable { 18 | # TODO: Add package option to upstream 19 | nixpkgs.overlays = [ 20 | (_: prev: { 21 | v2raya = prev.v2raya.override { 22 | v2ray-geoip = v2ray-rules-dat.geoip; 23 | v2ray-domain-list-community = v2ray-rules-dat.geosite; 24 | }; 25 | }) 26 | ]; 27 | networking.firewall.allowedTCPPorts = [ 28 | 10808 29 | 10809 30 | 10810 31 | ]; 32 | services.v2raya.enable = true; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /nixos/modules/services/networking/wpa_supplicant.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf singleton; 10 | cfg = config.abszero.networking.supplicant; 11 | in 12 | 13 | { 14 | # School wifi is insecure :( 15 | options.abszero.networking.supplicant.enableInsecureSSLCiphers = 16 | mkEnableOption "insecure SSL ciphers"; 17 | 18 | config = mkIf cfg.enableInsecureSSLCiphers { 19 | # Let wpa_supplicant use a version of openssl that supports weak SSL ciphers 20 | nixpkgs.overlays = singleton ( 21 | _: prev: 22 | let 23 | openssl = prev.openssl.overrideAttrs (prev: { 24 | configureFlags = prev.configureFlags ++ singleton "enable-weak-ssl-ciphers"; 25 | }); 26 | in 27 | { 28 | wpa_supplicant = prev.wpa_supplicant.override { inherit openssl; }; 29 | } 30 | ); 31 | 32 | environment.etc."wpa_supplicant.conf".text = '' 33 | openssl_ciphers=DEFAULT@SECLEVEL=0 34 | ''; 35 | 36 | systemd.services."wpa_supplicant".serviceConfig.ExecStart = [ 37 | "" # Clear the overridden ExecStart as it is additive 38 | "${pkgs.wpa_supplicant}/sbin/wpa_supplicant -u -i wlp1s0 -c /etc/wpa_supplicant.conf" 39 | ]; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /nixos/modules/services/networking/xray/blackhole-adblock.nix: -------------------------------------------------------------------------------- 1 | # Just an adblocker 2 | { config, lib, ... }: 3 | 4 | let 5 | inherit (lib) mkIf; 6 | cfg = config.abszero.services.xray; 7 | 8 | xraySettings = { 9 | routing.rules = [ 10 | { 11 | domain = [ "geosite:category-ads-all" ]; 12 | outboundTag = "block"; 13 | } 14 | { 15 | port = 53; 16 | outboundTag = "dns-out"; 17 | } 18 | ]; 19 | 20 | dns.servers = [ 21 | "fakedns" 22 | "https://1.1.1.1/dns-query" 23 | "https://8.8.8.8/dns-query" 24 | ]; 25 | 26 | inbounds = [ 27 | { 28 | protocol = "dokodemo-door"; 29 | listen = "127.0.0.1"; 30 | port = 1; 31 | sniffing = { 32 | enabled = true; 33 | destOverride = [ "fakedns" ]; 34 | }; 35 | settings = { 36 | network = "tcp,udp"; 37 | followRedirect = true; 38 | }; 39 | streamSettings.sockopt.tproxy = "tproxy"; 40 | } 41 | { 42 | protocol = "socks"; 43 | listen = "127.0.0.1"; 44 | port = 10808; 45 | sniffing = { 46 | enabled = true; 47 | destOverride = [ "fakedns" ]; 48 | }; 49 | settings.udp = true; 50 | } 51 | { 52 | protocol = "http"; 53 | listen = "127.0.0.1"; 54 | port = 10809; 55 | sniffing = { 56 | enabled = true; 57 | destOverride = [ "fakedns" ]; 58 | }; 59 | } 60 | ]; 61 | 62 | outbounds = [ 63 | { 64 | tag = "direct"; 65 | protocol = "freedom"; 66 | settings.domainStrategy = "UseIP"; 67 | } 68 | { 69 | tag = "block"; 70 | protocol = "blackhole"; 71 | } 72 | { 73 | tag = "dns-out"; 74 | protocol = "dns"; 75 | } 76 | ]; 77 | }; 78 | 79 | nftablesRuleset = '' 80 | table inet xray { 81 | chain prerouting { 82 | type filter hook prerouting priority filter; policy accept; 83 | meta skgid 255 return 84 | ip daddr { 127.0.0.0/8, 224.0.0.0/4, 255.255.255.255 } return 85 | meta l4proto tcp ip daddr 192.168.0.0/16 return 86 | ip daddr 192.168.0.0/16 udp dport != 53 return 87 | ip6 daddr { ::1, fe80::/10 } return 88 | meta l4proto tcp ip6 daddr fd00::/8 return 89 | ip6 daddr fd00::/8 udp dport != 53 return 90 | meta l4proto { tcp, udp } meta mark set 1 tproxy to :1 accept 91 | } 92 | 93 | chain output { 94 | type route hook output priority filter; policy accept; 95 | meta skgid 255 return 96 | ip daddr { 127.0.0.0/8, 224.0.0.0/4, 255.255.255.255 } return 97 | meta l4proto tcp ip daddr 192.168.0.0/16 return 98 | ip daddr 192.168.0.0/16 udp dport != 53 return 99 | ip6 daddr { ::1, fe80::/10 } return 100 | meta l4proto tcp ip6 daddr fd00::/8 return 101 | ip6 daddr fd00::/8 udp dport != 53 return 102 | meta l4proto { tcp, udp } meta mark set 1 accept 103 | } 104 | 105 | chain divert { 106 | type filter hook prerouting priority mangle; policy accept; 107 | meta l4proto tcp socket transparent 1 meta mark set 1 accept 108 | } 109 | } 110 | ''; 111 | in 112 | 113 | mkIf (cfg.enable && cfg.preset == "blackhole-adblock") { 114 | users = { 115 | groups.xray.gid = 255; 116 | users.xray = { 117 | isSystemUser = true; 118 | uid = 255; 119 | group = "xray"; 120 | }; 121 | }; 122 | 123 | networking = { 124 | firewall = { 125 | allowedTCPPorts = [ 126 | 10808 127 | 10809 128 | ]; 129 | allowedUDPPorts = [ 130 | 10808 131 | 10809 132 | ]; 133 | }; 134 | 135 | localCommands = '' 136 | ip rule add fwmark 1 table 100 137 | ip route add local 0.0.0.0/0 dev lo table 100 138 | 139 | ip -6 rule add fwmark 1 table 100 140 | ip -6 route add local ::/0 dev lo table 100 141 | ''; 142 | 143 | nftables = { 144 | enable = true; 145 | ruleset = nftablesRuleset; 146 | }; 147 | }; 148 | 149 | services.xray.settings = xraySettings; 150 | } 151 | -------------------------------------------------------------------------------- /nixos/modules/services/networking/xray/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) types mkOption mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.services.xray; 12 | 13 | presets = [ 14 | "vless-tcp-xtls-reality-server" 15 | "vless-tcp-xtls-reality-client" 16 | "blackhole-adblock" 17 | ]; 18 | in 19 | 20 | { 21 | imports = map (s: ./${s}.nix) presets ++ [ ../../../../../lib/modules/config/abszero.nix ]; 22 | 23 | options.abszero.services.xray = { 24 | enable = mkExternalEnableOption config "anti-censorship platform"; 25 | preset = mkOption { 26 | type = types.enum presets; 27 | description = "The config preset to use"; 28 | }; 29 | address = mkOption { 30 | type = types.nonEmptyStr; 31 | default = "0.0.0.0"; 32 | description = "Server address (client only)"; 33 | }; 34 | clientIds = mkOption { 35 | type = with types; listOf nonEmptyStr; 36 | description = "List of client IDs (server only)"; 37 | }; 38 | clientId = mkOption { 39 | type = types.nonEmptyStr; 40 | default = builtins.head config.abszero.users.admins; 41 | description = "Client ID (client only)"; 42 | }; 43 | reality = { 44 | privateKey = mkOption { 45 | type = types.nonEmptyStr; 46 | description = "Generate with `xray x25519` (server only)"; 47 | }; 48 | publicKey = mkOption { 49 | type = types.nonEmptyStr; 50 | description = "Generate with `xray x25519` (client only)"; 51 | }; 52 | shortIds = mkOption { 53 | type = with types; listOf str; 54 | default = [ "" ]; 55 | description = '' 56 | List of shortIds that can be used by clients. By default, shortId can 57 | be empty. Generate with `openssl rand -hex 8`. (server only) 58 | ''; 59 | }; 60 | shortId = mkOption { 61 | type = types.str; 62 | default = ""; 63 | description = "Generate with `openssl rand -hex 8` (client only)"; 64 | }; 65 | }; 66 | }; 67 | 68 | config.services.xray = mkIf cfg.enable { 69 | enable = true; 70 | package = 71 | with pkgs; 72 | xray.override { 73 | assets = [ 74 | v2ray-rules-dat.geoip 75 | v2ray-rules-dat.geosite 76 | ]; 77 | }; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /nixos/modules/services/networking/xray/vless-tcp-xtls-reality-server.nix: -------------------------------------------------------------------------------- 1 | # State-of-the-art Xray server configuration using VLESS-TCP-XTLS-REALITY 2 | # https://github.com/chika0801/Xray-examples/blob/main/VLESS-XTLS-uTLS-REALITY/config_server.json 3 | { config, lib, ... }: 4 | 5 | let 6 | inherit (lib) mkIf mkDefault; 7 | cfg = config.abszero.services.xray; 8 | 9 | xraySettings = { 10 | log = { 11 | loglevel = "info"; 12 | dnsLog = true; 13 | }; 14 | 15 | # Never EVER proxy Chinese websites as GFW is known to recognise and record 16 | # the proxy server's IP. Traffic to Chinese websites should be direct on the 17 | # client side but also blocked on the server side just to be sure. 18 | # https://github.com/XTLS/Xray-core/discussions/593#discussioncomment-845165 19 | routing = { 20 | domainStrategy = "IPIfNonMatch"; 21 | rules = [ 22 | # Since sniffing is disabled, requests to IP addresses are not matched 23 | # using domain rules. We have to rely on the clients to send requests 24 | # to domains. 25 | { 26 | domain = [ "geosite:bilibili" ]; 27 | outboundTag = "block"; 28 | } 29 | { 30 | ip = [ 31 | "geoip:cn" 32 | "geoip:private" 33 | ]; 34 | outboundTag = "block"; 35 | } 36 | ]; 37 | }; 38 | 39 | inbounds = [ 40 | { 41 | port = 443; 42 | protocol = "vless"; 43 | settings = { 44 | clients = map (id: { 45 | inherit id; 46 | flow = "xtls-rprx-vision"; 47 | }) cfg.clientIds; 48 | decryption = "none"; 49 | }; 50 | streamSettings = { 51 | network = "tcp"; 52 | security = "reality"; 53 | realitySettings = { 54 | # Requirements: foreign website, TLSv1.3, X25519 & H2 support, not 55 | # used for forwarding 56 | # https://bluearchive.jp doesn't support TLSv1.3 :( 57 | dest = "pjsekai.sega.jp:443"; 58 | # Server name on the certificate of dest 59 | serverNames = [ "pjsekai.sega.jp" ]; 60 | inherit (cfg.reality) privateKey shortIds; 61 | }; 62 | }; 63 | } 64 | ]; 65 | 66 | outbounds = [ 67 | { 68 | tag = "direct"; 69 | protocol = "freedom"; 70 | } 71 | { 72 | tag = "block"; 73 | protocol = "blackhole"; 74 | } 75 | ]; 76 | 77 | # Reduce fingerprint by changing default timeout 78 | # https://github.com/XTLS/Xray-core/issues/1511#issuecomment-1376887076 79 | policy.levels."0" = { 80 | handshake = 2; 81 | connIdle = 120; 82 | }; 83 | }; 84 | in 85 | 86 | mkIf (cfg.enable && cfg.preset == "vless-tcp-xtls-reality-server") { 87 | # Taken from https://github.com/bannedbook/fanqiang/blob/master/v2ss/server-cfg/sysctl-bbr-cake.conf 88 | # It seems that bbr+cake is currently faster than bbrplus and bbrv2 (how 89 | # weird). Need to periodically check for new updates. 90 | boot.kernel.sysctl = { 91 | "fs.file-max" = 1000000; 92 | "net.core.default_qdisc" = mkDefault "cake"; 93 | "net.ipv4.tcp_congestion_control" = mkDefault "bbr"; 94 | }; 95 | 96 | # Fix too many open files 97 | systemd.services.xray.serviceConfig = { 98 | LimitNPROC = 500; 99 | LimitNOFILE = 1000000; 100 | }; 101 | 102 | networking.firewall = { 103 | allowedTCPPorts = [ 443 ]; 104 | allowedUDPPorts = [ 443 ]; 105 | }; 106 | 107 | services.xray.settings = xraySettings; 108 | } 109 | -------------------------------------------------------------------------------- /nixos/modules/services/printing/cupsd.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkEnableOption mkIf; 5 | cfg = config.abszero.services.printing; 6 | in 7 | 8 | { 9 | options.abszero.services.printing.enable = mkEnableOption "printer support with CUPS"; 10 | 11 | config.services = mkIf cfg.enable { 12 | printing.enable = true; 13 | avahi.enable = true; # This also enables cups-browsed 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /nixos/modules/services/rclone/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (builtins) readDir warn; 10 | inherit (lib) mkEnableOption mkPackageOption mkIf; 11 | cfg = config.abszero.services.rclone; 12 | in 13 | 14 | { 15 | imports = [ 16 | ( 17 | if (readDir ./. ? "file-systems.nix") then 18 | ./file-systems.nix 19 | else 20 | warn "file-systems.nix is hidden, configuration is incomplete" { } 21 | ) 22 | ]; 23 | 24 | options.abszero.services.rclone = { 25 | enable = mkEnableOption "network storage client and server daemon"; 26 | package = mkPackageOption pkgs "rclone" { }; 27 | }; 28 | 29 | config = mkIf cfg.enable { 30 | environment.systemPackages = [ cfg.package ]; 31 | 32 | # Make mount use rclone as a mount helper 33 | systemd.tmpfiles.rules = [ "L /sbin/mount.rclone - - - - /run/current-system/sw/bin/rclone" ]; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /nixos/modules/services/rclone/file-systems.nix.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/nixos/modules/services/rclone/file-systems.nix.secret -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (builtins) readDir; 10 | inherit (lib) mkEnableOption mkIf singleton; 11 | cfg = config.abszero.boot.lanzaboote; 12 | in 13 | 14 | { 15 | options.abszero.boot.lanzaboote.enable = mkEnableOption "lanzaboote"; 16 | 17 | config = mkIf cfg.enable { 18 | assertions = singleton { 19 | assertion = 20 | readDir ./pki/keys/db ? "db.key" 21 | && readDir ./pki/keys/KEK ? "KEK.key" 22 | && readDir ./pki/keys/PK ? "PK.key"; 23 | message = "Secure boot keys are hidden, configuration cannot be activated"; 24 | }; 25 | boot.lanzaboote = { 26 | enable = true; 27 | mode = "uki"; 28 | configurationLimit = 5; 29 | pkiBundle = ./pki; 30 | }; 31 | environment.systemPackages = with pkgs; [ sbctl ]; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/GUID: -------------------------------------------------------------------------------- 1 | c850f7c6-cf5f-43d0-af77-7054b64ac38b -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/KEK/KEK.key.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/nixos/modules/system/boot/lanzaboote/pki/keys/KEK/KEK.key.secret -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/KEK/KEK.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIE9TCCAt2gAwIBAgIRAN4pemYFm/We7ACrXUolEUYwDQYJKoZIhvcNAQELBQAw 3 | NjEZMBcGA1UEBhMQS2V5IEV4Y2hhbmdlIEtleTEZMBcGA1UEAxMQS2V5IEV4Y2hh 4 | bmdlIEtleTAeFw0yNDA4MTExOTQyMjFaFw0yOTA4MTExOTQyMjFaMDYxGTAXBgNV 5 | BAYTEEtleSBFeGNoYW5nZSBLZXkxGTAXBgNVBAMTEEtleSBFeGNoYW5nZSBLZXkw 6 | ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDA9fBzZ7dHtUPQ46nS5VZB 7 | nbzZLZMwQXjWN+BEd9+B9wGCuFuKEsdVs5+zRoJ5eKcX7BpnouWvl2vn4yF1T1H0 8 | RYMhYwkXkyfgi1GFtnP64kyOWnKjDckgAoOUaNI+15q3npAmz/I3onPAsoAoaxrV 9 | 8wlbSXhUxyoHHpfR9Bj7ntTLGinwSqPBvtxneFvBo5ALEd0j8/85WtHKu5zYuF2V 10 | wFFm14e6o/HcHUf3MXFWoMQgsAX6kv2Ks4YOTVNSokoWCprkEN17ixRLMHq8vQyo 11 | 5Wy6fDYQvCbF1KVKM9k5iBVxDsDzkxxyKBHO+JQqtn1737sn2YLodiyjNzl122gM 12 | qT5Jqdr7SHlI/I19JM25nu9zhxgu06fXKwzf6REWkzRA7oCvHfdvfTqURbYTfE04 13 | t8RkOdaeRPEyAbYDlgtZ2dKYlMGakUDtXdkXywwejhC05tZ5K8S0bHqn1D3eRbZp 14 | zfW4uz1hiREVGjyy/coTFqQCQFv0on4KFLrtHkTU6WpmrIsJcN8XiHs0su0ujQPy 15 | ItB6nNTR/MIaUoERO/pJcS4sayq+JfGLFKbVjtLc/XitRAnsj63NAoj0oJ+KyCbw 16 | ojuR6Us+JN5rflcXp/EisFLW/jYQ93GX+uE5uhct+Dw9281RrvPWilN0OhJeHxoh 17 | xhitTIxK76QERhaikXtdWQIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQBhDzSS8d+R 18 | 4rzIBstXKQhrRDVLmXIiowRvOW2RiWfYd/Q34b8mUFpliMj6k6EVwaPhQYVgpt73 19 | 2IdoFrgOGUJS8d0Ajo+0gcghuBIvjRT4haW7FQ66v+fSPGzPtyRWJ55L0pPOcm1v 20 | lW/m8HECdoeqvE2cxH2AXOvUxOfuhkVp/SU1sMfbfjcOdgoeAeiSZOQ3V5YC7xiP 21 | hYY48jA9l39lazLNlbZHQUvSE8hiExaac48LnPA6yjwp0AdCz7tj4cfGyHwfnnMy 22 | DIj47DKWZ43qDjnJ5FWzBiR32sbEdse31yCjftycCrZ6JNGl5gkAPEiFGYyRL2af 23 | 8CaiZ1XaxWi0l9POj+MymnKx384ogG4waYADxZ9bzhjg4SdnO68aSoLrcIifhKCD 24 | qV9OYwZe0J2nnYZSHarXWC3KmnR4FV01MTWwlwys6w+fLQe5cCukk8DBFsFb+xiY 25 | Kuz8qaal3/sYFGiSZwgvjMB6JWpcOr1jKMMkEy/QPDHS+A+jMMbltQB3fNGY0KLp 26 | U1pbMM6k/7FipFlYwL6Y0Aye4VLSrvDag0wSKJfvuYbsxQiJZNjLxSR461TawOfi 27 | kxJHx3/n1hNAKuMaNY60wcgmZ6S3XJeDBDoCT39ClzlQ2VHIi6oNlh2ppLCJdoDi 28 | Zcnv5WQQIhI6Hc7J8cBYFoqdxswGcAPtUw== 29 | -----END CERTIFICATE----- 30 | -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/PK/PK.key.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/nixos/modules/system/boot/lanzaboote/pki/keys/PK/PK.key.secret -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/PK/PK.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIE5TCCAs2gAwIBAgIRAIdhMyPApP7Tz6jSjpaAdRMwDQYJKoZIhvcNAQELBQAw 3 | LjEVMBMGA1UEBhMMUGxhdGZvcm0gS2V5MRUwEwYDVQQDEwxQbGF0Zm9ybSBLZXkw 4 | HhcNMjQwODExMTk0MjE4WhcNMjkwODExMTk0MjE4WjAuMRUwEwYDVQQGEwxQbGF0 5 | Zm9ybSBLZXkxFTATBgNVBAMTDFBsYXRmb3JtIEtleTCCAiIwDQYJKoZIhvcNAQEB 6 | BQADggIPADCCAgoCggIBAMKdjAF/GocEs+iip+wyQYBgNaTdgd/aNjXA8J0yP9n+ 7 | o0sE3kA4t3MXCUQgf0I12NPwz7mHQIqslxLS9O0xcm0VspZg+QJG8MFg2Qm4skjJ 8 | n/FC8T/nQjbQkT0AHfdx7dOwH9uw9zX1cTE4eNbrprPtgPYDSlBq7OgQxfRJLD2X 9 | vOqMNvTP/sO1yN+fQtUK8dEICHNa7R7JZ2UM7yNuttAtznQ8VA0XTZ2yI6KQpnk4 10 | /ptNwFe9K34XooRqjDvNx2ZculYAY95FqHdBpEzCsVD2lvFBylNsX4W010mP87oS 11 | 2PWHnwmyHt5CdQeW3YL4G5hCAO5ZpX7xDpK4CtrRKSBYvnRN/j3jIyhsPt763D43 12 | wSpaFWHGChJw+7ctwwmMP+CD5IG3ghLx3diyYIDwk5oG4T9Wh8aCViIPBKewaUYL 13 | fltIlMxZ4KXpwxe1hd4mWnydz3KUSyxjsIoKGZiKpUqqEDtTOcUZJ8fmYhJX9dQO 14 | azeYz7zJvghWkzdO3wZHzRgvwLEreGa8UhbCgta4IrnKLWyJ5odkO3Ic8BrLU3jf 15 | XBkZitJ8Dw8RlZDxfVce5YbTUb+hohvwiRk4ZgvLGgXDaAd2XjcfagVuyKoG1dXJ 16 | v/dALtSlFpiFrDsgC8EmnoFPO0cPOcNh9TbTVFcVIwX2appbWvqcbwjS7eTmJnjJ 17 | AgMBAAEwDQYJKoZIhvcNAQELBQADggIBADBbXJysiXOCF6dlkW3MxXA2WXuwnk8v 18 | VJDFieuZCx0qkk2Fa5efAlMfl2bZFg2fE7Lls9xM9vPorrf36ZpWwMIwhAi6bPvY 19 | rpS/PK6mLDDK3Ghq0Vfx7CWDeySb8KHPonnKQrq9tw3OQ1XUjRPPl6ocmQy31XmY 20 | Er4SZWPAMmoS6PFETjVD0ls8aCXPSI8//SVQC/LTSCRfgJuA7E76n9TT2qVl1Y2q 21 | 8a/bP6yaWlLAmuzziz1wvvbVZHWaoi68LHLsuusYCAKKipCeYpMJcmaimYfZPwWi 22 | SF8h5zCqYUT1VEJ4i4Wl6AUHigEgcIvqxqjPMCNXfJKA0GvlhiKSUOFu+Hc7AC2w 23 | xbPQvZxxmlz9yl69LoWVhocC68ttS1ANEnPmINORiMYWbmow11nXlw+asec5xgkz 24 | NP41WEcfmwfVjenUAi3CLZrCuJASsw3yuMdj+hQWkl0DJiGfeSOwKXrz9TSHjoXi 25 | vWPjuuue1yXS0SQzG70BxNxNBGeOJxNGoxXedYjpRtVqAfOOVaNrKy7Zux4hTaC8 26 | 1hVGGERvlowY/4EgRhtRp5I/ZQtZXAsi9y/KpGFJVbW+EPJkfL7fWUaIorzPh1yi 27 | +A9QqGl43+5oSijiqCxfKcLtqXFQ6vJ2XjU377mLVYPl7Z8H8qVC/ya4vxfbjdC8 28 | kjJ5jNTNI3P9 29 | -----END CERTIFICATE----- 30 | -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/db/db.key.secret: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Weathercold/nixfiles/b2b51622e3b00675e34e9b1932846a1d8b811b98/nixos/modules/system/boot/lanzaboote/pki/keys/db/db.key.secret -------------------------------------------------------------------------------- /nixos/modules/system/boot/lanzaboote/pki/keys/db/db.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIE5TCCAs2gAwIBAgIRANC3vYm6w57IVr7wSG8ureswDQYJKoZIhvcNAQELBQAw 3 | LjEVMBMGA1UEBhMMRGF0YWJhc2UgS2V5MRUwEwYDVQQDEwxEYXRhYmFzZSBLZXkw 4 | HhcNMjQwODExMTk0MjIzWhcNMjkwODExMTk0MjIzWjAuMRUwEwYDVQQGEwxEYXRh 5 | YmFzZSBLZXkxFTATBgNVBAMTDERhdGFiYXNlIEtleTCCAiIwDQYJKoZIhvcNAQEB 6 | BQADggIPADCCAgoCggIBAMG7WcJCYVX7kI7S8jtDzqY3p5uMDflY4uttnUIsYEA7 7 | LClLkIDg9ya5U3TH9HDHaTA//kuZgTKtFhJiZYAg+FN8CxeN1hhdQSi3r/JcNYXi 8 | ryGE/SgLgyqdXMdm+UUIkbPnK05NuIOHHA85GBWZFUeHmaknCxBgGePslFBiRoun 9 | 6vTLvrphFv3brw9XE66u7s+5VaXfcCulWzZAE4WNbCVgpNtAs3xWnuxMAI2DDe7u 10 | XLcvgU/N9n2g/IOb+8ZmaLOevMH1gnMqRxFTt29d8NonwBMblLiFXEOjQunGCXk5 11 | 22I5eaLPx1iRjSXCvp74C6wEKnKU/N0dIcON9PXThXz+46X7SjjKqldxOAt1zOHw 12 | Bdgzybzgty5McUA6kikpUrKs0d88lSsZ6pAeAewSYdtOCT/rXQkvQEz6ZhAx8/Bc 13 | xL4DfJ7b0jYp76B5PvcoUJvomJqwOSmSlwKz10+L8LGJ50Q0f+o55JPOoOUBkmUc 14 | F3oG4FfYVciTLbZtibHebravchmMWsXoFr3aSkSlx9UENNtHSVU4EoYtMVclJLbU 15 | S56J7iRVmc70gWOGJ7wuphWAk/dAljQo9dns5TqQgJ8izSrPRwr/oQqELFzmir4b 16 | GCM/hEtn9+Kb24JF9xViIgqsia3k0ERrc1wozrjuFwFqf4M1utUnbOZ3+HmeT0SL 17 | AgMBAAEwDQYJKoZIhvcNAQELBQADggIBAE/bGpdpwHbk9xcWWTzR8lbnIKxexCvl 18 | 54KYbTlEx/8HvKj+esHHm2t74C4PEuuBdL8rC8OenRVsbIjPqWJEgzYhUVhX6zsu 19 | gQjl+c/7IPAQBkMyihX+4FHm/o9MNplzuPdZtrAiDQGnpBOXGkmx9EjOAmdjlvvi 20 | FarGIuOLaqxV67dDl1pm7zHH3rx7mCFi1J9ceNpKnGMv7dmzF19zMIpERKcC8Mqd 21 | 14BQWbBH8HjuwQWsGKE9zN5ooxXNh+lCGYes5KL5V+8GPOY8stk6hlEhxwch0O4d 22 | 1LK5k0hd9xp/yfjxSQ6zsFNUlzPZM1EP8tsTPHNNEuhRK5KNCHV3eR52KG1Mtvgp 23 | uKj77oHzLXx/eLv92FwWYKsHxJs2rv8NuhOkrfB4YwdPz11tRFiTNTL5G1ckZi7/ 24 | fyX7sTkL0hrTXNeDRI54kSBorzcIdp8l4b15hWHNOYbRA3jmNNfsQHPhJN+UFJga 25 | kvKBGoW8Y5Leit57yArYIp0a7ra847yLvX2oyeeHW9XS/tmHYA/vGR8AFJmKKjEV 26 | 8fY0YybXQisNqWC5i6AnEXqVTVTEFdIgwblSUcGO1Vaha+WfxbeyM05uvPuq4SCi 27 | IU6mCIsjVsYWL+7dvhI0ogU9sLvU6LMO4E0/NkPco7GlGEa6AfMwgfsFv2dlMHs3 28 | MOGexvMB4OqY 29 | -----END CERTIFICATE----- 30 | -------------------------------------------------------------------------------- /nixos/modules/system/boot/plymouth.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf mkEnableOption; 5 | cfg = config.abszero.boot.plymouth; 6 | in 7 | 8 | { 9 | options.abszero.boot.plymouth.enable = mkEnableOption "boot splash"; 10 | 11 | config = mkIf cfg.enable { 12 | abszero.boot.quiet = true; 13 | boot = { 14 | plymouth.enable = true; 15 | kernelParams = [ "plymouth.use-simpledrm" ]; # Show splash earlier 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /nixos/modules/system/boot/quiet.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf mkEnableOption; 5 | cfg = config.abszero.boot; 6 | in 7 | 8 | { 9 | options.abszero.boot.quiet = mkEnableOption "quiet boot"; 10 | 11 | config.boot = mkIf cfg.quiet { 12 | consoleLogLevel = 0; 13 | kernelParams = [ 14 | "quiet" 15 | "udev.log_level=3" 16 | ]; 17 | initrd.verbose = false; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /nixos/modules/themes/base/plymouth-rings_2.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.base.plymouth; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.base.plymouth.rings_2 = 18 | mkExternalEnableOption config "rings_2 plymouth theme from plymouth-themes"; 19 | 20 | config.boot.plymouth = mkIf cfg.rings_2 { 21 | enable = true; 22 | themePackages = with pkgs; [ 23 | (adi1090x-plymouth-themes.override { selected_themes = [ "rings_2" ]; }) 24 | ]; 25 | theme = "rings_2"; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /nixos/modules/themes/catppuccin/fonts.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.catppuccin; 12 | in 13 | 14 | { 15 | imports = [ ../../../../lib/modules/config/abszero.nix ]; 16 | 17 | options.abszero.themes.catppuccin.fonts.enable = 18 | mkExternalEnableOption config "fonts to use with catppuccin theme"; 19 | 20 | config.environment.systemPackages = with pkgs; mkIf cfg.fonts.enable [ open-sans ]; 21 | } 22 | -------------------------------------------------------------------------------- /nixos/modules/themes/catppuccin/plymouth.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkIf; 10 | inherit (lib.abszero.modules) mkExternalEnableOption; 11 | cfg = config.abszero.themes.catppuccin; 12 | in 13 | 14 | { 15 | imports = [ 16 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 17 | ]; 18 | 19 | options.abszero.themes.catppuccin.plymouth.enable = 20 | mkExternalEnableOption config "catppuccin plymouth theme. Complementary to catppuccin/nix"; 21 | 22 | config = mkIf cfg.plymouth.enable { 23 | abszero.themes.catppuccin.enable = true; 24 | catppuccin.plymouth.enable = true; 25 | boot.plymouth.logo = pkgs.emptyFile; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /nixos/modules/themes/catppuccin/sddm.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) mkIf; 5 | inherit (lib.abszero.modules) mkExternalEnableOption; 6 | cfg = config.abszero.themes.catppuccin; 7 | in 8 | 9 | { 10 | imports = [ 11 | ../../../../lib/modules/themes/catppuccin/catppuccin.nix 12 | ./fonts.nix 13 | ]; 14 | 15 | options.abszero.themes.catppuccin.sddm.enable = 16 | mkExternalEnableOption config "catppuccin sddm theme. Complementary to catppuccin/nix"; 17 | 18 | config = mkIf cfg.sddm.enable { 19 | abszero.themes.catppuccin = { 20 | enable = true; 21 | fonts.enable = true; 22 | }; 23 | services.displayManager.sddm.catppuccin = { 24 | enable = true; 25 | font = "Open Sans"; 26 | fontSize = "14"; 27 | }; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /nixos/modules/virtualisation/act.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkPackageOption mkIf; 10 | cfg = config.abszero.virtualisation.act; 11 | in 12 | 13 | { 14 | imports = [ ../virtualisation/docker.nix ]; 15 | 16 | options.abszero.virtualisation.act = { 17 | enable = mkEnableOption "local GitHub Actions runner"; 18 | package = mkPackageOption pkgs "act" { }; 19 | }; 20 | 21 | config = mkIf cfg.enable { 22 | environment.systemPackages = [ cfg.package ]; 23 | abszero.virtualisation.docker.enable = true; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /nixos/modules/virtualisation/docker.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | let 4 | inherit (lib) 5 | mkEnableOption 6 | mkIf 7 | mkDefault 8 | genAttrs 9 | const 10 | ; 11 | cfg = config.abszero.virtualisation.docker; 12 | in 13 | 14 | { 15 | options.abszero.virtualisation.docker.enable = mkEnableOption "docker"; 16 | 17 | config = mkIf cfg.enable { 18 | virtualisation.docker = { 19 | enable = true; 20 | enableOnBoot = mkDefault false; 21 | }; 22 | users.users = genAttrs config.abszero.users.admins (const { 23 | extraGroups = [ "docker" ]; 24 | }); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /nixos/modules/virtualisation/libvirtd.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | let 9 | inherit (lib) mkEnableOption mkIf; 10 | cfg = config.abszero.virtualisation.libvirtd; 11 | in 12 | 13 | { 14 | options.abszero.virtualisation.libvirtd.enable = mkEnableOption "libvirtd"; 15 | 16 | config = mkIf cfg.enable { 17 | virtualisation = { 18 | libvirtd.enable = true; 19 | spiceUSBRedirection.enable = true; 20 | }; 21 | programs.virt-manager.enable = true; 22 | environment.systemPackages = with pkgs; [ 23 | virtio-win 24 | virtiofsd 25 | ]; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /nur.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | builtins.removeAttrs (import ./pkgs { inherit pkgs; }) [ 5 | "catppuccin-discord-git" 6 | "vscode-insiders" 7 | "vscode-insiders-with-extensions" 8 | "vscodium-insiders" 9 | ] 10 | // { 11 | lib = import ./lib { inherit (pkgs) lib; }; 12 | overlays = rec { 13 | default = abszero; 14 | abszero = final: _: import ./pkgs { pkgs = final; }; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /pkgs/an/anki-bin-wayland/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | symlinkJoin, 3 | makeWrapper, 4 | anki-bin, 5 | mpv-unwrapped, 6 | }: 7 | symlinkJoin { 8 | name = "anki-bin-wayland"; 9 | paths = [ anki-bin ]; 10 | buildInputs = [ makeWrapper ]; 11 | postBuild = '' 12 | wrapProgram "$out/bin/anki" \ 13 | --set ANKI_WAYLAND 1 \ 14 | --prefix PATH : "${mpv-unwrapped}/bin" # Required for audio 15 | ''; 16 | inherit (anki-bin) meta; 17 | } 18 | -------------------------------------------------------------------------------- /pkgs/an/anki-wayland/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | symlinkJoin, 3 | makeWrapper, 4 | anki, 5 | }: 6 | symlinkJoin { 7 | name = "anki-wayland"; 8 | paths = [ anki ]; 9 | buildInputs = [ makeWrapper ]; 10 | postBuild = '' 11 | wrapProgram "$out/bin/anki" --set ANKI_WAYLAND 1 12 | ''; 13 | inherit (anki) meta; 14 | } 15 | -------------------------------------------------------------------------------- /pkgs/ca/catppuccin-discord-git/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | lib, 4 | fetchFromGitHub, 5 | mkYarnModules, 6 | nodejs, 7 | yarn, 8 | themes0 ? [ ], 9 | }: 10 | 11 | let 12 | inherit (builtins) length; 13 | inherit (lib) head concatStringsSep; 14 | 15 | matchTheme = 16 | if themes0 == [ ] then 17 | "*" 18 | else if length themes0 == 1 then 19 | head themes0 20 | else 21 | "{${concatStringsSep "," themes0}}"; 22 | in 23 | 24 | stdenv.mkDerivation rec { 25 | pname = "catppuccin-discord"; 26 | version = src.rev; 27 | 28 | src = fetchFromGitHub { 29 | owner = "catppuccin"; 30 | repo = "discord"; 31 | rev = "1c0a33e3a5e781f764b2d49829775c2fbf22ce98"; 32 | hash = "sha256-aZYChUi7vnbPp+tmn+Sv9/LCxzqPG4JQ5HjHHxfMfVE="; 33 | }; 34 | 35 | nodeModules = mkYarnModules { 36 | pname = "catppuccin-discord-node-modules"; 37 | version = src.rev; 38 | 39 | packageJSON = src + "/package.json"; 40 | yarnLock = src + "/yarn.lock"; 41 | }; 42 | 43 | nativeBuildInputs = [ 44 | nodejs 45 | yarn 46 | ]; 47 | 48 | buildPhase = '' 49 | runHook preBuild 50 | 51 | export HOME=$(mktemp -d) 52 | ln -s "$nodeModules/node_modules" node_modules 53 | yarn --offline release 54 | 55 | runHook postBuild 56 | ''; 57 | 58 | # Stop yarn from trying to build a binary in distPhase 59 | distPhase = "true"; 60 | 61 | installPhase = '' 62 | runHook preInstall 63 | 64 | mkdir -p $out/share/catppuccin-discord 65 | cp dist/dist/catppuccin-${matchTheme}.theme.css $out/share/catppuccin-discord 66 | 67 | runHook postInstall 68 | ''; 69 | 70 | meta = with lib; { 71 | description = "Soothing pastel theme for Discord"; 72 | homepage = "https://github.com/catppuccin/discord"; 73 | license = licenses.mit; 74 | maintainers = with maintainers; [ weathercold ]; 75 | platforms = platforms.all; 76 | sourceProvenance = with sourceTypes; [ fromSource ]; 77 | }; 78 | } 79 | -------------------------------------------------------------------------------- /pkgs/ca/catppuccin-discord-git/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | gnused 11 | jq 12 | nix-prefetch-github 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /pkgs/ca/catppuccin-discord-git/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | if [ ! -f "$ROOT/package.nix" ]; then 8 | echo "ERROR: cannot find package.nix in $ROOT" 9 | exit 1 10 | fi 11 | 12 | LOCK="$(nix-prefetch-github catppuccin discord)" 13 | REV=$(jq .rev <<< "$LOCK") 14 | HASH=$(jq .hash <<< "$LOCK") 15 | 16 | sed -i "$ROOT/package.nix" \ 17 | -e "s|rev = \".*\"|rev = $REV|" \ 18 | -e "s|hash = \".*\"|hash = $HASH|" \ 19 | -------------------------------------------------------------------------------- /pkgs/ca/catppuccin-wallpapers/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | stdenvNoCC, 4 | fetchFromGitHub, 5 | writeShellScript, 6 | # Install all wallpapers by default 7 | wallpapers ? null, 8 | }: 9 | 10 | let 11 | # I hate bash I hate bash I hate bash 12 | # Have to do this or find can't find \) 13 | installScript = writeShellScript "catppuccin-wallpapers-install" '' 14 | find . -type f \( -name *.png -or -name *.jpg \) -print0 \ 15 | | xargs -r0 -n1 \ 16 | -- bash -c \ 17 | '[[ " $1 " =~ " $(basename "''${2%.*}") " ]] \ 18 | && cp $2 "$out/share/wallpapers/catppuccin" || true' \ 19 | -- "$wallpapers" 20 | ''; 21 | in 22 | 23 | stdenvNoCC.mkDerivation { 24 | pname = "catppuccin-wallpapers"; 25 | version = "unstable-2022-08-23"; 26 | 27 | src = fetchFromGitHub { 28 | owner = "zhichaoh"; 29 | repo = "catppuccin-wallpapers"; 30 | rev = "1023077979591cdeca76aae94e0359da1707a60e"; 31 | hash = "sha256-h+cFlTXvUVJPRMpk32jYVDDhHu1daWSezFcvhJqDpmU="; 32 | }; 33 | 34 | inherit wallpapers; 35 | 36 | dontBuild = true; 37 | 38 | installPhase = '' 39 | runHook preInstall 40 | 41 | mkdir -p "$out/share/wallpapers/catppuccin" 42 | if [ -z "$wallpapers" ]; then 43 | find . -mindepth 1 -maxdepth 1 -type d \ 44 | -exec cp -r {} "$out/share/wallpapers/catppuccin" \; 45 | else 46 | bash ${installScript} 47 | fi 48 | 49 | runHook postInstall 50 | ''; 51 | 52 | dontFixup = true; 53 | 54 | meta = with lib; { 55 | description = "Wallpapers to match your Catppuccin setups (zhichaoh's fork)"; 56 | homepage = "https://github.com/zhichaoh/catppuccin-wallpapers"; 57 | license = licenses.mit; 58 | maintainers = with maintainers; [ weathercold ]; 59 | platforms = platforms.all; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /pkgs/co/colloid-gtk-theme-git/lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "owner": "vinceliuice", 3 | "repo": "Colloid-gtk-theme", 4 | "rev": "1f09381660f00c565c3eca9853839cdab79a7f08", 5 | "hash": "sha256-TyDCEd6iNaiUc+6ToxbTX2vgxBKc17g7fCVnoHIEe5w=" 6 | } 7 | -------------------------------------------------------------------------------- /pkgs/co/colloid-gtk-theme-git/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | colloid-gtk-theme, 4 | fetchFromGitHub, 5 | }: 6 | 7 | let 8 | lock = lib.importJSON ./lock.json; 9 | in 10 | 11 | colloid-gtk-theme.overrideAttrs (prev: { 12 | version = lock.rev; 13 | src = fetchFromGitHub lock; 14 | }) 15 | -------------------------------------------------------------------------------- /pkgs/co/colloid-gtk-theme-git/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | nix-prefetch-github 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /pkgs/co/colloid-gtk-theme-git/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | 8 | nix-prefetch-github vinceliuice Colloid-gtk-theme > "$ROOT/lock.json" 9 | -------------------------------------------------------------------------------- /pkgs/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | extLib = pkgs.lib.extend (_: prev: { abszero = import ../lib { lib = prev; }; }); 5 | extPkgs = pkgs.extend (_: _: { lib = extLib; }); 6 | pkgsByName = extLib.abszero.filesystem.toPackages extPkgs ./.; 7 | in 8 | 9 | pkgsByName 10 | // { 11 | vscode-insiders-with-extensions = extPkgs.vscode-with-extensions.override { 12 | vscode = pkgsByName.vscode-insiders; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /pkgs/flake-module.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | let 4 | inherit (lib) filter; 5 | inherit (builtins) attrValues; 6 | in 7 | 8 | { 9 | perSystem = 10 | { pkgs, ... }: 11 | rec { 12 | checks.buildPackages = pkgs.stdenv.mkDerivation { 13 | name = "all-packages"; 14 | buildInputs = filter (pkg: pkg ? meta.broken -> !pkg.meta.broken) (attrValues packages); 15 | dontUnpack = true; 16 | installPhase = ''mkdir -p $out''; 17 | }; 18 | packages = import ./. { inherit pkgs; }; 19 | }; 20 | flake.overlays = rec { 21 | abszero = final: _: import ./. { pkgs = final; }; 22 | default = abszero; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /pkgs/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-parts": { 4 | "inputs": { 5 | "nixpkgs-lib": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1743550720, 11 | "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", 12 | "owner": "hercules-ci", 13 | "repo": "flake-parts", 14 | "rev": "c621e8422220273271f52058f618c94e405bb0f5", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "hercules-ci", 19 | "repo": "flake-parts", 20 | "type": "github" 21 | } 22 | }, 23 | "nixpkgs": { 24 | "locked": { 25 | "lastModified": 1748026106, 26 | "narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=", 27 | "owner": "NixOS", 28 | "repo": "nixpkgs", 29 | "rev": "063f43f2dbdef86376cc29ad646c45c46e93234c", 30 | "type": "github" 31 | }, 32 | "original": { 33 | "owner": "NixOS", 34 | "ref": "nixos-unstable", 35 | "repo": "nixpkgs", 36 | "type": "github" 37 | } 38 | }, 39 | "root": { 40 | "inputs": { 41 | "flake-parts": "flake-parts", 42 | "nixpkgs": "nixpkgs" 43 | } 44 | } 45 | }, 46 | "root": "root", 47 | "version": 7 48 | } 49 | -------------------------------------------------------------------------------- /pkgs/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Weathercold's nixpkgs overlay"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 | flake-parts = { 7 | url = "github:hercules-ci/flake-parts"; 8 | inputs.nixpkgs-lib.follows = "nixpkgs"; 9 | }; 10 | }; 11 | 12 | outputs = 13 | { flake-parts, ... }@inputs: 14 | flake-parts.lib.mkFlake { inherit inputs; } { 15 | imports = [ ./flake-module.nix ]; 16 | 17 | systems = [ 18 | "x86_64-linux" 19 | "x86_64-darwin" 20 | "aarch64-darwin" 21 | "aarch64-linux" 22 | "armv7l-linux" 23 | ]; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /pkgs/io/iosevka-inconsolata/package.nix: -------------------------------------------------------------------------------- 1 | { iosevka }: 2 | (iosevka.override { 3 | set = "Inconsolata"; 4 | # https://typeof.net/Iosevka/customizer 5 | privateBuildPlan = { 6 | family = "Iosevka Inconsolata"; 7 | spacing = "term"; 8 | serifs = "sans"; 9 | noCvSs = true; 10 | exportGlyphNames = false; 11 | 12 | variants.design = { 13 | two = "straight-neck-serifless"; 14 | four = "closed-serifless"; 15 | five = "oblique-arched-serifless"; 16 | six = "open-contour"; 17 | nine = "closed-contour"; 18 | zero = "oval-tall-slashed"; 19 | capital-g = "toothless-rounded-serifless-hooked"; 20 | capital-j = "serifed-symmetric"; 21 | g = "double-storey"; 22 | asterisk = "penta-low"; 23 | brace = "straight"; 24 | lig-ltgteq = "slanted"; 25 | lig-equal-chain = "without-notch"; 26 | lig-hyphen-chain = "without-notch"; 27 | lig-single-arrow-bar = "without-notch"; 28 | }; 29 | 30 | ligations.inherits = "dlig"; 31 | 32 | weights = { 33 | Regular = { 34 | shape = 400; 35 | menu = 400; 36 | css = 400; 37 | }; 38 | 39 | Bold = { 40 | shape = 700; 41 | menu = 700; 42 | css = 700; 43 | }; 44 | }; 45 | 46 | widths.Normal = { 47 | shape = 600; 48 | menu = 5; 49 | css = "normal"; 50 | }; 51 | }; 52 | }).overrideAttrs 53 | (prev: { 54 | meta = prev.meta // { 55 | description = "Iosevka modified to look like Inconsolata"; 56 | }; 57 | }) 58 | -------------------------------------------------------------------------------- /pkgs/no/noita_save_manager/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | python3, 4 | fetchFromGitHub, 5 | makeDesktopItem, 6 | makeWrapper, 7 | }: 8 | 9 | python3.pkgs.buildPythonApplication rec { 10 | pname = "noita-save-manager"; 11 | version = "0.1.4"; 12 | pyproject = true; 13 | 14 | src = fetchFromGitHub { 15 | owner = "mcgillij"; 16 | repo = "noita_save_manager"; 17 | rev = version; 18 | hash = "sha256-v6zABwYqTCqDRI6uCWyOv8rjBJS2P0BfrOclDkELO/A="; 19 | }; 20 | 21 | desktopItem = makeDesktopItem { 22 | name = pname; 23 | exec = meta.mainProgram; 24 | comment = meta.description; 25 | desktopName = "Noita Save Manager"; 26 | categories = [ 27 | "Game" 28 | "Utility" 29 | ]; 30 | }; 31 | 32 | nativeBuildInputs = [ 33 | python3.pkgs.poetry-core 34 | makeWrapper 35 | ]; 36 | 37 | propagatedBuildInputs = with python3.pkgs; [ 38 | psutil 39 | pysimplegui 40 | ]; 41 | 42 | postInstall = '' 43 | # Replace hardcoded path to Noita savegame directory under Proton 44 | SAVE_MANAGER="$(find "$out" -name save_manager.py)" 45 | substituteInPlace "$SAVE_MANAGER" \ 46 | --replace '"/home/j/gits/save_noita"' \ 47 | 'os.path.expanduser("~") + "/.steam/steam/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita"' 48 | 49 | # Change backup location 50 | wrapProgram "$out/bin/noita_save_manager" \ 51 | --run 'DIR="''${XDG_DATA_HOME:-~/.local/share}" 52 | mkdir -p "$DIR/noita_save_manager" 53 | cd "$DIR/noita_save_manager"' 54 | 55 | mkdir -p "$out/share" 56 | ln -s ${desktopItem}/share/applications $out/share/applications 57 | ''; 58 | 59 | pythonImportsCheck = [ "noita_save_manager" ]; 60 | 61 | meta = with lib; { 62 | description = "Noita Savegame manager"; 63 | homepage = "https://github.com/mcgillij/noita_save_manager"; 64 | license = licenses.mit; 65 | maintainers = with maintainers; [ weathercold ]; 66 | mainProgram = "noita_save_manager"; 67 | platforms = platforms.linux; 68 | broken = true; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /pkgs/nu/nu_scripts-git/lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "owner": "nushell", 3 | "repo": "nu_scripts", 4 | "rev": "3c32fbfade8da4330561c1e05f3c89794a338450", 5 | "hash": "sha256-RYc3+HUKEsB54/l1DEynIcCv5DnOxex7ljYpf8k1AYQ=" 6 | } 7 | -------------------------------------------------------------------------------- /pkgs/nu/nu_scripts-git/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | nu_scripts, 4 | fetchFromGitHub, 5 | }: 6 | 7 | let 8 | lock = lib.importJSON ./lock.json; 9 | in 10 | 11 | nu_scripts.overrideAttrs (prev: { 12 | version = lock.rev; 13 | src = fetchFromGitHub lock; 14 | }) 15 | -------------------------------------------------------------------------------- /pkgs/nu/nu_scripts-git/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | nix-prefetch-github 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /pkgs/nu/nu_scripts-git/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | 8 | nix-prefetch-github nushell nu_scripts > "$ROOT/lock.json" 9 | -------------------------------------------------------------------------------- /pkgs/ob/obsidian-ime/package.nix: -------------------------------------------------------------------------------- 1 | { obsidian }: 2 | obsidian.overrideAttrs ( 3 | _: _: { 4 | postInstall = '' 5 | wrapProgram "$out/bin/obsidian" \ 6 | --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-wayland-ime}}" 7 | ''; 8 | } 9 | ) 10 | -------------------------------------------------------------------------------- /pkgs/pa/palgen/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildGoModule, 4 | fetchFromGitHub, 5 | }: 6 | buildGoModule rec { 7 | pname = "palgen"; 8 | version = "1.5.1"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "xyproto"; 12 | repo = "palgen"; 13 | rev = "v${version}"; 14 | hash = "sha256-jqc4qJKXNyCQDiZnykpMRTN6G6yYnsQdIBaiqStTPu0="; 15 | }; 16 | 17 | vendorHash = null; 18 | 19 | ldflags = [ 20 | "-s" 21 | "-w" 22 | ]; 23 | 24 | meta = with lib; { 25 | description = "Convert png to palettes in various formats"; 26 | homepage = "https://github.com/xyproto/palgen"; 27 | license = licenses.bsd3; 28 | maintainers = with maintainers; [ weathercold ]; 29 | platforms = platforms.all; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /pkgs/v2/v2ray-rules-dat/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenvNoCC, 3 | lib, 4 | fetchurl, 5 | }: 6 | 7 | let 8 | version = "2025-01-26-01-11"; 9 | geoipHash = "1rs4c9ir8yp8yyzmidy7bmzxng2jp1mgvcqywij1wqib5d0cnn1g"; 10 | geositeHash = "0dcmgxnwi4i3w97bm0znfgr6iq8iy789sf9qlsj66w97i7w0rdmr"; 11 | 12 | repo = "https://github.com/techprober/v2ray-rules-dat"; 13 | geoip = fetchurl { 14 | url = "${repo}/releases/download/${version}/geoip.dat"; 15 | sha256 = geoipHash; 16 | }; 17 | geosite = fetchurl { 18 | url = "${repo}/releases/download/${version}/geosite.dat"; 19 | sha256 = geositeHash; 20 | }; 21 | in 22 | 23 | stdenvNoCC.mkDerivation { 24 | pname = "v2ray-rules-dat"; 25 | inherit version; 26 | 27 | srcs = [ 28 | geoip 29 | geosite 30 | ]; 31 | 32 | outputs = [ 33 | "out" 34 | "geoip" 35 | "geosite" 36 | ]; 37 | 38 | unpackPhase = '' 39 | mkdir -p source 40 | cd source 41 | for src in $srcs; do 42 | cp $src $(stripHash $src) 43 | done 44 | ''; 45 | 46 | dontConfigure = true; 47 | 48 | dontBuild = true; 49 | 50 | installPhase = '' 51 | runHook preInstall 52 | 53 | mkdir -p "$out" 54 | install -Dm444 -t "$geoip/share/v2ray" geoip.dat 55 | install -Dm444 -t "$geosite/share/v2ray" geosite.dat 56 | 57 | runHook postInstall 58 | ''; 59 | 60 | dontFixup = true; 61 | 62 | meta = with lib; { 63 | description = "Enhanced edition of V2Ray rules dat files (techprober's fork)"; 64 | homepage = repo; 65 | downloadPage = "${repo}/releases"; 66 | license = licenses.gpl3Only; 67 | maintainers = with maintainers; [ weathercold ]; 68 | outputsToInstall = [ 69 | "geoip" 70 | "geosite" 71 | ]; 72 | platforms = platforms.all; 73 | }; 74 | } 75 | -------------------------------------------------------------------------------- /pkgs/v2/v2ray-rules-dat/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | curl 11 | gnused 12 | jq 13 | nix-prefetch-scripts 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /pkgs/v2/v2ray-rules-dat/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | if [ ! -f "$ROOT/package.nix" ]; then 8 | echo "ERROR: cannot find package.nix in $ROOT" 9 | exit 1 10 | fi 11 | 12 | VER=$(curl -fs https://api.github.com/repos/techprober/v2ray-rules-dat/releases/latest \ 13 | | jq -r .tag_name) 14 | GEOIP_HASH=$(nix-prefetch-url \ 15 | https://github.com/techprober/v2ray-rules-dat/releases/download/$VER/geoip.dat) 16 | GEOSITE_HASH=$(nix-prefetch-url \ 17 | https://github.com/techprober/v2ray-rules-dat/releases/download/$VER/geosite.dat) 18 | 19 | sed -i "$ROOT/package.nix" \ 20 | -e "s|version = \".*\"|version = \"$VER\"|" \ 21 | -e "s|geoipHash = \".*\"|geoipHash = \"$GEOIP_HASH\"|" \ 22 | -e "s|geositeHash = \".*\"|geositeHash = \"$GEOSITE_HASH\"|" 23 | -------------------------------------------------------------------------------- /pkgs/vs/vscode-insiders/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | lib, 4 | path, 5 | callPackage, 6 | fetchurl, 7 | commandLineArgs ? "", 8 | }: 9 | 10 | let 11 | inherit (stdenv.hostPlatform) system; 12 | throwSystem = throw "Unsupported system: ${system}"; 13 | 14 | plat = 15 | { 16 | x86_64-linux = "linux-x64"; 17 | x86_64-darwin = "darwin"; 18 | aarch64-linux = "linux-arm64"; 19 | aarch64-darwin = "darwin-arm64"; 20 | armv7l-linux = "linux-armhf"; 21 | } 22 | .${system} or throwSystem; 23 | 24 | archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz"; 25 | 26 | sha256 = 27 | { 28 | x86_64-linux = "1p3lhqyj2nr5av3zj1fjrvm99sh3r6hdd569z8dk9irzvdyzd2kx"; 29 | x86_64-darwin = "0ypmiqawwqpgi9y5bvrcdjx6siwy74v1d00mqfgbwi6pga3wps1h"; 30 | aarch64-linux = "1sq5a1ibb2gnikd30y12xaz88jfjwy9fklyw0agigydiz6dalhgb"; 31 | aarch64-darwin = "1ydf5aawr20axd8m54h8b4slrj50l78kniaihx8iznymxkml6ki9"; 32 | armv7l-linux = "0w0i6swgbwsixjbyfabi4xysnhi58yjqz4ckjwybv8wcqs1yhv23"; 33 | } 34 | .${system} or throwSystem; 35 | in 36 | 37 | callPackage "${path}/pkgs/applications/editors/vscode/generic.nix" rec { 38 | version = "1.101.0-insider"; 39 | pname = "vscode-insiders"; 40 | updateScript = ./update.sh; 41 | 42 | executableName = "code-insiders"; 43 | longName = "Visual Studio Code - Insiders"; 44 | shortName = "Code - Insiders"; 45 | inherit commandLineArgs; 46 | 47 | src = fetchurl { 48 | name = "VSCode_${version}_${plat}.${archive_fmt}"; 49 | url = "https://update.code.visualstudio.com/${version}/${plat}/insider"; 50 | inherit sha256; 51 | }; 52 | sourceRoot = ""; 53 | 54 | meta = with lib; { 55 | description = '' 56 | Open source source code editor developed by Microsoft for Windows, 57 | Linux and macOS 58 | ''; 59 | longDescription = '' 60 | Open source source code editor developed by Microsoft for Windows, 61 | Linux and macOS. It includes support for debugging, embedded Git 62 | control, syntax highlighting, intelligent code completion, snippets, 63 | and code refactoring. It is also customizable, so users can change the 64 | editor's theme, keyboard shortcuts, and preferences 65 | ''; 66 | homepage = "https://code.visualstudio.com"; 67 | downloadPage = "https://code.visualstudio.com/Updates"; 68 | license = licenses.unfree; 69 | # !!!: The insiders version breaks frequently, about once every month. 70 | # You will get errors such as segfaults, crashes, issues related to 71 | # read-only system, etc. For these reasons, I have personally switched 72 | # to stable. Please use this package with caution. 73 | broken = true; 74 | mainProgram = "code-insiders"; 75 | platforms = [ 76 | "x86_64-linux" 77 | "x86_64-darwin" 78 | "aarch64-darwin" 79 | "aarch64-linux" 80 | "armv7l-linux" 81 | ]; 82 | }; 83 | } 84 | -------------------------------------------------------------------------------- /pkgs/vs/vscode-insiders/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | curl 11 | gnused 12 | jq 13 | nix-prefetch-scripts 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /pkgs/vs/vscode-insiders/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | if [ ! -f "$ROOT/package.nix" ]; then 8 | echo "ERROR: cannot find package.nix in $ROOT" 9 | exit 1 10 | fi 11 | 12 | update_vscode () { 13 | VSCODE_VER=$1 14 | ARCH=$2 15 | ARCH_LONG=$3 16 | VSCODE_URL="https://update.code.visualstudio.com/${VSCODE_VER}/${ARCH}/insider" 17 | VSCODE_SHA256=$(nix-prefetch-url ${VSCODE_URL}) 18 | sed -i "s/${ARCH_LONG} = \".\{52\}\"/${ARCH_LONG} = \"${VSCODE_SHA256}\"/" \ 19 | "$ROOT/package.nix" 20 | } 21 | 22 | # VSCode 23 | 24 | VSCODE_VER=$(curl -fs https://update.code.visualstudio.com/api/releases/insider \ 25 | | jq -r .[0]) 26 | sed -i "s/version = \".*\"/version = \"${VSCODE_VER}\"/" "$ROOT/package.nix" 27 | 28 | update_vscode $VSCODE_VER linux-x64 x86_64-linux 29 | update_vscode $VSCODE_VER darwin x86_64-darwin 30 | update_vscode $VSCODE_VER linux-arm64 aarch64-linux 31 | update_vscode $VSCODE_VER darwin-arm64 aarch64-darwin 32 | update_vscode $VSCODE_VER linux-armhf armv7l-linux 33 | -------------------------------------------------------------------------------- /pkgs/vs/vscodium-insiders/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | lib, 4 | path, 5 | callPackage, 6 | fetchurl, 7 | commandLineArgs ? "", 8 | }: 9 | 10 | let 11 | inherit (stdenv.hostPlatform) system; 12 | throwSystem = throw "Unsupported system: ${system}"; 13 | 14 | plat = 15 | { 16 | x86_64-linux = "linux-x64"; 17 | x86_64-darwin = "darwin-x64"; 18 | aarch64-linux = "linux-arm64"; 19 | aarch64-darwin = "darwin-arm64"; 20 | armv7l-linux = "linux-armhf"; 21 | } 22 | .${system} or throwSystem; 23 | 24 | archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz"; 25 | 26 | sha256 = 27 | { 28 | x86_64-linux = "02j4dipwcc52qib2bpc598zs1pb31js3wb8z3msfwjfd868hbwxn"; 29 | x86_64-darwin = "1b57af7z94lrml1z2qv5lbkm0j5hwsqyw4dy07pk6x7cicwypxx9"; 30 | aarch64-linux = "0gyhsvbc0w80wgrkg5ba8v7gkwsra0pyr4zq0yal6cijn3bmkhv4"; 31 | aarch64-darwin = "1k84j2ywvvsxbdcngvl8ghwa9c8n6246zwkbwgw8am1nwfv0cpfw"; 32 | armv7l-linux = "0lv3v6z8hw1zqvbbhgc38vmr5cx1jjjc5jdffi9cpqyilk2l0vx8"; 33 | } 34 | .${system} or throwSystem; 35 | 36 | sourceRoot = if stdenv.isDarwin then "" else "."; 37 | in 38 | 39 | callPackage "${path}/pkgs/applications/editors/vscode/generic.nix" rec { 40 | version = "1.101.03679-insider"; 41 | pname = "vscodium-insiders"; 42 | updateScript = ./update.sh; 43 | 44 | executableName = "codium-insiders"; 45 | longName = "VSCodium - Insiders"; 46 | shortName = "Codium - Insiders"; 47 | inherit commandLineArgs; 48 | 49 | src = fetchurl { 50 | url = 51 | "https://github.com/VSCodium/vscodium-insiders/releases/download" 52 | + "/${version}/VSCodium-${plat}-${version}.${archive_fmt}"; 53 | inherit sha256; 54 | }; 55 | inherit sourceRoot; 56 | 57 | # tests = nixosTests.vscodium; 58 | 59 | meta = with lib; { 60 | description = '' 61 | Open source source code editor developed by Microsoft for Windows, 62 | Linux and macOS (VS Code without MS branding/telemetry/licensing) 63 | ''; 64 | longDescription = '' 65 | Open source source code editor developed by Microsoft for Windows, 66 | Linux and macOS. It includes support for debugging, embedded Git 67 | control, syntax highlighting, intelligent code completion, snippets, 68 | and code refactoring. It is also customizable, so users can change the 69 | editor's theme, keyboard shortcuts, and preferences 70 | ''; 71 | homepage = "https://github.com/VSCodium/vscodium-insiders"; 72 | downloadPage = "https://github.com/VSCodium/vscodium-insiders/releases"; 73 | license = licenses.mit; 74 | sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 75 | # !!!: The insiders version breaks frequently, about once every month. 76 | # You will get errors such as segfaults, crashes, issues related to 77 | # read-only system, etc. For these reasons, I have personally switched 78 | # to stable. Please use this package with caution. 79 | broken = true; 80 | mainProgram = "codium-insiders"; 81 | platforms = [ 82 | "x86_64-linux" 83 | "x86_64-darwin" 84 | "aarch64-linux" 85 | "aarch64-darwin" 86 | "armv7l-linux" 87 | ]; 88 | }; 89 | } 90 | -------------------------------------------------------------------------------- /pkgs/vs/vscodium-insiders/update-shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import { }, 3 | }: 4 | 5 | with pkgs; 6 | 7 | mkShell { 8 | packages = [ 9 | bash 10 | curl 11 | gawk 12 | gnused 13 | nix-prefetch-scripts 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /pkgs/vs/vscodium-insiders/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell update-shell.nix -i bash 3 | 4 | set -eou pipefail 5 | 6 | ROOT="$(dirname "$(readlink -f "$0")")" 7 | if [ ! -f "$ROOT/package.nix" ]; then 8 | echo "ERROR: cannot find package.nix in $ROOT" 9 | exit 1 10 | fi 11 | 12 | update_vscodium () { 13 | VSCODIUM_VER=$1 14 | ARCH=$2 15 | ARCH_LONG=$3 16 | ARCHIVE_FMT=$4 17 | VSCODIUM_URL="https://github.com/VSCodium/vscodium-insiders/releases/download\ 18 | /${VSCODIUM_VER}/VSCodium-${ARCH}-${VSCODIUM_VER}.${ARCHIVE_FMT}" 19 | VSCODIUM_SHA256=$(nix-prefetch-url ${VSCODIUM_URL}) 20 | sed -i "s/${ARCH_LONG} = \".\{52\}\"/${ARCH_LONG} = \"${VSCODIUM_SHA256}\"/" \ 21 | "$ROOT/package.nix" 22 | } 23 | 24 | # VSCodium 25 | 26 | VSCODIUM_VER=$(curl -Ls -w %{url_effective} -o /dev/null \ 27 | https://github.com/VSCodium/vscodium-insiders/releases/latest \ 28 | | awk -F'/' '{print $NF}') 29 | sed -i "s/version = \".*\"/version = \"${VSCODIUM_VER}\"/" "$ROOT/package.nix" 30 | 31 | update_vscodium $VSCODIUM_VER linux-x64 x86_64-linux tar.gz 32 | update_vscodium $VSCODIUM_VER darwin-x64 x86_64-darwin zip 33 | update_vscodium $VSCODIUM_VER linux-arm64 aarch64-linux tar.gz 34 | update_vscodium $VSCODIUM_VER darwin-arm64 aarch64-darwin zip 35 | update_vscodium $VSCODIUM_VER linux-armhf armv7l-linux tar.gz 36 | -------------------------------------------------------------------------------- /pkgs/wi/win2xcur/package.nix: -------------------------------------------------------------------------------- 1 | { lib, python313Packages }: 2 | 3 | let 4 | inherit (python313Packages) buildPythonPackage fetchPypi; 5 | in 6 | 7 | buildPythonPackage rec { 8 | pname = "win2xcur"; 9 | version = "0.1.2"; 10 | 11 | src = fetchPypi { 12 | inherit pname version; 13 | hash = "sha256-B8srOXQBUxK6dZ6GhDA5fYvxUBxHVcrSO/z+UWyF+qI="; 14 | }; 15 | 16 | propagatedBuildInputs = with python313Packages; [ 17 | numpy 18 | wand 19 | ]; 20 | 21 | doCheck = false; 22 | 23 | meta = with lib; { 24 | description = "A tool to convert Windows .cur and .ani cursors to Xcursor format."; 25 | homepage = "https://github.com/quantum5/win2xcur"; 26 | license = licenses.unfree; # No license upstream 27 | maintainers = with maintainers; [ weathercold ]; 28 | platforms = platforms.all; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | let 2 | lock = with builtins; (fromJSON (readFile ./flake.lock)).nodes.flake-compat.locked; 3 | in 4 | (import (fetchTarball { 5 | url = "https://github.com/edolstra/flake-compat/archive/${lock.rev}.tar.gz"; 6 | sha256 = lock.narHash; 7 | }) { src = ./.; }).shellNix 8 | --------------------------------------------------------------------------------