Update to (somewhat?) dendritic pattern
Heavily inspired by https://github.com/Doc-Steve/dendritic-design-with-flake-parts. > Atomic commits? Never heard of them!
This commit is contained in:
22
modules/nix/flake-parts/flake-file.nix
Normal file
22
modules/nix/flake-parts/flake-file.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ inputs, ... }: {
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.modules
|
||||
inputs.flake-file.flakeModules.default
|
||||
];
|
||||
|
||||
flake-file.inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-file.url = "github:vic/flake-file";
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
};
|
||||
|
||||
flake-file.outputs = ''
|
||||
inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)
|
||||
'';
|
||||
|
||||
systems = [
|
||||
# f Darwin >:(
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
}
|
||||
33
modules/nix/flake-parts/lib.nix
Normal file
33
modules/nix/flake-parts/lib.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ inputs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
# Helper functions for creating system / home-manager configurations
|
||||
|
||||
options.flake.lib = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.unspecified;
|
||||
default = { };
|
||||
};
|
||||
|
||||
config.flake.lib = {
|
||||
mkNixos = system: name: {
|
||||
${name} = inputs.nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
inputs.self.modules.nixos.${name}
|
||||
{ nixpkgs.hostPlatform = lib.mkDefault system; }
|
||||
{ nixpkgs.config.allowUnfree = true; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkHomeManager = system: name: {
|
||||
${name} = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
modules = [
|
||||
inputs.self.modules.homeManager.${name}
|
||||
{ nixpkgs.config.allowUnfree = true; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user