diff --git a/.github/workflows/ci.yml b/.github/workflows/format.yml similarity index 92% rename from .github/workflows/ci.yml rename to .github/workflows/format.yml index fcef98f..08874a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/format.yml @@ -1,11 +1,11 @@ -name: CI +name: Format on: - push - pull_request jobs: - Check: + format-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml new file mode 100644 index 0000000..11dfbec --- /dev/null +++ b/.github/workflows/test-vm.yml @@ -0,0 +1,28 @@ +name: Test modules + +on: + push: + paths: + - 'modules/**' + - 'test.nix' + - 'flake.*' + pull_request: + paths: + - 'modules/**' + - 'test.nix' + - 'flake.*' + workflow_dispatch: + +jobs: + run-vm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + with: + extra_nix_config: "system-features = benchmark big-parallel kvm nixos-test uid-range" + - uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Run VM + run: nix build -Lv .#checks.x86_64-linux.module-vm-test diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml new file mode 100644 index 0000000..57e9674 --- /dev/null +++ b/.github/workflows/update-lock.yml @@ -0,0 +1,41 @@ +name: Update lockfiles + +on: + schedule: + # run every friday + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + update-locks: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + + - name: Set Git user info + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Update flake inputs + run: | + nix flake update \ + --commit-lock-file --commit-lockfile-summary "chore: update flake inputs" + + - name: Update upstream sources + run: | + nix run nixpkgs#nvfetcher + + - name: Create PR + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.LOCKFILE_TOKEN }} + base: "main" + branch: "update-lock" + delete-branch: true + committer: github-actions[bot] github-actions[bot]@users.noreply.github.com + commit-message: "chore: update nvfetcher sources" + title: "chore: update lockfiles" + body: "Automated pull request updating flake inputs and nvfetcher sources" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a79d64..441441e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,20 @@ Create a file in `modules//` with the name of the port. Add the file to `catppuccin.accent` option. `catppuccin.flavour` and `catppuccin.accent` should default to `config.catppuccin.flavour` and `config.catppuccin.accent`, respectively. +[nvfetcher](https://github.com/berberman/nvfetcher) is used to track our upstream +sources to use in modules. This allows us to reduce [IFD](https://nixos.wiki/wiki/Import_From_Derivation) +and auto-update all themes. Most repositories can be specified like so: + +```toml +[program_name] +src.git = "https://github.com/catppuccin/program_name.git" +fetch.github = "catppuccin/program_name" +``` + +After creating your module, add the options to enable it in `test.nix` under the +`nodes.machine` attrset. This will allow for your configuration to be tested along +with the other modules in a VM automatically. + Commits that add ports should be of the format diff --git a/_sources/generated.json b/_sources/generated.json new file mode 100644 index 0000000..cfb2acf --- /dev/null +++ b/_sources/generated.json @@ -0,0 +1,362 @@ +{ + "alacritty": { + "cargoLocks": null, + "date": "2022-09-27", + "extract": null, + "name": "alacritty", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "alacritty", + "rev": "3c808cbb4f9c87be43ba5241bc57373c793d2f17", + "sha256": "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0=", + "type": "github" + }, + "version": "3c808cbb4f9c87be43ba5241bc57373c793d2f17" + }, + "bat": { + "cargoLocks": null, + "date": "2022-11-10", + "extract": null, + "name": "bat", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "bat", + "rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1", + "sha256": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=", + "type": "github" + }, + "version": "ba4d16880d63e656acced2b7d4e034e4a93f74b1" + }, + "bottom": { + "cargoLocks": null, + "date": "2022-12-30", + "extract": null, + "name": "bottom", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "bottom", + "rev": "c0efe9025f62f618a407999d89b04a231ba99c92", + "sha256": "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ=", + "type": "github" + }, + "version": "c0efe9025f62f618a407999d89b04a231ba99c92" + }, + "btop": { + "cargoLocks": null, + "date": "2023-10-07", + "extract": null, + "name": "btop", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "btop", + "rev": "c6469190f2ecf25f017d6120bf4e050e6b1d17af", + "sha256": "sha256-jodJl4f2T9ViNqsY9fk8IV62CrpC5hy7WK3aRpu70Cs=", + "type": "github" + }, + "version": "c6469190f2ecf25f017d6120bf4e050e6b1d17af" + }, + "fish": { + "cargoLocks": null, + "date": "2023-11-02", + "extract": null, + "name": "fish", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "fish", + "rev": "0ce27b518e8ead555dec34dd8be3df5bd75cff8e", + "sha256": "sha256-Dc/zdxfzAUM5NX8PxzfljRbYvO9f9syuLO8yBr+R3qg=", + "type": "github" + }, + "version": "0ce27b518e8ead555dec34dd8be3df5bd75cff8e" + }, + "glamour": { + "cargoLocks": null, + "date": "2023-05-01", + "extract": null, + "name": "glamour", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "glamour", + "rev": "3ef2c9533b6d3c4d6309a850765500179cf32d1c", + "sha256": "sha256-HD7g9unpRYLIj00FOqLiiInMYgGgYujjvAeYOa+V76Y=", + "type": "github" + }, + "version": "3ef2c9533b6d3c4d6309a850765500179cf32d1c" + }, + "grub": { + "cargoLocks": null, + "date": "2022-12-29", + "extract": null, + "name": "grub", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "grub", + "rev": "803c5df0e83aba61668777bb96d90ab8f6847106", + "sha256": "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=", + "type": "github" + }, + "version": "803c5df0e83aba61668777bb96d90ab8f6847106" + }, + "gtk": { + "cargoLocks": null, + "date": "2023-10-05", + "extract": null, + "name": "gtk", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "gtk", + "rev": "9082969c1c33b0dc8d8e9a8a241d029f2d864599", + "sha256": "sha256-95H/jWbaDYX+tdhLODMcKunh2EXelf5Wd/vG9ZKFdSc=", + "type": "github" + }, + "version": "9082969c1c33b0dc8d8e9a8a241d029f2d864599" + }, + "helix": { + "cargoLocks": null, + "date": "2023-10-20", + "extract": null, + "name": "helix", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "helix", + "rev": "8313c7250fcbbb22c6680db332669073ec6b28c2", + "sha256": "sha256-qEXhj/Mpm+aqThqEq5DlPJD8nsbPov9CNMgG9s4E02g=", + "type": "github" + }, + "version": "8313c7250fcbbb22c6680db332669073ec6b28c2" + }, + "kitty": { + "cargoLocks": null, + "date": "2023-06-09", + "extract": null, + "name": "kitty", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "kitty", + "rev": "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda", + "sha256": "sha256-uZSx+fuzcW//5/FtW98q7G4xRRjJjD5aQMbvJ4cs94U=", + "type": "github" + }, + "version": "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda" + }, + "lazygit": { + "cargoLocks": null, + "date": "2023-09-19", + "extract": null, + "name": "lazygit", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "lazygit", + "rev": "0543c28e8af1a935f8c512ad9451facbcc17d8a8", + "sha256": "sha256-OVihY5E+elPKag2H4RyWiSv+MdIqHtfGNM3/1u2ik6U=", + "type": "github" + }, + "version": "0543c28e8af1a935f8c512ad9451facbcc17d8a8" + }, + "mako": { + "cargoLocks": null, + "date": "2023-08-12", + "extract": null, + "name": "mako", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "mako", + "rev": "9dd088aa5f4529a3dd4d9760415e340664cb86df", + "sha256": "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ=", + "type": "github" + }, + "version": "9dd088aa5f4529a3dd4d9760415e340664cb86df" + }, + "micro": { + "cargoLocks": null, + "date": "2022-09-27", + "extract": null, + "name": "micro", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "micro", + "rev": "ed8ef015f97c357575b5013e18042c9faa6c068a", + "sha256": "sha256-/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8=", + "type": "github" + }, + "version": "ed8ef015f97c357575b5013e18042c9faa6c068a" + }, + "neovim": { + "cargoLocks": null, + "date": "2023-11-01", + "extract": null, + "name": "neovim", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "nvim", + "rev": "40dc9f0621c55bd40da4ad0731fac44d15bb393a", + "sha256": "sha256-m1SYlSUVO9BbxUzPZ1VFkfCSHVTYSp65TX3mUm+kjeo=", + "type": "github" + }, + "version": "40dc9f0621c55bd40da4ad0731fac44d15bb393a" + }, + "polybar": { + "cargoLocks": null, + "date": "2022-10-05", + "extract": null, + "name": "polybar", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "polybar", + "rev": "9ee66f83335404186ce979bac32fcf3cd047396a", + "sha256": "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA=", + "type": "github" + }, + "version": "9ee66f83335404186ce979bac32fcf3cd047396a" + }, + "starship": { + "cargoLocks": null, + "date": "2023-07-13", + "extract": null, + "name": "starship", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "starship", + "rev": "5629d2356f62a9f2f8efad3ff37476c19969bd4f", + "sha256": "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0=", + "type": "github" + }, + "version": "5629d2356f62a9f2f8efad3ff37476c19969bd4f" + }, + "sway": { + "cargoLocks": null, + "date": "2023-08-20", + "extract": null, + "name": "sway", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "sway", + "rev": "c976222e5cacbba7946fb82163944924bd5fac12", + "sha256": "sha256-VEyjHFjNFQQB20NGciO8y2m/rWkASzQZQekzGZ88pLg=", + "type": "github" + }, + "version": "c976222e5cacbba7946fb82163944924bd5fac12" + }, + "tmux": { + "cargoLocks": null, + "date": "2023-11-01", + "extract": null, + "name": "tmux", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "tmux", + "rev": "47e33044b4b47b1c1faca1e42508fc92be12131a", + "sha256": "sha256-kn3kf7eiiwXj57tgA7fs5N2+B2r441OtBlM8IBBLl4I=", + "type": "github" + }, + "version": "47e33044b4b47b1c1faca1e42508fc92be12131a" + } +} \ No newline at end of file diff --git a/_sources/generated.nix b/_sources/generated.nix new file mode 100644 index 0000000..7005e51 --- /dev/null +++ b/_sources/generated.nix @@ -0,0 +1,220 @@ +# This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }: +{ + alacritty = { + pname = "alacritty"; + version = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "alacritty"; + rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + fetchSubmodules = false; + sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; + }; + date = "2022-09-27"; + }; + bat = { + pname = "bat"; + version = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + fetchSubmodules = false; + sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; + }; + date = "2022-11-10"; + }; + bottom = { + pname = "bottom"; + version = "c0efe9025f62f618a407999d89b04a231ba99c92"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "bottom"; + rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; + fetchSubmodules = false; + sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; + }; + date = "2022-12-30"; + }; + btop = { + pname = "btop"; + version = "c6469190f2ecf25f017d6120bf4e050e6b1d17af"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "btop"; + rev = "c6469190f2ecf25f017d6120bf4e050e6b1d17af"; + fetchSubmodules = false; + sha256 = "sha256-jodJl4f2T9ViNqsY9fk8IV62CrpC5hy7WK3aRpu70Cs="; + }; + date = "2023-10-07"; + }; + fish = { + pname = "fish"; + version = "0ce27b518e8ead555dec34dd8be3df5bd75cff8e"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "fish"; + rev = "0ce27b518e8ead555dec34dd8be3df5bd75cff8e"; + fetchSubmodules = false; + sha256 = "sha256-Dc/zdxfzAUM5NX8PxzfljRbYvO9f9syuLO8yBr+R3qg="; + }; + date = "2023-11-02"; + }; + glamour = { + pname = "glamour"; + version = "3ef2c9533b6d3c4d6309a850765500179cf32d1c"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "glamour"; + rev = "3ef2c9533b6d3c4d6309a850765500179cf32d1c"; + fetchSubmodules = false; + sha256 = "sha256-HD7g9unpRYLIj00FOqLiiInMYgGgYujjvAeYOa+V76Y="; + }; + date = "2023-05-01"; + }; + grub = { + pname = "grub"; + version = "803c5df0e83aba61668777bb96d90ab8f6847106"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "grub"; + rev = "803c5df0e83aba61668777bb96d90ab8f6847106"; + fetchSubmodules = false; + sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0="; + }; + date = "2022-12-29"; + }; + gtk = { + pname = "gtk"; + version = "9082969c1c33b0dc8d8e9a8a241d029f2d864599"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "gtk"; + rev = "9082969c1c33b0dc8d8e9a8a241d029f2d864599"; + fetchSubmodules = false; + sha256 = "sha256-95H/jWbaDYX+tdhLODMcKunh2EXelf5Wd/vG9ZKFdSc="; + }; + date = "2023-10-05"; + }; + helix = { + pname = "helix"; + version = "8313c7250fcbbb22c6680db332669073ec6b28c2"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "helix"; + rev = "8313c7250fcbbb22c6680db332669073ec6b28c2"; + fetchSubmodules = false; + sha256 = "sha256-qEXhj/Mpm+aqThqEq5DlPJD8nsbPov9CNMgG9s4E02g="; + }; + date = "2023-10-20"; + }; + kitty = { + pname = "kitty"; + version = "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "kitty"; + rev = "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda"; + fetchSubmodules = false; + sha256 = "sha256-uZSx+fuzcW//5/FtW98q7G4xRRjJjD5aQMbvJ4cs94U="; + }; + date = "2023-06-09"; + }; + lazygit = { + pname = "lazygit"; + version = "0543c28e8af1a935f8c512ad9451facbcc17d8a8"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "lazygit"; + rev = "0543c28e8af1a935f8c512ad9451facbcc17d8a8"; + fetchSubmodules = false; + sha256 = "sha256-OVihY5E+elPKag2H4RyWiSv+MdIqHtfGNM3/1u2ik6U="; + }; + date = "2023-09-19"; + }; + mako = { + pname = "mako"; + version = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "mako"; + rev = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; + fetchSubmodules = false; + sha256 = "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ="; + }; + date = "2023-08-12"; + }; + micro = { + pname = "micro"; + version = "ed8ef015f97c357575b5013e18042c9faa6c068a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "micro"; + rev = "ed8ef015f97c357575b5013e18042c9faa6c068a"; + fetchSubmodules = false; + sha256 = "sha256-/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8="; + }; + date = "2022-09-27"; + }; + neovim = { + pname = "neovim"; + version = "40dc9f0621c55bd40da4ad0731fac44d15bb393a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "nvim"; + rev = "40dc9f0621c55bd40da4ad0731fac44d15bb393a"; + fetchSubmodules = false; + sha256 = "sha256-m1SYlSUVO9BbxUzPZ1VFkfCSHVTYSp65TX3mUm+kjeo="; + }; + date = "2023-11-01"; + }; + polybar = { + pname = "polybar"; + version = "9ee66f83335404186ce979bac32fcf3cd047396a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "polybar"; + rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; + fetchSubmodules = false; + sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; + }; + date = "2022-10-05"; + }; + starship = { + pname = "starship"; + version = "5629d2356f62a9f2f8efad3ff37476c19969bd4f"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "starship"; + rev = "5629d2356f62a9f2f8efad3ff37476c19969bd4f"; + fetchSubmodules = false; + sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0="; + }; + date = "2023-07-13"; + }; + sway = { + pname = "sway"; + version = "c976222e5cacbba7946fb82163944924bd5fac12"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "sway"; + rev = "c976222e5cacbba7946fb82163944924bd5fac12"; + fetchSubmodules = false; + sha256 = "sha256-VEyjHFjNFQQB20NGciO8y2m/rWkASzQZQekzGZ88pLg="; + }; + date = "2023-08-20"; + }; + tmux = { + pname = "tmux"; + version = "47e33044b4b47b1c1faca1e42508fc92be12131a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "tmux"; + rev = "47e33044b4b47b1c1faca1e42508fc92be12131a"; + fetchSubmodules = false; + sha256 = "sha256-kn3kf7eiiwXj57tgA7fs5N2+B2r441OtBlM8IBBLl4I="; + }; + date = "2023-11-01"; + }; +} diff --git a/default.nix b/default.nix index 2cccff2..4393224 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,8 @@ (import ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; + url = "https://github.com/edolstra/flake-compat/archive/0f9255e01c2351cc7d116c072cb317785dd33b33.tar.gz"; + sha256 = "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U="; } ) { src = ./.; } diff --git a/flake.lock b/flake.lock index 9f825d3..7423a05 100644 --- a/flake.lock +++ b/flake.lock @@ -1,28 +1,32 @@ { "nodes": { - "flake-compat": { - "flake": false, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "lastModified": 1698873617, + "narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "48b0a30202516e25d9885525fbb200a045f23f26", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "nix-community", + "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1685655444, - "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "type": "github" }, "original": { @@ -33,7 +37,7 @@ }, "root": { "inputs": { - "flake-compat": "flake-compat", + "home-manager": "home-manager", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 2e6fd98..30d0948 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,16 @@ { description = "Soothing pastel theme for Nix"; + inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, ... }: + outputs = { self, nixpkgs, ... }@inputs: let systems = [ "x86_64-linux" @@ -19,19 +21,29 @@ inherit (nixpkgs) lib; - forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); - nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); + forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s}); + + sources = pkgs: + let + s = + import ./_sources/generated.nix { inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools; }; + in + builtins.mapAttrs (_: p: p.src) s; in { + checks = forAllSystems (pkgs: lib.optionalAttrs pkgs.stdenv.isLinux { + module-vm-test = pkgs.nixosTest (import ./test.nix { inherit self inputs; }); + }); + formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); - homeManagerModules.catppuccin = import ./modules/home-manager nixpkgs; + homeManagerModules.catppuccin = import ./modules/home-manager { inherit inputs sources; }; - nixosModules.catppuccin = import ./modules/nixos nixpkgs; + nixosModules.catppuccin = import ./modules/nixos { inherit inputs sources; }; packages = forAllSystems (pkgs: let - mkEval = module: lib.evalModules { + eval = module: lib.evalModules { modules = [ module { @@ -43,25 +55,23 @@ ]; }; - mkDoc = name: options: + mkDoc = name: module: let doc = pkgs.nixosOptionsDoc { - options = lib.filterAttrs (n: _: n != "_module") options; + options = lib.filterAttrs (n: _: n != "_module") (eval module).options; documentType = "none"; - revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; + revision = builtins.substring 0 7 self.rev or "dirty"; }; in pkgs.runCommand "${name}-module-doc.md" { } '' cat ${doc.optionsCommonMark} > $out ''; - - hmEval = mkEval self.homeManagerModules.catppuccin; - nixosEval = mkEval self.nixosModules.catppuccin; in - rec { - nixos-doc = mkDoc "nixos" nixosEval.options; - home-manager-doc = mkDoc "home-manager" hmEval.options; - default = home-manager-doc; + { + nixos-doc = mkDoc "nixos" self.nixosModules.catppuccin; + home-manager-doc = mkDoc "home-manager" self.homeManagerModules.catppuccin; + + default = self.packages.${pkgs.system}.home-manager-doc; }); }; } diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 2500756..ba159da 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -10,19 +10,11 @@ let in { options.programs.alacritty.catppuccin = - ctp.mkCatppuccinOpt "alacritty" config; + ctp.mkCatppuccinOpt "alacritty"; config.programs.alacritty.settings = let - file = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "alacritty"; - rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; - sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; - } - + "/catppuccin-${cfg.flavour}.yml"; + file = "${sources.alacritty}/catppuccin-${cfg.flavour}.yml"; in - lib.mkIf enable (ctp.fromYaml pkgs file); + lib.mkIf enable (ctp.fromYaml file); } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index c775aa6..ac88fdd 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -1,29 +1,24 @@ { config -, pkgs , lib +, sources , ... }: let cfg = config.programs.bat.catppuccin; enable = cfg.enable && config.programs.bat.enable; + themeName = "Catppuccin-${cfg.flavour}"; in { options.programs.bat.catppuccin = - lib.ctp.mkCatppuccinOpt "bat" config; + lib.ctp.mkCatppuccinOpt "bat"; - config = { - programs.bat = lib.mkIf enable { - config.theme = "Catppuccin-${cfg.flavour}"; - themes."Catppuccin-${cfg.flavour}" = { - src = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "bat"; - rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; - hash = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; - }; - file = "Catppuccin-${cfg.flavour}.tmTheme"; + config = lib.mkIf enable { + programs.bat = { + config.theme = themeName; + + themes.${themeName} = { + src = sources.bat; + file = "${themeName}.tmTheme"; }; }; }; diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index db58880..dbe990a 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -1,23 +1,23 @@ { config -, pkgs , lib +, sources , ... }: let - inherit (builtins) fromTOML readFile; cfg = config.programs.bottom.catppuccin; enable = cfg.enable && config.programs.bottom.enable; in { options.programs.bottom.catppuccin = - lib.ctp.mkCatppuccinOpt "bottom" config; + lib.ctp.mkCatppuccinOpt "bottom"; - config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "bottom"; - rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; - sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; - } - + "/themes/${cfg.flavour}.toml"))); + config = lib.mkIf enable { + + programs.bottom = { + + settings = builtins.fromTOML ( + builtins.readFile "${sources.bottom}/themes/${cfg.flavour}.toml" + ); + }; + }; } diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 4c2fc44..a6605f5 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -1,30 +1,21 @@ { config -, pkgs , lib +, sources , ... }: let - inherit (lib) mkIf; cfg = config.programs.btop.catppuccin; enable = cfg.enable && config.programs.btop.enable; themeFile = "catppuccin_${cfg.flavour}.theme"; themePath = "/themes/${themeFile}"; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "btop"; - rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; - sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; - } - + themePath; + theme = sources.btop + themePath; in { options.programs.btop.catppuccin = - lib.ctp.mkCatppuccinOpt "btop" config; + lib.ctp.mkCatppuccinOpt "btop"; - config = mkIf enable + config = lib.mkIf enable { xdg = { # xdg is required for this to work diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 6b3241f..29c697a 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,10 +1,6 @@ -nixpkgs: { config - , pkgs - , lib - , ... - }: +{ inputs, ... }@flakeArgs: { lib, pkgs, ... }@systemArgs: let - extendedLib = import ../lib/mkExtLib.nix nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib (flakeArgs // systemArgs); inherit (extendedLib) ctp; in { @@ -30,7 +26,7 @@ in ./tmux.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib files; + extendedLib.ctp.mapModules extendedLib files; options.catppuccin = { flavour = lib.mkOption { diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index f851f22..95400f8 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -8,25 +8,22 @@ let cfg = config.programs.fish.catppuccin; enable = cfg.enable && config.programs.fish.enable; - theme = pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "fish"; - rev = "91e6d6721362be05a5c62e235ed8517d90c567c9"; - sha256 = "sha256-l9V7YMfJWhKDL65dNbxaddhaM6GJ0CFZ6z+4R6MJwBA="; - }; themeName = "Catppuccin ${ctp.mkUpper cfg.flavour}"; + themePath = "/themes/${themeName}.theme"; in { - options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish" config; + options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish"; # xdg is required for this to work config = mkIf enable { - xdg.enable = lib.mkForce true; + xdg = { + enable = lib.mkForce true; + + configFile."fish${themePath}".source = "${sources.fish}${themePath}"; + }; programs.fish.shellInit = '' fish_config theme choose "${themeName}" ''; - xdg.configFile."fish/themes/${themeName}.theme".source = "${theme}/themes/${themeName}.theme"; }; } diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index d0bc7a4..b2b286f 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -1,11 +1,11 @@ { config , pkgs , lib -, +, ... }: let cfg = config.programs.glamour.catppuccin; - enable = cfg.enable; + inherit (cfg) enable; version = "1.0.0"; @@ -18,7 +18,7 @@ let in { options.programs.glamour.catppuccin = - lib.ctp.mkCatppuccinOpt "glamour" config; + lib.ctp.mkCatppuccinOpt "glamour"; config = { home.sessionVariables = lib.mkIf enable { diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index 4487968..9c70c60 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -10,9 +10,9 @@ let in { options.gtk.catppuccin = - ctp.mkCatppuccinOpt "gtk" config + ctp.mkCatppuccinOpt "gtk" // { - accent = ctp.mkAccentOpt "gtk" config; + accent = ctp.mkAccentOpt "gtk"; size = mkOption { type = types.enum [ "standard" "compact" ]; default = "standard"; diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 846e859..e01caf0 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -1,16 +1,15 @@ { config -, pkgs , lib +, sources , ... }: let - inherit (builtins) fromTOML readFile; cfg = config.programs.helix.catppuccin; enable = cfg.enable && config.programs.helix.enable; in { options.programs.helix.catppuccin = with lib; - ctp.mkCatppuccinOpt "helix" config + ctp.mkCatppuccinOpt "helix" // { useItalics = mkEnableOption "Italics in Catppuccin theme for Helix"; }; @@ -28,13 +27,7 @@ in editor.color-modes = lib.mkDefault true; }; - themes."catppuccin-${cfg.flavour}" = fromTOML (readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "helix"; - rev = "5677c16dc95297a804caea9161072ff174018fdd"; - sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; - } - + "/themes/${subdir}/catppuccin_${cfg.flavour}.toml")); + themes."catppuccin-${cfg.flavour}" = builtins.fromTOML + (builtins.readFile "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"); }; } diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index 847d806..7e2f138 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -9,7 +9,7 @@ let in { options.programs.kitty.catppuccin = - ctp.mkCatppuccinOpt "kitty" config; + ctp.mkCatppuccinOpt "kitty"; config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavour}"; }; diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index 300a2d6..7ec5bba 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,27 +1,24 @@ { config -, pkgs , lib +, sources , ... }: let + inherit (lib) ctp; cfg = config.programs.lazygit.catppuccin; enable = cfg.enable && config.programs.lazygit.enable; + + themePath = "/${cfg.flavour}/${cfg.accent}.yml"; in { options.programs.lazygit.catppuccin = - lib.ctp.mkCatppuccinOpt "lazygit" config; + lib.ctp.mkCatppuccinOpt "lazygit" // { + accent = ctp.mkAccentOpt "lazygit"; - config.programs.lazygit.settings = - let - file = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "lazygit"; - rev = "f01edfd57fa2aa7cd69a92537a613bb3c91e65dd"; - sha256 = "sha256-zjzDtXcGtUon4QbrZnlAPzngEyH56yy8TCyFv0rIbOA="; - } - + "/themes/${cfg.flavour}.yml"; - in - lib.mkIf enable (lib.ctp.fromYaml pkgs file); + }; + + config = lib.mkIf enable { + + programs.lazygit.settings = lib.ctp.fromYaml "${sources.lazygit}/themes/${themePath}"; + }; } diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index bb3ef39..e31c3ff 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -1,6 +1,7 @@ { config , pkgs , lib +, sources , ... }: let @@ -8,20 +9,14 @@ let cfg = config.services.mako.catppuccin; enable = cfg.enable && config.services.mako.enable; - theme = lib.ctp.fromINI pkgs (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "mako"; - rev = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; - hash = "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ="; - } + /src/${cfg.flavour}); + theme = lib.ctp.fromINI (sources.mako + /src/${cfg.flavour}); # Settings that need to be extracted and put in extraConfig extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; in { options.services.mako.catppuccin = - lib.ctp.mkCatppuccinOpt "mako" config; + lib.ctp.mkCatppuccinOpt "mako"; # Will cause infinite recursion if config.services.mako is directly set as a whole config.services.mako = lib.mkIf enable { diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index 7efc2f1..29085c3 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -8,19 +8,10 @@ let enable = cfg.enable && config.programs.micro.enable; themePath = "catppuccin-${cfg.flavour}.micro"; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "micro"; - rev = "ed8ef015f97c357575b5013e18042c9faa6c068a"; - sha256 = "/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8="; - } - + "/src/${themePath}"; in { options.programs.micro.catppuccin = - lib.ctp.mkCatppuccinOpt "micro" config; + lib.ctp.mkCatppuccinOpt "micro"; config = lib.mkIf enable { programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; @@ -28,7 +19,7 @@ in xdg = { # xdg is required for this to work enable = lib.mkForce true; - configFile."micro/colorschemes/${themePath}".source = theme; + configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}"; }; }; } diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index 6e7231b..c77bd3f 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -8,7 +8,7 @@ let enable = cfg.enable && config.programs.neovim.enable; in { - options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt "neovim" config; + options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt "neovim"; config.programs.neovim = lib.mkIf enable { plugins = with pkgs.vimPlugins; [ diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 5669de4..38d00ee 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -9,14 +9,8 @@ let in { options.services.polybar.catppuccin = - lib.ctp.mkCatppuccinOpt "polybar" config; + lib.ctp.mkCatppuccinOpt "polybar"; - config.services.polybar.extraConfig = lib.mkIf enable (builtins.readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "polybar"; - rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; - sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; - } - + "/themes/${cfg.flavour}.ini")); + config.services.polybar.extraConfig = lib.mkIf enable + (builtins.readFile "${sources.polybar}/themes/${cfg.flavour}.ini"); } diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 960ceb7..cbf2b52 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -10,7 +10,7 @@ let in { options.programs.starship.catppuccin = - lib.ctp.mkCatppuccinOpt "starship" config; + lib.ctp.mkCatppuccinOpt "starship"; config.programs.starship.settings = lib.mkIf enable @@ -18,13 +18,5 @@ in format = lib.mkDefault "$all"; palette = "catppuccin_${cfg.flavour}"; } - // fromTOML (readFile - (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "starship"; - rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; - sha256 = "sha256-soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY="; - } - + "/palettes/${cfg.flavour}.toml"))); + // fromTOML (readFile "${sources.starship}/palettes/${cfg.flavour}.toml")); } diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index b900330..628f476 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -1,24 +1,16 @@ { config -, pkgs , lib +, sources , ... }: let cfg = config.wayland.windowManager.sway.catppuccin; enable = cfg.enable && config.wayland.windowManager.sway.enable; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "sway"; - rev = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; - sha256 = "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk="; - } - + "/themes/catppuccin-${cfg.flavour}"; + theme = "${sources.sway}/themes/catppuccin-${cfg.flavour}"; in { options.wayland.windowManager.sway.catppuccin = - lib.ctp.mkCatppuccinOpt "sway" config; + lib.ctp.mkCatppuccinOpt "sway"; config.wayland.windowManager.sway.extraConfigEarly = lib.mkIf enable '' diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index a7377b9..4cdd2cc 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -1,30 +1,24 @@ { config -, pkgs , lib +, pkgs +, sources , ... }: let cfg = config.programs.tmux.catppuccin; enable = cfg.enable && config.programs.tmux.enable; - plugin = with builtins; - with pkgs; let - rev = "4e48b09a76829edc7b55fbb15467cf0411f07931"; - in - tmuxPlugins.mkTmuxPlugin { + plugin = + # TODO @getchoo: upstream this in nixpkgs + pkgs.tmuxPlugins.mkTmuxPlugin { pluginName = "catppuccin"; - version = substring 0 7 rev; - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "tmux"; - inherit rev; - sha256 = "sha256-bXEsxt4ozl3cAzV3ZyvbPsnmy0RAdpLxHwN82gvjLdU="; - }; + version = builtins.substring 0 7 sources.tmux.rev; + src = sources.tmux; }; in { options.programs.tmux.catppuccin = - lib.ctp.mkCatppuccinOpt "tmux" config; + lib.ctp.mkCatppuccinOpt "tmux"; config.programs.tmux.plugins = lib.mkIf enable [ { diff --git a/modules/lib/default.nix b/modules/lib/default.nix index cae0c09..db7d7f2 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -1,4 +1,4 @@ -lib: +lib: { config, pkgs, sources, ... }: let # string -> type -> string -> a -> a # this is an internal function and shouldn't be @@ -6,7 +6,7 @@ let # a string (the name of the property, i.e., flavour # or accent), the type of the property, the name of # the module, followed by local config attrset - mkBasicOpt = attr: type: name: config: + mkBasicOpt = attr: type: name: lib.mkOption { inherit type; default = config.catppuccin.${attr}; @@ -53,7 +53,7 @@ in # a -> path -> a # fromJSON but for yaml (and without readFile) # a should be the local pkgs attrset - fromYaml = pkgs: file: + fromYaml = file: let inherit (builtins) fromJSON readFile; @@ -68,7 +68,7 @@ in # a -> path -> a # fromJSON but for ini (and without readFile) # a should be the local pkgs attrset - fromINI = pkgs: file: + fromINI = file: let inherit (builtins) fromJSON readFile; @@ -83,9 +83,10 @@ in # a -> a -> [path] -> [path] # this imports a list of paths while inheriting # multiple attributes - mapModules = config: pkgs: extendedLib: + mapModules = extendedLib: map (m: (import m { inherit config pkgs; + sources = sources pkgs; lib = extendedLib; })); @@ -94,9 +95,9 @@ in # enable and flavour option. the fist string should # be the name of the module, followed by the local config # attrset - mkCatppuccinOpt = name: config: { + mkCatppuccinOpt = name: { enable = lib.mkEnableOption "Catppuccin theme"; - flavour = mkFlavourOpt name config; + flavour = mkFlavourOpt name; }; # string -> a -> a diff --git a/modules/lib/mkExtLib.nix b/modules/lib/mkExtLib.nix index b7c4503..45ef539 100644 --- a/modules/lib/mkExtLib.nix +++ b/modules/lib/mkExtLib.nix @@ -1 +1 @@ -lib: lib.extend (self: _: { ctp = import ./. self; }) +lib: args: lib.extend (self: _: { ctp = import ./. self args; }) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 0d4ff6a..07a17b2 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,6 @@ -nixpkgs: { config, pkgs, lib, ... }: +{ inputs, ... }@flakeArgs: { lib, pkgs, ... }@systemArgs: let - extendedLib = import ../lib/mkExtLib.nix nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib (systemArgs // flakeArgs); in { imports = @@ -9,7 +9,7 @@ in ./grub.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib files; + extendedLib.ctp.mapModules extendedLib files; options.catppuccin = with extendedLib; { diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 6174404..78b48ca 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -1,28 +1,22 @@ { config -, pkgs , lib +, pkgs +, sources , ... }: let cfg = config.boot.loader.grub.catppuccin; enable = cfg.enable && config.boot.loader.grub.enable; - theme = with pkgs; let - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "grub"; - rev = "803c5df0e83aba61668777bb96d90ab8f6847106"; - sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0="; - }; - in - runCommand "catppuccin-grub-theme" { } '' + # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes + theme = pkgs.runCommand "catppuccin-grub-theme" { } '' mkdir -p "$out" - cp -r ${src}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ + cp -r ${sources.grub}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ ''; in { options.boot.loader.grub.catppuccin = - lib.ctp.mkCatppuccinOpt "grub" config; + lib.ctp.mkCatppuccinOpt "grub"; config.boot.loader.grub = lib.mkIf enable { font = "${theme}/font.pf2"; diff --git a/nvfetcher.toml b/nvfetcher.toml new file mode 100644 index 0000000..ce4ede5 --- /dev/null +++ b/nvfetcher.toml @@ -0,0 +1,71 @@ +[alacritty] +src.git = "https://github.com/catppuccin/alacritty.git" +fetch.github = "catppuccin/alacritty" + +[bat] +src.git = "https://github.com/catppuccin/bat.git" +fetch.github = "catppuccin/bat" + +[bottom] +src.git = "https://github.com/catppuccin/bottom.git" +fetch.github = "catppuccin/bottom" + +[btop] +src.git = "https://github.com/catppuccin/btop.git" +fetch.github = "catppuccin/btop" + +[fish] +src.git = "https://github.com/catppuccin/fish.git" +fetch.github = "catppuccin/fish" + +[glamour] +src.git = "https://github.com/catppuccin/glamour.git" +fetch.github = "catppuccin/glamour" + +[grub] +src.git = "https://github.com/catppuccin/grub.git" +fetch.github = "catppuccin/grub" + +[gtk] +src.git = "https://github.com/catppuccin/gtk.git" +fetch.github = "catppuccin/gtk" + +[helix] +src.git = "https://github.com/catppuccin/helix.git" +fetch.github = "catppuccin/helix" + +[kitty] +src.git = "https://github.com/catppuccin/kitty.git" +fetch.github = "catppuccin/kitty" + +[lazygit] +src.git = "https://github.com/catppuccin/lazygit.git" +fetch.github = "catppuccin/lazygit" + +[mako] +src.git = "https://github.com/catppuccin/mako.git" +fetch.github = "catppuccin/mako" + +[micro] +src.git = "https://github.com/catppuccin/micro.git" +fetch.github = "catppuccin/micro" + +[neovim] +src.git = "https://github.com/catppuccin/nvim.git" +fetch.github = "catppuccin/nvim" + +[polybar] +src.git = "https://github.com/catppuccin/polybar.git" +fetch.github = "catppuccin/polybar" + +[starship] +src.git = "https://github.com/catppuccin/starship.git" +fetch.github = "catppuccin/starship" + +[sway] +src.git = "https://github.com/catppuccin/sway.git" +fetch.github = "catppuccin/sway" + +[tmux] +src.git = "https://github.com/catppuccin/tmux.git" +fetch.github = "catppuccin/tmux" diff --git a/test.nix b/test.nix new file mode 100644 index 0000000..c23eb85 --- /dev/null +++ b/test.nix @@ -0,0 +1,92 @@ +{ self +, inputs +, ... +}: +let + common = { + catppuccin.flavour = "mocha"; + users.users.test = { + isNormalUser = true; + home = "/home/test"; + }; + }; + + ctpEnable = { + enable = true; + catppuccin.enable = true; + }; +in +{ + name = "module-test"; + + nodes.machine = { lib, ... }: { + imports = [ + self.nixosModules.catppuccin + inputs.home-manager.nixosModules.default + common + ]; + + boot.loader.grub = ctpEnable; + + programs.dconf.enable = true; # required for gtk + + virtualisation = { + memorySize = 4096; + writableStore = true; + }; + + home-manager.users.test = { + imports = [ + self.homeManagerModules.catppuccin + ]; + + inherit (common) catppuccin; + + home = { + username = "test"; + stateVersion = lib.mkDefault "23.11"; + }; + + manual.manpages.enable = lib.mkDefault false; + + programs = { + alacritty = ctpEnable; + bat = ctpEnable; + bottom = ctpEnable; + btop = ctpEnable; + fish = ctpEnable; + glamour.catppuccin.enable = true; + helix = ctpEnable; + home-manager.enable = false; + kitty = ctpEnable; + lazygit = ctpEnable; + micro = ctpEnable; + neovim = ctpEnable; + starship = ctpEnable; + tmux = ctpEnable; + }; + + gtk = ctpEnable; + + services = { + mako = ctpEnable; + polybar = + ctpEnable + // { + script = '' + polybar top & + ''; + }; + }; + + wayland.windowManager.sway = ctpEnable; + }; + }; + + testScript = _: '' + machine.start() + machine.wait_for_unit("home-manager-test.service") + machine.wait_until_succeeds("systemctl status home-manager-test.service") + machine.succeed("echo \"system started!\"") + ''; +}