Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add enable option globally #124

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions dev/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions dev/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};

get-flake.url = "github:ursi/get-flake";
};

outputs = { self, nixpkgs, get-flake, ... }@inputs:
outputs = { self, nixpkgs, ... }@inputs:
let
systems = [
"x86_64-linux"
Expand All @@ -24,11 +22,10 @@
inherit (nixpkgs) lib;

forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s});
ctp = get-flake ../.;
in
{
checks = forAllSystems (pkgs: lib.optionalAttrs pkgs.stdenv.isLinux {
module-vm-test = pkgs.nixosTest (import ../test.nix { inherit ctp inputs; });
module-vm-test = pkgs.nixosTest (import ../test.nix inputs);
});

formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt);
Expand Down Expand Up @@ -57,8 +54,8 @@
'';
in
{
nixos-doc = mkDoc "nixos" ctp.nixosModules.catppuccin;
home-manager-doc = mkDoc "home-manager" ctp.homeManagerModules.catppuccin;
nixos-doc = mkDoc "nixos" ../modules/nixos;
home-manager-doc = mkDoc "home-manager" ../modules/home-manager;

default = self.packages.${pkgs.system}.home-manager-doc;
});
Expand Down
2 changes: 2 additions & 0 deletions modules/home-manager/globals.nix
getchoo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ lib, ... }: {
options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally";

flavour = lib.mkOption {
type = lib.ctp.types.flavourOption;
default = "latte";
Expand Down
4 changes: 3 additions & 1 deletion modules/lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ in
# be the name of the module, followed by the local config
# attrset
mkCatppuccinOpt = name: {
enable = lib.mkEnableOption "Catppuccin theme";
enable = lib.mkEnableOption "Catppuccin theme" // {
default = config.catppuccin.enable;
};
flavour = mkFlavourOpt name;
};

Expand Down
2 changes: 2 additions & 0 deletions modules/nixos/globals.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ lib, ... }: {
options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally";

flavour = lib.mkOption {
type = lib.ctp.types.flavourOption;
default = "latte";
Expand Down
109 changes: 53 additions & 56 deletions test.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
{ ctp
, inputs
, ...
}:
inputs:
let
common = {
catppuccin.flavour = "mocha";
users.users.test = {
isNormalUser = true;
home = "/home/test";
catppuccin = {
enable = true;
flavour = "mocha";
};
};

ctpEnable = {
enable = true;
catppuccin.enable = true;
};
# shorthand enable
enable = { enable = true; };
in
{
name = "module-test";

nodes.machine = { lib, ... }: {
imports = [
ctp.nixosModules.catppuccin
inputs.home-manager.nixosModules.default
./modules/nixos
common
];

boot.loader.grub = ctpEnable;
boot.loader.grub = enable;

console = ctpEnable;
console = enable;

programs.dconf.enable = true; # required for gtk
programs.dconf = enable; # required for gtk

users.users.test = {
isNormalUser = true;
home = "/home/test";
};

virtualisation = {
memorySize = 4096;
Expand All @@ -39,11 +38,10 @@ in

home-manager.users.test = {
imports = [
ctp.homeManagerModules.catppuccin
./modules/home-manager
common
];

inherit (common) catppuccin;

xdg.enable = true;

home = {
Expand All @@ -53,58 +51,57 @@ in

manual.manpages.enable = lib.mkDefault false;

i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.catppuccin.enable = true;
};
i18n.inputMethod.enabled = "fcitx5";

programs = {
alacritty = ctpEnable;
bat = ctpEnable;
bottom = ctpEnable;
btop = ctpEnable;
cava = ctpEnable;
fish = ctpEnable;
foot = ctpEnable;
fzf = ctpEnable;
git.enable = true; # Required for delta
git.delta = ctpEnable;
gitui = ctpEnable;
alacritty = enable;
bat = enable;
bottom = enable;
btop = enable;
cava = enable;
fish = enable;
foot = enable;
fzf = enable;
git = enable // {
delta = enable;
};
gitui = enable;
# this is enabled by default already, but still
# listing explicitly so we know it's tested
glamour.catppuccin.enable = true;
helix = ctpEnable;
home-manager.enable = false;
imv = ctpEnable;
k9s = ctpEnable;
kitty = ctpEnable;
lazygit = ctpEnable;
micro = ctpEnable;
mpv = ctpEnable;
neovim = ctpEnable;
rio = ctpEnable;
rofi = ctpEnable;
starship = ctpEnable;
swaylock = ctpEnable;
tmux = ctpEnable;
yazi = ctpEnable;
zathura = ctpEnable;
helix = enable;
imv = enable;
k9s = enable;
kitty = enable;
lazygit = enable;
micro = enable;
mpv = enable;
neovim = enable;
rio = enable;
rofi = enable;
starship = enable;
swaylock = enable;
tmux = enable;
yazi = enable;
zathura = enable;
};

gtk = lib.recursiveUpdate ctpEnable { catppuccin.cursor.enable = true; };
gtk = lib.recursiveUpdate enable { catppuccin.cursor.enable = true; };

services = {
dunst = ctpEnable;
mako = ctpEnable;
dunst = enable;
mako = enable;
polybar =
ctpEnable
enable
// {
script = ''
polybar top &
'';
};
};

wayland.windowManager.sway = ctpEnable;
wayland.windowManager.hyprland = ctpEnable;
wayland.windowManager.sway = enable;
wayland.windowManager.hyprland = enable;
};
};

Expand Down