From 7ed47be803b244512aebbaab6d02bbfc9022b250 Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Mon, 23 Jan 2023 20:37:34 +0530 Subject: [PATCH] lib: init also added globalArgs Signed-off-by: Amneesh Singh --- flake.nix | 4 +++- home/default.nix | 7 ++----- home/natto/programs.nix | 4 +++- hosts/default.nix | 4 ---- lib/colors.nix | 41 +++++++++++++++++++++++++++++++++++++++++ lib/default.nix | 14 ++++++++++++++ 6 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 lib/colors.nix create mode 100644 lib/default.nix diff --git a/flake.nix b/flake.nix index e8dea20..0286bd3 100644 --- a/flake.nix +++ b/flake.nix @@ -32,13 +32,15 @@ hyprland.url = github:hyprwm/Hyprland; }; - outputs = inputs@{ self, nixpkgs, ... }: + outputs = inputs@{ self, ... }: inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" ]; + imports = [ ./hosts ./home ./pkgs + ./lib ]; perSystem = { pkgs, system, ... }: rec { diff --git a/home/default.nix b/home/default.nix index f2facf1..bb6fc08 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,4 +1,4 @@ -{ self, inputs, ... }: +{ self, inputs, globalArgs, ... }: { flake.homeConfigurations = { natto = inputs.home-manager.lib.homeManagerConfiguration { @@ -6,12 +6,9 @@ ./natto ./modules/secret.nix inputs.hyprland.homeManagerModules.default + globalArgs ]; pkgs = self.legacyPackages.x86_64-linux; - extraSpecialArgs = { - inherit inputs; - flake = self; - }; }; }; } diff --git a/home/natto/programs.nix b/home/natto/programs.nix index 0e0e28e..737d5de 100644 --- a/home/natto/programs.nix +++ b/home/natto/programs.nix @@ -24,6 +24,8 @@ go.enable = true; password-store.enable = true; direnv.enable = true; - foot.enable = false; + foot = { + enable = false; + }; }; } diff --git a/hosts/default.nix b/hosts/default.nix index 9ee0519..bf8ff0d 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,7 +1,6 @@ { self, inputs, ... }: let inherit (inputs) nixpkgs; - specialArgs = { inherit inputs; }; commonModules = [ ./modules/nvim ]; personalModules = [ ./modules/sound.nix ]; @@ -18,7 +17,6 @@ in #Home laptop satori = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - inherit specialArgs; modules = [ ./satori { nixpkgs.pkgs = self.legacyPackages.${system}; } @@ -30,7 +28,6 @@ in #Home server (RPi4) marisa = nixpkgs.lib.nixosSystem rec { system = "aarch64-linux"; - inherit specialArgs; modules = [ ./marisa { nixpkgs.pkgs = self.legacyPackages.${system}; } @@ -42,7 +39,6 @@ in #Oracle Cloud VM remilia = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - inherit specialArgs; modules = [ ./remilia inputs.mailserver.nixosModules.mailserver diff --git a/lib/colors.nix b/lib/colors.nix new file mode 100644 index 0000000..ff4e642 --- /dev/null +++ b/lib/colors.nix @@ -0,0 +1,41 @@ +#Catpuccin Mocha +let + colors = rec{ + rosewater = "#F5E0DC"; + flamingo = "#F2CDCD"; + pink = "#F5C2E7"; + mauve = "#CBA6F7"; + red = "#F38BA8"; + maroon = "#EBA0AC"; + peach = "#FAB387"; + yellow = "#F9E2AF"; + green = "#A6E3A1"; + teal = "#94E2D5"; + sky = "#89DCEB"; + sapphire = "#74C7EC"; + blue = "#89B4FA"; + lavender = "#B4BEFE"; + + text = "#CDD6F4"; + subtext1 = "#BAC2DE"; + subtext0 = "#A6ADC8"; + overlay2 = "#9399B2"; + overlay1 = "#7F849C"; + overlay0 = "#6C7086"; + surface2 = "#585B70"; + surface1 = "#45475A"; + surface0 = "#313244"; + + base = "#1E1E2E"; + mantle = "#181825"; + crust = "#11111B"; + + background = crust; + foreground = text; + }; +in +rec { + default = with builtins; mapAttrs (_: color: substring 1 6 color) colors; # hex without hash + hex = colors; # hex with hash + argb = { a ? "ff" }: builtins.mapAttrs (_:color: a + color) default; # ARGB +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..b63bc07 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,14 @@ +{ inputs, self, ... }: +{ + imports = [ + { + config._module.args.globalArgs = { + _module.args = { + inherit inputs self; + flake = self; + colors = import ./colors.nix; + }; + }; + } + ]; +}