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,46 +1,53 @@
{ {
description = "A simple NixOS flakes"; description = "A simple NixOS flakes";
outputs = { outputs =
flake-parts, {
flake-utils, flake-parts,
home-manager, flake-utils,
treefmt-nix, home-manager,
nixpkgs, treefmt-nix,
... nixpkgs,
} @ inputs: let ...
nixpkgs-lib = nixpkgs.lib; }@inputs:
lib = nixpkgs-lib.extend (import ./lib); let
in nixpkgs-lib = nixpkgs.lib;
flake-parts.lib.mkFlake { lib = nixpkgs-lib.extend (import ./lib);
inherit inputs; in
specialArgs = { flake-parts.lib.mkFlake
inherit lib; {
rootPath = ./.; inherit inputs;
}; specialArgs = {
} ({lib, ...}: { inherit lib;
systems = flake-utils.lib.defaultSystems; rootPath = ./.;
imports =
[
home-manager.flakeModules.home-manager
treefmt-nix.flakeModule
]
++ lib.youthlic.loadImports ./flake;
flake = {
inherit lib;
nix.settings = {
# substituters shared in home-manager and nixos configuration
substituters = let
cachix = x: "https://${x}.cachix.org";
in
lib.flatten [
(cachix "nix-community")
"https://cache.nixos.org"
(cachix "cosmic")
];
}; };
}; }
}); (
{ lib, ... }:
{
systems = flake-utils.lib.defaultSystems;
imports = [
home-manager.flakeModules.home-manager
treefmt-nix.flakeModule
]
++ lib.youthlic.loadImports ./flake;
flake = {
inherit lib;
nix.settings = {
# substituters shared in home-manager and nixos configuration
substituters =
let
cachix = x: "https://${x}.cachix.org";
in
lib.flatten [
(cachix "nix-community")
"https://cache.nixos.org"
(cachix "cosmic")
];
};
};
}
);
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

View file

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

View file

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

View file

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

View file

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

View file

@ -2,66 +2,72 @@
inputs, inputs,
rootPath, rootPath,
... ...
}: { }:
{
imports = [ imports = [
(rootPath + "/treefmt.nix") (rootPath + "/treefmt.nix")
]; ];
perSystem = { perSystem =
pkgs, {
system, pkgs,
lib, system,
self', lib,
inputs', self',
... inputs',
}: let ...
inherit (inputs) nixpkgs; }:
in { let
_module.args.pkgs = import nixpkgs { inherit (inputs) 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;
});
in in
lib.packagesFromDirectoryRecursive { {
inherit (inputsScope) callPackage; _module.args.pkgs = import nixpkgs {
directory = rootPath + "/pkgs"; inherit system;
config = {
allowUnfree = true;
};
overlays = [ (_final: _prev: { inherit lib; }) ];
}; };
packages = let devShells.default = pkgs.mkShell {
flattenPkgs = path: value: name = "nixos-shell";
if lib.isDerivation value packages = with pkgs; [
then { nixd
${lib.concatStringsSep "/" path} = value; nil
} typos
else if lib.isAttrs value typos-lsp
then lib.concatMapAttrs (name: flattenPkgs (path ++ [name])) value just
else {}; nvfetcher
in ];
flattenPkgs [] self'.legacyPackages; };
checks = legacyPackages =
lib.concatMapAttrs (name: value: { 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; "package-${name}" = value;
}) }) self'.packages;
self'.packages; };
};
} }

View file

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

View file

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

View file

@ -1 +1 @@
{...}: {} { ... }: { }

View file

@ -4,32 +4,35 @@
unixName, unixName,
config, config,
... ...
}: { }:
{
imports = lib.youthlic.loadImports ./.; imports = lib.youthlic.loadImports ./.;
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = let programs =
email = config.accounts.email.accounts.ulic-youthlic; let
inherit (email) address name; email = config.accounts.email.accounts.ulic-youthlic;
signKey = email.gpg.key; inherit (email) address name;
in { signKey = email.gpg.key;
gpg.enable = true; in
git = { {
inherit name signKey; gpg.enable = true;
email = address; git = {
encrypt-credential = true; inherit name signKey;
email = address;
encrypt-credential = true;
};
fish.enable = true;
bash.enable = true;
jujutsu = {
enable = true;
inherit name signKey;
email = address;
};
starship.enable = true;
sops.enable = true;
atuin.enable = true;
}; };
fish.enable = true;
bash.enable = true;
jujutsu = {
enable = true;
inherit name signKey;
email = address;
};
starship.enable = true;
sops.enable = true;
atuin.enable = true;
};
}; };
david = { david = {

View file

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

View file

@ -4,40 +4,43 @@
config, config,
unixName, unixName,
... ...
}: { }:
{
imports = lib.youthlic.loadImports ./.; imports = lib.youthlic.loadImports ./.;
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = let programs =
email = config.accounts.email.accounts.ulic-youthlic; let
inherit (email) name address; email = config.accounts.email.accounts.ulic-youthlic;
signKey = email.gpg.key; inherit (email) name address;
in { signKey = email.gpg.key;
rustypaste-cli.enable = true; in
gpg.enable = true; {
jujutsu = { rustypaste-cli.enable = true;
enable = true; gpg.enable = true;
inherit name signKey; jujutsu = {
email = address; enable = true;
inherit name signKey;
email = address;
};
git = {
inherit name signKey;
email = address;
encrypt-credential = true;
};
fish.enable = true;
bash.enable = true;
starship.enable = true;
sops.enable = true;
kvm.enable = true;
atuin.enable = true;
ion.enable = true;
awscli = {
enable = true;
url = "http://localhost:8491";
};
doom.enable = true;
}; };
git = {
inherit name signKey;
email = address;
encrypt-credential = true;
};
fish.enable = true;
bash.enable = true;
starship.enable = true;
sops.enable = true;
kvm.enable = true;
atuin.enable = true;
ion.enable = true;
awscli = {
enable = true;
url = "http://localhost:8491";
};
doom.enable = true;
};
}; };
david = { david = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,9 +3,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.david.programs.espanso; cfg = config.david.programs.espanso;
in { in
{
options = { options = {
david.programs.espanso = { david.programs.espanso = {
enable = lib.mkEnableOption "espanso"; enable = lib.mkEnableOption "espanso";
@ -16,7 +18,7 @@ in {
enable = true; enable = true;
package = pkgs.espanso-wayland; package = pkgs.espanso-wayland;
configs = { configs = {
default = {}; default = { };
}; };
matches = { matches = {
base = { base = {

View file

@ -3,9 +3,11 @@
lib, lib,
config, config,
... ...
}: let }:
let
cfg = config.david.programs.firefox; cfg = config.david.programs.firefox;
in { in
{
options = { options = {
david.programs.firefox = { david.programs.firefox = {
enable = lib.mkEnableOption "firefox"; enable = lib.mkEnableOption "firefox";
@ -92,7 +94,7 @@ in {
} }
]; ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"]; definedAliases = [ "@np" ];
}; };
"Nix Options" = { "Nix Options" = {
urls = [ urls = [
@ -110,7 +112,7 @@ in {
]; ];
} }
]; ];
definedAliases = ["@no"]; definedAliases = [ "@no" ];
}; };
"Home Manager Options" = { "Home Manager Options" = {
urls = [ urls = [
@ -128,7 +130,7 @@ in {
]; ];
} }
]; ];
definedAliases = ["hm"]; definedAliases = [ "hm" ];
}; };
"NUR Packages" = { "NUR Packages" = {
urls = [ urls = [
@ -136,7 +138,7 @@ in {
template = "https://nur.nix-community.org/"; template = "https://nur.nix-community.org/";
} }
]; ];
definedAliases = ["nu"]; definedAliases = [ "nu" ];
}; };
"Nix Flakes" = { "Nix Flakes" = {
urls = [ urls = [
@ -154,7 +156,7 @@ in {
]; ];
} }
]; ];
definedAliases = ["nf"]; definedAliases = [ "nf" ];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
urls = [ urls = [
@ -168,7 +170,7 @@ in {
]; ];
} }
]; ];
definedAliases = ["nw"]; definedAliases = [ "nw" ];
}; };
"bing".metaData.hidden = true; "bing".metaData.hidden = true;
"google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias "google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias

