Skip to content

Commit

Permalink
feat: remove all IFD
Browse files Browse the repository at this point in the history
by moving all upstream repos to our flake inputs, we no longer need
to have [IFD](https://nixos.wiki/wiki/Import_From_Derivation) in our
modules - making evaluation faster for all configurations
  • Loading branch information
getchoo committed Jul 30, 2023
1 parent a60d227 commit 0c5e54b
Show file tree
Hide file tree
Showing 18 changed files with 328 additions and 167 deletions.
172 changes: 171 additions & 1 deletion flake.lock

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

99 changes: 44 additions & 55 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,51 @@
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, ... }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

inherit (nixpkgs) lib;

forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s});
nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; });
in
{
formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt);

homeManagerModules.catppuccin = import ./modules/home-manager nixpkgs;

nixosModules.catppuccin = import ./modules/nixos nixpkgs;

packages = forAllSystems (pkgs:
let
mkEval = module: lib.evalModules {
modules = [
module
{
_module = {
check = false;
args.lib = import ./modules/lib/mkExtLib.nix lib;
};
}
];
};

mkDoc = name: options:
let
doc = pkgs.nixosOptionsDoc {
options = lib.filterAttrs (n: _: n != "_module") options;
documentType = "none";
revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty";
};
in
pkgs.runCommand "${name}-module-doc.md" { } ''
cat ${doc.optionsCommonMark} > $out
'';
# home-manager
alacritty = {
url = "github:catppuccin/alacritty";
flake = false;
};
bat = {
url = "github:catppuccin/bat";
flake = false;
};
bottom = {
url = "github:catppuccin/bottom";
flake = false;
};
btop = {
url = "github:catppuccin/btop";
flake = false;
};
helix = {
url = "github:catppuccin/helix";
flake = false;
};
lazygit = {
url = "github:catppuccin/lazygit";
flake = false;
};
polybar = {
url = "github:catppuccin/polybar";
flake = false;
};
starship = {
url = "github:catppuccin/starship";
flake = false;
};
sway = {
url = "github:catppuccin/sway";
flake = false;
};

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
grub = {
url = "github:catppuccin/grub";
flake = false;
};
};

outputs = inputs: (import ./outputs.nix inputs); # yes these parantheseis are unneeded, but i wanted to get around a statix warning
}
15 changes: 15 additions & 0 deletions inputs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
# home-manager
alacritty = "github:catppuccin/alacritty";
bat = "github:catppuccin/bat";
bottom = "github:catppuccin/bottom";
btop = "github:catppuccin/btop";
helix = "github:catppuccin/helix";
lazygit = "github:catppuccin/lazygit";
polybar = "github:catppuccin/polybar";
starship = "github:catppuccin/starship";
sway = "github:catppuccin/sway";

# nixos
grub = "github:catppuccin/grub";
}
11 changes: 2 additions & 9 deletions modules/home-manager/alacritty.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ config
, pkgs
, lib
, inputs
, ...
}:
let
Expand All @@ -14,15 +15,7 @@ in

config.programs.alacritty.settings =
let
file =
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "alacritty";
rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17";
sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0=";
}
+ "/catppuccin-${cfg.flavour}.yml";
file = "${inputs.alacritty}/catppuccin-${cfg.flavour}.yml";
in
lib.mkIf enable (ctp.fromYaml pkgs file);
}
11 changes: 2 additions & 9 deletions modules/home-manager/bat.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ config
, pkgs
, lib
, inputs
, ...
}:
let
Expand All @@ -14,14 +14,7 @@ in
config = {
programs.bat = lib.mkIf enable {
config.theme = "Catppuccin-${cfg.flavour}";
themes."Catppuccin-${cfg.flavour}" = builtins.readFile (pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
}
+ "/Catppuccin-${cfg.flavour}.tmTheme");
themes."Catppuccin-${cfg.flavour}" = builtins.readFile "${inputs.bat}/Catppuccin-${cfg.flavour}.tmTheme";
};
};
}
11 changes: 2 additions & 9 deletions modules/home-manager/bottom.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ config
, pkgs
, lib
, inputs
, ...
}:
let
Expand All @@ -12,12 +12,5 @@ in
options.programs.bottom.catppuccin =
lib.ctp.mkCatppuccinOpt "bottom" config;

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.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile "${inputs.bottom}/themes/${cfg.flavour}.toml"));
}
Loading

0 comments on commit 0c5e54b

Please sign in to comment.