Reformat nix source file using nixfmt

This commit is contained in:
ulic-youthlic 2025-07-13 06:04:55 +08:00
parent 2e4a532958
commit 9201969c1b
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
220 changed files with 3169 additions and 2487 deletions

View file

@ -4,30 +4,32 @@
flake-parts-lib,
self,
...
}: let
}:
let
inherit (self) outputs;
inherit (inputs) deploy-rs;
mkDeployNode = {
hostName,
unixName ? "deploy",
system ? "x86_64-linux",
sshName ? hostName,
}: {
"${hostName}" = {
hostname = "${sshName}";
sshUser = "${unixName}";
interactiveSudo = true;
profiles = {
system = {
user = "root";
path =
deploy-rs.lib."${system}".activate.nixos
outputs.nixosConfigurations."${hostName}";
mkDeployNode =
{
hostName,
unixName ? "deploy",
system ? "x86_64-linux",
sshName ? hostName,
}:
{
"${hostName}" = {
hostname = "${sshName}";
sshUser = "${unixName}";
interactiveSudo = true;
profiles = {
system = {
user = "root";
path = deploy-rs.lib."${system}".activate.nixos outputs.nixosConfigurations."${hostName}";
};
};
};
};
};
in {
in
{
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
deploy = lib.mkOption {
@ -43,10 +45,10 @@ in {
]
|> map (
hostName:
mkDeployNode {
inherit hostName;
}
mkDeployNode {
inherit hostName;
}
)
|> lib.foldr (a: b: a // b) {};
|> lib.foldr (a: b: a // b) { };
};
}

View file

@ -4,7 +4,8 @@
self,
rootPath,
...
}: let
}:
let
inherit (self) outputs;
homeModules =
(
@ -13,10 +14,10 @@
|> lib.filterAttrs (_key: value: value == "directory")
|> lib.filterAttrs (
key: _value:
!builtins.elem key [
"modules"
"extra"
]
!builtins.elem key [
"modules"
"extra"
]
)
|> builtins.attrNames
|> (with lib; flip genAttrs (name: import (rootPath + "/home/${name}/modules")))
@ -25,19 +26,20 @@
default = import "${toString rootPath}/home/modules";
extra = import "${toString rootPath}/home/extra";
};
makeHomeConfiguration = {
hostName,
unixName ? "david",
system ? "x86_64-linux",
nixpkgs ? inputs.nixpkgs,
home-manager ? inputs.home-manager,
}: {
"${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
};
modules =
[
makeHomeConfiguration =
{
hostName,
unixName ? "david",
system ? "x86_64-linux",
nixpkgs ? inputs.nixpkgs,
home-manager ? inputs.home-manager,
}:
{
"${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
};
modules = [
(rootPath + "/home/${unixName}/configurations/${hostName}")
]
++ (with homeModules; [
@ -49,28 +51,29 @@
]
++ [
{
lib = {inherit (lib) youthlic;};
lib = { inherit (lib) youthlic; };
}
];
extraSpecialArgs = {
inherit
inputs
outputs
unixName
hostName
system
rootPath
;
extraSpecialArgs = {
inherit
inputs
outputs
unixName
hostName
system
rootPath
;
};
};
};
};
in {
in
{
flake = {
homeConfigurations = lib.foldr (a: b: a // b) {} (
homeConfigurations = lib.foldr (a: b: a // b) { } (
[
# Hostname
]
|> map (hostName: makeHomeConfiguration {inherit hostName;})
|> map (hostName: makeHomeConfiguration { inherit hostName; })
);
inherit homeModules;
};

View file

@ -4,31 +4,37 @@
self,
rootPath,
...
}: let
}:
let
inherit (self) outputs;
in {
in
{
flake = {
nixosModules = {
default = import (rootPath + "/nixos/modules/top-level");
gui = import (rootPath + "/nixos/modules/top-level/gui.nix");
};
nixosConfigurations = let
makeNixosConfiguration = hostName:
lib.nixosSystem {
modules = [(rootPath + "/nixos/configurations/${hostName}")];
specialArgs = {
inherit inputs outputs rootPath lib;
nixosConfigurations =
let
makeNixosConfiguration =
hostName:
lib.nixosSystem {
modules = [ (rootPath + "/nixos/configurations/${hostName}") ];
specialArgs = {
inherit
inputs
outputs
rootPath
lib
;
};
};
};
in
in
[
"Tytonidae"
"Cape"
"Akun"
]
|> (
with lib;
flip genAttrs makeNixosConfiguration
);
|> (with lib; flip genAttrs makeNixosConfiguration);
};
}

View file

@ -4,10 +4,12 @@
lib,
rootPath,
...
}: let
}:
let
inherit (self) outputs;
importWithArgs = lib.flip import {inherit inputs outputs;};
in {
importWithArgs = lib.flip import { inherit inputs outputs; };
in
{
flake.overlays =
[
"modifications"

View file

@ -2,66 +2,72 @@
inputs,
rootPath,
...
}: {
}:
{
imports = [
(rootPath + "/treefmt.nix")
];
perSystem = {
pkgs,
system,
lib,
self',
inputs',
...
}: let
inherit (inputs) nixpkgs;
in {
_module.args.pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = [(_final: _prev: {inherit lib;})];
};
devShells.default = pkgs.mkShell {
name = "nixos-shell";
packages = with pkgs; [
nixd
nil
typos
typos-lsp
just
nvfetcher
];
};
legacyPackages = let
inputsScope = lib.makeScope pkgs.newScope (self: {
inherit inputs rootPath;
srcs = self.callPackage (rootPath + "/_sources/generated.nix") {};
inherit (inputs'.nixvim.legacyPackages) makeNixvim makeNixvimWithModule;
inherit (self'.legacyPackages) nixvimPlugins;
neovim_git = inputs'.neovim-nightly.packages.default;
});
perSystem =
{
pkgs,
system,
lib,
self',
inputs',
...
}:
let
inherit (inputs) nixpkgs;
in
lib.packagesFromDirectoryRecursive {
inherit (inputsScope) callPackage;
directory = rootPath + "/pkgs";
{
_module.args.pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = [ (_final: _prev: { inherit lib; }) ];
};
packages = let
flattenPkgs = path: value:
if lib.isDerivation value
then {
${lib.concatStringsSep "/" path} = value;
}
else if lib.isAttrs value
then lib.concatMapAttrs (name: flattenPkgs (path ++ [name])) value
else {};
in
flattenPkgs [] self'.legacyPackages;
checks =
lib.concatMapAttrs (name: value: {
devShells.default = pkgs.mkShell {
name = "nixos-shell";
packages = with pkgs; [
nixd
nil
typos
typos-lsp
just
nvfetcher
];
};
legacyPackages =
let
inputsScope = lib.makeScope pkgs.newScope (self: {
inherit inputs rootPath;
srcs = self.callPackage (rootPath + "/_sources/generated.nix") { };
inherit (inputs'.nixvim.legacyPackages) makeNixvim makeNixvimWithModule;
inherit (self'.legacyPackages) nixvimPlugins;
neovim_git = inputs'.neovim-nightly.packages.default;
});
in
lib.packagesFromDirectoryRecursive {
inherit (inputsScope) callPackage;
directory = rootPath + "/pkgs";
};
packages =
let
flattenPkgs =
path: value:
if lib.isDerivation value then
{
${lib.concatStringsSep "/" path} = value;
}
else if lib.isAttrs value then
lib.concatMapAttrs (name: flattenPkgs (path ++ [ name ])) value
else
{ };
in
flattenPkgs [ ] self'.legacyPackages;
checks = lib.concatMapAttrs (name: value: {
"package-${name}" = value;
})
self'.packages;
};
}) self'.packages;
};
}

View file

@ -3,7 +3,8 @@
lib,
rootPath,
...
}: {
}:
{
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
templates = lib.mkOption {