Skip to content

Commit

Permalink
feat: limit use of IFD, add auto updates & vm testing (#40)
Browse files Browse the repository at this point in the history
* feat(modules): remove unnecessary IFD

by moving all upstream repos to our flake inputs, we no longer need
to have [IFD](https://nixos.wiki/wiki/Import_From_Derivation) in most
of our modules - making evaluation faster for all configurations. the
only remaining instances of IFD are in `lib.ctp.toYAML` and the themes
for kitty, which is due to it's use upstream in home-manager

* ci: start auto updating flake inputs

* ci: init basic vm tests

* ci: rename ci to format

* ci: use PAT for update-lock workflow

this is required to run tests such as test-vm after the pull request is
made

* fix(home-manager): make sure to use readFile in helix module

* ci: fix typo in test-vm

* ci: use verbose logging in test-vm & enable kvm

* docs: add flake inputs & vm testing to CONTRIBUTING.md

* feat(modules)!: use nvfetcher for upstream sources

* docs: add information about nvfetcher

* chore: don't include flake-compat in flake inputs

while this does make us lose out on easy updating, i think it's nice not
  have this as a required dependency for flake users

* chore: update flake inputs

Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/f58889c07efa8e1328fdf93dc1796ec2a5c47f38' (2023-07-29)
  → 'github:nix-community/home-manager/48b0a30202516e25d9885525fbb200a045f23f26' (2023-11-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28' (2023-07-28)
  → 'github:NixOS/nixpkgs/0cbe9f69c234a7700596e943bfae7ef27a31b735' (2023-10-29)

* chore: update nvfetcher sources

* refactor: don't instantiate nixpkgs in flake + cleanup vm test

* fix(home-manager): update paths from new lazygit theme revision

* feat(lib)!: use constant module arguments automatically
  • Loading branch information
getchoo authored Nov 2, 2023
1 parent 71f4a7d commit a30f0ff
Show file tree
Hide file tree
Showing 33 changed files with 983 additions and 228 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test-vm.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions .github/workflows/update-lock.yml
Original file line number Diff line number Diff line change
@@ -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"
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ Create a file in `modules/<module>/` 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.

<!-- This loooks the best with the changelog generator. -->
Commits that add ports should be of the format

Expand Down
Loading

0 comments on commit a30f0ff

Please sign in to comment.