refactor: do not depend on inputs for modules

This commit is contained in:
Youwen Wu 2024-12-25 22:33:04 -08:00
parent dbc5fbd875
commit 8424b025f6
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
11 changed files with 87 additions and 39 deletions

View file

@ -118,11 +118,17 @@
# "aarch64-darwin" # "aarch64-darwin"
# aarch64-darwin is currently disabled due to lack of maintenance # aarch64-darwin is currently disabled due to lack of maintenance
]; ];
flake = { flake = rec {
nixosConfigurations = { nixosConfigurations = {
demeter = buildLiminalOS { demeter = nixpkgs.lib.nixosSystem {
inherit inputs nixpkgs; specialArgs = {
systemModule = ./reference/hosts/demeter; liminalSystemModules = nixosModules;
liminalHomeManagerModules = homeManagerModules;
inherit inputs;
};
modules = [
./reference/hosts/demeter
];
}; };
callisto = buildLiminalOS { callisto = buildLiminalOS {
inherit nixpkgs inputs; inherit nixpkgs inputs;
@ -145,12 +151,33 @@
./hosts/phobos ./hosts/phobos
]; ];
}; };
nixosModules = rec {
inherit (inputs)
home-manager
nixos-wsl
stylix
nix-flatpak
;
default = liminalOS;
liminalOS = ./modules/default.nix;
};
homeManagerModules = rec {
inherit (inputs)
spicetify
stylix
nix-index-database
zen-browser
;
default = liminalOS;
liminalOS = ./hm/modules/default.nix;
};
}; };
perSystem = perSystem =
{ {
pkgs, pkgs,
system, system,
config,
... ...
}: }:
{ {
@ -171,15 +198,6 @@
]; ];
}; };
nixosModules = {
default = config.nixosModules.liminalOS;
liminalOS = ./modules/default.nix;
};
homeManagerModules = {
default = config.homeManagerModules.liminalOS;
liminalOS = ./hm/modules/default.nix;
};
}; };
}; };
} }

View file

