switch nixfmt to alejandra to format nix code

This commit is contained in:
ulic-youthlic 2025-04-28 21:20:32 +08:00
parent 582bdb783c
commit e44894c666
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
120 changed files with 1163 additions and 1237 deletions

230
flake.nix
View file

@ -170,47 +170,47 @@
}; };
}; };
}; };
outputs = outputs = {
{ self,
self, nixpkgs,
nixpkgs, flake-parts,
flake-parts, flake-utils,
flake-utils, ...
... } @ inputs: let
}@inputs: inherit (self) outputs;
let rootPath = ./.;
inherit (self) outputs; in
rootPath = ./.; flake-parts.lib.mkFlake {inherit inputs;} {
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = flake-utils.lib.defaultSystems; systems = flake-utils.lib.defaultSystems;
imports = [ imports = [
inputs.home-manager.flakeModules.home-manager inputs.home-manager.flakeModules.home-manager
]; ];
perSystem = perSystem = {
{ pkgs, system, ... }@args: pkgs,
{ system,
_module.args.pkgs = import inputs.nixpkgs { ...
inherit system; } @ args: {
config = { _module.args.pkgs = import inputs.nixpkgs {
allowUnfree = true; inherit system;
}; config = {
allowUnfree = true;
}; };
packages = import ./pkgs (
args
// {
inherit inputs;
}
);
}; };
formatter = pkgs.alejandra;
packages = import ./pkgs (
args
// {
inherit inputs;
}
);
};
flake = flake =
{ {
nix.settings = { nix.settings = {
# substituters shared in home-manager and nixos configuration # substituters shared in home-manager and nixos configuration
substituters = substituters = let
let cachix = x: "https://${x}.cachix.org";
cachix = x: "https://${x}.cachix.org"; in
in
nixpkgs.lib.flatten [ nixpkgs.lib.flatten [
(cachix "nix-community") (cachix "nix-community")
"https://cache.nixos.org" "https://cache.nixos.org"
@ -221,30 +221,30 @@
nixosModules.default = import ./nixos/modules; nixosModules.default = import ./nixos/modules;
overlays = { overlays = {
modifications = (import ./overlays/modifications { inherit inputs outputs; }); modifications = import ./overlays/modifications {inherit inputs outputs;};
additions = (import ./overlays/additions { inherit inputs outputs; }); additions = import ./overlays/additions {inherit inputs outputs;};
}; };
nixosConfigurations = nixosConfigurations = let
let nixosConfigDir = ./nixos/configurations;
nixosConfigDir = ./nixos/configurations; makeNixConfiguration = hostName:
makeNixConfiguration = nixpkgs.lib.nixosSystem {
hostName: modules =
nixpkgs.lib.nixosSystem { [outputs.nixosModules.default]
modules = ++ [
[ outputs.nixosModules.default ] (
++ [ let
( dirPath = nixosConfigDir + "/${hostName}";
let filePath = nixosConfigDir + "/${hostName}.nix";
dirPath = nixosConfigDir + "/${hostName}"; in
filePath = nixosConfigDir + "/${hostName}.nix"; if builtins.pathExists dirPath
in then dirPath
if builtins.pathExists dirPath then dirPath else filePath else filePath
) )
]; ];
specialArgs = { inherit inputs outputs rootPath; }; specialArgs = {inherit inputs outputs rootPath;};
}; };
in in
nixosConfigDir nixosConfigDir
|> builtins.readDir |> builtins.readDir
|> builtins.attrNames |> builtins.attrNames
@ -257,45 +257,42 @@
} }
// ( // (
let let
mkHomeConfig = mkHomeConfig = {
{ hostName,
hostName, unixName ? "david",
unixName ? "david", system ? "x86_64-linux",
system ? "x86_64-linux", nixpkgs ? inputs.nixpkgs,
nixpkgs ? inputs.nixpkgs, home-manager ? inputs.home-manager,
home-manager ? inputs.home-manager, }: {
}: "${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration {
{ pkgs = nixpkgs.legacyPackages."${system}";
"${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration { modules =
pkgs = nixpkgs.legacyPackages."${system}"; [
modules = "${toString ./home}/${unixName}/configurations/${hostName}"
[ ]
"${toString ./home}/${unixName}/configurations/${hostName}" ++ (with outputs.homeModules; [
] default
++ (with outputs.homeModules; [ extra
default ])
extra ++ [
]) outputs.homeModules."${unixName}"
++ [ ];
outputs.homeModules."${unixName}" extraSpecialArgs = {
]; inherit
extraSpecialArgs = { inputs
inherit outputs
inputs unixName
outputs hostName
unixName system
hostName rootPath
system ;
rootPath
;
};
}; };
}; };
in };
{ in {
homeConfigurations = homeConfigurations =
nixpkgs.lib.foldr (a: b: a // b) { } ( nixpkgs.lib.foldr (a: b: a // b) {} (
map (hostName: mkHomeConfig { inherit hostName; }) [ map (hostName: mkHomeConfig {inherit hostName;}) [
"Tytonidae" "Tytonidae"
"Akun" "Akun"
] ]
@ -315,10 +312,10 @@
|> nixpkgs.lib.filterAttrs (key: value: value == "directory") |> nixpkgs.lib.filterAttrs (key: value: value == "directory")
|> nixpkgs.lib.filterAttrs ( |> nixpkgs.lib.filterAttrs (
key: value: key: value:
!builtins.elem key [ !builtins.elem key [
"modules" "modules"
"extra" "extra"
] ]
) )
|> builtins.attrNames |> builtins.attrNames
|> map (name: { |> map (name: {
@ -331,30 +328,27 @@
) )
// ( // (
let let
mkDeployNode = mkDeployNode = {
{ hostName,
hostName, unixName ? "deploy",
unixName ? "deploy", system ? "x86_64-linux",
system ? "x86_64-linux", sshName ? hostName,
sshName ? hostName, }: {
}: "${hostName}" = {
{ hostname = "${sshName}";
"${hostName}" = { sshUser = "${unixName}";
hostname = "${sshName}"; interactiveSudo = true;
sshUser = "${unixName}"; profiles = {
interactiveSudo = true; system = {
profiles = { user = "root";
system = { path =
user = "root"; inputs.deploy-rs.lib."${system}".activate.nixos
path = self.outputs.nixosConfigurations."${hostName}";
inputs.deploy-rs.lib."${system}".activate.nixos
self.outputs.nixosConfigurations."${hostName}";
};
}; };
}; };
}; };
in };
{ in {
deploy.nodes = deploy.nodes =
[ [
"Cape" "Cape"
@ -362,11 +356,11 @@
] ]
|> map ( |> map (
hostName: hostName:
mkDeployNode { mkDeployNode {
inherit hostName; inherit hostName;
} }
) )
|> nixpkgs.lib.foldr (a: b: a // b) { }; |> nixpkgs.lib.foldr (a: b: a // b) {};
} }
); );
}; };

View file

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

View file

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

View file

@ -4,8 +4,7 @@
config, config,
rootPath, rootPath,
... ...
}: }: {
{
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = { programs = {

View file

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

View file

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
imports = [ imports = [
./wallpaper.nix ./wallpaper.nix
./programs ./programs

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
imports = [ imports = [
./openssh.nix ./openssh.nix
./niri ./niri

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.david.programs.niri;
in
{ {
config,
lib,
...
}: let
cfg = config.david.programs.niri;
in {
options = { options = {
david.programs.niri = { david.programs.niri = {
enable = lib.mkEnableOption "niri"; enable = lib.mkEnableOption "niri";

View file

@ -3,11 +3,9 @@
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,10 +33,9 @@ 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

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.david.programs.wluma;
in
{ {
lib,
config,
...
}: let
cfg = config.david.programs.wluma;
in {
options = { options = {
david.programs.wluma = { david.programs.wluma = {
enable = lib.mkEnableOption "wluma"; enable = lib.mkEnableOption "wluma";

View file

@ -3,11 +3,9 @@
lib, lib,
config, config,
... ...
}: }: 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

@ -1,5 +1,4 @@
{ inputs, ... }: {inputs, ...}: {
{
imports = imports =
(with inputs; [ (with inputs; [
niri-flake.homeModules.niri niri-flake.homeModules.niri

View file

@ -4,13 +4,12 @@
pkgs, pkgs,
inputs, inputs,
... ...
}: }: {
{
config = { config = {
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
allowUnfreePredicate = (_: true); allowUnfreePredicate = _: true;
}; };
overlays = [ overlays = [
outputs.overlays.modifications outputs.overlays.modifications

View file

@ -1,8 +1,4 @@
{ {inputs, ...}: {
inputs,
...
}:
{
imports = imports =
(with inputs; [ (with inputs; [
sops-nix.homeManagerModules.sops sops-nix.homeManagerModules.sops

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.atuin;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.atuin;
in {
options = { options = {
youthlic.programs.atuin = { youthlic.programs.atuin = {
enable = lib.mkEnableOption "atuin"; enable = lib.mkEnableOption "atuin";

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.chromium;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.chromium;
in {
options = { options = {
youthlic.programs.chromium = { youthlic.programs.chromium = {
enable = lib.mkEnableOption "chromium"; enable = lib.mkEnableOption "chromium";

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
imports = [ imports = [
./zed.nix ./zed.nix
./rustypaste-cli.nix ./rustypaste-cli.nix

View file

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

View file

@ -5,11 +5,9 @@
lib, lib,
config, config,
... ...
}: }: let
let
cfg = config.youthlic.programs.firefox; cfg = config.youthlic.programs.firefox;
in in {
{
options = { options = {
youthlic.programs.firefox = { youthlic.programs.firefox = {
enable = lib.mkEnableOption "firefox"; enable = lib.mkEnableOption "firefox";
@ -60,7 +58,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 = [
@ -78,7 +76,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@no" ]; definedAliases = ["@no"];
}; };
"Home Manager Options" = { "Home Manager Options" = {
urls = [ urls = [
@ -96,7 +94,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "hm" ]; definedAliases = ["hm"];
}; };
"NUR Packages" = { "NUR Packages" = {
urls = [ urls = [
@ -104,7 +102,7 @@ in
template = "https://nur.nix-community.org/"; template = "https://nur.nix-community.org/";
} }
]; ];
definedAliases = [ "nu" ]; definedAliases = ["nu"];
}; };
"Nix Flakes" = { "Nix Flakes" = {
urls = [ urls = [
@ -122,7 +120,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "nf" ]; definedAliases = ["nf"];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
urls = [ urls = [
@ -136,7 +134,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

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.foot;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.foot;
in {
options = { options = {
youthlic.programs.foot = { youthlic.programs.foot = {
enable = lib.mkEnableOption "foot"; enable = lib.mkEnableOption "foot";

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.fuzzel;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.fuzzel;
in {
options = { options = {
youthlic.programs.fuzzel = { youthlic.programs.fuzzel = {
enable = lib.mkEnableOption "fuzzel"; enable = lib.mkEnableOption "fuzzel";

View file

@ -3,61 +3,58 @@
config, config,
lib, lib,
... ...
}: }: {
{
options = { options = {
youthlic.programs.ghostty = { youthlic.programs.ghostty = {
enable = lib.mkEnableOption "ghostty"; enable = lib.mkEnableOption "ghostty";
}; };
}; };
config = config = let
let cfg = config.youthlic.programs.ghostty;
cfg = config.youthlic.programs.ghostty; in (lib.mkIf cfg.enable {
in programs.ghostty = lib.mkMerge [
(lib.mkIf cfg.enable { {
programs.ghostty = lib.mkMerge [ enable = true;
{ package = pkgs.ghostty;
enable = true; settings = {
package = pkgs.ghostty; # font-family = "FiraCode Nerd Font";
settings = { # font-feature = [
# font-family = "FiraCode Nerd Font"; # "calt=1"
# font-feature = [ # "clig=1"
# "calt=1" # "liga=1"
# "clig=1" # "cv01"
# "liga=1" # "cv02"
# "cv01" # "cv06"
# "cv02" # "zero"
# "cv06" # "onum"
# "zero" # "cv17"
# "onum" # "ss05"
# "cv17" # "ss03"
# "ss05" # "cv16"
# "ss03" # "cv31"
# "cv16" # "cv29"
# "cv31" # "cv30"
# "cv29" # ];
# "cv30"
# ];
# font-family = "Maple Mono SC NF"; # font-family = "Maple Mono SC NF";
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

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

View file

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

View file

@ -4,17 +4,15 @@
config, config,
outputs, outputs,
... ...
}: }: {
{
options = { options = {
youthlic.programs.helix = { youthlic.programs.helix = {
enable = lib.mkEnableOption "helix"; enable = lib.mkEnableOption "helix";
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
] ]
); );
@ -24,236 +22,232 @@
}; };
}; };
}; };
config = config = let
let cfg = config.youthlic.programs.helix;
cfg = config.youthlic.programs.helix; in {
in stylix.targets.helix.enable = false;
{ programs.helix = lib.mkIf cfg.enable {
stylix.targets.helix.enable = false; enable = true;
programs.helix = lib.mkIf cfg.enable { package = outputs.packages."${pkgs.system}".helix;
enable = true; defaultEditor = true;
package = outputs.packages."${pkgs.system}".helix; extraPackages = cfg.extraPackages;
defaultEditor = true; settings = let
extraPackages = cfg.extraPackages; config-file = builtins.readFile ./config.toml;
settings = config = builtins.fromTOML config-file;
let in
config-file = builtins.readFile ./config.toml; config;
config = builtins.fromTOML config-file; languages = {
in language-server = {
config; neocmakelsp = {
languages = { command = "neocmakelsp";
language-server = { args = [
neocmakelsp = { "stdio"
command = "neocmakelsp"; ];
args = [ };
"stdio" fish-lsp = {
]; command = "fish-lsp";
}; args = [
fish-lsp = { "start"
command = "fish-lsp"; ];
args = [
"start"
];
};
}; };
language = [
{
name = "cmake";
language-servers = [
"neocmakelsp"
"cmake-language-server"
];
}
{
name = "kdl";
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
];
};
}
{
name = "just";
formatter = {
command = "just";
args = [
"--dump"
];
};
}
{
name = "nix";
formatter = {
command = "nixfmt";
args = [ "-" ];
};
}
{
name = "xml";
formatter = {
command = "xmllint";
args = [
"--format"
"-"
];
};
}
{
name = "typst";
formatter = {
command = "typstyle";
};
}
{
name = "c";
formatter = {
command = "clang-format";
};
}
{
name = "cpp";
formatter = {
command = "clang-format";
};
}
{
name = "python";
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
];
};
language-servers = [
"pyright"
"ruff"
];
}
{
name = "go";
formatter = {
command = "goimports";
};
}
{
name = "awk";
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
}
{
name = "fish";
language-servers = [
"fish-lsp"
];
}
{
name = "yaml";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
}
{
name = "html";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"html"
];
};
language-servers = [
"vscode-html-language-server"
];
}
{
name = "css";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"css"
];
};
language-servers = [
"vscode-css-language-server"
];
}
{
name = "toml";
formatter = {
command = "taplo";
args = [
"fmt"
"-"
];
};
}
{
name = "markdown";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"md"
];
};
}
{
name = "json";
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
}
{
name = "jsonc";
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
}
];
}; };
language = [
{
name = "cmake";
language-servers = [
"neocmakelsp"
"cmake-language-server"
];
}
{
name = "kdl";
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
];
};
}
{
name = "just";
formatter = {
command = "just";
args = [
"--dump"
];
};
}
{
name = "nix";
formatter = {
command = "alejandra";
};
}
{
name = "xml";
formatter = {
command = "xmllint";
args = [
"--format"
"-"
];
};
}
{
name = "typst";
formatter = {
command = "typstyle";
};
}
{
name = "c";
formatter = {
command = "clang-format";
};
}
{
name = "cpp";
formatter = {
command = "clang-format";
};
}
{
name = "python";
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
];
};
language-servers = [
"pyright"
"ruff"
];
}
{
name = "go";
formatter = {
command = "goimports";
};
}
{
name = "awk";
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
}
{
name = "fish";
language-servers = [
"fish-lsp"
];
}
{
name = "yaml";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
}
{
name = "html";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"html"
];
};
language-servers = [
"vscode-html-language-server"
];
}
{
name = "css";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"css"
];
};
language-servers = [
"vscode-css-language-server"
];
}
{
name = "toml";
formatter = {
command = "taplo";
args = [
"fmt"
"-"
];
};
}
{
name = "markdown";
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"md"
];
};
}
{
name = "json";
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
}
{
name = "jsonc";
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
}
];
}; };
}; };
};
} }

View file

@ -3,11 +3,9 @@
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

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.kvm;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.kvm;
in {
options = { options = {
youthlic.programs.kvm = { youthlic.programs.kvm = {
enable = lib.mkEnableOption "kvm"; enable = lib.mkEnableOption "kvm";
@ -12,8 +14,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

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.mpv;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.mpv;
in {
options = { options = {
youthlic.programs.mpv = { youthlic.programs.mpv = {
enable = lib.mkEnableOption "mpv"; enable = lib.mkEnableOption "mpv";

View file

@ -4,12 +4,10 @@
lib, lib,
osConfig ? null, osConfig ? null,
... ...
}: }: let
let
cfg = config.youthlic.programs.niri; cfg = config.youthlic.programs.niri;
niri = osConfig.programs.niri.package; niri = osConfig.programs.niri.package;
in in {
{
options = { options = {
youthlic.programs.niri = { youthlic.programs.niri = {
enable = lib.mkEnableOption "niri"; enable = lib.mkEnableOption "niri";
@ -32,36 +30,34 @@ in
wl-clipboard wl-clipboard
cliphist cliphist
]) ])
++ [ 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 {
{ text = qtctConf;
"qt5ct/qt5ct.conf" = lib.mkForce {
text = qtctConf;
};
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
}; };
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
};
youthlic.programs = { youthlic.programs = {
fuzzel.enable = true; fuzzel.enable = true;
wluma.enable = true; wluma.enable = true;

View file

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

View file

@ -3,22 +3,20 @@
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

@ -2,13 +2,11 @@
config, config,
lib, lib,
... ...
}: }: let
let
inherit (lib) mkEnableOption mkIf mkMerge; inherit (lib) mkEnableOption mkIf mkMerge;
fish-cfg = config.youthlic.programs.fish; fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash; bash-cfg = config.youthlic.programs.bash;
cfg-helper = cfg-helper = conf:
conf:
mkMerge [ mkMerge [
conf conf
(mkIf fish-cfg.enable { (mkIf fish-cfg.enable {
@ -18,8 +16,7 @@ let
enableBashIntegration = true; enableBashIntegration = true;
}) })
]; ];
in in {
{
options = { options = {
youthlic.programs = { youthlic.programs = {
fish = { fish = {

View file

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

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.starship;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.starship;
in {
options = { options = {
youthlic.programs.starship = { youthlic.programs.starship = {
enable = lib.mkEnableOption "starship"; enable = lib.mkEnableOption "starship";
@ -12,10 +14,9 @@ in
programs.starship = lib.mkMerge [ programs.starship = lib.mkMerge [
{ {
enable = true; enable = 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 config.youthlic.programs.fish.enable { (lib.mkIf config.youthlic.programs.fish.enable {

View file

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

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.swaync;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.swaync;
in {
options = { options = {
youthlic.programs.swaync = { youthlic.programs.swaync = {
enable = lib.mkEnableOption "swaync"; enable = lib.mkEnableOption "swaync";
@ -16,7 +18,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

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.thunderbird;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.thunderbird;
in {
options = { options = {
youthlic.programs.thunderbird = { youthlic.programs.thunderbird = {
enable = lib.mkEnableOption "thunderbird"; enable = lib.mkEnableOption "thunderbird";

View file

@ -3,11 +3,9 @@
config, config,
lib, lib,
... ...
}: }: let
let
cfg = config.youthlic.programs.waybar; cfg = config.youthlic.programs.waybar;
in in {
{
options = { options = {
youthlic.programs.waybar = { youthlic.programs.waybar = {
enable = lib.mkEnableOption "waybar"; enable = lib.mkEnableOption "waybar";
@ -26,7 +24,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"
@ -40,7 +38,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,11 +3,9 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
cfg = config.youthlic.programs.wluma; cfg = config.youthlic.programs.wluma;
in in {
{
options = { options = {
youthlic.programs.wluma = { youthlic.programs.wluma = {
enable = lib.mkEnableOption "wluma"; enable = lib.mkEnableOption "wluma";
@ -39,18 +37,18 @@ in
systemd.user.services.wluma = { systemd.user.services.wluma = {
Unit = { Unit = {
Description = "Adjusting screen brightness based on screen contents and amount of ambient light"; Description = "Adjusting screen brightness based on screen contents and amount of ambient light";
PartOf = [ "graphical-session.target" ]; PartOf = ["graphical-session.target"];
After = [ "graphical-session.target" ]; After = ["graphical-session.target"];
}; };
Service = { Service = {
ExecStart = [ "${lib.getExe cfg.package}" ]; ExecStart = ["${lib.getExe cfg.package}"];
Restart = "always"; Restart = "always";
EnvironmentFile = [ "-%E/wluma/service.conf" ]; EnvironmentFile = ["-%E/wluma/service.conf"];
PrivateNetwork = true; PrivateNetwork = true;
PrivateMounts = false; PrivateMounts = false;
}; };
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = ["graphical-session.target"];
}; };
}; };
}; };

View file

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

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.xdg-dirs;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.xdg-dirs;
in {
options = { options = {
youthlic.xdg-dirs = { youthlic.xdg-dirs = {
enable = lib.mkEnableOption "xdg-dirs"; enable = lib.mkEnableOption "xdg-dirs";

View file

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./stylix.nix ./stylix.nix

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,17 +1,21 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
]; 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.initrd.kernelModules = [];
boot.kernelModules = [ ]; boot.kernelModules = [];
boot.extraModulePackages = [ ]; 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,5 +1,4 @@
{ ... }: {...}: {
{
systemd.network = { systemd.network = {
enable = true; enable = true;
wait-online.enable = false; wait-online.enable = false;

View file

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

View file

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

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: {
pkgs,
...
}:
{
imports = [ imports = [
./forgejo.nix ./forgejo.nix
./networking.nix ./networking.nix

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,12 +1,11 @@
{ config, ... }: {config, ...}: {
{
youthlic.containers.forgejo = { youthlic.containers.forgejo = {
enable = true; enable = true;
domain = "forgejo.youthlic.fun"; domain = "forgejo.youthlic.fun";
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

@ -1,17 +1,21 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/profiles/qemu-guest.nix") lib,
]; 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.initrd.kernelModules = [];
boot.kernelModules = [ ]; boot.kernelModules = [];
boot.extraModulePackages = [ ]; 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,5 +1,4 @@
{ config, ... }: {config, ...}: {
{
sops.secrets."miniflux" = { sops.secrets."miniflux" = {
}; };
youthlic.containers.miniflux = { youthlic.containers.miniflux = {

View file

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

View file

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

View file

@ -1,5 +1,4 @@
{ 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

@ -3,8 +3,7 @@
pkgs, pkgs,
inputs, inputs,
... ...
}: }: {
{
imports = imports =
(with inputs; [ (with inputs; [
nixos-hardware.nixosModules.asus-fx506hm nixos-hardware.nixosModules.asus-fx506hm

View file

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

View file

@ -1,17 +1,21 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
]; 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.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [ ]; 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,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
nixpkgs.config.cudaSupport = true; nixpkgs.config.cudaSupport = true;
services = { services = {
hardware.bolt.enable = true; hardware.bolt.enable = true;

View file

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

View file

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

View file

@ -1,5 +1,8 @@
{ lib, pkgs, ... }:
{ {
lib,
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

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.containers;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.containers;
in {
imports = [ imports = [
./forgejo.nix ./forgejo.nix
./miniflux.nix ./miniflux.nix

View file

@ -3,11 +3,9 @@
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";
@ -56,64 +54,62 @@ in
} }
]; ];
config = config = {lib, ...}: {
{ lib, ... }: imports = [
{ ./../programs/forgejo.nix
imports = [ ./../programs/postgresql.nix
./../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 = {
systemd.services.forgejo = { enable = true;
wants = [ "postgresql.service" ]; database = "forgejo";
requires = [ "postgresql.service" ]; auth_method = "peer";
after = [ "postgresql.service" ]; version = "17";
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;
};
services.resolved.enable = true;
system.stateVersion = "24.11";
}; };
systemd.services.forgejo = {
wants = ["postgresql.service"];
requires = ["postgresql.service"];
after = ["postgresql.service"];
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;
};
services.resolved.enable = true;
system.stateVersion = "24.11";
};
}; };
}; };
} }

View file

@ -3,11 +3,9 @@
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";
@ -38,57 +36,55 @@ in
}; };
}; };
config = config = {lib, ...}: {
{ lib, ... }: imports = [
{ ./../programs/miniflux.nix
imports = [ ./../programs/postgresql.nix
./../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 = {
systemd.services.miniflux = { enable = true;
wants = [ "postgresql.service" ]; database = "miniflux";
requires = [ "postgresql.service" ]; auth_method = "peer";
after = [ "postgresql.service" ]; version = "17";
wantedBy = [ "default.target" ];
}; };
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";
}; };
systemd.services.miniflux = {
wants = ["postgresql.service"];
requires = ["postgresql.service"];
after = ["postgresql.service"];
wantedBy = ["default.target"];
};
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";
};
}; };
}; };
} }

View file

@ -3,8 +3,7 @@
inputs, inputs,
outputs, outputs,
... ...
}: }: {
{
imports = imports =
(with inputs; [ (with inputs; [
niri-flake.nixosModules.niri niri-flake.nixosModules.niri

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.users.deploy;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.users.deploy;
in {
options = { options = {
youthlic.users.deploy = { youthlic.users.deploy = {
enable = lib.mkEnableOption "deploy"; enable = lib.mkEnableOption "deploy";

View file

@ -3,11 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: 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,11 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.youthlic.gui; cfg = config.youthlic.gui;
in in {
{
imports = [ imports = [
./niri.nix ./niri.nix
./cosmic.nix ./cosmic.nix
@ -66,7 +64,7 @@ in
monospace = [ monospace = [
"Maple Mono NF CN" "Maple Mono NF CN"
]; ];
emoji = [ "Noto Color Emoji" ]; emoji = ["Noto Color Emoji"];
}; };
}; };

View file

@ -2,11 +2,9 @@
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") {
stylix.targets.qt.platform = "kde"; stylix.targets.qt.platform = "kde";
services = { services = {

View file

@ -3,11 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.youthlic.gui; cfg = config.youthlic.gui;
in in {
{
config = lib.mkIf (cfg.enabled == "niri") { config = lib.mkIf (cfg.enabled == "niri") {
qt = { qt = {
enable = true; enable = true;
@ -23,7 +21,7 @@ in
terminal-exec = { terminal-exec = {
enable = true; enable = true;
settings = { settings = {
default = [ "com.mitchellh.ghostty.desktop" ]; default = ["com.mitchellh.ghostty.desktop"];
}; };
}; };
mime = { mime = {
@ -52,7 +50,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"

View file

@ -6,8 +6,7 @@
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;
@ -33,19 +32,17 @@
''; '';
}; };
}; };
config = config = let
let cfg = config.youthlic.home-manager;
cfg = config.youthlic.home-manager; unixName = cfg.unixName;
unixName = cfg.unixName; hostName = cfg.hostName;
hostName = cfg.hostName; in
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}")
@ -58,7 +55,7 @@
inherit (pkgs) system; inherit (pkgs) system;
}; };
backupFileExtension = "backup"; backupFileExtension = "backup";
sharedModules = [ outputs.homeModules.default ]; sharedModules = [outputs.homeModules.default];
}; };
}; };
} }

View file

@ -3,11 +3,9 @@
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,14 +5,12 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
config = { config = {
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
allowInsecurePredicate = allowInsecurePredicate = p:
p:
builtins.elem (lib.getName p) [ builtins.elem (lib.getName p) [
# for fluffychat and neochat # for fluffychat and neochat
"olm" "olm"
@ -25,7 +23,7 @@
mode = "0444"; mode = "0444";
}; };
nix = { nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nixPath = ["nixpkgs=${inputs.nixpkgs}"];
extraOptions = '' extraOptions = ''
!include ${config.sops.secrets."access-tokens".path} !include ${config.sops.secrets."access-tokens".path}
''; '';

View file

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

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.caddy;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.caddy;
in {
options = { options = {
youthlic.programs.caddy = { youthlic.programs.caddy = {
enable = lib.mkEnableOption "caddy"; enable = lib.mkEnableOption "caddy";
@ -17,7 +19,7 @@ in
enable = true; enable = true;
}; };
networking.firewall = { networking.firewall = {
allowedTCPPorts = [ 443 ]; allowedTCPPorts = [443];
}; };
}; };
} }

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.conduwuit;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.conduwuit;
in {
options = { options = {
youthlic.programs.conduwuit = { youthlic.programs.conduwuit = {
enable = lib.mkEnableOption "conduwuit"; enable = lib.mkEnableOption "conduwuit";
@ -24,7 +26,7 @@ in
enable = true; enable = true;
settings = { settings = {
global = { global = {
port = [ 8481 ]; port = [8481];
address = [ address = [
"0.0.0.0" "0.0.0.0"
"::" "::"

View file

@ -4,11 +4,9 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
cfg = config.youthlic.programs.dae; cfg = config.youthlic.programs.dae;
in in {
{
options = { options = {
youthlic.programs.dae = { youthlic.programs.dae = {
enable = lib.mkEnableOption "dae"; enable = lib.mkEnableOption "dae";
@ -30,102 +28,100 @@ in
mode = "0444"; mode = "0444";
sopsFile = rootPath + "/secrets/general.yaml"; sopsFile = rootPath + "/secrets/general.yaml";
}; };
systemd.services = systemd.services = let
let update = ''
update = '' head="user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
head="user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" new_proxy=/etc/dae/proxy.d.new
new_proxy=/etc/dae/proxy.d.new num=0
num=0 check=1
check=1 urls="$(cat ${config.sops.secrets.url.path})"
urls="$(cat ${config.sops.secrets.url.path})" mkdir -p ''${new_proxy}
mkdir -p ''${new_proxy} for url in ''${urls}; do
for url in ''${urls}; do txt=''${new_proxy}/''${num}.txt
txt=''${new_proxy}/''${num}.txt config="''${new_proxy}/''${num}.dae"
config="''${new_proxy}/''${num}.dae" echo \'curl -LH \""''${head}"\" \""''${url}"\" -o \""''${txt}"\"\'
echo \'curl -LH \""''${head}"\" \""''${url}"\" -o \""''${txt}"\"\' curl -LH "''${head}" "''${url}" -o "''${txt}"
curl -LH "''${head}" "''${url}" -o "''${txt}" echo End curl
echo End curl echo "" > ''${config}
echo "" > ''${config} {
{ echo 'subscription {'
echo 'subscription {' echo \ \ wget:\ \"file://proxy.d/''${num}.txt\"
echo \ \ wget:\ \"file://proxy.d/''${num}.txt\" echo "}"
echo "}" } >> ''${config}
} >> ''${config} if [[ ! -s ''${txt} ]]; then
if [[ ! -s ''${txt} ]]; then check=0
check=0
fi
chmod 0640 ''${txt}
chmod 0640 ''${config}
num=$((num+1))
if [[ ''${check} -eq 0 ]]; then
echo "''${txt}" is empty
exit 103
fi
done
if [[ -d /etc/dae/proxy.d ]]; then
rm -rf /etc/proxy.d.old
mv /etc/dae/proxy.d /etc/dae/proxy.d.old
fi fi
mv ''${new_proxy} /etc/dae/proxy.d chmod 0640 ''${txt}
''; chmod 0640 ''${config}
updateScript = pkgs.writeShellApplication { num=$((num+1))
name = "update.sh";
runtimeInputs = with pkgs; [ if [[ ''${check} -eq 0 ]]; then
coreutils echo "''${txt}" is empty
curl exit 103
]; fi
text = '' done
mkdir -p /etc/proxy.d if [[ -d /etc/dae/proxy.d ]]; then
if [ -z "$(ls -A /etc/dae/proxy.d 2>/dev/null)" ]; then rm -rf /etc/proxy.d.old
echo "No subscription file found in /etc/dae/proxy.d. Update now..." mv /etc/dae/proxy.d /etc/dae/proxy.d.old
${update} fi
else mv ''${new_proxy} /etc/dae/proxy.d
echo "Found existing subscription files. Skipping immediate update." '';
fi updateScript = pkgs.writeShellApplication {
''; name = "update.sh";
}; runtimeInputs = with pkgs; [
updateForceScript = pkgs.writeShellApplication { coreutils
name = "update-force.sh"; curl
runtimeInputs = with pkgs; [ ];
coreutils text = ''
curl mkdir -p /etc/proxy.d
]; if [ -z "$(ls -A /etc/dae/proxy.d 2>/dev/null)" ]; then
text = '' echo "No subscription file found in /etc/dae/proxy.d. Update now..."
${update} ${update}
''; else
echo "Found existing subscription files. Skipping immediate update."
fi
'';
};
updateForceScript = pkgs.writeShellApplication {
name = "update-force.sh";
runtimeInputs = with pkgs; [
coreutils
curl
];
text = ''
${update}
'';
};
in {
"update-dae-subscription-immediate" = {
after = ["network-online.target"];
wants = ["network-online.target"];
before = ["dae.service"];
serviceConfig = {
Type = "oneshot";
User = "root";
ExecStart = [
"${updateScript}/bin/update.sh"
];
}; };
in wantedBy = ["multi-user.target"];
{ };
"update-dae-subscription-immediate" = { "update-dae-subscription-force" = {
after = [ "network-online.target" ]; serviceConfig = {
wants = [ "network-online.target" ]; Type = "oneshot";
before = [ "dae.service" ]; User = "root";
serviceConfig = { ExecStartPre = [
Type = "oneshot"; "-${pkgs.systemd}/bin/systemctl stop dae.service"
User = "root"; ];
ExecStart = [ ExecStartPost = [
"${updateScript}/bin/update.sh" "-${pkgs.systemd}/bin/systemctl start dae.service"
]; ];
}; ExecStart = [
wantedBy = [ "multi-user.target" ]; "${updateForceScript}/bin/update-force.sh"
}; ];
"update-dae-subscription-force" = {
serviceConfig = {
Type = "oneshot";
User = "root";
ExecStartPre = [
"-${pkgs.systemd}/bin/systemctl stop dae.service"
];
ExecStartPost = [
"-${pkgs.systemd}/bin/systemctl start dae.service"
];
ExecStart = [
"${updateForceScript}/bin/update-force.sh"
];
};
}; };
}; };
};
}) })
(lib.mkIf (cfg.enable && config.youthlic.programs.juicity.client.enable) { (lib.mkIf (cfg.enable && config.youthlic.programs.juicity.client.enable) {
environment.etc."dae/local.d/0.dae" = { environment.etc."dae/local.d/0.dae" = {

View file

@ -1,5 +1,8 @@
{ config, lib, ... }:
{ {
config,
lib,
...
}: {
imports = [ imports = [
./transfer-sh.nix ./transfer-sh.nix
./rustypaste ./rustypaste

View file

@ -3,11 +3,9 @@
config, config,
lib, lib,
... ...
}: }: let
let
cfg = config.youthlic.programs.forgejo; cfg = config.youthlic.programs.forgejo;
in in {
{
options = { options = {
youthlic.programs.forgejo = { youthlic.programs.forgejo = {
enable = lib.mkEnableOption "forgejo"; enable = lib.mkEnableOption "forgejo";
@ -92,15 +90,15 @@ in
let let
caddy-cfg = config.youthlic.programs.caddy; caddy-cfg = config.youthlic.programs.caddy;
in in
lib.mkIf (cfg.enable && caddy-cfg.enable) { lib.mkIf (cfg.enable && caddy-cfg.enable) {
services.caddy.virtualHosts = { services.caddy.virtualHosts = {
"forgejo.${caddy-cfg.baseDomain}" = { "forgejo.${caddy-cfg.baseDomain}" = {
extraConfig = '' extraConfig = ''
reverse_proxy 127.0.0.1:${cfg.httpPort} reverse_proxy 127.0.0.1:${cfg.httpPort}
''; '';
};
}; };
}; }
}
) )
]; ];
} }

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.guix;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.guix;
in {
options = { options = {
youthlic.programs.guix = { youthlic.programs.guix = {
enable = lib.mkEnableOption "guix"; enable = lib.mkEnableOption "guix";

View file

@ -3,11 +3,9 @@
lib, lib,
config, config,
... ...
}: }: let
let
cfg = config.youthlic.programs.juicity; cfg = config.youthlic.programs.juicity;
in in {
{
imports = [ imports = [
./template.nix ./template.nix
]; ];
@ -23,12 +21,12 @@ in
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf cfg.client.enable { (lib.mkIf cfg.client.enable {
users.groups.juicity.members = [ "root" ]; users.groups.juicity.members = ["root"];
sops = { sops = {
secrets = { secrets = {
"juicity/serverIp" = { }; "juicity/serverIp" = {};
"juicity/sni" = { }; "juicity/sni" = {};
"juicity/certchainSha256" = { }; "juicity/certchainSha256" = {};
}; };
templates."juicity-client-config.json" = { templates."juicity-client-config.json" = {
group = "juicity"; group = "juicity";
@ -58,7 +56,7 @@ in
}; };
}) })
(lib.mkIf cfg.server.enable { (lib.mkIf cfg.server.enable {
users.groups.juicity.members = [ "root" ]; users.groups.juicity.members = ["root"];
sops = { sops = {
secrets = { secrets = {
"juicity/certificate" = { "juicity/certificate" = {
@ -98,8 +96,8 @@ in
}) })
(lib.mkIf (cfg.server.enable || cfg.client.enable) { (lib.mkIf (cfg.server.enable || cfg.client.enable) {
sops.secrets = { sops.secrets = {
"juicity/uuid" = { }; "juicity/uuid" = {};
"juicity/password" = { }; "juicity/password" = {};
}; };
}) })
]; ];

View file

@ -3,27 +3,23 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.services.juicity; cfg = config.services.juicity;
settingsFormat = pkgs.formats.json { }; settingsFormat = pkgs.formats.json {};
clientConfigFile = clientConfigFile =
if (cfg.client.configFile != null) then if (cfg.client.configFile != null)
cfg.client.configFile then cfg.client.configFile
else else settingsFormat cfg.client.settings;
settingsFormat cfg.client.settings;
serverConfigFile = serverConfigFile =
if (cfg.server.configFile != null) then if (cfg.server.configFile != null)
cfg.server.configFile then cfg.server.configFile
else else settingsFormat cfg.server.settings;
settingsFormat cfg.server.settings; in {
in
{
options = { options = {
services.juicity = { services.juicity = {
client = { client = {
enable = lib.mkEnableOption "juicity-client"; enable = lib.mkEnableOption "juicity-client";
package = lib.mkPackageOption pkgs "juicity" { }; package = lib.mkPackageOption pkgs "juicity" {};
group = lib.mkOption { group = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
example = "juicity"; example = "juicity";
@ -31,7 +27,7 @@ in
}; };
settings = lib.mkOption { settings = lib.mkOption {
type = settingsFormat.type; type = settingsFormat.type;
default = { }; default = {};
example = { example = {
listen = ":1000"; listen = ":1000";
server = "112.32.62.11:23182"; server = "112.32.62.11:23182";
@ -59,7 +55,7 @@ in
}; };
allowedOpenFirewallPorts = lib.mkOption { allowedOpenFirewallPorts = lib.mkOption {
type = lib.types.nullOr (lib.types.listOf lib.types.port); type = lib.types.nullOr (lib.types.listOf lib.types.port);
example = [ 23182 ]; example = [23182];
default = null; default = null;
description = '' description = ''
the ports should be open the ports should be open
@ -68,7 +64,7 @@ in
}; };
server = { server = {
enable = lib.mkEnableOption "juicity-server"; enable = lib.mkEnableOption "juicity-server";
package = lib.mkPackageOption pkgs "juicity" { }; package = lib.mkPackageOption pkgs "juicity" {};
group = lib.mkOption { group = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
example = "juicity"; example = "juicity";
@ -76,7 +72,7 @@ in
}; };
settings = lib.mkOption { settings = lib.mkOption {
type = settingsFormat.type; type = settingsFormat.type;
default = { }; default = {};
description = '' description = ''
Juicity server configuration, for configuration options Juicity server configuration, for configuration options
see example of [server](https://github.com/juicity/juicity/blob/main/install/example-server.json) on github. see example of [server](https://github.com/juicity/juicity/blob/main/install/example-server.json) on github.
@ -104,7 +100,7 @@ in
}; };
allowedOpenFirewallPorts = lib.mkOption { allowedOpenFirewallPorts = lib.mkOption {
type = lib.types.nullOr (lib.types.listOf lib.types.port); type = lib.types.nullOr (lib.types.listOf lib.types.port);
example = [ 23182 ]; example = [23182];
default = null; default = null;
description = '' description = ''
the ports should be open the ports should be open

View file

@ -3,18 +3,16 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.youthlic.programs.kanata; cfg = config.youthlic.programs.kanata;
in in {
{
options = { options = {
youthlic.programs.kanata = { youthlic.programs.kanata = {
enable = lib.mkEnableOption "kanata"; enable = lib.mkEnableOption "kanata";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot.kernelModules = [ "uinput" ]; boot.kernelModules = ["uinput"];
hardware.uinput.enable = true; hardware.uinput.enable = true;
services.kanata = { services.kanata = {
enable = true; enable = true;

View file

@ -3,11 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: 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";
@ -24,7 +22,7 @@ in
programs.virt-manager = { programs.virt-manager = {
enable = true; enable = true;
}; };
users.groups.libvirtd.members = [ cfg.unixName ]; users.groups.libvirtd.members = [cfg.unixName];
virtualisation = { virtualisation = {
libvirtd = { libvirtd = {
enable = true; enable = true;

View file

@ -1,21 +1,22 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.mautrix-telegram;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.mautrix-telegram;
in {
options = { options = {
youthlic.programs.mautrix-telegram = { youthlic.programs.mautrix-telegram = {
enable = lib.mkEnableOption "mautrix-telegram"; enable = lib.mkEnableOption "mautrix-telegram";
}; };
}; };
config = config = let
let conduwuit-cfg = config.youthlic.programs.conduwuit;
conduwuit-cfg = config.youthlic.programs.conduwuit; caddy-cfg = config.youthlic.programs.caddy;
caddy-cfg = config.youthlic.programs.caddy; in
in
lib.mkMerge [ lib.mkMerge [
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
sops.secrets.matrix-telegram-bot = { }; sops.secrets.matrix-telegram-bot = {};
services.mautrix-telegram = { services.mautrix-telegram = {
enable = true; enable = true;
environmentFile = "${config.sops.secrets.matrix-telegram-bot.path}"; environmentFile = "${config.sops.secrets.matrix-telegram-bot.path}";

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.miniflux;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.miniflux;
in {
options = { options = {
youthlic.programs.miniflux = { youthlic.programs.miniflux = {
enable = lib.mkEnableOption "miniflux"; enable = lib.mkEnableOption "miniflux";

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.minio;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.minio;
in {
options = { options = {
youthlic.programs.minio = { youthlic.programs.minio = {
enable = lib.mkEnableOption "minio"; enable = lib.mkEnableOption "minio";

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
config = { config = {
programs.nh = { programs.nh = {
enable = true; enable = true;

View file

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

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.open-webui;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.open-webui;
in {
options = { options = {
youthlic.programs.open-webui = { youthlic.programs.open-webui = {
enable = lib.mkEnableOption "open-webui"; enable = lib.mkEnableOption "open-webui";
@ -23,15 +25,15 @@ in
let let
caddy-cfg = config.youthlic.programs.caddy; caddy-cfg = config.youthlic.programs.caddy;
in in
lib.mkIf (cfg.enable && caddy-cfg.enable) { lib.mkIf (cfg.enable && caddy-cfg.enable) {
services.caddy.virtualHosts = { services.caddy.virtualHosts = {
"open-webui.${caddy-cfg.baseDomain}" = { "open-webui.${caddy-cfg.baseDomain}" = {
extraConfig = '' extraConfig = ''
reverse_proxy 127.0.0.1:8083 reverse_proxy 127.0.0.1:8083
''; '';
};
}; };
}; }
}
) )
]; ];
} }

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.openssh;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.openssh;
in {
options = { options = {
youthlic.programs.openssh = { youthlic.programs.openssh = {
enable = lib.mkEnableOption "openssh"; enable = lib.mkEnableOption "openssh";
@ -42,7 +44,7 @@ in
"diffie-hellman-group-exchange-sha256" "diffie-hellman-group-exchange-sha256"
]; ];
}; };
ports = [ 3022 ]; ports = [3022];
}; };
}; };
} }

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.owncast;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.owncast;
in {
options = { options = {
youthlic.programs.owncast = { youthlic.programs.owncast = {
enable = lib.mkEnableOption "owncast"; enable = lib.mkEnableOption "owncast";

View file

@ -3,11 +3,9 @@
config, config,
lib, lib,
... ...
}: }: let
let
cfg = config.youthlic.programs.postgresql; cfg = config.youthlic.programs.postgresql;
in in {
{
options = { options = {
youthlic.programs.postgresql = { youthlic.programs.postgresql = {
enable = lib.mkEnableOption "postgresql"; enable = lib.mkEnableOption "postgresql";
@ -29,7 +27,7 @@ in
# default socket: /var/lib/postgresql # default socket: /var/lib/postgresql
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [ cfg.database ]; ensureDatabases = [cfg.database];
ensureUsers = [ ensureUsers = [
{ {
name = "${cfg.database}"; name = "${cfg.database}";

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.rustypaste;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.rustypaste;
in {
imports = [ imports = [
./template.nix ./template.nix
]; ];

View file

@ -3,20 +3,18 @@
lib, lib,
config, config,
... ...
}: }: let
let
cfg = config.services.rustypaste; cfg = config.services.rustypaste;
settingsFormat = pkgs.formats.toml { }; settingsFormat = pkgs.formats.toml {};
configFile = settingsFormat.generate "rustypaste-config.toml" cfg.settings; configFile = settingsFormat.generate "rustypaste-config.toml" cfg.settings;
in in {
{
options = { options = {
services.rustypaste = { services.rustypaste = {
enable = lib.mkEnableOption "rustypaste"; enable = lib.mkEnableOption "rustypaste";
package = lib.mkPackageOption pkgs "rustypaste" { }; package = lib.mkPackageOption pkgs "rustypaste" {};
settings = lib.mkOption { settings = lib.mkOption {
type = settingsFormat.type; type = settingsFormat.type;
default = { }; default = {};
description = '' description = ''
Rustypaste configuration Rustypaste configuration
''; '';
@ -63,7 +61,7 @@ in
isSystemUser = true; isSystemUser = true;
}; };
groups = lib.optionalAttrs (cfg.group == "rustypaste") { groups = lib.optionalAttrs (cfg.group == "rustypaste") {
rustypaste = { }; rustypaste = {};
}; };
}; };
systemd.services.rustypaste = { systemd.services.rustypaste = {
@ -88,8 +86,8 @@ in
Type = "simple"; Type = "simple";
Restart = "on-failure"; Restart = "on-failure";
Home = "/var/lib/rustypaste"; Home = "/var/lib/rustypaste";
ReadWritePaths = [ "/var/lib/rustypaste" ]; ReadWritePaths = ["/var/lib/rustypaste"];
StateDirectory = [ "rustypaste" ]; StateDirectory = ["rustypaste"];
ExecStart = '' ExecStart = ''
${lib.getExe cfg.package} ${lib.getExe cfg.package}
''; '';

View file

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

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.tailscale;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.tailscale;
in {
options = { options = {
youthlic.programs.tailscale = { youthlic.programs.tailscale = {
enable = lib.mkEnableOption "tailscale"; enable = lib.mkEnableOption "tailscale";

View file

@ -1,8 +1,10 @@
{ lib, config, ... }:
let
cfg = config.youthlic.programs.transfer-sh;
in
{ {
lib,
config,
...
}: let
cfg = config.youthlic.programs.transfer-sh;
in {
options = { options = {
youthlic.programs.transfer-sh = { youthlic.programs.transfer-sh = {
enable = lib.mkEnableOption "transfer.sh"; enable = lib.mkEnableOption "transfer.sh";

View file

@ -5,11 +5,9 @@
inputs, inputs,
rootPath, rootPath,
... ...
}: }: let
let
cfg = config.youthlic.programs.transmission; cfg = config.youthlic.programs.transmission;
in in {
{
options = { options = {
youthlic.programs.transmission = { youthlic.programs.transmission = {
enable = lib.mkEnableOption "transmission"; enable = lib.mkEnableOption "transmission";
@ -43,21 +41,21 @@ in
let let
caddy-cfg = config.youthlic.programs.caddy; caddy-cfg = config.youthlic.programs.caddy;
in in
lib.mkIf (cfg.enable && caddy-cfg.enable) { lib.mkIf (cfg.enable && caddy-cfg.enable) {
services.transmission = { services.transmission = {
openRPCPort = lib.mkForce false; openRPCPort = lib.mkForce false;
settings = { settings = {
rpc-bind-address = lib.mkForce "127.0.0.1"; rpc-bind-address = lib.mkForce "127.0.0.1";
};
}; };
}; services.caddy.virtualHosts = {
services.caddy.virtualHosts = { "transmission.${caddy-cfg.baseDomain}" = {
"transmission.${caddy-cfg.baseDomain}" = { extraConfig = ''
extraConfig = '' reverse_proxy 127.0.0.1:9091
reverse_proxy 127.0.0.1:9091 '';
''; };
}; };
}; }
}
) )
]; ];
} }

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