View file

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

View file

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

View file

@ -3,58 +3,61 @@
config, config,
lib, lib,
... ...
}: { }:
{
options = { options = {
david.programs.ghostty = { david.programs.ghostty = {
enable = lib.mkEnableOption "ghostty"; enable = lib.mkEnableOption "ghostty";
}; };
}; };
config = let config =
cfg = config.david.programs.ghostty; let
in (lib.mkIf cfg.enable { cfg = config.david.programs.ghostty;
programs.ghostty = lib.mkMerge [ in
{ (lib.mkIf cfg.enable {
enable = true; programs.ghostty = lib.mkMerge [
package = pkgs.ghostty; {
settings = { enable = true;
# font-family = "FiraCode Nerd Font"; package = pkgs.ghostty;
# font-feature = [ settings = {
# "calt=1" # font-family = "FiraCode Nerd Font";
# "clig=1" # font-feature = [
# "liga=1" # "calt=1"
# "cv01" # "clig=1"
# "cv02" # "liga=1"
# "cv06" # "cv01"
# "zero" # "cv02"
# "onum" # "cv06"
# "cv17" # "zero"
# "ss05" # "onum"
# "ss03" # "cv17"
# "cv16" # "ss05"
# "cv31" # "ss03"
# "cv29" # "cv16"
# "cv30" # "cv31"
# ]; # "cv29"
# "cv30"
# ];
# font-family = "Maple Mono NF CN"; # font-family = "Maple Mono NF CN";
font-feature = [ font-feature = [
"calt" "calt"
"zero" "zero"
"cv03" "cv03"
"ss08" "ss08"
]; ];
font-size = lib.mkForce 17; font-size = lib.mkForce 17;
# theme = "ayu"; # theme = "ayu";
background-opacity = lib.mkForce 0.8; background-opacity = lib.mkForce 0.8;
confirm-close-surface = "false"; confirm-close-surface = "false";
}; };
} }
(lib.mkIf config.youthlic.programs.fish.enable { (lib.mkIf config.youthlic.programs.fish.enable {
enableFishIntegration = true; enableFishIntegration = true;
}) })
(lib.mkIf config.youthlic.programs.bash.enable { (lib.mkIf config.youthlic.programs.bash.enable {
enableBashIntegration = true; enableBashIntegration = true;
}) })
]; ];
}); });
} }

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -6,10 +6,12 @@
osConfig ? null, osConfig ? null,
options, options,
... ...
} @ args: let }@args:
let
cfg = config.david.programs.niri; cfg = config.david.programs.niri;
niri = osConfig.programs.niri.package; niri = osConfig.programs.niri.package;
in { in
{
options = { options = {
david.programs.niri = { david.programs.niri = {
enable = lib.mkEnableOption "niri"; enable = lib.mkEnableOption "niri";
@ -40,37 +42,37 @@ in {
{ {
david.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri"; david.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri";
} }
( (lib.mkIf cfg.enable {
lib.mkIf cfg.enable { home.packages =
home.packages = (with pkgs; [
(with pkgs; [ swaynotificationcenter
swaynotificationcenter kdePackages.polkit-kde-agent-1
kdePackages.polkit-kde-agent-1 wl-clipboard
wl-clipboard cliphist
cliphist swayimg
swayimg ])
]) ++ [ niri ];
++ [niri]; qt = {
qt = { enable = true;
enable = true; };
}; xdg.portal = {
xdg.portal = { configPackages = [ niri ];
configPackages = [niri]; enable = true;
enable = true; extraPortals = lib.mkIf (
extraPortals = lib.mkIf ( !niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures
!niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures ) [ pkgs.xdg-desktop-portal-gnome ];
) [pkgs.xdg-desktop-portal-gnome]; };
}; xdg.configFile =
xdg.configFile = let let
qtctConf = qtctConf = ''
'' [Appearance]
[Appearance] standard_dialogs=xdgdesktopportal
standard_dialogs=xdgdesktopportal ''
'' + lib.optionalString (config.qt.style ? name) ''
+ lib.optionalString (config.qt.style ? name) '' style=${config.qt.style.name}
style=${config.qt.style.name} '';
''; in
in { {
"qt5ct/qt5ct.conf" = lib.mkForce { "qt5ct/qt5ct.conf" = lib.mkForce {
text = qtctConf; text = qtctConf;
}; };
@ -78,28 +80,26 @@ in {
text = qtctConf; text = qtctConf;
}; };
}; };
david.programs = { david.programs = {
fuzzel.enable = true; fuzzel.enable = true;
waybar = { waybar = {
enable = true; enable = true;
inherit (cfg.waybar) settings; inherit (cfg.waybar) settings;
};
wluma = {
enable = true;
inherit (cfg.wluma) extraSettings;
};
swaync.enable = true;
swaylock.enable = true;
waypaper.enable = true;
kanshi.enable = true;
}; };
programs.niri = { wluma = {
config = enable = true;
(lib.toList (import ./config.nix (args // {inherit pkgs;}))) inherit (cfg.wluma) extraSettings;
++ (lib.toList cfg.extraConfig);
package = niri;
}; };
} swaync.enable = true;
) swaylock.enable = true;
waypaper.enable = true;
kanshi.enable = true;
};
programs.niri = {
config =
(lib.toList (import ./config.nix (args // { inherit pkgs; }))) ++ (lib.toList cfg.extraConfig);
package = niri;
};
})
]; ];
} }

View file

@ -3,9 +3,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.david.programs.openssh; cfg = config.david.programs.openssh;
in { in
{
options = { options = {
david.programs.openssh = { david.programs.openssh = {
enable = lib.mkEnableOption "openssh"; enable = lib.mkEnableOption "openssh";
@ -35,7 +37,7 @@ in {
}; };
}) })
(lib.mkIf (cfg.enable && config.youthlic.programs.sops.enable) { (lib.mkIf (cfg.enable && config.youthlic.programs.sops.enable) {
programs.ssh.includes = [config.sops.secrets.ssh-config.path]; programs.ssh.includes = [ config.sops.secrets.ssh-config.path ];
sops.secrets = { sops.secrets = {
"ssh-private-key/tytonidae" = { "ssh-private-key/tytonidae" = {
mode = "0600"; mode = "0600";

View file

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

View file

@ -2,9 +2,11 @@
lib, lib,
config, config,
... ...
}: let }:
let
cfg = config.david.programs.swaync; cfg = config.david.programs.swaync;
in { in
{
options = { options = {
david.programs.swaync = { david.programs.swaync = {
enable = lib.mkEnableOption "swaync"; enable = lib.mkEnableOption "swaync";
@ -18,7 +20,7 @@ in {
}; };
}) })
(lib.mkIf (!cfg.systemd.enable) { (lib.mkIf (!cfg.systemd.enable) {
systemd.user.services.swaync = lib.mkForce {}; systemd.user.services.swaync = lib.mkForce { };
}) })
]; ];
} }

View file

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

View file

@ -4,9 +4,11 @@
lib, lib,
options, options,
... ...
}: let }:
let
cfg = config.david.programs.waybar; cfg = config.david.programs.waybar;
in { in
{
options = { options = {
david.programs.waybar = { david.programs.waybar = {
enable = lib.mkEnableOption "waybar"; enable = lib.mkEnableOption "waybar";
@ -23,7 +25,7 @@ in {
"niri/workspaces" "niri/workspaces"
"wlr/taskbar" "wlr/taskbar"
]; ];
modules-center = ["clock"]; modules-center = [ "clock" ];
modules-right = [ modules-right = [
"tray" "tray"
"idle_inhibitor" "idle_inhibitor"
@ -37,7 +39,7 @@ in {
on-click = "activate"; on-click = "activate";
}; };
"niri/worksapces" = {}; "niri/worksapces" = { };
"niri/taskbar" = { "niri/taskbar" = {
icon-size = 15; icon-size = 15;
on-click = "activate"; on-click = "activate";

View file

@ -3,16 +3,22 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.david.programs.waypaper; cfg = config.david.programs.waypaper;
in { in
{
options = { options = {
david.programs.waypaper = { david.programs.waypaper = {
enable = lib.mkEnableOption "waypaper"; enable = lib.mkEnableOption "waypaper";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [waypaper socat mpvpaper]; home.packages = with pkgs; [
waypaper
socat
mpvpaper
];
systemd.user = { systemd.user = {
timers."waypaper" = { timers."waypaper" = {
Unit = { Unit = {
@ -23,7 +29,7 @@ in {
OnCalendar = "*:0/10"; OnCalendar = "*:0/10";
}; };
Install = { Install = {
WantedBy = ["timers.target"]; WantedBy = [ "timers.target" ];
}; };
}; };
services."waypaper" = { services."waypaper" = {

View file

@ -3,9 +3,11 @@
config, config,
options, options,
... ...
}: let }:
let
cfg = config.david.programs.wluma; cfg = config.david.programs.wluma;
in { in
{
options = { options = {
david.programs.wluma = { david.programs.wluma = {
enable = lib.mkEnableOption "wluma"; enable = lib.mkEnableOption "wluma";
@ -33,23 +35,22 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.wluma = { services.wluma = {
enable = true; enable = true;
settings = settings = {
{ als = {
als = { webcam = {
webcam = { video = 0;
video = 0; thresholds = {
thresholds = { "0" = "night";
"0" = "night"; "15" = "dark";
"15" = "dark"; "30" = "dim";
"30" = "dim"; "45" = "normal";
"45" = "normal"; "60" = "bright";
"60" = "bright"; "75" = "outdoors";
"75" = "outdoors";
};
}; };
}; };
} };
// cfg.extraSettings; }
// cfg.extraSettings;
systemd = { systemd = {
enable = true; enable = true;
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,9 +3,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.youthlic.programs.awscli; cfg = config.youthlic.programs.awscli;
in { in
{
options = { options = {
youthlic.programs.awscli = { youthlic.programs.awscli = {
enable = lib.mkEnableOption "awscli"; enable = lib.mkEnableOption "awscli";
@ -16,7 +18,7 @@ in {
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets."awscli" = {}; sops.secrets."awscli" = { };
programs.awscli = { programs.awscli = {
enable = true; enable = true;
credentials = { credentials = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,36 +3,44 @@
pkgs, pkgs,
config, config,
... ...
}: let }:
let
cfg = config.youthlic.programs.helix; cfg = config.youthlic.programs.helix;
defaultLanguagesSettings = config.programs.helix.package.passthru.languages.language; defaultLanguagesSettings = config.programs.helix.package.passthru.languages.language;
in { in
{
options = { options = {
youthlic.programs.helix = { youthlic.programs.helix = {
enable = lib.mkEnableOption "helix"; enable = lib.mkEnableOption "helix";
languageSettings = lib.mkOption { languageSettings = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({...}: { type = lib.types.attrsOf (
freeformType = lib.types.anything; lib.types.submodule (
options = { { ... }:
language-servers = lib.mkOption { {
type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything); freeformType = lib.types.anything;
default = ["typos-lsp"]; options = {
example = ["rust-analyzer"]; language-servers = lib.mkOption {
apply = lib.unique; type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything);
}; default = [ "typos-lsp" ];
}; example = [ "rust-analyzer" ];
})); apply = lib.unique;
};
};
}
)
);
default = lib.pipe defaultLanguagesSettings [ default = lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"]))) (map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ])))
lib.listToAttrs lib.listToAttrs
]; ];
apply = lib.mapAttrsToList (name: value: {inherit name;} // value); apply = lib.mapAttrsToList (name: value: { inherit name; } // value);
}; };
extraPackages = lib.mkOption { extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package; type = lib.types.listOf lib.types.package;
default = []; default = [ ];
example = ( example = (
with pkgs; [ with pkgs;
[
deno deno
] ]
); );
@ -49,224 +57,224 @@ in {
defaultEditor = true; defaultEditor = true;
extraPackages = cfg.extraPackages; extraPackages = cfg.extraPackages;
settings = ./config.toml |> builtins.readFile |> builtins.fromTOML; settings = ./config.toml |> builtins.readFile |> builtins.fromTOML;
languages = languages = lib.recursiveUpdate {
lib.recursiveUpdate language-server = {
{ neocmakelsp = {
language-server = { command = "neocmakelsp";
neocmakelsp = { args = [
command = "neocmakelsp"; "stdio"
args = [ ];
"stdio"
];
};
fish-lsp = {
command = "fish-lsp";
args = [
"start"
];
};
ty = {
command = "ty";
args = [
"server"
];
};
typos-lsp = {
command = "typos-lsp";
};
}; };
} fish-lsp = {
{language = cfg.languageSettings;}; command = "fish-lsp";
args = [
"start"
];
};
ty = {
command = "ty";
args = [
"server"
];
};
typos-lsp = {
command = "typos-lsp";
};
};
} { language = cfg.languageSettings; };
}; };
}) })
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
youthlic.programs.helix.languageSettings = lib.pipe defaultLanguagesSettings [ youthlic.programs.helix.languageSettings = lib.pipe defaultLanguagesSettings [
(map ({name, ...}: lib.nameValuePair name {language-servers = ["typos-lsp"];})) (map ({ name, ... }: lib.nameValuePair name { language-servers = [ "typos-lsp" ]; }))
lib.listToAttrs lib.listToAttrs
]; ];
}) })
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
youthlic.programs.helix.languageSettings = youthlic.programs.helix.languageSettings =
lib.recursiveUpdate 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" ])))
cmake = { lib.listToAttrs
language-servers = [ ])
"neocmakelsp" {
"cmake-language-server" cmake = {
]; language-servers = [
}; "neocmakelsp"
kdl = { "cmake-language-server"
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
]; ];
}; };
}; kdl = {
just = { formatter = {
formatter = { command = "kdlfmt";
command = "just"; args = [
args = [ "format"
"--dump" "-"
];
};
};
just = {
formatter = {
command = "just";
args = [
"--dump"
];
};
};
nix = {
formatter = {
command = "nixfmt";
};
};
xml = {
formatter = {
command = "xmllint";
args = [
"--format"
"-"
];
};
};
typst = {
formatter = {
command = "typstyle";
};
};
c = {
formatter = {
command = "clang-format";
};
};
cpp = {
formatter = {
command = "clang-format";
};
};
python = {
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
];
};
language-servers = [
"pyright"
"ruff"
"ty"
]; ];
}; };
}; go = {
nix = { formatter = {
formatter = { command = "goimports";
command = "alejandra"; };
}; };
}; awk = {
xml = { formatter = {
formatter = { command = "awk";
command = "xmllint"; timeout = 5;
args = [ args = [
"--format" "--file=/dev/stdin"
"-" "--pretty-print=/dev/stdout"
];
};
};
fish = {
language-servers = [
"fish-lsp"
]; ];
}; };
}; yaml = {
typst = { formatter = {
formatter = { command = "deno";
command = "typstyle"; args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
}; };
}; html = {
c = { formatter = {
formatter = { command = "deno";
command = "clang-format"; args = [
}; "fmt"
}; "-"
cpp = { "--ext"
formatter = { "html"
command = "clang-format"; ];
}; };
}; language-servers = [
python = { "vscode-html-language-server"
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
]; ];
}; };
language-servers = [ css = {
"pyright" formatter = {
"ruff" command = "deno";
"ty" args = [
]; "fmt"
}; "-"
go = { "--ext"
formatter = { "css"
command = "goimports"; ];
}; };
}; language-servers = [
awk = { "vscode-css-language-server"
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
]; ];
}; };
}; toml = {
fish = { formatter = {
language-servers = [ command = "taplo";
"fish-lsp" args = [
]; "fmt"
}; "-"
yaml = { ];
formatter = { };
command = "deno"; };
args = [ markdown = {
"fmt" formatter = {
"-" command = "deno";
"--ext" args = [
"yaml" "fmt"
"-"
"--ext"
"md"
];
};
};
json = {
language-servers = [
"vscode-json-language-server"
]; ];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
};
jsonc = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
}; };
}; };
html = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"html"
];
};
language-servers = [
"vscode-html-language-server"
];
};
css = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"css"
];
};
language-servers = [
"vscode-css-language-server"
];
};
toml = {
formatter = {
command = "taplo";
args = [
"fmt"
"-"
];
};
};
markdown = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"md"
];
};
};
json = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
};
jsonc = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
};
};
}) })
]; ];
} }

View file

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

View file

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

View file

@ -2,9 +2,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.youthlic.programs.kvm; cfg = config.youthlic.programs.kvm;
in { in
{
options = { options = {
youthlic.programs.kvm = { youthlic.programs.kvm = {
enable = lib.mkEnableOption "kvm"; enable = lib.mkEnableOption "kvm";
@ -14,8 +16,8 @@ in {
dconf = { dconf = {
settings = { settings = {
"org/virt-manager/virt-manager/connections" = { "org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"]; autoconnect = [ "qemu:///system" ];
uris = ["qemu:///system"]; uris = [ "qemu:///system" ];
}; };
}; };
}; };

View file

@ -3,20 +3,22 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.youthlic.programs.rustypaste-cli; cfg = config.youthlic.programs.rustypaste-cli;
in { in
{
options = { options = {
youthlic.programs.rustypaste-cli = { youthlic.programs.rustypaste-cli = {
enable = lib.mkEnableOption "rustypaste-cli"; enable = lib.mkEnableOption "rustypaste-cli";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [pkgs.rustypaste-cli]; home.packages = [ pkgs.rustypaste-cli ];
sops = { sops = {
secrets = { secrets = {
"rustypaste/auth" = {}; "rustypaste/auth" = { };
"rustypaste/delete" = {}; "rustypaste/delete" = { };
}; };
templates."rustypaste-config.toml" = { templates."rustypaste-config.toml" = {
path = "${config.xdg.configHome}/rustypaste/config.toml"; path = "${config.xdg.configHome}/rustypaste/config.toml";

View file

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

View file

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

View file

@ -3,11 +3,13 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.youthlic.programs.yazi; cfg = config.youthlic.programs.yazi;
fish-cfg = config.youthlic.programs.fish; fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash; bash-cfg = config.youthlic.programs.bash;
in { in
{
options = { options = {
youthlic.programs.yazi = { youthlic.programs.yazi = {
enable = lib.mkEnableOption "yazi"; enable = lib.mkEnableOption "yazi";
@ -21,7 +23,15 @@ in {
programs.yazi = { programs.yazi = {
enable = true; enable = true;
plugins = { 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 = initLua =
#lua #lua
@ -63,12 +73,15 @@ in {
mgr = { mgr = {
prepend_keymap = [ prepend_keymap = [
{ {
on = ["c" "m"]; on = [
"c"
"m"
];
run = "plugin chmod"; run = "plugin chmod";
desc = "Chmod on selected files"; desc = "Chmod on selected files";
} }
{ {
on = ["l"]; on = [ "l" ];
run = "plugin smart-enter"; run = "plugin smart-enter";
desc = "Enter the child directory, or open the file"; desc = "Enter the child directory, or open the file";
} }

View file

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

View file

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

View file

@ -1,35 +1,38 @@
final: _prev: { final: _prev: {
youthlic = { youthlic = {
loadImports' = dir: f: loadImports' =
dir: f:
final.pipe dir [ final.pipe dir [
final.youthlic.loadImports final.youthlic.loadImports
f f
]; ];
loadImports = dir: loadImports =
dir:
with final; with final;
if !(pathExists dir && builtins.readFileType dir == "directory") if !(pathExists dir && builtins.readFileType dir == "directory") then
then [] [ ]
else let else
items = pipe dir [builtins.readDir attrNames]; let
in items = pipe dir [
pipe items [ builtins.readDir
(concatMap attrNames
(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 []))
(filter (name: !hasSuffix "/default.nix" (toString name)))
]; ];
in
pipe items [
(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
[ ]
))
(filter (name: !hasSuffix "/default.nix" (toString name)))
];
}; };
} }

View file

@ -4,7 +4,8 @@
lib, lib,
outputs, outputs,
... ...
}: { }:
{
imports = imports =
(with inputs.nixos-hardware.nixosModules; [ (with inputs.nixos-hardware.nixosModules; [
common-cpu-intel common-cpu-intel
@ -75,9 +76,13 @@
kernelPackages = pkgs.linuxPackages_cachyos; kernelPackages = pkgs.linuxPackages_cachyos;
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
kernelParams = ["i915.enable_guc=2"]; kernelParams = [ "i915.enable_guc=2" ];
};
nix = {
settings = {
system-features = [ "gccarch-skylake" ];
};
}; };
nix = {settings = {system-features = ["gccarch-skylake"];};};
hardware = { hardware = {
graphics.package = pkgs.mesa_git; graphics.package = pkgs.mesa_git;
intelgpu = { intelgpu = {

View file

@ -49,7 +49,7 @@
]; ];
content = { content = {
type = "btrfs"; type = "btrfs";
extraArgs = ["-f"]; extraArgs = [ "-f" ];
subvolumes = { subvolumes = {
"@root" = { "@root" = {
mountpoint = "/"; mountpoint = "/";

View file

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

View file

@ -7,15 +7,23 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "xhci_pci"
boot.kernelModules = []; "ahci"
boot.extraModulePackages = []; "nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

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

View file

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

View file

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

View file

@ -3,12 +3,12 @@
lib, lib,
outputs, outputs,
... ...
}: { }:
imports = {
[ imports = [
outputs.nixosModules.default outputs.nixosModules.default
] ]
++ (lib.youthlic.loadImports ./.); ++ (lib.youthlic.loadImports ./.);
youthlic = { youthlic = {
home-manager = { home-manager = {
@ -68,7 +68,7 @@
}; };
nix = { nix = {
settings = { settings = {
system-features = ["gccarch-ivybridge"]; system-features = [ "gccarch-ivybridge" ];
}; };
}; };

View file

@ -15,7 +15,7 @@
size = "100%"; size = "100%";
content = { content = {
type = "btrfs"; type = "btrfs";
extraArgs = ["-f"]; extraArgs = [ "-f" ];
subvolumes = { subvolumes = {
"@root" = { "@root" = {
mountpoint = "/"; mountpoint = "/";

View file

@ -1,11 +1,12 @@
{config, ...}: { { config, ... }:
{
youthlic.containers.forgejo = { youthlic.containers.forgejo = {
enable = true; enable = true;
domain = "forgejo.youthlic.social"; domain = "forgejo.youthlic.social";
sshPort = 2222; sshPort = 2222;
httpPort = 8480; httpPort = 8480;
}; };
networking.firewall.allowedTCPPorts = [2222]; networking.firewall.allowedTCPPorts = [ 2222 ];
services.caddy.virtualHosts = { services.caddy.virtualHosts = {
"forgejo.${config.youthlic.programs.caddy.baseDomain}" = { "forgejo.${config.youthlic.programs.caddy.baseDomain}" = {
extraConfig = '' extraConfig = ''

View file

@ -7,15 +7,22 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "ata_piix"
boot.kernelModules = []; "uhci_hcd"
boot.extraModulePackages = []; "virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

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

View file

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

View file

@ -1,5 +1,6 @@
{config, ...}: { { config, ... }:
sops.secrets."ssh-private-key/radicle/Cape" = {}; {
sops.secrets."ssh-private-key/radicle/Cape" = { };
youthlic.programs.radicle = { youthlic.programs.radicle = {
enable = true; enable = true;
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBbQrJNWcWsFncTX4w/hkhz6zPNwHrTjA+6lnq5dmu/s radicle"; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBbQrJNWcWsFncTX4w/hkhz6zPNwHrTjA+6lnq5dmu/s radicle";

View file

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

View file

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

View file

@ -4,7 +4,8 @@
inputs, inputs,
outputs, outputs,
... ...
}: { }:
{
imports = imports =
(with inputs.nixos-hardware.nixosModules; [ (with inputs.nixos-hardware.nixosModules; [
common-hidpi common-hidpi
@ -17,7 +18,7 @@
++ (with outputs; [ ++ (with outputs; [
nixosModules.gui nixosModules.gui
]) ])
++ [inputs.lanzaboote.nixosModules.lanzaboote] ++ [ inputs.lanzaboote.nixosModules.lanzaboote ]
++ (lib.youthlic.loadImports ./.); ++ (lib.youthlic.loadImports ./.);
youthlic = { youthlic = {

View file

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

View file

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

View file

@ -7,15 +7,22 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "xhci_pci"
boot.kernelModules = ["kvm-intel"]; "thunderbolt"
boot.extraModulePackages = []; "nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -3,7 +3,8 @@
lib, lib,
config, config,
... ...
}: { }:
{
nixpkgs.config.cudaSupport = true; nixpkgs.config.cudaSupport = true;
services = { services = {
hardware.bolt.enable = true; hardware.bolt.enable = true;
@ -13,11 +14,15 @@
enableUdevRules = true; enableUdevRules = true;
}; };
}; };
nix = {settings = {system-features = ["gccarch-alderlake"];};}; nix = {
settings = {
system-features = [ "gccarch-alderlake" ];
};
};
hardware = { hardware = {
openrazer = { openrazer = {
enable = true; enable = true;
users = ["david"]; users = [ "david" ];
}; };
graphics.package = pkgs.mesa_git; graphics.package = pkgs.mesa_git;
intelgpu = { intelgpu = {
@ -35,8 +40,12 @@
}; };
}; };
boot = { boot = {
extraModulePackages = with config.boot.kernelPackages; [ddcci-driver]; extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ];
kernelModules = ["ddcci" "ddcci-backlight" "i2c-dev"]; kernelModules = [
"ddcci"
"ddcci-backlight"
"i2c-dev"
];
binfmt = { binfmt = {
emulatedSystems = [ emulatedSystems = [
"aarch64-linux" "aarch64-linux"
@ -47,33 +56,38 @@
}; };
systemd.services."ddcci@" = { systemd.services."ddcci@" = {
description = "ddcci handler"; description = "ddcci handler";
after = ["graphical.target"]; after = [ "graphical.target" ];
before = ["shutdown.target"]; before = [ "shutdown.target" ];
conflicts = ["shutdown.target"]; conflicts = [ "shutdown.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = let ExecStart =
script = pkgs.writeShellApplication { let
name = "ddcci-handler"; script = pkgs.writeShellApplication {
runtimeInputs = with pkgs; [coreutils ddcutil]; name = "ddcci-handler";
text = '' runtimeInputs = with pkgs; [
echo Trying to attach ddcci to "$1" coreutils
success=0 ddcutil
i=0 ];
id=$(echo "$1" | cut -d "-" -f 2) text = ''
while ((success < 1)) && ((i++ < 5)); do echo Trying to attach ddcci to "$1"
if ddcutil getvcp 10 -b "$id"; then success=0
if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then i=0
success=1 id=$(echo "$1" | cut -d "-" -f 2)
echo ddcci attached to "$1" while ((success < 1)) && ((i++ < 5)); do
if ddcutil getvcp 10 -b "$id"; then
if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then
success=1
echo ddcci attached to "$1"
fi
fi fi
fi echo "Try $i"
echo "Try $i" sleep 1;
sleep 1; done
done '';
''; };
}; in
in "${lib.getExe' script "ddcci-handler"} %i"; "${lib.getExe' script "ddcci-handler"} %i";
}; };
}; };
services.udev.extraRules = '' services.udev.extraRules = ''

View file

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

View file

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

View file

@ -2,7 +2,8 @@
inputs, inputs,
lib, lib,
... ...
}: let }:
let
extraConfig = '' extraConfig = ''
output "DP-1" { output "DP-1" {
mode "2560x1440@169.900" mode "2560x1440@169.900"
@ -22,11 +23,12 @@
open-on-output "DP-1" open-on-output "DP-1"
} }
''; '';
in { in
{
config.specialisation.niri-hybrid = { config.specialisation.niri-hybrid = {
inheritParentConfig = true; inheritParentConfig = true;
configuration = { configuration = {
imports = [inputs.nixos-hardware.nixosModules.common-gpu-nvidia]; imports = [ inputs.nixos-hardware.nixosModules.common-gpu-nvidia ];
youthlic.gui.niri.extraConfig = lib.mkForce extraConfig; youthlic.gui.niri.extraConfig = lib.mkForce extraConfig;
hardware.nvidia.prime.reverseSync.enable = lib.mkForce false; hardware.nvidia.prime.reverseSync.enable = lib.mkForce false;
}; };

View file

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

View file

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

View file

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

View file

@ -3,9 +3,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.youthlic.containers.forgejo; cfg = config.youthlic.containers.forgejo;
in { in
{
options = { options = {
youthlic.containers.forgejo = { youthlic.containers.forgejo = {
enable = lib.mkEnableOption "forgejo container"; enable = lib.mkEnableOption "forgejo container";
@ -54,62 +56,64 @@ in {
} }
]; ];
config = {lib, ...}: { config =
imports = [ { lib, ... }:
./../programs/forgejo.nix {
./../programs/postgresql.nix imports = [
]; ./../programs/forgejo.nix
./../programs/postgresql.nix
];
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/lib/forgejo 770 forgejo forgejo -" "d /var/lib/forgejo 770 forgejo forgejo -"
"d /var/lib/postgresql 770 postgres postgres -" "d /var/lib/postgresql 770 postgres postgres -"
]; ];
youthlic.programs = { youthlic.programs = {
forgejo = { forgejo = {
enable = true; enable = true;
domain = cfg.domain; domain = cfg.domain;
sshPort = cfg.sshPort; sshPort = cfg.sshPort;
httpPort = cfg.httpPort; httpPort = cfg.httpPort;
database = { database = {
user = "forgejo"; user = "forgejo";
};
};
postgresql = {
enable = true;
database = "forgejo";
auth_method = "peer";
version = "17";
}; };
}; };
postgresql = {
enable = true;
database = "forgejo";
auth_method = "peer";
version = "17";
};
};
systemd.services.forgejo = { systemd.services.forgejo = {
wants = ["postgresql.service"]; wants = [ "postgresql.service" ];
requires = ["postgresql.service"]; requires = [ "postgresql.service" ];
after = ["postgresql.service"]; after = [ "postgresql.service" ];
wantedBy = ["default.target"]; wantedBy = [ "default.target" ];
};
networking = {
defaultGateway = "192.168.111.1";
firewall = {
enable = true;
allowedTCPPorts = [
cfg.httpPort
cfg.sshPort
];
allowedUDPPorts = [
cfg.httpPort
cfg.sshPort
];
}; };
useHostResolvConf = lib.mkForce false;
networking = {
defaultGateway = "192.168.111.1";
firewall = {
enable = true;
allowedTCPPorts = [
cfg.httpPort
cfg.sshPort
];
allowedUDPPorts = [
cfg.httpPort
cfg.sshPort
];
};
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
system.stateVersion = "24.11";
}; };
services.resolved.enable = true;
system.stateVersion = "24.11";
};
}; };
}; };
} }

View file

@ -3,9 +3,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.youthlic.containers.miniflux; cfg = config.youthlic.containers.miniflux;
in { in
{
options = { options = {
youthlic.containers.miniflux = { youthlic.containers.miniflux = {
enable = lib.mkEnableOption "miniflux container"; enable = lib.mkEnableOption "miniflux container";
@ -36,55 +38,57 @@ in {
}; };
}; };
config = {lib, ...}: { config =
imports = [ { lib, ... }:
./../programs/miniflux.nix {
./../programs/postgresql.nix imports = [
]; ./../programs/miniflux.nix
./../programs/postgresql.nix
];
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/lib/miniflux 770 miniflux miniflux -" "d /var/lib/miniflux 770 miniflux miniflux -"
"d /var/lib/postgresql 770 postgres postgres -" "d /var/lib/postgresql 770 postgres postgres -"
"d /run/secrets 770 root miniflux -" "d /run/secrets 770 root miniflux -"
]; ];
youthlic.programs = { youthlic.programs = {
miniflux = { miniflux = {
enable = true; enable = true;
database = { database = {
user = "miniflux"; user = "miniflux";
};
adminCredentialsFile = cfg.adminCredentialsFile;
};
postgresql = {
enable = true;
database = "miniflux";
auth_method = "peer";
version = "17";
}; };
adminCredentialsFile = cfg.adminCredentialsFile;
}; };
postgresql = {
enable = true;
database = "miniflux";
auth_method = "peer";
version = "17";
};
};
systemd.services.miniflux = { systemd.services.miniflux = {
wants = ["postgresql.service"]; wants = [ "postgresql.service" ];
requires = ["postgresql.service"]; requires = [ "postgresql.service" ];
after = ["postgresql.service"]; after = [ "postgresql.service" ];
wantedBy = ["default.target"]; wantedBy = [ "default.target" ];
};
networking = {
defaultGateway = "192.168.111.1";
firewall = {
enable = true;
allowedTCPPorts = [8485];
allowedUDPPorts = [8485];
}; };
useHostResolvConf = lib.mkForce false;
networking = {
defaultGateway = "192.168.111.1";
firewall = {
enable = true;
allowedTCPPorts = [ 8485 ];
allowedUDPPorts = [ 8485 ];
};
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
system.stateVersion = "24.11";
}; };
services.resolved.enable = true;
system.stateVersion = "24.11";
};
}; };
}; };
} }

View file

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

View file

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

View file

@ -6,119 +6,125 @@
}: }:
lib.mkMerge [ lib.mkMerge [
{ {
environment.systemPackages = with pkgs; [man-pages man-pages-posix]; environment.systemPackages = with pkgs; [
man-pages
man-pages-posix
];
documentation = { documentation = {
info.enable = true; info.enable = true;
nixos.enable = false; nixos.enable = false;
dev.enable = true; dev.enable = true;
}; };
} }
(let (
inherit (pkgs.writers) writeFish; let
cfg = config.documentation.man.man-db; inherit (pkgs.writers) writeFish;
cachePath = "/var/cache/man/nixos"; cfg = config.documentation.man.man-db;
in { cachePath = "/var/cache/man/nixos";
documentation.man.generateCaches = false; in
{
documentation.man.generateCaches = false;
systemd.services."man-db" = { systemd.services."man-db" = {
requires = ["sysinit-reactivation.target"]; requires = [ "sysinit-reactivation.target" ];
after = ["sysinit-reactivation.target"]; after = [ "sysinit-reactivation.target" ];
partOf = ["sysinit-reactivation.target"]; partOf = [ "sysinit-reactivation.target" ];
wantedBy = ["default.target"]; wantedBy = [ "default.target" ];
path = [ path = [
cfg.package cfg.package
pkgs.gawk pkgs.gawk
]; ];
serviceConfig = { serviceConfig = {
Nice = 19; Nice = 19;
IOSchedulingClass = "idle"; IOSchedulingClass = "idle";
IOSchedulingPrioriry = 7; IOSchedulingPrioriry = 7;
ExecStart = ExecStart =
writeFish "mandbsvc" # fish writeFish "mandbsvc" # fish
''
set -l SystemManLoc "/run/current-system/sw/share/man"
set -l ContentRecord "${cachePath}/man-db-state"
if [ ! -d "${cachePath}" ] ''
mkdir -pv "${cachePath}" || exit 1 set -l SystemManLoc "/run/current-system/sw/share/man"
end set -l ContentRecord "${cachePath}/man-db-state"
if [ ! -f "$ContentRecord" ] if [ ! -d "${cachePath}" ]
touch "$ContentRecord" || exit 1 mkdir -pv "${cachePath}" || exit 1
end end
# 1) Collect list of all manpage files and calculate hashes
# of them
#
# man1/ls.1.gz
# man3/func.3.gz
#
# hash ->
#
# bbbbbbbbbbbb (man1/ls.1.gz)
# aaaaaaaaaaaa (man3/func.3.gz)
set -l hashes "$(
find -L "$SystemManLoc" -type f -iname "*.gz" \
-exec sha256sum "{}" "+" \
| awk '{ print $1 }'
or exit 1
)"
# 2) Sort the hashes to make them "stable", if [ ! -f "$ContentRecord" ]
# and then join them toghther into a big long string, touch "$ContentRecord" || exit 1
# and then hash this big string to get the hash of the directory end
# # 1) Collect list of all manpage files and calculate hashes
# bbbbbbbbbbbb # of them
# aaaaaaaaaaaa #
# # man1/ls.1.gz
# sort -> # man3/func.3.gz
# #
# aaaaaaaaaaaa # hash ->
# bbbbbbbbbbbb #
# # bbbbbbbbbbbb (man1/ls.1.gz)
# join -> # aaaaaaaaaaaa (man3/func.3.gz)
# set -l hashes "$(
# aaaaaaaaaaaabbbbbbbbbbbb find -L "$SystemManLoc" -type f -iname "*.gz" \
# -exec sha256sum "{}" "+" \
# hash -> | awk '{ print $1 }'
# or exit 1
# cccccccccccc )"
set -l ultimate_hash (
echo $hashes \
| sort \
| string join "" \
| sha256sum - \
| awk '{ print $1 }'
or exit 1
)
set -l old_hash "$( string collect < "$ContentRecord" )" # 2) Sort the hashes to make them "stable",
# and then join them toghther into a big long string,
# and then hash this big string to get the hash of the directory
#
# bbbbbbbbbbbb
# aaaaaaaaaaaa
#
# sort ->
#
# aaaaaaaaaaaa
# bbbbbbbbbbbb
#
# join ->
#
# aaaaaaaaaaaabbbbbbbbbbbb
#
# hash ->
#
# cccccccccccc
set -l ultimate_hash (
echo $hashes \
| sort \
| string join "" \
| sha256sum - \
| awk '{ print $1 }'
or exit 1
)
echo "Old hash: $old_hash" set -l old_hash "$( string collect < "$ContentRecord" )"
echo "New hash: $ultimate_hash"
if [ "$old_hash" != "$ultimate_hash" ] echo "Old hash: $old_hash"
echo "Hash changed, do a full man-db rebuild" echo "New hash: $ultimate_hash"
mandb -psc || exit 1
echo "Write new hash" if [ "$old_hash" != "$ultimate_hash" ]
echo "$ultimate_hash" > "$ContentRecord" echo "Hash changed, do a full man-db rebuild"
else mandb -psc || exit 1
echo "Hash not changed, skip" echo "Write new hash"
end echo "$ultimate_hash" > "$ContentRecord"
''; else
echo "Hash not changed, skip"
end
'';
};
}; };
};
environment.extraSetup = environment.extraSetup =
# bash # bash
'' ''
find "$out/share/man" \ find "$out/share/man" \
-mindepth 1 -maxdepth 1 \ -mindepth 1 -maxdepth 1 \
-not -name "man[1-8]" \ -not -name "man[1-8]" \
-exec rm -r "{}" ";" -exec rm -r "{}" ";"
rm -r "$out/share/man/man3" rm -r "$out/share/man/man3"
''; '';
}) }
)
] ]

View file

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

View file

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

View file

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

View file

@ -3,9 +3,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.youthlic.gui; cfg = config.youthlic.gui;
in { in
{
options = { options = {
youthlic.gui.niri = { youthlic.gui.niri = {
}; };
@ -27,7 +29,7 @@ in {
terminal-exec = { terminal-exec = {
enable = true; enable = true;
settings = { settings = {
default = ["Alacritty.desktop"]; default = [ "Alacritty.desktop" ];
}; };
}; };
mime = { mime = {
@ -59,7 +61,7 @@ in {
"firefox.desktop" "firefox.desktop"
"chromium-browser.desktop" "chromium-browser.desktop"
]; ];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"]; "x-scheme-handler/tg" = [ "telegramdesktop.desktop" ];
"x-scheme-handler/unknown" = [ "x-scheme-handler/unknown" = [
"firefox.desktop" "firefox.desktop"
"chromium-browser.desktop" "chromium-browser.desktop"
@ -97,7 +99,11 @@ in {
programs = { programs = {
regreet = { regreet = {
enable = true; enable = true;
cageArgs = ["-s" "-m" "last"]; cageArgs = [
"-s"
"-m"
"last"
];
}; };
niri = { niri = {
enable = true; enable = true;

View file

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

View file

@ -6,7 +6,8 @@
pkgs, pkgs,
rootPath, rootPath,
... ...
}: { }:
{
options.youthlic.home-manager = { options.youthlic.home-manager = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@ -32,17 +33,19 @@
''; '';
}; };
}; };
config = let config =
cfg = config.youthlic.home-manager; let
unixName = cfg.unixName; cfg = config.youthlic.home-manager;
hostName = cfg.hostName; unixName = cfg.unixName;
in hostName = cfg.hostName;
in
lib.mkIf cfg.enable { lib.mkIf cfg.enable {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users."${cfg.unixName}" = ( users."${cfg.unixName}" = (
{...}: { { ... }:
{
imports = [ imports = [
outputs.homeModules."${unixName}" outputs.homeModules."${unixName}"
(rootPath + "/home/${unixName}/configurations/${hostName}") (rootPath + "/home/${unixName}/configurations/${hostName}")
@ -55,7 +58,7 @@
inherit (pkgs) system; inherit (pkgs) system;
}; };
backupFileExtension = "backup"; backupFileExtension = "backup";
sharedModules = [outputs.homeModules.default]; sharedModules = [ outputs.homeModules.default ];
}; };
}; };
} }

View file

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

View file

@ -5,18 +5,22 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
config = { config = {
environment.etc = environment.etc =
inputs inputs
|> lib.mapAttrs' (name: value: |> lib.mapAttrs' (
name: value:
lib.nameValuePair "nix/inputs/${name}" { lib.nameValuePair "nix/inputs/${name}" {
source = value; source = value;
}); }
);
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
allowInsecurePredicate = p: allowInsecurePredicate =
p:
builtins.elem (lib.getName p) [ builtins.elem (lib.getName p) [
# for fluffychat and neochat # for fluffychat and neochat
"olm" "olm"
@ -29,7 +33,7 @@
mode = "0444"; mode = "0444";
}; };
nix = { nix = {
nixPath = ["/etc/nix/inputs"]; nixPath = [ "/etc/nix/inputs" ];
extraOptions = '' extraOptions = ''
!include ${config.sops.secrets."access-tokens".path} !include ${config.sops.secrets."access-tokens".path}
''; '';
@ -44,13 +48,12 @@
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
auto-optimise-store = lib.mkDefault true; auto-optimise-store = lib.mkDefault true;
experimental-features = experimental-features = [
[ "nix-command"
"nix-command" "flakes"
"flakes" ]
] ++ (lib.optional config.lix.enable "pipe-operator")
++ (lib.optional config.lix.enable "pipe-operator") ++ (lib.optional (!config.lix.enable) "pipe-operators");
++ (lib.optional (!config.lix.enable) "pipe-operators");
warn-dirty = false; warn-dirty = false;
system-features = [ system-features = [
"kvm" "kvm"
@ -63,11 +66,13 @@
registry = registry =
inputs inputs
|> lib.filterAttrs (name: _value: name != "nixpkgs") |> lib.filterAttrs (name: _value: name != "nixpkgs")
|> lib.mapAttrs (_name: value: { |> lib.mapAttrs (
flake = lib.mkForce { _name: value: {
outPath = value; flake = lib.mkForce {
}; outPath = value;
}); };
}
);
}; };
}; };
} }

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