mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-24 18:19:11 +00:00
chore: reformat codebase
This commit is contained in:
parent
2f389641cd
commit
44090d6257
@ -22,5 +22,6 @@
|
|||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode =
|
||||||
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
return {
|
return {
|
||||||
s(
|
s(
|
||||||
"today",
|
"today",
|
||||||
f(function()
|
f(function()
|
||||||
return os.date("%F")
|
return os.date("%F")
|
||||||
end)
|
end)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"retrieve",
|
"retrieve",
|
||||||
f(function()
|
f(function()
|
||||||
return string.format("(retrieved %s)", os.date("%F"))
|
return string.format("(retrieved %s)", os.date("%F"))
|
||||||
end)
|
end)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
{ trig = 'reldate (-?%d+) "(.+)"', regTrig = true },
|
{ trig = 'reldate (-?%d+) "(.+)"', regTrig = true },
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
-- The point is in number of days.
|
-- The point is in number of days.
|
||||||
local point = 60 * 60 * 24 * snip.captures[1]
|
local point = 60 * 60 * 24 * snip.captures[1]
|
||||||
|
|
||||||
local now = os.time()
|
local now = os.time()
|
||||||
return os.date(snip.captures[2], now + point)
|
return os.date(snip.captures[2], now + point)
|
||||||
end)
|
end)
|
||||||
),
|
),
|
||||||
|
|
||||||
s("#!", fmt("#!{}", i(1, "/usr/bin/env bash"))),
|
s("#!", fmt("#!{}", i(1, "/usr/bin/env bash"))),
|
||||||
|
|
||||||
parse("ie", "(i.e., $1)"),
|
parse("ie", "(i.e., $1)"),
|
||||||
parse("eg", "(e.g., $1)"),
|
parse("eg", "(e.g., $1)"),
|
||||||
}
|
}
|
||||||
|
@ -1,170 +1,170 @@
|
|||||||
function max_asciidoc_header(level)
|
function max_asciidoc_header(level)
|
||||||
return math.min(level, 6)
|
return math.min(level, 6)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
parse("bf", "**$1**"),
|
parse("bf", "**$1**"),
|
||||||
parse("it", "__$1__"),
|
parse("it", "__$1__"),
|
||||||
parse("sp", "^$1^"),
|
parse("sp", "^$1^"),
|
||||||
parse("sb", "~$1~"),
|
parse("sb", "~$1~"),
|
||||||
s(
|
s(
|
||||||
"tt",
|
"tt",
|
||||||
fmt("{}{}{}", {
|
fmt("{}{}{}", {
|
||||||
c(1, { t("`"), t("`+") }),
|
c(1, { t("`"), t("`+") }),
|
||||||
i(2, "TEXT"),
|
i(2, "TEXT"),
|
||||||
rep(1),
|
rep(1),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
parse("foot", "footnote:[$1]"),
|
parse("foot", "footnote:[$1]"),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"link",
|
"link",
|
||||||
fmt("link:{}[{}]", {
|
fmt("link:{}[{}]", {
|
||||||
i(1, "LINK"),
|
i(1, "LINK"),
|
||||||
rep(1),
|
rep(1),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
parse("var", ":$1: $2"),
|
parse("var", ":$1: $2"),
|
||||||
|
|
||||||
parse("audio", "audio::$1[$2]"),
|
parse("audio", "audio::$1[$2]"),
|
||||||
parse("video", "video::$1[$2]"),
|
parse("video", "video::$1[$2]"),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"img",
|
"img",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
.{}
|
.{}
|
||||||
image::{}[{}, {}]
|
image::{}[{}, {}]
|
||||||
{}
|
{}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1, "CAPTION"),
|
i(1, "CAPTION"),
|
||||||
i(2, "IMAGE_PATH"),
|
i(2, "IMAGE_PATH"),
|
||||||
i(3, "ALT_TEXT"),
|
i(3, "ALT_TEXT"),
|
||||||
i(4, "width=100%,height=100%"),
|
i(4, "width=100%,height=100%"),
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"fmt",
|
"fmt",
|
||||||
fmt("{}{}{}", {
|
fmt("{}{}{}", {
|
||||||
c(1, {
|
c(1, {
|
||||||
t("**"),
|
t("**"),
|
||||||
t("__"),
|
t("__"),
|
||||||
t("`"),
|
t("`"),
|
||||||
}),
|
}),
|
||||||
i(2),
|
i(2),
|
||||||
rep(1),
|
rep(1),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"dt",
|
"dt",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
{}::
|
{}::
|
||||||
{}
|
{}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1, "TERM"),
|
i(1, "TERM"),
|
||||||
i(2, "DEFINITION"),
|
i(2, "DEFINITION"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"src",
|
"src",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
[source, {}]
|
[source, {}]
|
||||||
----
|
----
|
||||||
{}
|
{}
|
||||||
----
|
----
|
||||||
{}
|
{}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1, "LANGUAGE"),
|
i(1, "LANGUAGE"),
|
||||||
i(2, "CODE"),
|
i(2, "CODE"),
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
{ trig = "h(%d)", regTrig = true },
|
{ trig = "h(%d)", regTrig = true },
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
{} {}
|
{} {}
|
||||||
{}
|
{}
|
||||||
{}
|
{}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
local level = max_asciidoc_header(snip.captures[1])
|
local level = max_asciidoc_header(snip.captures[1])
|
||||||
return string.rep("=", level)
|
return string.rep("=", level)
|
||||||
end),
|
end),
|
||||||
i(1, "CHAPTER"),
|
i(1, "CHAPTER"),
|
||||||
d(2, function(_, snip)
|
d(2, function(_, snip)
|
||||||
local nodes = {}
|
local nodes = {}
|
||||||
table.insert(nodes, t(""))
|
table.insert(nodes, t(""))
|
||||||
|
|
||||||
local level = max_asciidoc_header(snip.captures[1])
|
local level = max_asciidoc_header(snip.captures[1])
|
||||||
|
|
||||||
if level == 1 then
|
if level == 1 then
|
||||||
table.insert(nodes, t(":toc:"))
|
table.insert(nodes, t(":toc:"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local parent = c(1, nodes)
|
local parent = c(1, nodes)
|
||||||
if level > 1 then
|
if level > 1 then
|
||||||
parent = t("")
|
parent = t("")
|
||||||
end
|
end
|
||||||
|
|
||||||
return sn(nil, parent)
|
return sn(nil, parent)
|
||||||
end, {}),
|
end, {}),
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"admon",
|
"admon",
|
||||||
fmt("{}: {}", {
|
fmt("{}: {}", {
|
||||||
c(1, {
|
c(1, {
|
||||||
t("NOTE"),
|
t("NOTE"),
|
||||||
t("TIP"),
|
t("TIP"),
|
||||||
t("IMPORTANT"),
|
t("IMPORTANT"),
|
||||||
t("CAUTION"),
|
t("CAUTION"),
|
||||||
t("WARNING"),
|
t("WARNING"),
|
||||||
}),
|
}),
|
||||||
i(0),
|
i(0),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
"admonB",
|
"admonB",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
[{}]
|
[{}]
|
||||||
====
|
====
|
||||||
{}
|
{}
|
||||||
====
|
====
|
||||||
{}
|
{}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
c(1, {
|
c(1, {
|
||||||
t("NOTE"),
|
t("NOTE"),
|
||||||
t("TIP"),
|
t("TIP"),
|
||||||
t("IMPORTANT"),
|
t("IMPORTANT"),
|
||||||
t("CAUTION"),
|
t("CAUTION"),
|
||||||
t("WARNING"),
|
t("WARNING"),
|
||||||
}),
|
}),
|
||||||
i(2, "BODY"),
|
i(2, "BODY"),
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,10 @@ in
|
|||||||
query = "@${query}.outer";
|
query = "@${query}.outer";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.mapAttrs' mkQueryMappings {
|
lib.mapAttrs' mkQueryMappings {
|
||||||
"function" = "f";
|
"function" = "f";
|
||||||
"class" = "F";
|
"class" = "F";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
move = lib.mkMerge ([{
|
move = lib.mkMerge ([{
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -100,8 +100,9 @@ in
|
|||||||
|
|
||||||
# A set of bindings to be used for each jump direction.
|
# A set of bindings to be used for each jump direction.
|
||||||
bindings:
|
bindings:
|
||||||
let
|
let
|
||||||
mappings = builtins.map (motion:
|
mappings = builtins.map
|
||||||
|
(motion:
|
||||||
let
|
let
|
||||||
inherit (motion) region jumpDirection variant;
|
inherit (motion) region jumpDirection variant;
|
||||||
jumpDirection' = lib.strings.toLower jumpDirection;
|
jumpDirection' = lib.strings.toLower jumpDirection;
|
||||||
@ -115,19 +116,21 @@ in
|
|||||||
query = "@${query}.${variant}";
|
query = "@${query}.${variant}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}) motions;
|
})
|
||||||
in
|
motions;
|
||||||
acc ++ mappings;
|
in
|
||||||
|
acc ++ mappings;
|
||||||
in
|
in
|
||||||
lib.foldlAttrs mkQueryMappings [ ] {
|
lib.foldlAttrs mkQueryMappings [ ] {
|
||||||
"function" = { previous = "M"; next = "m"; };
|
"function" = { previous = "M"; next = "m"; };
|
||||||
"block" = { previous = "B"; next = "b"; };
|
"block" = { previous = "B"; next = "b"; };
|
||||||
"call" = { previous = "F"; next = "f"; };
|
"call" = { previous = "F"; next = "f"; };
|
||||||
"class" = { previous = "C"; next = "c"; };
|
"class" = { previous = "C"; next = "c"; };
|
||||||
"conditional" = { previous = "D"; next = "d"; };
|
"conditional" = { previous = "D"; next = "d"; };
|
||||||
"statement" = { previous = "S"; next = "s"; };
|
"statement" = { previous = "S"; next = "s"; };
|
||||||
"loop" = { previous = "L"; next = "l"; };
|
"loop" = { previous = "L"; next = "l"; };
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
select = {
|
select = {
|
||||||
enable = true;
|
enable = true;
|
||||||
lookahead = true;
|
lookahead = true;
|
||||||
@ -161,16 +164,17 @@ in
|
|||||||
|
|
||||||
let
|
let
|
||||||
mappingsList =
|
mappingsList =
|
||||||
builtins.map (variant:
|
builtins.map
|
||||||
let
|
(variant:
|
||||||
prefixMap' = prefixMap.${variant};
|
let
|
||||||
in
|
prefixMap' = prefixMap.${variant};
|
||||||
lib.nameValuePair "${prefixMap'.key}${binding}" {
|
in
|
||||||
query = "@${query}.${variant}";
|
lib.nameValuePair "${prefixMap'.key}${binding}" {
|
||||||
desc = prefixMap'.desc query;
|
query = "@${query}.${variant}";
|
||||||
}) [ "outer" "inner" ];
|
desc = prefixMap'.desc query;
|
||||||
|
}) [ "outer" "inner" ];
|
||||||
in
|
in
|
||||||
lib.listToAttrs mappingsList;
|
lib.listToAttrs mappingsList;
|
||||||
in
|
in
|
||||||
lib.concatMapAttrs mkQueryMappings {
|
lib.concatMapAttrs mkQueryMappings {
|
||||||
"function" = "m";
|
"function" = "m";
|
||||||
@ -203,29 +207,33 @@ in
|
|||||||
|
|
||||||
mkQueryMappings = acc: query: bindings:
|
mkQueryMappings = acc: query: bindings:
|
||||||
let
|
let
|
||||||
mappings = builtins.map (motion:
|
mappings = builtins.map
|
||||||
let
|
(motion:
|
||||||
inherit (motion) jumpDirection variant;
|
let
|
||||||
jumpDirection' = lib.strings.toLower jumpDirection;
|
inherit (motion) jumpDirection variant;
|
||||||
binding' = bindings.${jumpDirection'};
|
jumpDirection' = lib.strings.toLower jumpDirection;
|
||||||
bindingPrefix = motionMap."${variant}${jumpDirection}";
|
binding' = bindings.${jumpDirection'};
|
||||||
in
|
bindingPrefix = motionMap."${variant}${jumpDirection}";
|
||||||
{
|
in
|
||||||
"swap${jumpDirection}" = {
|
{
|
||||||
"${bindingPrefix}${binding'}" = {
|
"swap${jumpDirection}" = {
|
||||||
desc = actionDesc variant jumpDirection' query;
|
"${bindingPrefix}${binding'}" = {
|
||||||
query = "@${query}.${variant}";
|
desc = actionDesc variant jumpDirection' query;
|
||||||
|
query = "@${query}.${variant}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
}) motions;
|
motions;
|
||||||
in
|
in
|
||||||
acc ++ mappings;
|
acc ++ mappings;
|
||||||
in
|
in
|
||||||
lib.foldlAttrs mkQueryMappings [ ] {
|
lib.foldlAttrs mkQueryMappings [ ] {
|
||||||
"function" = { next = "f"; previous = "F"; };
|
"function" = { next = "f"; previous = "F"; };
|
||||||
"parameter" = { next = "a"; previous = "A"; };
|
"parameter" = { next = "a"; previous = "A"; };
|
||||||
"conditional" = { next = "d"; previous = "D"; };
|
"conditional" = { next = "d"; previous = "D"; };
|
||||||
}));
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,12 @@ let
|
|||||||
partsConfig = config;
|
partsConfig = config;
|
||||||
|
|
||||||
# A thin wrapper around the home-manager configuration function.
|
# A thin wrapper around the home-manager configuration function.
|
||||||
mkHome = { system, nixpkgsBranch ? "nixpkgs", homeManagerBranch ? "home-manager", extraModules ? [ ] }:
|
mkHome =
|
||||||
|
{ system
|
||||||
|
, nixpkgsBranch ? "nixpkgs"
|
||||||
|
, homeManagerBranch ? "home-manager"
|
||||||
|
, extraModules ? [ ]
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
pkgs = inputs.${nixpkgsBranch}.legacyPackages.${system};
|
pkgs = inputs.${nixpkgsBranch}.legacyPackages.${system};
|
||||||
in
|
in
|
||||||
|
@ -41,7 +41,12 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
# A very very thin wrapper around `mkHost` to build with the given format.
|
# A very very thin wrapper around `mkHost` to build with the given format.
|
||||||
mkImage = { system, nixpkgsBranch ? "nixpkgs", extraModules ? [ ], format ? "iso" }:
|
mkImage =
|
||||||
|
{ system
|
||||||
|
, nixpkgsBranch ? "nixpkgs"
|
||||||
|
, extraModules ? [ ]
|
||||||
|
, format ? "iso"
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
extraModules' =
|
extraModules' =
|
||||||
extraModules ++ [ inputs.nixos-generators.nixosModules.${format} ];
|
extraModules ++ [ inputs.nixos-generators.nixosModules.${format} ];
|
||||||
@ -295,72 +300,71 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config.modules = [
|
||||||
modules = [
|
# Bring in the required modules.
|
||||||
# Bring in the required modules.
|
inputs.${config.homeManagerBranch}.nixosModules.home-manager
|
||||||
inputs.${config.homeManagerBranch}.nixosModules.home-manager
|
../../../configs/nixos/${name}
|
||||||
../../../configs/nixos/${name}
|
|
||||||
|
|
||||||
# Mapping the declarative home-manager users (if it has one) into NixOS
|
# Mapping the declarative home-manager users (if it has one) into NixOS
|
||||||
# users.
|
# users.
|
||||||
(lib.mkIf (config.homeManagerUsers.users != { })
|
(lib.mkIf (config.homeManagerUsers.users != { })
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
setupConfig = config;
|
setupConfig = config;
|
||||||
hasHomeManagerUsers = config.homeManagerUsers.users != { };
|
hasHomeManagerUsers = config.homeManagerUsers.users != { };
|
||||||
inherit (config.homeManagerUsers) nixpkgsInstance;
|
inherit (config.homeManagerUsers) nixpkgsInstance;
|
||||||
isNixpkgs = state: hasHomeManagerUsers && nixpkgsInstance == state;
|
isNixpkgs = state: hasHomeManagerUsers && nixpkgsInstance == state;
|
||||||
in
|
in
|
||||||
{ config, lib, pkgs, ... }: {
|
{ config, lib, pkgs, ... }: {
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf hasHomeManagerUsers {
|
(lib.mkIf hasHomeManagerUsers {
|
||||||
users.users =
|
users.users =
|
||||||
lib.mkMerge
|
lib.mkMerge
|
||||||
(lib.mapAttrsToList
|
|
||||||
(name: hmUser: { ${name} = hmUser.userConfig; })
|
|
||||||
setupConfig.homeManagerUsers.users);
|
|
||||||
|
|
||||||
home-manager.users = lib.mkMerge
|
|
||||||
(lib.mapAttrsToList
|
(lib.mapAttrsToList
|
||||||
(name: hmUser: {
|
(name: hmUser: { ${name} = hmUser.userConfig; })
|
||||||
${name} = { lib, ... }: {
|
setupConfig.homeManagerUsers.users);
|
||||||
imports =
|
|
||||||
partsConfig.setups.home-manager.configs.${name}.modules
|
home-manager.users = lib.mkMerge
|
||||||
++ hmUser.additionalModules;
|
(lib.mapAttrsToList
|
||||||
|
(name: hmUser: {
|
||||||
|
${name} = { lib, ... }: {
|
||||||
|
imports =
|
||||||
|
partsConfig.setups.home-manager.configs.${name}.modules
|
||||||
|
++ hmUser.additionalModules;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
setupConfig.homeManagerUsers.users);
|
||||||
|
})
|
||||||
|
|
||||||
|
(lib.mkIf (isNixpkgs "global") {
|
||||||
|
home-manager.useGlobalPkgs = lib.mkForce true;
|
||||||
|
|
||||||
|
# Disable all options that are going to be blocked once
|
||||||
|
# `home-manager.useGlobalPkgs` is used.
|
||||||
|
home-manager.users =
|
||||||
|
lib.mkMerge
|
||||||
|
(lib.mapAttrsToList
|
||||||
|
(name: _: {
|
||||||
|
${name} = {
|
||||||
|
nixpkgs.overlays = lib.mkForce null;
|
||||||
|
nixpkgs.config = lib.mkForce null;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
setupConfig.homeManagerUsers.users);
|
setupConfig.homeManagerUsers.users);
|
||||||
})
|
|
||||||
|
|
||||||
(lib.mkIf (isNixpkgs "global") {
|
# Then apply all of the user overlays into the nixpkgs instance
|
||||||
home-manager.useGlobalPkgs = lib.mkForce true;
|
# of the NixOS system.
|
||||||
|
nixpkgs.overlays =
|
||||||
|
let
|
||||||
|
hmUsersOverlays =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(name: _:
|
||||||
|
partsConfig.setups.home-manager.configs.${name}.overlays)
|
||||||
|
setupConfig.homeManagerUsers.users;
|
||||||
|
|
||||||
# Disable all options that are going to be blocked once
|
overlays = lib.lists.flatten hmUsersOverlays;
|
||||||
# `home-manager.useGlobalPkgs` is used.
|
in
|
||||||
home-manager.users =
|
# Most of the overlays are going to be imported from a
|
||||||
lib.mkMerge
|
|
||||||
(lib.mapAttrsToList
|
|
||||||
(name: _: {
|
|
||||||
${name} = {
|
|
||||||
nixpkgs.overlays = lib.mkForce null;
|
|
||||||
nixpkgs.config = lib.mkForce null;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
setupConfig.homeManagerUsers.users);
|
|
||||||
|
|
||||||
# Then apply all of the user overlays into the nixpkgs instance
|
|
||||||
# of the NixOS system.
|
|
||||||
nixpkgs.overlays =
|
|
||||||
let
|
|
||||||
hmUsersOverlays =
|
|
||||||
lib.mapAttrsToList
|
|
||||||
(name: _:
|
|
||||||
partsConfig.setups.home-manager.configs.${name}.overlays)
|
|
||||||
setupConfig.homeManagerUsers.users;
|
|
||||||
|
|
||||||
overlays = lib.lists.flatten hmUsersOverlays;
|
|
||||||
in
|
|
||||||
# Most of the overlays are going to be imported from a
|
|
||||||
# variable anyways. This should massively reduce the step
|
# variable anyways. This should massively reduce the step
|
||||||
# needed for nixpkgs to do its thing.
|
# needed for nixpkgs to do its thing.
|
||||||
#
|
#
|
||||||
@ -368,64 +372,64 @@ let
|
|||||||
# overlay list is constructed. However, this is much more
|
# overlay list is constructed. However, this is much more
|
||||||
# preferable than letting a massive list with duplicated
|
# preferable than letting a massive list with duplicated
|
||||||
# overlays from different home-manager users to be applied.
|
# overlays from different home-manager users to be applied.
|
||||||
lib.lists.unique overlays;
|
lib.lists.unique overlays;
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (isNixpkgs "separate") {
|
(lib.mkIf (isNixpkgs "separate") {
|
||||||
home-manager.useGlobalPkgs = lib.mkForce false;
|
home-manager.useGlobalPkgs = lib.mkForce false;
|
||||||
home-manager.users =
|
home-manager.users =
|
||||||
lib.mkMerge
|
lib.mkMerge
|
||||||
(lib.mapAttrsToList
|
(lib.mapAttrsToList
|
||||||
(name: _: {
|
(name: _: {
|
||||||
${name} = {
|
${name} = {
|
||||||
nixpkgs.overlays =
|
nixpkgs.overlays =
|
||||||
partsConfig.setups.home-manager.configs.${name}.overlays;
|
partsConfig.setups.home-manager.configs.${name}.overlays;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
setupConfig.homeManagerUsers.users);
|
setupConfig.homeManagerUsers.users);
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}))
|
}
|
||||||
|
))
|
||||||
|
|
||||||
# Next, we include the chosen NixVim configuration into NixOS.
|
# Next, we include the chosen NixVim configuration into NixOS.
|
||||||
(lib.mkIf (config.nixvim.instance != null)
|
(lib.mkIf (config.nixvim.instance != null)
|
||||||
(
|
|
||||||
let
|
|
||||||
setupConfig = config;
|
|
||||||
in
|
|
||||||
{ config, lib, ... }: {
|
|
||||||
imports = [ inputs.nixvim.nixosModules.nixvim ];
|
|
||||||
|
|
||||||
programs.nixvim = {
|
|
||||||
enable = true;
|
|
||||||
imports =
|
|
||||||
partsConfig.setups.nixvim.${config.nixvim.instance}.modules
|
|
||||||
++ partsConfig.setups.nixvim.sharedModules
|
|
||||||
++ setupConfig.nixvim.additionalModules;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
))
|
|
||||||
|
|
||||||
# Setting up the typical configuration.
|
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
setupConfig = config;
|
setupConfig = config;
|
||||||
in
|
in
|
||||||
{ config, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
config = lib.mkMerge [
|
imports = [ inputs.nixvim.nixosModules.nixvim ];
|
||||||
{
|
|
||||||
nixpkgs.overlays = setupConfig.overlays;
|
|
||||||
networking.hostName = lib.mkDefault setupConfig.hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
(lib.mkIf (setupConfig.domain != null) {
|
programs.nixvim = {
|
||||||
networking.domain = lib.mkDefault setupConfig.domain;
|
enable = true;
|
||||||
})
|
imports =
|
||||||
];
|
partsConfig.setups.nixvim.${config.nixvim.instance}.modules
|
||||||
|
++ partsConfig.setups.nixvim.sharedModules
|
||||||
|
++ setupConfig.nixvim.additionalModules;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
)
|
))
|
||||||
];
|
|
||||||
};
|
# Setting up the typical configuration.
|
||||||
|
(
|
||||||
|
let
|
||||||
|
setupConfig = config;
|
||||||
|
in
|
||||||
|
{ config, lib, ... }: {
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = setupConfig.overlays;
|
||||||
|
networking.hostName = lib.mkDefault setupConfig.hostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
(lib.mkIf (setupConfig.domain != null) {
|
||||||
|
networking.domain = lib.mkDefault setupConfig.domain;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ let
|
|||||||
cfg = config.setups.nixvim;
|
cfg = config.setups.nixvim;
|
||||||
nixvimModules = ../../nixvim;
|
nixvimModules = ../../nixvim;
|
||||||
|
|
||||||
mkNixvimConfig = { system, pkgs, modules ? [] }:
|
mkNixvimConfig = { system, pkgs, modules ? [ ] }:
|
||||||
inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
module = {
|
module = {
|
||||||
@ -24,7 +24,7 @@ let
|
|||||||
|
|
||||||
modulesOption = lib.mkOption {
|
modulesOption = lib.mkOption {
|
||||||
type = with lib.types; listOf raw;
|
type = with lib.types; listOf raw;
|
||||||
default = [];
|
default = [ ];
|
||||||
};
|
};
|
||||||
modulesOption' = configEnv: modulesOption // {
|
modulesOption' = configEnv: modulesOption // {
|
||||||
description = ''
|
description = ''
|
||||||
@ -84,7 +84,7 @@ in
|
|||||||
configType
|
configType
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
default = {};
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
A set of NixVim configurations to be integrated into the declarative
|
A set of NixVim configurations to be integrated into the declarative
|
||||||
setups configuration. Each of them will be available as part of
|
setups configuration. Each of them will be available as part of
|
||||||
@ -101,14 +101,15 @@ in
|
|||||||
standaloneConfigModules = modulesOption' "standalone configuration";
|
standaloneConfigModules = modulesOption' "standalone configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (cfg.configs != {}) {
|
config = lib.mkIf (cfg.configs != { }) {
|
||||||
setups.nixvim.sharedModules = [ nixvimModules ];
|
setups.nixvim.sharedModules = [ nixvimModules ];
|
||||||
|
|
||||||
perSystem = { system, config, lib, ... }:
|
perSystem = { system, config, lib, ... }:
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
validConfigs = lib.filterAttrs
|
validConfigs = lib.filterAttrs
|
||||||
(_: metadata: lib.elem system metadata.systems) cfg.configs;
|
(_: metadata: lib.elem system metadata.systems)
|
||||||
|
cfg.configs;
|
||||||
|
|
||||||
nixvimConfigurations =
|
nixvimConfigurations =
|
||||||
let
|
let
|
||||||
@ -135,7 +136,7 @@ in
|
|||||||
cfg.sharedModules
|
cfg.sharedModules
|
||||||
++ cfg.standaloneConfigModules
|
++ cfg.standaloneConfigModules
|
||||||
++ metadata.modules
|
++ metadata.modules
|
||||||
++ [ { package = neovimPkg; } ];
|
++ [{ package = neovimPkg; }];
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
builtins.map mkNixvimConfig' neovimPackages;
|
builtins.map mkNixvimConfig' neovimPackages;
|
||||||
@ -157,8 +158,8 @@ in
|
|||||||
lib.nameValuePair
|
lib.nameValuePair
|
||||||
"nixvim-check-${name}"
|
"nixvim-check-${name}"
|
||||||
(inputs.nixvim.lib.${system}.check.mkTestDerivationFromNvim {
|
(inputs.nixvim.lib.${system}.check.mkTestDerivationFromNvim {
|
||||||
inherit nvim;
|
inherit nvim;
|
||||||
name = "${name} configuration";
|
name = "${name} configuration";
|
||||||
}))
|
}))
|
||||||
nixvimConfigurations;
|
nixvimConfigurations;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ in
|
|||||||
socketOptions
|
socketOptions
|
||||||
unitConfig
|
unitConfig
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
pathUnit = optionalSystemdUnitOption "path" "paths" // {
|
pathUnit = optionalSystemdUnitOption "path" "paths" // {
|
||||||
type =
|
type =
|
||||||
@ -205,8 +205,9 @@ in
|
|||||||
TODO: Is `Type=notify` a good default?
|
TODO: Is `Type=notify` a good default?
|
||||||
* `Service.Type=` is obviously not included since not all desktop
|
* `Service.Type=` is obviously not included since not all desktop
|
||||||
components are the same either. Some of them could be a D-Bus service,
|
components are the same either. Some of them could be a D-Bus service,
|
||||||
some of them are oneshots, etc. Not to mention, this is already implied
|
some of them are oneshots, etc. Though, it might be better to have this
|
||||||
to be `Type=simple` by systemd anyways which is enough for most cases.
|
as an explicit option set by the user instead of setting `Type=notify` as
|
||||||
|
a default.
|
||||||
|
|
||||||
TODO: A good balance for this value, probably?
|
TODO: A good balance for this value, probably?
|
||||||
* `Service.OOMScoreAdjust=` have different values for different
|
* `Service.OOMScoreAdjust=` have different values for different
|
||||||
|
@ -61,10 +61,10 @@ let
|
|||||||
{ }
|
{ }
|
||||||
session.components;
|
session.components;
|
||||||
in
|
in
|
||||||
sessionComponents // {
|
sessionComponents // {
|
||||||
"${name}.service" = serviceToUnit name session.serviceUnit;
|
"${name}.service" = serviceToUnit name session.serviceUnit;
|
||||||
"${name}.target" = targetToUnit name session.targetUnit;
|
"${name}.target" = targetToUnit name session.targetUnit;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
cfg.sessions;
|
cfg.sessions;
|
||||||
in
|
in
|
||||||
@ -173,12 +173,10 @@ in
|
|||||||
environment.
|
environment.
|
||||||
|
|
||||||
::: {.tip}
|
::: {.tip}
|
||||||
While you can make identifiers in any way, it is
|
While you can make identifiers in any way, it is encouraged to stick to
|
||||||
encouraged to stick to a naming scheme. Here's two common ways to name
|
a naming scheme. The recommended method is a reverse DNS-like scheme
|
||||||
a desktop environment.
|
preferably with a domain name you own (e.g.,
|
||||||
|
`com.example.MoseyBranch`).
|
||||||
* Reverse DNS-like scheme (e.g., `com.example.MoseyBranch`).
|
|
||||||
* Kebab-case (e.g., `mosey-branch`).
|
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
let
|
let
|
||||||
cfg = config.keyunmaps;
|
cfg = config.keyunmaps;
|
||||||
|
|
||||||
keyunmapOption = { config, lib, ...}: {
|
keyunmapOption = { config, lib, ... }: {
|
||||||
options = {
|
options = {
|
||||||
key = lib.mkOption {
|
key = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
|
@ -9,7 +9,7 @@ in
|
|||||||
package = helpers.mkPackageOption "firenvim" pkgs.vimPlugins.firenvim;
|
package = helpers.mkPackageOption "firenvim" pkgs.vimPlugins.firenvim;
|
||||||
extraConfig = lib.mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = with lib.types; attrsOf anything;
|
type = with lib.types; attrsOf anything;
|
||||||
default = {};
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
globalSettings = { alt = "all"; };
|
globalSettings = { alt = "all"; };
|
||||||
localSettings = {
|
localSettings = {
|
||||||
|
Loading…
Reference in New Issue
Block a user