| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- { inputs
- , outputs
- ,
- }:
- let
- inherit (inputs) darwin devenv home-manager nixpkgs;
- inherit (nixpkgs) lib;
- # Helper to determine if a system is Darwin
- isDarwin = system: builtins.elem "darwin" (builtins.split "-" system);
- # Helper to get the appropriate nixpkgs for a system
- getPkgsForSystem = system:
- if isDarwin system
- then inputs.nixpkgs-darwin.legacyPackages.${system}
- else inputs.nixpkgs.legacyPackages.${system};
- in
- rec {
- mkSystem =
- { system
- , nixpkgs ? nixpkgs
- , modules ? [ ]
- ,
- }:
- lib.nixosSystem {
- inherit system modules nixpkgs;
- specialArgs = { inherit inputs outputs; };
- };
- mkDarwin =
- { system
- , modules ? [ ]
- ,
- }:
- darwin.lib.darwinSystem {
- inherit system modules;
- specialArgs = { inherit inputs outputs; };
- };
- mkHome =
- { system
- , modules ? [ ]
- ,
- }:
- home-manager.lib.homeManagerConfiguration {
- inherit modules;
- pkgs = getPkgsForSystem system;
- extraSpecialArgs = { inherit inputs outputs; };
- };
- mkDevenvShell = config:
- eachSystemWithPkgs (
- { pkgs }:
- lib.mapAttrs
- (
- _name: module:
- devenv.lib.mkShell {
- inherit inputs pkgs;
- modules = [ module ];
- }
- )
- config
- );
- eachSystem = lib.genAttrs [
- "x86_64-linux"
- "x86_64-darwin"
- "aarch64-linux"
- "aarch64-darwin"
- ];
- eachSystemWithPkgs = f:
- eachSystem (
- system:
- f {
- pkgs = getPkgsForSystem system;
- }
- );
- print = text:
- let
- json = builtins.toJSON text;
- in
- builtins.trace (builtins.fromJSON json) (builtins.fromJSON json);
- }
|