mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05:58 -05:00
style: fmt
This commit is contained in:
159
flake.nix
159
flake.nix
@@ -11,89 +11,92 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
...
|
||||
} @ inputs: let
|
||||
core-inputs =
|
||||
inputs
|
||||
// {
|
||||
src = self;
|
||||
};
|
||||
|
||||
# Create the library, extending the nixpkgs library and merging
|
||||
# libraries from other inputs to make them available like
|
||||
# `lib.flake-utils-plus.mkApp`.
|
||||
# Usage: mkLib { inherit inputs; src = ./.; }
|
||||
# result: lib
|
||||
mkLib = import ./snowfall-lib core-inputs;
|
||||
|
||||
# A convenience wrapper to create the library and then call `lib.mkFlake`.
|
||||
# Usage: mkFlake { inherit inputs; src = ./.; ... }
|
||||
# result: <flake-outputs>
|
||||
mkFlake = flake-and-lib-options @ {
|
||||
inputs,
|
||||
src,
|
||||
snowfall ? {},
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
lib = mkLib {
|
||||
inherit inputs src snowfall;
|
||||
};
|
||||
flake-options = builtins.removeAttrs flake-and-lib-options ["inputs" "src"];
|
||||
in
|
||||
lib.mkFlake flake-options;
|
||||
in {
|
||||
inherit mkLib mkFlake;
|
||||
|
||||
nixosModules = {
|
||||
user = ./modules/nixos/user/default.nix;
|
||||
};
|
||||
|
||||
darwinModules = {
|
||||
user = ./modules/darwin/user/default.nix;
|
||||
};
|
||||
|
||||
homeModules = {
|
||||
user = ./modules/home/user/default.nix;
|
||||
};
|
||||
|
||||
formatter = {
|
||||
x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
|
||||
aarch64-linux = inputs.nixpkgs.legacyPackages.aarch64-linux.nixfmt-tree;
|
||||
x86_64-darwin = inputs.nixpkgs.legacyPackages.x86_64-darwin.nixfmt-tree;
|
||||
aarch64-darwin = inputs.nixpkgs.legacyPackages.aarch64-darwin.nixfmt-tree;
|
||||
};
|
||||
|
||||
snowfall = rec {
|
||||
raw-config = config;
|
||||
|
||||
config = {
|
||||
root = self;
|
||||
}@inputs:
|
||||
let
|
||||
core-inputs = inputs // {
|
||||
src = self;
|
||||
namespace = "snowfall";
|
||||
lib-dir = "snowfall-lib";
|
||||
|
||||
meta = {
|
||||
name = "snowfall-lib";
|
||||
title = "Snowfall Lib";
|
||||
};
|
||||
};
|
||||
|
||||
internal-lib = let
|
||||
lib = mkLib {
|
||||
src = self;
|
||||
# Create the library, extending the nixpkgs library and merging
|
||||
# libraries from other inputs to make them available like
|
||||
# `lib.flake-utils-plus.mkApp`.
|
||||
# Usage: mkLib { inherit inputs; src = ./.; }
|
||||
# result: lib
|
||||
mkLib = import ./snowfall-lib core-inputs;
|
||||
|
||||
inputs =
|
||||
inputs
|
||||
// {
|
||||
self = {};
|
||||
};
|
||||
# A convenience wrapper to create the library and then call `lib.mkFlake`.
|
||||
# Usage: mkFlake { inherit inputs; src = ./.; ... }
|
||||
# result: <flake-outputs>
|
||||
mkFlake =
|
||||
flake-and-lib-options@{
|
||||
inputs,
|
||||
src,
|
||||
snowfall ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
lib = mkLib {
|
||||
inherit inputs src snowfall;
|
||||
};
|
||||
flake-options = builtins.removeAttrs flake-and-lib-options [
|
||||
"inputs"
|
||||
"src"
|
||||
];
|
||||
in
|
||||
lib.mkFlake flake-options;
|
||||
in
|
||||
{
|
||||
inherit mkLib mkFlake;
|
||||
|
||||
nixosModules = {
|
||||
user = ./modules/nixos/user/default.nix;
|
||||
};
|
||||
|
||||
darwinModules = {
|
||||
user = ./modules/darwin/user/default.nix;
|
||||
};
|
||||
|
||||
homeModules = {
|
||||
user = ./modules/home/user/default.nix;
|
||||
};
|
||||
|
||||
formatter = {
|
||||
x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
|
||||
aarch64-linux = inputs.nixpkgs.legacyPackages.aarch64-linux.nixfmt-tree;
|
||||
x86_64-darwin = inputs.nixpkgs.legacyPackages.x86_64-darwin.nixfmt-tree;
|
||||
aarch64-darwin = inputs.nixpkgs.legacyPackages.aarch64-darwin.nixfmt-tree;
|
||||
};
|
||||
|
||||
snowfall = rec {
|
||||
raw-config = config;
|
||||
|
||||
config = {
|
||||
root = self;
|
||||
src = self;
|
||||
namespace = "snowfall";
|
||||
lib-dir = "snowfall-lib";
|
||||
|
||||
meta = {
|
||||
name = "snowfall-lib";
|
||||
title = "Snowfall Lib";
|
||||
};
|
||||
};
|
||||
in
|
||||
builtins.removeAttrs
|
||||
lib.snowfall
|
||||
["internal"];
|
||||
|
||||
internal-lib =
|
||||
let
|
||||
lib = mkLib {
|
||||
src = self;
|
||||
|
||||
inputs = inputs // {
|
||||
self = { };
|
||||
};
|
||||
};
|
||||
in
|
||||
builtins.removeAttrs lib.snowfall [ "internal" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user