lib: init

also added globalArgs

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-01-23 20:37:34 +05:30
parent 969eb05a7a
commit 7ed47be803
6 changed files with 63 additions and 11 deletions

View File

@@ -32,13 +32,15 @@
hyprland.url = github:hyprwm/Hyprland; hyprland.url = github:hyprwm/Hyprland;
}; };
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } { inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ]; systems = [ "x86_64-linux" "aarch64-linux" ];
imports = [ imports = [
./hosts ./hosts
./home ./home
./pkgs ./pkgs
./lib
]; ];
perSystem = { pkgs, system, ... }: rec { perSystem = { pkgs, system, ... }: rec {

View File

@@ -1,4 +1,4 @@
{ self, inputs, ... }: { self, inputs, globalArgs, ... }:
{ {
flake.homeConfigurations = { flake.homeConfigurations = {
natto = inputs.home-manager.lib.homeManagerConfiguration { natto = inputs.home-manager.lib.homeManagerConfiguration {
@@ -6,12 +6,9 @@
./natto ./natto
./modules/secret.nix ./modules/secret.nix
inputs.hyprland.homeManagerModules.default inputs.hyprland.homeManagerModules.default
globalArgs
]; ];
pkgs = self.legacyPackages.x86_64-linux; pkgs = self.legacyPackages.x86_64-linux;
extraSpecialArgs = {
inherit inputs;
flake = self;
};
}; };
}; };
} }

View File

@@ -24,6 +24,8 @@
go.enable = true; go.enable = true;
password-store.enable = true; password-store.enable = true;
direnv.enable = true; direnv.enable = true;
foot.enable = false; foot = {
enable = false;
};
}; };
} }

View File

@@ -1,7 +1,6 @@
{ self, inputs, ... }: { self, inputs, ... }:
let let
inherit (inputs) nixpkgs; inherit (inputs) nixpkgs;
specialArgs = { inherit inputs; };
commonModules = [ ./modules/nvim ]; commonModules = [ ./modules/nvim ];
personalModules = [ ./modules/sound.nix ]; personalModules = [ ./modules/sound.nix ];
@@ -18,7 +17,6 @@ in
#Home laptop #Home laptop
satori = nixpkgs.lib.nixosSystem rec { satori = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
inherit specialArgs;
modules = [ modules = [
./satori ./satori
{ nixpkgs.pkgs = self.legacyPackages.${system}; } { nixpkgs.pkgs = self.legacyPackages.${system}; }
@@ -30,7 +28,6 @@ in
#Home server (RPi4) #Home server (RPi4)
marisa = nixpkgs.lib.nixosSystem rec { marisa = nixpkgs.lib.nixosSystem rec {
system = "aarch64-linux"; system = "aarch64-linux";
inherit specialArgs;
modules = [ modules = [
./marisa ./marisa
{ nixpkgs.pkgs = self.legacyPackages.${system}; } { nixpkgs.pkgs = self.legacyPackages.${system}; }
@@ -42,7 +39,6 @@ in
#Oracle Cloud VM #Oracle Cloud VM
remilia = nixpkgs.lib.nixosSystem rec { remilia = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
inherit specialArgs;
modules = [ modules = [
./remilia ./remilia
inputs.mailserver.nixosModules.mailserver inputs.mailserver.nixosModules.mailserver

41
lib/colors.nix Normal file
View File

@@ -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
}

14
lib/default.nix Normal file
View File

@@ -0,0 +1,14 @@
{ inputs, self, ... }:
{
imports = [
{
config._module.args.globalArgs = {
_module.args = {
inherit inputs self;
flake = self;
colors = import ./colors.nix;
};
};
}
];
}