@ -1,5 +1,6 @@
{ {
inputs, liminalHomeManagerModules,
liminalSystemModules,
config, config,
lib, lib,
... ...
@ -9,7 +10,7 @@ let
in in
{ {
imports = [ imports = [
inputs.home-manager.nixosModules.home-manager liminalSystemModules.home-manager.nixosModules.home-manager
]; ];
options.liminalOS.integrateHomeManager = lib.mkOption { options.liminalOS.integrateHomeManager = lib.mkOption {
@ -24,6 +25,6 @@ in
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
backupFileExtension = "backup"; backupFileExtension = "backup";
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit liminalHomeManagerModules; };
}; };
} }

View file

@ -1,7 +1,7 @@
{ {
config, config,
lib, lib,
inputs, liminalHomeManagerModules,
pkgs, pkgs,
osConfig, osConfig,
... ...
@ -11,7 +11,7 @@ let
in in
{ {
imports = [ imports = [
inputs.nix-index-database.hmModules.nix-index liminalHomeManagerModules.nix-index-database.hmModules.nix-index
./fastfetch ./fastfetch
]; ];

View file

@ -1,5 +1,4 @@
{ {
inputs,
lib, lib,
config, config,
osConfig, osConfig,
@ -25,8 +24,6 @@ in
}; };
config = { config = {
services.tlp.enable = lib.mkIf (cfg.formFactor == "laptop") true;
programs.light.enable = lib.mkIf (cfg.formFactor == "laptop") true;
assertions = [ assertions = [
{ {
assertion = cfg.formFactor != null; assertion = cfg.formFactor != null;

View file

@ -1,6 +1,6 @@
{ {
pkgs, pkgs,
inputs, liminalHomeManagerModules,
config, config,
lib, lib,
... ...
@ -85,11 +85,11 @@ in
}; };
home.packages = lib.mkIf cfg.zen.enable [ home.packages = lib.mkIf cfg.zen.enable [
inputs.zen-browser.packages.${pkgs.system}.default liminalHomeManagerModules.zen-browser.packages.${pkgs.system}.default
]; ];
home.sessionVariables.DEFAULT_BROWSER = lib.mkIf cfg.zen.enable "${ home.sessionVariables.DEFAULT_BROWSER = lib.mkIf cfg.zen.enable "${
inputs.zen-browser.packages.${pkgs.system}.default liminalHomeManagerModules.zen-browser.packages.${pkgs.system}.default
}/bin/zen"; }/bin/zen";
}; };
} }

View file

@ -1,5 +1,5 @@
{ {
inputs, liminalHomeManagerModules,
pkgs, pkgs,
config, config,
osConfig, osConfig,
@ -7,11 +7,11 @@
... ...
}: }:
let let
spicepkgs = inputs.spicetify.legacyPackages.${pkgs.system}; spicepkgs = liminalHomeManagerModules.spicetify.legacyPackages.${pkgs.system};
in in
{ {
imports = [ imports = [
inputs.spicetify.homeManagerModules.default liminalHomeManagerModules.spicetify.homeManagerModules.default
]; ];
config = lib.mkIf (config.liminalOS.programs.enable && osConfig.liminalOS.config.allowUnfree) { config = lib.mkIf (config.liminalOS.programs.enable && osConfig.liminalOS.config.allowUnfree) {

View file

@ -3,7 +3,7 @@
# persist between generations. This is not ideal, but at least it is a better # persist between generations. This is not ideal, but at least it is a better
# situation than imperative installation # situation than imperative installation
{ {
inputs, liminalSystemModules,
config, config,
lib, lib,
... ...
@ -13,7 +13,7 @@ let
in in
{ {
imports = [ imports = [
inputs.nix-flatpak.nixosModules.nix-flatpak liminalSystemModules.nix-flatpak.nixosModules.nix-flatpak
]; ];
options.liminalOS.programs.flatpak = { options.liminalOS.programs.flatpak = {

View file

@ -103,6 +103,9 @@ in
) )
); );
services.tlp.enable = lib.mkIf (cfg.formFactor == "laptop") true;
programs.light.enable = lib.mkIf (cfg.formFactor == "laptop") true;
environment.variables.EDITOR = lib.mkIf ( environment.variables.EDITOR = lib.mkIf (
cfg.defaultEditor != null cfg.defaultEditor != null
) cfg.defaultEditor.meta.mainProgram; ) cfg.defaultEditor.meta.mainProgram;

View file

@ -1,5 +1,5 @@
{ {
inputs, liminalSystemModules,
pkgs, pkgs,
config, config,
lib, lib,
@ -24,20 +24,45 @@ in
Whether to enable plymouth and sane defaults. Whether to enable plymouth and sane defaults.
''; '';
}; };
wallpaper = lib.mkOption {
type = lib.types.path;
default = "../../../hm/modules/common/shellenv/fastfetch/nixos-logo.png";
description = ''
Path to wallpaper to set as background and generate system colorscehme from.
'';
};
polarity = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"light"
"dark"
]
);
default = null;
description = ''
Whether to force colorscheme to be generated as light or dark theme. Set to null to automatically determine.
'';
};
base16Scheme = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Base 16 colorscheme from base16-schemes to override wallpaper generated colorscheme with. Set to null to use wallpaper generated scheme.
Example: ''${pkgs.base16-schemes}/share/themes/rose-pine.yaml
'';
};
}; };
imports = [ imports = [
inputs.stylix.nixosModules.stylix liminalSystemModules.stylix.nixosModules.stylix
]; ];
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
stylix = { stylix = {
enable = true; enable = true;
image = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png"; image = lib.mkIf (cfg.wallpaper != null) cfg.wallpaper;
# image = "${inputs.wallpapers}/aesthetic/red_deadly_sun.jpg"; base16Scheme = lib.mkIf (cfg.base16Scheme != null) cfg.base16Scheme;
# image = "${inputs.wallpapers}/aesthetic/afterglow_sand_dunes.jpg"; polarity = lib.mkIf (cfg.polarity != null) cfg.polarity;
base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine.yaml";
polarity = "dark";
fonts = { fonts = {
serif = { serif = {

View file

@ -1,5 +1,5 @@
{ {
inputs, liminalSystemModules,
config, config,
lib, lib,
... ...
@ -9,7 +9,7 @@ let
in in
{ {
imports = [ imports = [
inputs.nixos-wsl.nixosModules.default liminalSystemModules.nixos-wsl.nixosModules.default
]; ];
options.liminalOS.wsl = { options.liminalOS.wsl = {

View file

@ -19,6 +19,10 @@
config.allowUnfree = true; config.allowUnfree = true;
defaultEditor = inputs.viminal.packages.${pkgs.system}.default; defaultEditor = inputs.viminal.packages.${pkgs.system}.default;
formFactor = "desktop"; formFactor = "desktop";
theming = {
wallpaper = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png";
base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine.yaml";
};
system = { system = {
audio.prod.enable = true; audio.prod.enable = true;
networking = { networking = {