Refactor module input to use self for better input handling
This commit is contained in:
parent
e3326913f1
commit
3f904de4da
4 changed files with 39 additions and 39 deletions
61
flake.nix
61
flake.nix
|
@ -15,52 +15,49 @@
|
|||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
flake-utils,
|
||||
chaotic,
|
||||
...
|
||||
}@inputs:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
in
|
||||
{
|
||||
lib = import ./lib { inherit (nixpkgs) lib; };
|
||||
|
||||
nixosModules = {
|
||||
play = import ./modules/nixos self;
|
||||
default = self.nixosModules.play;
|
||||
};
|
||||
|
||||
homeManagerModules = {
|
||||
play = import ./modules/home self;
|
||||
default = self.homeManagerModules.play;
|
||||
};
|
||||
|
||||
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./test-config.nix
|
||||
self.nixosModules.play
|
||||
];
|
||||
};
|
||||
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
|
||||
# Extend lib with play utilities
|
||||
lib = nixpkgs.lib.extend (
|
||||
final: prev: {
|
||||
play = import ./lib { lib = final; };
|
||||
}
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
proton-cachyos = pkgs.callPackage ./pkgs/proton-cachyos { };
|
||||
default = self.packages.${system}.proton-cachyos;
|
||||
};
|
||||
|
||||
# Expose the extended lib
|
||||
lib = lib;
|
||||
}
|
||||
)
|
||||
// {
|
||||
homeManagerModules.play = import ./modules/home inputs;
|
||||
nixosModules.play = import ./modules/nixos inputs;
|
||||
|
||||
# Default module (home-manager)
|
||||
homeManagerModules.default = self.homeManagerModules.play;
|
||||
|
||||
# Test configuration
|
||||
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
self.nixosModules.play
|
||||
./test-config.nix
|
||||
];
|
||||
};
|
||||
);
|
||||
|
||||
# Overlay for packages
|
||||
overlays.default = final: prev: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
inputs: {
|
||||
self: {
|
||||
imports = [
|
||||
./monitors.nix
|
||||
./gamescoperun.nix
|
||||
|
@ -6,5 +6,7 @@ inputs: {
|
|||
];
|
||||
|
||||
# Pass inputs to all modules via _module.args
|
||||
_module.args = { inherit inputs; };
|
||||
_module.args = {
|
||||
inputs = self.inputs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -129,7 +129,6 @@ let
|
|||
# Execute gamescope with the final arguments and the command
|
||||
exec ${lib.getExe gamescopePackages.gamescope} $final_args -- $argv
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
options.play.gamescoperun = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
inputs: {
|
||||
self: {
|
||||
imports = [
|
||||
./amd.nix
|
||||
./ananicy.nix
|
||||
|
@ -8,5 +8,7 @@ inputs: {
|
|||
];
|
||||
|
||||
# Pass inputs to all modules via _module.args
|
||||
_module.args = { inherit inputs; };
|
||||
_module.args = {
|
||||
inputs = self.inputs;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue