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

@ -1,27 +1,32 @@
{
description = "A simple NixOS flakes";
outputs = {
outputs =
{
flake-parts,
flake-utils,
home-manager,
treefmt-nix,
nixpkgs,
...
} @ inputs: let
}@inputs:
let
nixpkgs-lib = nixpkgs.lib;
lib = nixpkgs-lib.extend (import ./lib);
in
flake-parts.lib.mkFlake {
flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs = {
inherit lib;
rootPath = ./.;
};
} ({lib, ...}: {
}
(
{ lib, ... }:
{
systems = flake-utils.lib.defaultSystems;
imports =
[
imports = [
home-manager.flakeModules.home-manager
treefmt-nix.flakeModule
]
@ -30,7 +35,8 @@
inherit lib;
nix.settings = {
# substituters shared in home-manager and nixos configuration
substituters = let
substituters =
let
cachix = x: "https://${x}.cachix.org";
in
lib.flatten [
@ -40,7 +46,8 @@
];
};
};
});
}
);
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

View file

@ -4,15 +4,18 @@
flake-parts-lib,
self,
...
}: let
}:
let
inherit (self) outputs;
inherit (inputs) deploy-rs;
mkDeployNode = {
mkDeployNode =
{
hostName,
unixName ? "deploy",
system ? "x86_64-linux",
sshName ? hostName,
}: {
}:
{
"${hostName}" = {
hostname = "${sshName}";
sshUser = "${unixName}";
@ -20,14 +23,13 @@
profiles = {
system = {
user = "root";
path =
deploy-rs.lib."${system}".activate.nixos
outputs.nixosConfigurations."${hostName}";
path = deploy-rs.lib."${system}".activate.nixos outputs.nixosConfigurations."${hostName}";
};
};
};
};
in {
in
{
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
deploy = lib.mkOption {

View file

@ -4,7 +4,8 @@
self,
rootPath,
...
}: let
}:
let
inherit (self) outputs;
homeModules =
(
@ -25,19 +26,20 @@
default = import "${toString rootPath}/home/modules";
extra = import "${toString rootPath}/home/extra";
};
makeHomeConfiguration = {
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 =
[
modules = [
(rootPath + "/home/${unixName}/configurations/${hostName}")
]
++ (with homeModules; [
@ -64,7 +66,8 @@
};
};
};
in {
in
{
flake = {
homeConfigurations = lib.foldr (a: b: a // b) { } (
[

View file

@ -4,20 +4,29 @@
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:
nixosConfigurations =
let
makeNixosConfiguration =
hostName:
lib.nixosSystem {
modules = [ (rootPath + "/nixos/configurations/${hostName}") ];
specialArgs = {
inherit inputs outputs rootPath lib;
inherit
inputs
outputs
rootPath
lib
;
};
};
in
@ -26,9 +35,6 @@ in {
"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 {
in
{
flake.overlays =
[
"modifications"

View file

@ -2,20 +2,24 @@
inputs,
rootPath,
...
}: {
}:
{
imports = [
(rootPath + "/treefmt.nix")
];
perSystem = {
perSystem =
{
pkgs,
system,
lib,
self',
inputs',
...
}: let
}:
let
inherit (inputs) nixpkgs;
in {
in
{
_module.args.pkgs = import nixpkgs {
inherit system;
config = {
@ -34,7 +38,8 @@
nvfetcher
];
};
legacyPackages = let
legacyPackages =
let
inputsScope = lib.makeScope pkgs.newScope (self: {
inherit inputs rootPath;
srcs = self.callPackage (rootPath + "/_sources/generated.nix") { };
@ -47,21 +52,22 @@
inherit (inputsScope) callPackage;
directory = rootPath + "/pkgs";
};
packages = let
flattenPkgs = path: value:
if lib.isDerivation value
then {
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 {};
else if lib.isAttrs value then
lib.concatMapAttrs (name: flattenPkgs (path ++ [ name ])) value
else
{ };
in
flattenPkgs [ ] self'.legacyPackages;
checks =
lib.concatMapAttrs (name: value: {
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 {

View file

@ -2,7 +2,8 @@
pkgs,
unixName,
...
}: {
}:
{
youthlic = {
xdg-dirs.enable = true;
programs = {

View file

@ -4,15 +4,18 @@
unixName,
config,
...
}: {
}:
{
imports = lib.youthlic.loadImports ./.;
youthlic = {
xdg-dirs.enable = true;
programs = let
programs =
let
email = config.accounts.email.accounts.ulic-youthlic;
inherit (email) address name;
signKey = email.gpg.key;
in {
in
{
gpg.enable = true;
git = {
inherit name signKey;

View file

@ -2,13 +2,17 @@
config,
inputs,
...
}: let
}:
let
inherit (inputs.niri-flake.lib.kdl) node leaf flag;
in {
in
{
david.programs.niri = {
waybar.settings = let
waybar.settings =
let
cfg = config.david.programs.niri.waybar;
in [(cfg.template // (cfg.helper.mkBacklight "intel_backlight") // {output = "eDP-1";})];
in
[ (cfg.template // (cfg.helper.mkBacklight "intel_backlight") // { output = "eDP-1"; }) ];
wluma.extraSettings = {
output = {
backlight = [
@ -20,10 +24,14 @@ in {
];
};
};
extraConfig = let
extraConfig =
let
output = node "output";
in [
(output ["eDP-1"] [
in
[
(output
[ "eDP-1" ]
[
(leaf "mode" [ "1920x1200@60.018" ])
(leaf "scale" [ 1.0 ])
(flag "focus-at-startup")
@ -34,7 +42,8 @@ in {
}
])
(leaf "transform" [ "normal" ])
])
]
)
];
};
}

View file

@ -4,15 +4,18 @@
config,
unixName,
...
}: {
}:
{
imports = lib.youthlic.loadImports ./.;
youthlic = {
xdg-dirs.enable = true;
programs = let
programs =
let
email = config.accounts.email.accounts.ulic-youthlic;
inherit (email) name address;
signKey = email.gpg.key;
in {
in
{
rustypaste-cli.enable = true;
gpg.enable = true;
jujutsu = {

View file

@ -1,8 +1,11 @@
{config, ...}: {
{ config, ... }:
{
david.programs.niri = {
waybar.settings = let
waybar.settings =
let
cfg = config.david.programs.niri.waybar;
in [
in
[
(cfg.template // (cfg.helper.mkBacklight "ddcci13") // { output = "DP-3"; })
(cfg.template // (cfg.helper.mkBacklight "nvidia_0") // { output = "eDP-1"; })
];

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
imports = lib.youthlic.loadImports ./.;
config = {
youthlic.programs = {

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.accounts.email;
in {
in
{
options = {
david.accounts.email = {
enable = lib.mkEnableOption "emails";

View file

@ -3,9 +3,11 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.david.programs.alacritty;
in {
in
{
options = {
david.programs.alacritty = {
enable = lib.mkEnableOption "alacritty";
@ -15,9 +17,7 @@ in {
programs.alacritty = {
enable = true;
package = pkgs.alacritty_git;
settings =
(./alacritty.toml |> builtins.readFile |> builtins.fromTOML)
// {
settings = (./alacritty.toml |> builtins.readFile |> builtins.fromTOML) // {
colors = lib.mkForce { };
font.size = lib.mkForce 16;
window.opacity = lib.mkForce 0.8;

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.david.programs.chromium;
in {
in
{
options = {
david.programs.chromium = {
enable = lib.mkEnableOption "chromium";

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.david.programs.espanso;
in {
in
{
options = {
david.programs.espanso = {
enable = lib.mkEnableOption "espanso";

View file

@ -3,9 +3,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.david.programs.firefox;
in {
in
{
options = {
david.programs.firefox = {
enable = lib.mkEnableOption "firefox";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.foot;
in {
in
{
options = {
david.programs.foot = {
enable = lib.mkEnableOption "foot";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.fuzzel;
in {
in
{
options = {
david.programs.fuzzel = {
enable = lib.mkEnableOption "fuzzel";

View file

@ -3,15 +3,18 @@
config,
lib,
...
}: {
}:
{
options = {
david.programs.ghostty = {
enable = lib.mkEnableOption "ghostty";
};
};
config = let
config =
let
cfg = config.david.programs.ghostty;
in (lib.mkIf cfg.enable {
in
(lib.mkIf cfg.enable {
programs.ghostty = lib.mkMerge [
{
enable = true;

View file

@ -3,9 +3,11 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.david.programs.helix;
in {
in
{
options = {
david.programs.helix = {
enable = lib.mkEnableOption "helix";

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.david.programs.kanshi;
in {
in
{
options = {
david.programs.kanshi = {
enable = lib.mkEnableOption "kanshi";

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.david.programs.mpv;
in {
in
{
options = {
david.programs.mpv = {
enable = lib.mkEnableOption "mpv";

View file

@ -5,10 +5,10 @@
inputs,
osConfig ? null,
...
}: let
}:
let
inherit (lib) getExe getExe';
inherit
(inputs.niri-flake.lib.kdl)
inherit (inputs.niri-flake.lib.kdl)
# node with args, props and children
# node:: \lambda name -> [argOrProp] -> [child] -> Output
# arg: single value
@ -44,13 +44,31 @@ in
(
let
spawn = leaf "spawn";
in [
in
[
(plain "binds" [
(plain "Mod+V" [
(spawn [ cliphist-fuzzel-img ])
])
(plain "Mod+Shift+P" [
(spawn [swaylock "--screenshots" "--clock" "--indicator" "--indicator-radius" "100" "--indicator-thickness" "7" "--effect-blur" "7x5" "--effect-vignette" "0.5:0.5" "--grace" "2" "--fade-in" "0.5"])
(spawn [
swaylock
"--screenshots"
"--clock"
"--indicator"
"--indicator-radius"
"100"
"--indicator-thickness"
"7"
"--effect-blur"
"7x5"
"--effect-vignette"
"0.5:0.5"
"--grace"
"2"
"--fade-in"
"0.5"
])
])
(plain "Mod+Shift+Slash" [
(flag "show-hotkey-overlay")
@ -66,24 +84,59 @@ in
(plain "Mod+Space" [
(spawn [ fuzzel ])
])
(node "XF86AudioRaiseVolume" [{allow-when-locked = true;}] [
(spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"])
(node "XF86AudioRaiseVolume"
[ { allow-when-locked = true; } ]
[
(spawn [
wpctl
"set-volume"
"@DEFAULT_AUDIO_SINK@"
"0.1+"
])
(node "XF86AudioLowerVolume" [{allow-when-locked = true;}] [
(spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"])
]
)
(node "XF86AudioLowerVolume"
[ { allow-when-locked = true; } ]
[
(spawn [
wpctl
"set-volume"
"@DEFAULT_AUDIO_SINK@"
"0.1-"
])
(node "XF86AudioMute" [{allow-when-locked = true;}] [
(spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "toggle"])
]
)
(node "XF86AudioMute"
[ { allow-when-locked = true; } ]
[
(spawn [
wpctl
"set-volume"
"@DEFAULT_AUDIO_SINK@"
"toggle"
])
(node "XF86AudioMicMute" [{allow-when-locked = true;}] [
(spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SOURCE@" "toggle"])
]
)
(node "XF86AudioMicMute"
[ { allow-when-locked = true; } ]
[
(spawn [
wpctl
"set-volume"
"@DEFAULT_AUDIO_SOURCE@"
"toggle"
])
]
)
(plain "Mod+Q" [
(flag "close-window")
])
(node "Mod+O" [{repeat = false;}] [
(node "Mod+O"
[ { repeat = false; } ]
[
(flag "toggle-overview")
])
]
)
(plain "Mod+Left" [
(flag "focus-column-left")
])
@ -228,12 +281,18 @@ in
(plain "Mod+Ctrl+I" [
(flag "move-workspace-up")
])
(node "Mod+Shift+WheelScrollDown" [{cooldown-ms = 150;}] [
(node "Mod+Shift+WheelScrollDown"
[ { cooldown-ms = 150; } ]
[
(flag "focus-workspace-down")
])
(node "Mod+Shift+WheelScrollUp" [{cooldown-ms = 150;}] [
]
)
(node "Mod+Shift+WheelScrollUp"
[ { cooldown-ms = 150; } ]
[
(flag "focus-workspace-up")
])
]
)
(plain "Mod+WheelScrollDown" [
(flag "focus-column-right")
])
@ -318,36 +377,60 @@ in
(plain "Mod+Period" [
(flag "expel-window-from-column")
])
(node "Mod+R" [{repeat = false;}] [
(node "Mod+R"
[ { repeat = false; } ]
[
(flag "switch-preset-column-width")
])
(node "Mod+Shift+R" [{repeat = false;}] [
]
)
(node "Mod+Shift+R"
[ { repeat = false; } ]
[
(flag "switch-preset-window-height")
])
]
)
(plain "Mod+Ctrl+R" [
(flag "reset-window-height")
])
(node "Mod+M" [{repeat = false;}] [
(node "Mod+M"
[ { repeat = false; } ]
[
(flag "maximize-column")
])
(node "Mod+Shift+M" [{repeat = false;}] [
]
)
(node "Mod+Shift+M"
[ { repeat = false; } ]
[
(flag "fullscreen-window")
])
]
)
(plain "Mod+Z" [
(flag "center-column")
])
(node "Mod+Minus" [{repeat = false;}] [
(node "Mod+Minus"
[ { repeat = false; } ]
[
(leaf "set-column-width" [ "-10%" ])
])
(node "Mod+Equal" [{repeat = false;}] [
]
)
(node "Mod+Equal"
[ { repeat = false; } ]
[
(leaf "set-column-width" [ "+10%" ])
])
(node "Mod+Shift+Minus" [{repeat = false;}] [
]
)
(node "Mod+Shift+Minus"
[ { repeat = false; } ]
[
(leaf "set-window-height" [ "-10%" ])
])
(node "Mod+Shift+Equal" [{repeat = false;}] [
]
)
(node "Mod+Shift+Equal"
[ { repeat = false; } ]
[
(leaf "set-window-height" [ "+10%" ])
])
]
)
(plain "Print" [
(flag "screenshot")
])
@ -378,7 +461,8 @@ in
++ (
let
spawn-at-startup = leaf "spawn-at-startup";
in [
in
[
(leaf "screenshot-path" [ "${config.xdg.userDirs.pictures}/screenshots/%Y-%m-%d_%H:%M:%S.png" ])
(plain "hotkey-overlay" [
(flag "skip-at-startup")
@ -386,11 +470,26 @@ in
(flag "prefer-no-csd")
(spawn-at-startup [ waybar ])
(spawn-at-startup [ swaync ])
(spawn-at-startup [waypaper "--restore"])
(spawn-at-startup [
waypaper
"--restore"
])
(spawn-at-startup [ polkit-kde-agent ])
(spawn-at-startup [wl-paste "--watch" cliphist "store"])
(spawn-at-startup [wl-clip-persist "--clipboard" "regular"])
(spawn-at-startup [fcitx5 "--replace"])
(spawn-at-startup [
wl-paste
"--watch"
cliphist
"store"
])
(spawn-at-startup [
wl-clip-persist
"--clipboard"
"regular"
])
(spawn-at-startup [
fcitx5
"--replace"
])
(plain "input" [
(plain "touchpad" [
(leaf "click-method" [ "clickfinger" ])
@ -459,7 +558,8 @@ in
let
window-rule = plain "window-rule";
match = leaf "match";
in [
in
[
(window-rule [
(leaf "draw-border-with-background" [ true ])
(leaf "geometry-corner-radius" [ 12.0 ])
@ -543,7 +643,8 @@ in
let
layer-rule = plain "layer-rule";
match = leaf "match";
in [
in
[
(layer-rule [
(match [ { namespace = "^swaync-notification-window$"; } ])
(match [ { namespace = "^swaync-control-center$"; } ])

View file

@ -6,10 +6,12 @@
osConfig ? null,
options,
...
} @ args: let
}@args:
let
cfg = config.david.programs.niri;
niri = osConfig.programs.niri.package;
in {
in
{
options = {
david.programs.niri = {
enable = lib.mkEnableOption "niri";
@ -40,8 +42,7 @@ in {
{
david.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri";
}
(
lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
home.packages =
(with pkgs; [
swaynotificationcenter
@ -61,16 +62,17 @@ in {
!niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures
) [ pkgs.xdg-desktop-portal-gnome ];
};
xdg.configFile = let
qtctConf =
''
xdg.configFile =
let
qtctConf = ''
[Appearance]
standard_dialogs=xdgdesktopportal
''
+ lib.optionalString (config.qt.style ? name) ''
style=${config.qt.style.name}
'';
in {
in
{
"qt5ct/qt5ct.conf" = lib.mkForce {
text = qtctConf;
};
@ -95,11 +97,9 @@ in {
};
programs.niri = {
config =
(lib.toList (import ./config.nix (args // {inherit pkgs;})))
++ (lib.toList cfg.extraConfig);
(lib.toList (import ./config.nix (args // { inherit pkgs; }))) ++ (lib.toList cfg.extraConfig);
package = niri;
};
}
)
})
];
}

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.openssh;
in {
in
{
options = {
david.programs.openssh = {
enable = lib.mkEnableOption "openssh";

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.swaylock;
in {
in
{
options = {
david.programs.swaylock = {
enable = lib.mkEnableOption "swaylock";

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.david.programs.swaync;
in {
in
{
options = {
david.programs.swaync = {
enable = lib.mkEnableOption "swaync";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.thunderbird;
in {
in
{
options = {
david.programs.thunderbird = {
enable = lib.mkEnableOption "thunderbird";

View file

@ -4,9 +4,11 @@
lib,
options,
...
}: let
}:
let
cfg = config.david.programs.waybar;
in {
in
{
options = {
david.programs.waybar = {
enable = lib.mkEnableOption "waybar";

View file

@ -3,16 +3,22 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.david.programs.waypaper;
in {
in
{
options = {
david.programs.waypaper = {
enable = lib.mkEnableOption "waypaper";
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [waypaper socat mpvpaper];
home.packages = with pkgs; [
waypaper
socat
mpvpaper
];
systemd.user = {
timers."waypaper" = {
Unit = {

View file

@ -3,9 +3,11 @@
config,
options,
...
}: let
}:
let
cfg = config.david.programs.wluma;
in {
in
{
options = {
david.programs.wluma = {
enable = lib.mkEnableOption "wluma";
@ -33,8 +35,7 @@ in {
config = lib.mkIf cfg.enable {
services.wluma = {
enable = true;
settings =
{
settings = {
als = {
webcam = {
video = 0;

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.david.programs.zed-editor;
in {
in
{
options = {
david.programs.zed-editor = {
enable = lib.mkEnableOption "zed-editor";
@ -63,7 +65,11 @@ in {
};
languages = {
Python = {
language_servers = ["ty" "ruff" "pyright"];
language_servers = [
"ty"
"ruff"
"pyright"
];
formatter = [
{
language_server = {
@ -79,11 +85,13 @@ in {
];
};
Nix = {
language_servers = ["nixd" "nil"];
language_servers = [
"nixd"
"nil"
];
formatter = {
external = {
command = "alejandra";
arguments = ["--quiet" "--"];
command = "nixfmt";
};
};
};

View file

@ -3,9 +3,11 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.david.wallpaper;
in {
in
{
options = {
david.wallpaper = {
enable = lib.mkEnableOption "wallpaper";

View file

@ -2,7 +2,8 @@
lib,
inputs,
...
}: {
}:
{
imports =
(with inputs; [
niri-flake.homeModules.niri

View file

@ -4,7 +4,8 @@
pkgs,
inputs,
...
}: {
}:
{
config = {
nixpkgs = {
config = {

View file

@ -2,7 +2,8 @@
lib,
inputs,
...
}: {
}:
{
imports =
(with inputs; [
sops-nix.homeManagerModules.sops

View file

@ -2,7 +2,8 @@
osConfig ? null,
lib,
...
}: {
}:
{
config = lib.mkIf (osConfig != null) {
xdg.dataFile = {
"fcitx5/rime/default.custom.yaml".source = ./default.custom.yaml;

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.youthlic.programs.atuin;
in {
in
{
options = {
youthlic.programs.atuin = {
enable = lib.mkEnableOption "atuin";

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.programs.awscli;
in {
in
{
options = {
youthlic.programs.awscli = {
enable = lib.mkEnableOption "awscli";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.bash;
in {
in
{
options = {
youthlic.programs.bash = {
enable = lib.mkEnableOption "bash";

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.programs.doom;
in {
in
{
options = {
youthlic.programs.doom = {
enable = lib.mkEnableOption "doom";
@ -16,8 +18,8 @@ in {
programs.doom-emacs = {
enable = true;
emacs = pkgs.emacs-pgtk;
extraPackages = emacsPackages:
with emacsPackages; [
extraPackages =
emacsPackages: with emacsPackages; [
melpaPackages.telega
];
extraBinPackages = with pkgs; [

View file

@ -2,12 +2,14 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.eza;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
ion-cfg = config.youthlic.programs.ion;
in {
in
{
options = {
youthlic.programs.eza = {
enable = lib.mkEnableOption "eza";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.fish;
in {
in
{
options = {
youthlic.programs.fish = {
enable = lib.mkEnableOption "fish";

View file

@ -2,11 +2,13 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.fzf;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in {
in
{
options = {
youthlic.programs.fzf = {
enable = lib.mkEnableOption "fzf";

View file

@ -2,7 +2,8 @@
config,
lib,
...
}: {
}:
{
options = {
youthlic.programs.git = {
email = lib.mkOption {
@ -30,7 +31,8 @@
encrypt-credential = lib.mkEnableOption "encrypt git credential";
};
};
config = let
config =
let
cfg = config.youthlic.programs.git;
in
lib.mkMerge [

View file

@ -4,13 +4,15 @@
lib,
outputs,
...
}: {
}:
{
options = {
youthlic.programs.gpg = {
enable = lib.mkEnableOption "gpg";
};
};
config = let
config =
let
cfg = config.youthlic.programs.gpg;
in
lib.mkIf cfg.enable {

View file

@ -3,15 +3,20 @@
pkgs,
config,
...
}: let
}:
let
cfg = config.youthlic.programs.helix;
defaultLanguagesSettings = config.programs.helix.package.passthru.languages.language;
in {
in
{
options = {
youthlic.programs.helix = {
enable = lib.mkEnableOption "helix";
languageSettings = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({...}: {
type = lib.types.attrsOf (
lib.types.submodule (
{ ... }:
{
freeformType = lib.types.anything;
options = {
language-servers = lib.mkOption {
@ -21,7 +26,9 @@ in {
apply = lib.unique;
};
};
}));
}
)
);
default = lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ])))
lib.listToAttrs
@ -32,7 +39,8 @@ in {
type = lib.types.listOf lib.types.package;
default = [ ];
example = (
with pkgs; [
with pkgs;
[
deno
]
);
@ -49,9 +57,7 @@ in {
defaultEditor = true;
extraPackages = cfg.extraPackages;
settings = ./config.toml |> builtins.readFile |> builtins.fromTOML;
languages =
lib.recursiveUpdate
{
languages = lib.recursiveUpdate {
language-server = {
neocmakelsp = {
command = "neocmakelsp";
@ -75,8 +81,7 @@ in {
command = "typos-lsp";
};
};
}
{language = cfg.languageSettings;};
} { language = cfg.languageSettings; };
};
})
(lib.mkIf cfg.enable {
@ -88,7 +93,10 @@ in {
(lib.mkIf cfg.enable {
youthlic.programs.helix.languageSettings =
lib.recursiveUpdate
(lib.pipe defaultLanguagesSettings [(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"]))) lib.listToAttrs])
(lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ])))
lib.listToAttrs
])
{
cmake = {
language-servers = [
@ -115,7 +123,7 @@ in {
};
nix = {
formatter = {
command = "alejandra";
command = "nixfmt";
};
};
xml = {

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.youthlic.programs.ion;
in {
in
{
options = {
youthlic.programs.ion = {
enable = lib.mkEnableOption "ion";

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.jujutsu;
in {
in
{
options = {
youthlic.programs.jujutsu = {
enable = lib.mkEnableOption "jujutsu";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.kvm;
in {
in
{
options = {
youthlic.programs.kvm = {
enable = lib.mkEnableOption "kvm";

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.programs.rustypaste-cli;
in {
in
{
options = {
youthlic.programs.rustypaste-cli = {
enable = lib.mkEnableOption "rustypaste-cli";

View file

@ -4,7 +4,8 @@
pkgs,
rootPath,
...
}: {
}:
{
options = {
youthlic.programs.sops = {
enable = lib.mkOption {
@ -24,12 +25,14 @@
};
};
};
config = let
config =
let
cfg = config.youthlic.programs.sops;
in
lib.mkIf cfg.enable {
home.packages = (
with pkgs; [
with pkgs;
[
sops
age
]

View file

@ -2,30 +2,31 @@
lib,
config,
...
}: let
}:
let
cfg = config.youthlic.programs.starship;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
ion-cfg = config.youthlic.programs.ion;
in {
in
{
options = {
youthlic.programs.starship = {
enable = lib.mkEnableOption "starship";
};
};
config = lib.mkMerge [
(
lib.mkIf cfg.enable {
(lib.mkIf cfg.enable {
programs.starship = {
enable = true;
enableTransience = true;
settings = let
settings =
let
config-file = builtins.readFile ./config.toml;
in
builtins.fromTOML config-file;
};
}
)
})
(lib.mkIf (cfg.enable && fish-cfg.enable) {
programs.starship.enableFishIntegration = true;
programs.fish.functions = {

View file

@ -3,11 +3,13 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.programs.yazi;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in {
in
{
options = {
youthlic.programs.yazi = {
enable = lib.mkEnableOption "yazi";
@ -21,7 +23,15 @@ in {
programs.yazi = {
enable = true;
plugins = {
inherit (pkgs.yaziPlugins) ouch starship piper chmod smart-enter git full-border;
inherit (pkgs.yaziPlugins)
ouch
starship
piper
chmod
smart-enter
git
full-border
;
};
initLua =
#lua
@ -63,7 +73,10 @@ in {
mgr = {
prepend_keymap = [
{
on = ["c" "m"];
on = [
"c"
"m"
];
run = "plugin chmod";
desc = "Chmod on selected files";
}

View file

@ -2,11 +2,13 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.zoxide;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in {
in
{
options = {
youthlic.programs.zoxide = {
enable = lib.mkEnableOption "zoxide";

View file

@ -2,9 +2,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.youthlic.xdg-dirs;
in {
in
{
options = {
youthlic.xdg-dirs = {
enable = lib.mkEnableOption "xdg-dirs";

View file

@ -1,34 +1,37 @@
final: _prev: {
youthlic = {
loadImports' = dir: f:
loadImports' =
dir: f:
final.pipe dir [
final.youthlic.loadImports
f
];
loadImports = dir:
loadImports =
dir:
with final;
if !(pathExists dir && builtins.readFileType dir == "directory")
then []
else let
items = pipe dir [builtins.readDir attrNames];
if !(pathExists dir && builtins.readFileType dir == "directory") then
[ ]
else
let
items = pipe dir [
builtins.readDir
attrNames
];
in
pipe items [
(concatMap
(name: let
(concatMap (
name:
let
path = dir + "/${name}";
type = builtins.readFileType path;
in
if type == "directory"
then
if pathExists (path + "/default.nix")
then [path]
else youthlic.loadImports path
else if type == "regular"
then
if hasSuffix ".nix" name
then [path]
else []
else []))
if type == "directory" then
if pathExists (path + "/default.nix") then [ path ] else youthlic.loadImports path
else if type == "regular" then
if hasSuffix ".nix" name then [ path ] else [ ]
else
[ ]
))
(filter (name: !hasSuffix "/default.nix" (toString name)))
];
};

View file

@ -4,7 +4,8 @@
lib,
outputs,
...
}: {
}:
{
imports =
(with inputs.nixos-hardware.nixosModules; [
common-cpu-intel
@ -77,7 +78,11 @@
loader.efi.canTouchEfiVariables = true;
kernelParams = [ "i915.enable_guc=2" ];
};
nix = {settings = {system-features = ["gccarch-skylake"];};};
nix = {
settings = {
system-features = [ "gccarch-skylake" ];
};
};
hardware = {
graphics.package = pkgs.mesa_git;
intelgpu = {

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.gui = {
enabled = "niri";
};

View file

@ -7,12 +7,20 @@
pkgs,
modulesPath,
...
}: {
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
systemd.network = {
enable = true;
wait-online.enable = false;

View file

@ -2,7 +2,8 @@
pkgs,
rootPath,
...
}: {
}:
{
stylix = {
enable = true;
image = rootPath + "/assets/wallpaper/01.png";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
users = {
mutableUsers = true;
users.david = {

View file

@ -3,9 +3,9 @@
lib,
outputs,
...
}: {
imports =
[
}:
{
imports = [
outputs.nixosModules.default
]
++ (lib.youthlic.loadImports ./.);

View file

@ -1,4 +1,5 @@
{config, ...}: {
{ config, ... }:
{
youthlic.containers.forgejo = {
enable = true;
domain = "forgejo.youthlic.social";

View file

@ -7,12 +7,19 @@
pkgs,
modulesPath,
...
}: {
}:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];

View file

@ -1,4 +1,5 @@
{config, ...}: {
{ config, ... }:
{
sops.secrets."miniflux" = {
};
youthlic.containers.miniflux = {

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
systemd.network = {
enable = true;
wait-online.enable = true;

View file

@ -1,4 +1,5 @@
{config, ...}: {
{ config, ... }:
{
sops.secrets."ssh-private-key/radicle/Cape" = { };
youthlic.programs.radicle = {
enable = true;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
stylix = {
enable = false;
};

View file

@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
users.users.alice = {
initialHashedPassword = "$y$j9T$eS5zCi4W.4IPpf3P8Tb/o1$xhumXY1.PJKmTguNi/zlljLbLemNGiubWoUEc878S36";
isNormalUser = true;

View file

@ -4,7 +4,8 @@
inputs,
outputs,
...
}: {
}:
{
imports =
(with inputs.nixos-hardware.nixosModules; [
common-hidpi

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
disko.devices = {
disk = {
disk1 = {

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.gui = {
enabled = "niri";
};

View file

@ -7,12 +7,19 @@
pkgs,
modulesPath,
...
}: {
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

View file

@ -3,7 +3,8 @@
lib,
config,
...
}: {
}:
{
nixpkgs.config.cudaSupport = true;
services = {
hardware.bolt.enable = true;
@ -13,7 +14,11 @@
enableUdevRules = true;
};
};
nix = {settings = {system-features = ["gccarch-alderlake"];};};
nix = {
settings = {
system-features = [ "gccarch-alderlake" ];
};
};
hardware = {
openrazer = {
enable = true;
@ -36,7 +41,11 @@
};
boot = {
extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ];
kernelModules = ["ddcci" "ddcci-backlight" "i2c-dev"];
kernelModules = [
"ddcci"
"ddcci-backlight"
"i2c-dev"
];
binfmt = {
emulatedSystems = [
"aarch64-linux"
@ -52,10 +61,14 @@
conflicts = [ "shutdown.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = let
ExecStart =
let
script = pkgs.writeShellApplication {
name = "ddcci-handler";
runtimeInputs = with pkgs; [coreutils ddcutil];
runtimeInputs = with pkgs; [
coreutils
ddcutil
];
text = ''
echo Trying to attach ddcci to "$1"
success=0
@ -73,7 +86,8 @@
done
'';
};
in "${lib.getExe' script "ddcci-handler"} %i";
in
"${lib.getExe' script "ddcci-handler"} %i";
};
};
services.udev.extraRules = ''

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
systemd.network = {
enable = true;
wait-online.enable = false;

View file

@ -1,4 +1,5 @@
{lib, ...}: {
{ lib, ... }:
{
config.specialisation.kde = {
inheritParentConfig = true;
configuration = {

View file

@ -2,7 +2,8 @@
inputs,
lib,
...
}: let
}:
let
extraConfig = ''
output "DP-1" {
mode "2560x1440@169.900"
@ -22,7 +23,8 @@
open-on-output "DP-1"
}
'';
in {
in
{
config.specialisation.niri-hybrid = {
inheritParentConfig = true;
configuration = {

View file

@ -2,7 +2,8 @@
pkgs,
rootPath,
...
}: {
}:
{
stylix = {
enable = true;
image = rootPath + "/assets/wallpaper/01.png";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
users.users.david = {
initialHashedPassword = "$y$j9T$eS5zCi4W.4IPpf3P8Tb/o1$xhumXY1.PJKmTguNi/zlljLbLemNGiubWoUEc878S36";
isNormalUser = true;

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.containers;
in {
in
{
imports = lib.youthlic.loadImports ./.;
options = {
youthlic.containers = {

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.containers.forgejo;
in {
in
{
options = {
youthlic.containers.forgejo = {
enable = lib.mkEnableOption "forgejo container";
@ -54,7 +56,9 @@ in {
}
];
config = {lib, ...}: {
config =
{ lib, ... }:
{
imports = [
./../programs/forgejo.nix
./../programs/postgresql.nix

View file

@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.containers.miniflux;
in {
in
{
options = {
youthlic.containers.miniflux = {
enable = lib.mkEnableOption "miniflux container";
@ -36,7 +38,9 @@ in {
};
};
config = {lib, ...}: {
config =
{ lib, ... }:
{
imports = [
./../programs/miniflux.nix
./../programs/postgresql.nix

View file

@ -1,3 +1,6 @@
{lib, ...}: {
imports = with lib; youthlic.loadImports' ./. (filter (name: !hasSuffix "/top-level" (toString name)));
{ lib, ... }:
{
imports =
with lib;
youthlic.loadImports' ./. (filter (name: !hasSuffix "/top-level" (toString name)));
}

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.users.deploy;
in {
in
{
options = {
youthlic.users.deploy = {
enable = lib.mkEnableOption "deploy";

View file

@ -6,18 +6,23 @@
}:
lib.mkMerge [
{
environment.systemPackages = with pkgs; [man-pages man-pages-posix];
environment.systemPackages = with pkgs; [
man-pages
man-pages-posix
];
documentation = {
info.enable = true;
nixos.enable = false;
dev.enable = true;
};
}
(let
(
let
inherit (pkgs.writers) writeFish;
cfg = config.documentation.man.man-db;
cachePath = "/var/cache/man/nixos";
in {
in
{
documentation.man.generateCaches = false;
systemd.services."man-db" = {
@ -120,5 +125,6 @@ lib.mkMerge [
rm -r "$out/share/man/man3"
'';
})
}
)
]

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.gui;
in {
in
{
config = lib.mkIf (cfg.enabled == "cosmic") {
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.gui;
in {
in
{
imports = with lib; youthlic.loadImports ./.;
options = {
youthlic.gui = {

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.gui;
in {
in
{
config = lib.mkIf (cfg.enabled == "kde") {
services = {
desktopManager.plasma6.enable = true;

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.gui;
in {
in
{
options = {
youthlic.gui.niri = {
};
@ -97,7 +99,11 @@ in {
programs = {
regreet = {
enable = true;
cageArgs = ["-s" "-m" "last"];
cageArgs = [
"-s"
"-m"
"last"
];
};
niri = {
enable = true;

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.hardware;
in {
in
{
options = {
youthlic.hardware = {
asus = {

View file

@ -6,7 +6,8 @@
pkgs,
rootPath,
...
}: {
}:
{
options.youthlic.home-manager = {
enable = lib.mkOption {
type = lib.types.bool;
@ -32,7 +33,8 @@
'';
};
};
config = let
config =
let
cfg = config.youthlic.home-manager;
unixName = cfg.unixName;
hostName = cfg.hostName;
@ -42,7 +44,8 @@
useGlobalPkgs = true;
useUserPackages = true;
users."${cfg.unixName}" = (
{...}: {
{ ... }:
{
imports = [
outputs.homeModules."${unixName}"
(rootPath + "/home/${unixName}/configurations/${hostName}")

View file

@ -3,9 +3,11 @@
lib,
config,
...
}: let
}:
let
cfg = config.youthlic.i18n;
in {
in
{
options = {
youthlic.i18n = {
enable = lib.mkEnableOption "zh env";

View file

@ -5,18 +5,22 @@
pkgs,
lib,
...
}: {
}:
{
config = {
environment.etc =
inputs
|> lib.mapAttrs' (name: value:
|> lib.mapAttrs' (
name: value:
lib.nameValuePair "nix/inputs/${name}" {
source = value;
});
}
);
nixpkgs = {
config = {
allowUnfree = true;
allowInsecurePredicate = p:
allowInsecurePredicate =
p:
builtins.elem (lib.getName p) [
# for fluffychat and neochat
"olm"
@ -44,8 +48,7 @@
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
auto-optimise-store = lib.mkDefault true;
experimental-features =
[
experimental-features = [
"nix-command"
"flakes"
]
@ -63,11 +66,13 @@
registry =
inputs
|> lib.filterAttrs (name: _value: name != "nixpkgs")
|> lib.mapAttrs (_name: value: {
|> lib.mapAttrs (
_name: value: {
flake = lib.mkForce {
outPath = value;
};
});
}
);
};
};
}

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.asusd;
in {
in
{
options = {
youthlic.programs.asusd = {
enable = lib.mkEnableOption "asusd";

View file

@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.youthlic.programs.bash;
in {
in
{
options = {
youthlic.programs.bash = {
enable = lib.mkEnableOption "bash";

View file

@ -3,10 +3,12 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.youthlic.programs.caddy.outer-wilds-text-adventure;
caddy-cfg = config.youthlic.programs.caddy;
in {
in
{
options = {
youthlic.programs.caddy.outer-wilds-text-adventure = {
enable = lib.mkEnableOption "caddy.OuterWildsTextAdventure";

Some files were not shown because too many files have changed in this diff Show more