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,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
home-manager,
|
|
||||||
flake-utils,
|
|
||||||
chaotic,
|
chaotic,
|
||||||
...
|
...
|
||||||
}@inputs:
|
}@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:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [ self.overlays.default ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Extend lib with play utilities
|
|
||||||
lib = nixpkgs.lib.extend (
|
|
||||||
final: prev: {
|
|
||||||
play = import ./lib { lib = final; };
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = {
|
|
||||||
proton-cachyos = pkgs.callPackage ./pkgs/proton-cachyos { };
|
proton-cachyos = pkgs.callPackage ./pkgs/proton-cachyos { };
|
||||||
default = self.packages.${system}.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
|
# Overlay for packages
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
inputs: {
|
self: {
|
||||||
imports = [
|
imports = [
|
||||||
./monitors.nix
|
./monitors.nix
|
||||||
./gamescoperun.nix
|
./gamescoperun.nix
|
||||||
|
@ -6,5 +6,7 @@ inputs: {
|
||||||
];
|
];
|
||||||
|
|
||||||
# Pass inputs to all modules via _module.args
|
# 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
|
# Execute gamescope with the final arguments and the command
|
||||||
exec ${lib.getExe gamescopePackages.gamescope} $final_args -- $argv
|
exec ${lib.getExe gamescopePackages.gamescope} $final_args -- $argv
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.play.gamescoperun = {
|
options.play.gamescoperun = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
inputs: {
|
self: {
|
||||||
imports = [
|
imports = [
|
||||||
./amd.nix
|
./amd.nix
|
||||||
./ananicy.nix
|
./ananicy.nix
|
||||||
|
@ -8,5 +8,7 @@ inputs: {
|
||||||
];
|
];
|
||||||
|
|
||||||
# Pass inputs to all modules via _module.args
|
# 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