mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05:58 -05:00
style(nix): apply nix fmt
Normalize formatting with the treefmt-based nix fmt configuration.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
options,
|
|
||||||
config,
|
config,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
inputs@{
|
inputs@{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
options,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
args@{
|
args@{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
options,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
core-inputs,
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
mapAttrs
|
mapAttrs
|
||||||
flatten
|
flatten
|
||||||
@@ -95,7 +91,7 @@ in
|
|||||||
let
|
let
|
||||||
merged = foldl merge-fn { } items;
|
merged = foldl merge-fn { } items;
|
||||||
in
|
in
|
||||||
merged // mapAttrs (name: value: merged.${value}) alias;
|
merged // mapAttrs (_name: value: merged.${value}) alias;
|
||||||
|
|
||||||
## Apply aliases and overrides to an already-merged attribute set.
|
## Apply aliases and overrides to an already-merged attribute set.
|
||||||
## Use this when you have a pre-built attribute set (e.g., from fix).
|
## Use this when you have a pre-built attribute set (e.g., from fix).
|
||||||
@@ -108,7 +104,7 @@ in
|
|||||||
apply-aliases-and-overrides =
|
apply-aliases-and-overrides =
|
||||||
items: alias: overrides:
|
items: alias: overrides:
|
||||||
let
|
let
|
||||||
aliased = mapAttrs (name: value: items.${value}) alias;
|
aliased = mapAttrs (_name: value: items.${value}) alias;
|
||||||
in
|
in
|
||||||
items // aliased // overrides;
|
items // aliased // overrides;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
snowfall-lib,
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
check = {
|
check = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ core-inputs: user-options:
|
|||||||
let
|
let
|
||||||
raw-snowfall-config = user-options.snowfall or { };
|
raw-snowfall-config = user-options.snowfall or { };
|
||||||
snowfall-config = raw-snowfall-config // {
|
snowfall-config = raw-snowfall-config // {
|
||||||
src = user-options.src;
|
inherit (user-options) src;
|
||||||
root = raw-snowfall-config.root or user-options.src;
|
root = raw-snowfall-config.root or user-options.src;
|
||||||
namespace = raw-snowfall-config.namespace or "internal";
|
namespace = raw-snowfall-config.namespace or "internal";
|
||||||
meta = {
|
meta = {
|
||||||
@@ -16,7 +16,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
user-inputs = user-options.inputs // {
|
user-inputs = user-options.inputs // {
|
||||||
src = user-options.src;
|
inherit (user-options) src;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
@@ -73,7 +73,7 @@ let
|
|||||||
snowfall-lib-dirs =
|
snowfall-lib-dirs =
|
||||||
let
|
let
|
||||||
files = builtins.readDir snowfall-lib-root;
|
files = builtins.readDir snowfall-lib-root;
|
||||||
dirs = filterAttrs (name: kind: kind == "directory") files;
|
dirs = filterAttrs (_name: kind: kind == "directory") files;
|
||||||
names = builtins.attrNames dirs;
|
names = builtins.attrNames dirs;
|
||||||
in
|
in
|
||||||
names;
|
names;
|
||||||
@@ -94,7 +94,7 @@ let
|
|||||||
merge-deep libs
|
merge-deep libs
|
||||||
);
|
);
|
||||||
|
|
||||||
snowfall-top-level-lib = filterAttrs (name: value: !builtins.isAttrs value) snowfall-lib;
|
snowfall-top-level-lib = filterAttrs (_name: value: !builtins.isAttrs value) snowfall-lib;
|
||||||
|
|
||||||
base-lib = merge-shallow [
|
base-lib = merge-shallow [
|
||||||
core-inputs.nixpkgs.lib
|
core-inputs.nixpkgs.lib
|
||||||
@@ -113,7 +113,7 @@ let
|
|||||||
attrs = {
|
attrs = {
|
||||||
inherit (user-options) inputs;
|
inherit (user-options) inputs;
|
||||||
snowfall-inputs = core-inputs;
|
snowfall-inputs = core-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
lib = merge-shallow [
|
lib = merge-shallow [
|
||||||
base-lib
|
base-lib
|
||||||
{ ${snowfall-config.namespace} = user-lib; }
|
{ ${snowfall-config.namespace} = user-lib; }
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
|
||||||
foldl
|
|
||||||
filterAttrs
|
filterAttrs
|
||||||
const
|
const
|
||||||
mapAttrs
|
mapAttrs
|
||||||
@@ -15,11 +13,9 @@ let
|
|||||||
hasSuffix
|
hasSuffix
|
||||||
removeSuffix
|
removeSuffix
|
||||||
nameValuePair
|
nameValuePair
|
||||||
traceVal
|
|
||||||
pipe
|
pipe
|
||||||
;
|
;
|
||||||
in
|
|
||||||
let
|
|
||||||
flake =
|
flake =
|
||||||
let
|
let
|
||||||
## Remove the `self` attribute from an attribute set.
|
## Remove the `self` attribute from an attribute set.
|
||||||
@@ -103,8 +99,8 @@ let
|
|||||||
get-libs =
|
get-libs =
|
||||||
attrs:
|
attrs:
|
||||||
pipe attrs [
|
pipe attrs [
|
||||||
(filterAttrs (name: value: builtins.isAttrs (value.lib or null)))
|
(filterAttrs (_name: value: builtins.isAttrs (value.lib or null)))
|
||||||
(mapAttrs (name: value: value.lib))
|
(mapAttrs (_name: value: value.lib))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -191,7 +187,7 @@ let
|
|||||||
channelsConfig = full-flake-options.channels-config or full-flake-options.channelsConfig or { };
|
channelsConfig = full-flake-options.channels-config or full-flake-options.channelsConfig or { };
|
||||||
|
|
||||||
channels = mapAttrs (
|
channels = mapAttrs (
|
||||||
channel: config:
|
_channel: config:
|
||||||
config
|
config
|
||||||
// {
|
// {
|
||||||
overlaysBuilder = snowfall-lib.overlay.create-overlays-builder {
|
overlaysBuilder = snowfall-lib.overlay.create-overlays-builder {
|
||||||
@@ -206,7 +202,7 @@ let
|
|||||||
snowfall = {
|
snowfall = {
|
||||||
config = snowfall-config;
|
config = snowfall-config;
|
||||||
raw-config = full-flake-options.snowfall or { };
|
raw-config = full-flake-options.snowfall or { };
|
||||||
user-lib = snowfall-lib.internal.user-lib;
|
inherit (snowfall-lib.internal) user-lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
core-inputs,
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins) baseNameOf dirOf;
|
|
||||||
inherit (core-inputs.nixpkgs.lib) id foldr flip;
|
inherit (core-inputs.nixpkgs.lib) id foldr flip;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -35,7 +31,7 @@ in
|
|||||||
## 1
|
## 1
|
||||||
## ```
|
## ```
|
||||||
#@ (a -> b) -> a -> b
|
#@ (a -> b) -> a -> b
|
||||||
call = f: x: f x;
|
call = f: f;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit compose call;
|
inherit compose call;
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins) readDir pathExists;
|
inherit (builtins) readDir pathExists;
|
||||||
inherit (core-inputs) flake-utils-plus;
|
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
|
||||||
filterAttrs
|
filterAttrs
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
flatten
|
|
||||||
pipe
|
pipe
|
||||||
;
|
;
|
||||||
|
|
||||||
file-name-regex = "(.*)\\.(.*)$";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fs = rec {
|
fs = rec {
|
||||||
@@ -95,7 +90,7 @@ in
|
|||||||
get-entries-by-kind =
|
get-entries-by-kind =
|
||||||
kind-predicate: path:
|
kind-predicate: path:
|
||||||
pipe (safe-read-directory path) [
|
pipe (safe-read-directory path) [
|
||||||
(filterAttrs (name: kind: kind-predicate kind))
|
(filterAttrs (_name: kind-predicate))
|
||||||
(mapAttrsToList (name: _: "${path}/${name}"))
|
(mapAttrsToList (name: _: "${path}/${name}"))
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -151,7 +146,7 @@ in
|
|||||||
let
|
let
|
||||||
entries = safe-read-directory path;
|
entries = safe-read-directory path;
|
||||||
filtered-entries = filterAttrs (
|
filtered-entries = filterAttrs (
|
||||||
name: kind: (is-file-kind kind) || (is-directory-kind kind)
|
_name: kind: (is-file-kind kind) || (is-directory-kind kind)
|
||||||
) entries;
|
) entries;
|
||||||
map-file =
|
map-file =
|
||||||
name: kind:
|
name: kind:
|
||||||
|
|||||||
@@ -9,23 +9,12 @@ let
|
|||||||
assertMsg
|
assertMsg
|
||||||
foldl
|
foldl
|
||||||
head
|
head
|
||||||
tail
|
|
||||||
concatMap
|
concatMap
|
||||||
optionalAttrs
|
|
||||||
optional
|
|
||||||
mkIf
|
mkIf
|
||||||
filterAttrs
|
|
||||||
mapAttrs'
|
|
||||||
mkMerge
|
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
optionals
|
|
||||||
mkDefault
|
mkDefault
|
||||||
mkAliasDefinitions
|
|
||||||
mkAliasAndWrapDefinitions
|
mkAliasAndWrapDefinitions
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
hasInfix
|
hasInfix
|
||||||
hasSuffix
|
|
||||||
pipe
|
pipe
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -41,13 +30,13 @@ in
|
|||||||
# not exist.
|
# not exist.
|
||||||
if user-inputs ? home-manager then
|
if user-inputs ? home-manager then
|
||||||
snowfall-lib.internal.system-lib.extend (
|
snowfall-lib.internal.system-lib.extend (
|
||||||
final: prev:
|
_final: prev:
|
||||||
# NOTE: This order is important, this library's extend and other utilities must write
|
# NOTE: This order is important, this library's extend and other utilities must write
|
||||||
# _over_ the original `system-lib`.
|
# _over_ the original `system-lib`.
|
||||||
snowfall-lib.internal.system-lib
|
snowfall-lib.internal.system-lib
|
||||||
// prev
|
// prev
|
||||||
// {
|
// {
|
||||||
hm = snowfall-lib.internal.system-lib.home-manager.hm;
|
inherit (snowfall-lib.internal.system-lib.home-manager) hm;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@@ -130,7 +119,7 @@ in
|
|||||||
format = "home";
|
format = "home";
|
||||||
|
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
|
|
||||||
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
||||||
inherit pkgs lib;
|
inherit pkgs lib;
|
||||||
@@ -226,7 +215,7 @@ in
|
|||||||
|
|
||||||
user-home-modules-list = mapAttrsToList (
|
user-home-modules-list = mapAttrsToList (
|
||||||
module-path: module:
|
module-path: module:
|
||||||
args@{ pkgs, ... }:
|
args:
|
||||||
(module args)
|
(module args)
|
||||||
// {
|
// {
|
||||||
_file = "${user-homes-root}/${module-path}/default.nix";
|
_file = "${user-homes-root}/${module-path}/default.nix";
|
||||||
@@ -296,8 +285,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
extra-special-args-module =
|
extra-special-args-module =
|
||||||
args@{
|
{
|
||||||
config,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
system ? pkgs.stdenv.hostPlatform.system,
|
system ? pkgs.stdenv.hostPlatform.system,
|
||||||
target ? system,
|
target ? system,
|
||||||
@@ -337,7 +325,7 @@ in
|
|||||||
other-modules = users.users.${name}.modules or [ ];
|
other-modules = users.users.${name}.modules or [ ];
|
||||||
user-name = created-user.specialArgs.user;
|
user-name = created-user.specialArgs.user;
|
||||||
in
|
in
|
||||||
args@{
|
{
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
pkgs,
|
pkgs,
|
||||||
@@ -392,7 +380,7 @@ in
|
|||||||
(
|
(
|
||||||
(users.users.${name}.specialArgs or { })
|
(users.users.${name}.specialArgs or { })
|
||||||
// {
|
// {
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
[
|
[
|
||||||
@@ -407,7 +395,7 @@ in
|
|||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
users.${user-name} = mkIf config.snowfallorg.users.${user-name}.home.enable (
|
users.${user-name} = mkIf config.snowfallorg.users.${user-name}.home.enable (
|
||||||
{ pkgs, ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
imports = (home-config.imports or [ ]) ++ other-modules ++ [ user-module ];
|
imports = (home-config.imports or [ ]) ++ other-modules ++ [ user-module ];
|
||||||
config = builtins.removeAttrs home-config [ "imports" ];
|
config = builtins.removeAttrs home-config [ "imports" ];
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
# This code is adapted from flake-utils-plus:
|
# This code is adapted from flake-utils-plus:
|
||||||
# https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a/lib/options.nix
|
# https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a/lib/options.nix
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
user-inputs,
|
|
||||||
core-inputs,
|
core-inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ let
|
|||||||
core-inputs-libs = snowfall-lib.flake.get-libs (snowfall-lib.flake.without-self core-inputs);
|
core-inputs-libs = snowfall-lib.flake.get-libs (snowfall-lib.flake.without-self core-inputs);
|
||||||
user-inputs-libs = snowfall-lib.flake.get-libs (snowfall-lib.flake.without-self user-inputs);
|
user-inputs-libs = snowfall-lib.flake.get-libs (snowfall-lib.flake.without-self user-inputs);
|
||||||
|
|
||||||
snowfall-top-level-lib = filterAttrs (name: value: !builtins.isAttrs value) snowfall-lib;
|
snowfall-top-level-lib = filterAttrs (_name: value: !builtins.isAttrs value) snowfall-lib;
|
||||||
|
|
||||||
base-lib = snowfall-lib.attrs.merge-shallow [
|
base-lib = snowfall-lib.attrs.merge-shallow [
|
||||||
core-inputs.nixpkgs.lib
|
core-inputs.nixpkgs.lib
|
||||||
@@ -36,7 +36,7 @@ let
|
|||||||
attrs = {
|
attrs = {
|
||||||
inputs = snowfall-lib.flake.without-snowfall-inputs user-inputs;
|
inputs = snowfall-lib.flake.without-snowfall-inputs user-inputs;
|
||||||
snowfall-inputs = core-inputs;
|
snowfall-inputs = core-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
lib = snowfall-lib.attrs.merge-shallow [
|
lib = snowfall-lib.attrs.merge-shallow [
|
||||||
base-lib
|
base-lib
|
||||||
{ "${snowfall-config.namespace}" = user-lib; }
|
{ "${snowfall-config.namespace}" = user-lib; }
|
||||||
@@ -86,7 +86,7 @@ in
|
|||||||
inherit channels;
|
inherit channels;
|
||||||
lib = system-lib;
|
lib = system-lib;
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
}
|
}
|
||||||
) item { };
|
) item { };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,14 +5,8 @@
|
|||||||
snowfall-config,
|
snowfall-config,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins) baseNameOf;
|
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
foldl
|
|
||||||
mapAttrs
|
|
||||||
hasSuffix
|
|
||||||
isFunction
|
isFunction
|
||||||
splitString
|
|
||||||
tail
|
|
||||||
;
|
;
|
||||||
|
|
||||||
user-modules-root = snowfall-lib.fs.get-snowfall-file "modules";
|
user-modules-root = snowfall-lib.fs.get-snowfall-file "modules";
|
||||||
@@ -49,7 +43,7 @@ in
|
|||||||
# NOTE: home-manager *requires* modules to specify named arguments or it will not
|
# NOTE: home-manager *requires* modules to specify named arguments or it will not
|
||||||
# pass values in. For this reason we must specify things like `pkgs` as a named attribute.
|
# pass values in. For this reason we must specify things like `pkgs` as a named attribute.
|
||||||
${metadata.name} =
|
${metadata.name} =
|
||||||
args@{ pkgs, ... }:
|
args:
|
||||||
let
|
let
|
||||||
system = args.system or args.pkgs.stdenv.hostPlatform.system;
|
system = args.system or args.pkgs.stdenv.hostPlatform.system;
|
||||||
target = args.target or system;
|
target = args.target or system;
|
||||||
@@ -74,7 +68,7 @@ in
|
|||||||
lib = snowfall-lib.internal.system-lib;
|
lib = snowfall-lib.internal.system-lib;
|
||||||
|
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
};
|
};
|
||||||
imported-user-module = import metadata.path;
|
imported-user-module = import metadata.path;
|
||||||
user-module =
|
user-module =
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
|
||||||
foldl
|
foldl
|
||||||
concatStringsSep
|
|
||||||
pipe
|
pipe
|
||||||
flatten
|
flatten
|
||||||
;
|
;
|
||||||
@@ -114,8 +112,7 @@ in
|
|||||||
${namespace} = (prev.${namespace} or { }) // user-packages;
|
${namespace} = (prev.${namespace} or { }) // user-packages;
|
||||||
};
|
};
|
||||||
|
|
||||||
create-overlay = (
|
create-overlay = overlays: file:
|
||||||
overlays: file:
|
|
||||||
let
|
let
|
||||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||||
@@ -145,20 +142,19 @@ in
|
|||||||
user-overlay-packages = user-overlay final prev-with-packages;
|
user-overlay-packages = user-overlay final prev-with-packages;
|
||||||
outputs = user-overlay-packages;
|
outputs = user-overlay-packages;
|
||||||
in
|
in
|
||||||
if user-overlay-packages.__dontExport or false == true then
|
if user-overlay-packages.__dontExport or false then
|
||||||
outputs // { __dontExport = true; }
|
outputs // { __dontExport = true; }
|
||||||
else
|
else
|
||||||
outputs;
|
outputs;
|
||||||
fake-overlay-result = overlay fake-pkgs fake-pkgs;
|
fake-overlay-result = overlay fake-pkgs fake-pkgs;
|
||||||
in
|
in
|
||||||
if fake-overlay-result.__dontExport or false == true then
|
if fake-overlay-result.__dontExport or false then
|
||||||
overlays
|
overlays
|
||||||
else
|
else
|
||||||
overlays
|
overlays
|
||||||
// {
|
// {
|
||||||
${name} = overlay;
|
${name} = overlay;
|
||||||
}
|
};
|
||||||
);
|
|
||||||
|
|
||||||
overlays = foldl create-overlay { } user-overlays;
|
overlays = foldl create-overlay { } user-overlays;
|
||||||
|
|
||||||
@@ -171,9 +167,8 @@ in
|
|||||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
||||||
overlay =
|
overlay =
|
||||||
final: prev:
|
_final: prev:
|
||||||
let
|
let
|
||||||
channels = channel-systems.${prev.system};
|
|
||||||
packages = snowfall-lib.package.create-packages {
|
packages = snowfall-lib.package.create-packages {
|
||||||
inherit namespace;
|
inherit namespace;
|
||||||
channels = channel-systems.${prev.system};
|
channels = channel-systems.${prev.system};
|
||||||
|
|||||||
@@ -5,13 +5,10 @@
|
|||||||
snowfall-config,
|
snowfall-config,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (core-inputs.flake-utils-plus.lib) filterPackages allSystems;
|
inherit (core-inputs.flake-utils-plus.lib) filterPackages;
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
|
||||||
fix
|
fix
|
||||||
foldl
|
foldl
|
||||||
mapAttrs
|
|
||||||
filterAttrs
|
|
||||||
callPackageWith
|
callPackageWith
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
core-inputs,
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
snowfall-lib,
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins)
|
inherit (builtins)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
snowfall-lib,
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
shell = {
|
shell = {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
snowfall-config,
|
snowfall-config,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins) dirOf baseNameOf;
|
inherit (builtins) baseNameOf;
|
||||||
inherit (core-inputs.nixpkgs.lib)
|
inherit (core-inputs.nixpkgs.lib)
|
||||||
assertMsg
|
assertMsg
|
||||||
fix
|
fix
|
||||||
@@ -13,7 +13,6 @@ let
|
|||||||
concatMap
|
concatMap
|
||||||
foldl
|
foldl
|
||||||
optionals
|
optionals
|
||||||
singleton
|
|
||||||
;
|
;
|
||||||
|
|
||||||
virtual-systems = import ./virtual-systems.nix;
|
virtual-systems = import ./virtual-systems.nix;
|
||||||
@@ -291,7 +290,7 @@ in
|
|||||||
|
|
||||||
virtual = (get-virtual-system-type target) != "";
|
virtual = (get-virtual-system-type target) != "";
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
namespace = snowfall-config.namespace;
|
inherit (snowfall-config) namespace;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ args@{
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = core-inputs.nixpkgs.lib;
|
inherit (core-inputs.nixpkgs) lib;
|
||||||
nixosModulesPath = core-inputs.nixpkgs + "/nixos/modules";
|
nixosModulesPath = core-inputs.nixpkgs + "/nixos/modules";
|
||||||
|
|
||||||
nixosArgs = builtins.removeAttrs args [ "format" ];
|
nixosArgs = builtins.removeAttrs args [ "format" ];
|
||||||
@@ -57,7 +57,7 @@ let
|
|||||||
getImageVariant =
|
getImageVariant =
|
||||||
variant:
|
variant:
|
||||||
let
|
let
|
||||||
config = (mkSystem [ ]).config;
|
inherit ((mkSystem [ ])) config;
|
||||||
images = getImages config;
|
images = getImages config;
|
||||||
in
|
in
|
||||||
assert lib.assertMsg (lib.hasAttr variant images)
|
assert lib.assertMsg (lib.hasAttr variant images)
|
||||||
@@ -176,7 +176,7 @@ let
|
|||||||
|
|
||||||
specialHandlers = {
|
specialHandlers = {
|
||||||
docker = (mkBuild [ dockerModule ]).tarball;
|
docker = (mkBuild [ dockerModule ]).tarball;
|
||||||
vm = (mkBuild [ vmModule ]).vm;
|
inherit ((mkBuild [ vmModule ])) vm;
|
||||||
vm-bootloader = (mkBuild [ vmBootloaderModule ]).vm;
|
vm-bootloader = (mkBuild [ vmBootloaderModule ]).vm;
|
||||||
vm-nogui = (mkBuild [ vmNoGuiModule ]).vm;
|
vm-nogui = (mkBuild [ vmNoGuiModule ]).vm;
|
||||||
iso = (mkBuild [ isoModule ]).isoImage;
|
iso = (mkBuild [ isoModule ]).isoImage;
|
||||||
@@ -186,7 +186,7 @@ let
|
|||||||
kexec-bundle = (mkBuild [ kexecBundleModule ]).kexec_bundle;
|
kexec-bundle = (mkBuild [ kexecBundleModule ]).kexec_bundle;
|
||||||
};
|
};
|
||||||
|
|
||||||
imageHandlers = lib.mapAttrs (_: variant: getImageVariant variant) imageVariants;
|
imageHandlers = lib.mapAttrs (_: getImageVariant) imageVariants;
|
||||||
formatHandlers = imageHandlers // specialHandlers;
|
formatHandlers = imageHandlers // specialHandlers;
|
||||||
in
|
in
|
||||||
formatHandlers.${format} or (throw "Unsupported virtual system format '${format}'.")
|
formatHandlers.${format} or (throw "Unsupported virtual system format '${format}'.")
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
{
|
{
|
||||||
core-inputs,
|
core-inputs,
|
||||||
user-inputs,
|
|
||||||
snowfall-lib,
|
snowfall-lib,
|
||||||
snowfall-config,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (builtins) baseNameOf;
|
|
||||||
inherit (core-inputs.nixpkgs.lib) assertMsg foldl mapAttrs;
|
|
||||||
|
|
||||||
user-templates-root = snowfall-lib.fs.get-snowfall-file "templates";
|
user-templates-root = snowfall-lib.fs.get-snowfall-file "templates";
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in New Issue
Block a user