feat: Change nix formatter to alejandra

This commit is contained in:
ulic-youthlic 2025-11-09 06:25:03 +08:00
parent 0b8b647f05
commit b4c3dfec42
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
229 changed files with 2528 additions and 2884 deletions

1
.nvim.lua Normal file
View file

@ -0,0 +1 @@
require("conform").formatters_by_ft.nix = { "alejandra" }

12
.zed/settings.json Normal file
View file

@ -0,0 +1,12 @@
{
"languages": {
"Nix": {
"formatter": {
"external": {
"command": "alejandra",
"arguments": ["-"]
}
}
}
}
}

View file

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

View file

@ -4,32 +4,28 @@
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,
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 = deploy-rs.lib."${system}".activate.nixos outputs.nixosConfigurations."${hostName}";
user = "root";
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 {
@ -38,21 +34,20 @@ in
}; };
}; };
config = { config = {
flake.deploy.nodes = flake.deploy.nodes = with lib;
with lib;
pipe pipe
[ [
"Cape" "Cape"
"Akun" "Akun"
] ]
[ [
(map ( (map (
hostName: hostName:
mkDeployNode { mkDeployNode {
inherit hostName; inherit hostName;
} }
)) ))
(foldr (a: b: a // b) { }) (foldr (a: b: a // b) {})
]; ];
}; };
} }

View file

@ -4,44 +4,42 @@
self, self,
rootPath, rootPath,
... ...
}: }: let
let
inherit (self) outputs; inherit (self) outputs;
homeModules = homeModules =
( (
with lib; with lib;
pipe (rootPath + "/home") [ pipe (rootPath + "/home") [
builtins.readDir builtins.readDir
(filterAttrs (_key: value: value == "directory")) (filterAttrs (_key: value: value == "directory"))
(filterAttrs ( (filterAttrs (
key: _value: key: _value:
!builtins.elem key [ !builtins.elem key [
"modules" "modules"
"extra" "extra"
] ]
)) ))
builtins.attrNames builtins.attrNames
(flip genAttrs (name: import (rootPath + "/home/${name}/modules"))) (flip genAttrs (name: import (rootPath + "/home/${name}/modules")))
] ]
) )
// { // {
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,
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 = import nixpkgs {
"${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration { localSystem = {inherit system;};
pkgs = import nixpkgs { };
localSystem = { inherit system; }; modules =
}; [
modules = [
(rootPath + "/home/${unixName}/configurations/${hostName}") (rootPath + "/home/${unixName}/configurations/${hostName}")
] ]
++ (with homeModules; [ ++ (with homeModules; [
@ -53,32 +51,30 @@ let
] ]
++ [ ++ [
{ {
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 = homeConfigurations = with lib;
with lib; foldr (a: b: a // b) {} (
foldr (a: b: a // b) { } (
pipe pipe
[ [
# Hostname # Hostname
] ]
[ (map (hostName: makeHomeConfiguration { inherit hostName; })) ] [(map (hostName: makeHomeConfiguration {inherit hostName;}))]
); );
inherit homeModules; inherit homeModules;
}; };

View file

@ -4,39 +4,35 @@
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 = nixosConfigurations = let
let makeNixosConfiguration = hostName:
makeNixosConfiguration = lib.nixosSystem {
hostName: modules = [(rootPath + "/nixos/configurations/${hostName}")];
lib.nixosSystem { specialArgs = {
modules = [ (rootPath + "/nixos/configurations/${hostName}") ]; inherit
specialArgs = { inputs
inherit outputs
inputs rootPath
outputs lib
rootPath ;
lib
;
};
}; };
in };
in
with lib; with lib;
pipe pipe
[ [
"Tytonidae" "Tytonidae"
"Cape" "Cape"
"Akun" "Akun"
] ]
[ (flip genAttrs makeNixosConfiguration) ]; [(flip genAttrs makeNixosConfiguration)];
}; };
} }

View file

@ -4,18 +4,15 @@
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 = with lib;
flake.overlays =
with lib;
pipe pipe
[ [
"modifications" "modifications"
"additions" "additions"
] ]
[ (flip genAttrs (name: importWithArgs (rootPath + "/overlays/${name}"))) ]; [(flip genAttrs (name: importWithArgs (rootPath + "/overlays/${name}")))];
} }

View file

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

View file

@ -3,8 +3,7 @@
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,8 +2,7 @@
pkgs, pkgs,
unixName, unixName,
... ...
}: }: {
{
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = { programs = {

View file

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

View file

@ -4,35 +4,32 @@
unixName, unixName,
config, config,
... ...
}: }: {
{
imports = lib.youthlic.loadImports ./.; imports = lib.youthlic.loadImports ./.;
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = programs = let
let email = config.accounts.email.accounts.ulic-youthlic;
email = config.accounts.email.accounts.ulic-youthlic; inherit (email) address name;
inherit (email) address name; signKey = email.gpg.key;
signKey = email.gpg.key; in {
in gpg.enable = true;
{ git = {
gpg.enable = true; inherit name signKey;
git = { email = address;
inherit name signKey; encrypt-credential = true;
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,17 +2,13 @@
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 = waybar.settings = let
let cfg = config.david.programs.niri.waybar;
cfg = config.david.programs.niri.waybar; in [(cfg.template // (cfg.helper.mkBacklight "intel_backlight") // {output = "eDP-1";})];
in
[ (cfg.template // (cfg.helper.mkBacklight "intel_backlight") // { output = "eDP-1"; }) ];
wluma.extraSettings = { wluma.extraSettings = {
output = { output = {
backlight = [ backlight = [
@ -24,26 +20,25 @@ in
]; ];
}; };
}; };
extraConfig = extraConfig = let
let output = node "output";
output = node "output"; in [
in (
[ output
(output ["eDP-1"]
[ "eDP-1" ] [
[ (leaf "mode" ["1920x1200@60.018"])
(leaf "mode" [ "1920x1200@60.018" ]) (leaf "scale" [1.0])
(leaf "scale" [ 1.0 ]) (flag "focus-at-startup")
(flag "focus-at-startup") (leaf "position" [
(leaf "position" [ {
{ x = 0;
x = 0; y = 0;
y = 0; }
} ])
]) (leaf "transform" ["normal"])
(leaf "transform" [ "normal" ]) ]
] )
) ];
];
}; };
} }

View file

@ -4,43 +4,40 @@
config, config,
unixName, unixName,
... ...
}: }: {
{
imports = lib.youthlic.loadImports ./.; imports = lib.youthlic.loadImports ./.;
youthlic = { youthlic = {
xdg-dirs.enable = true; xdg-dirs.enable = true;
programs = programs = let
let email = config.accounts.email.accounts.ulic-youthlic;
email = config.accounts.email.accounts.ulic-youthlic; inherit (email) name address;
inherit (email) name address; signKey = email.gpg.key;
signKey = email.gpg.key; in {
in rustypaste-cli.enable = true;
{ gpg.enable = true;
rustypaste-cli.enable = true; jujutsu = {
gpg.enable = true; enable = true;
jujutsu = { inherit name signKey;
enable = true; email = address;
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;
spotifyd.enable = true;
awscli = {
enable = true;
url = "http://localhost:8491";
};
}; };
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;
spotifyd.enable = true;
awscli = {
enable = true;
url = "http://localhost:8491";
};
};
}; };
david = { david = {

View file

@ -1,17 +1,17 @@
{ config, lib, ... }:
let
cfg = config.david.programs.niri;
in
{ {
config,
lib,
...
}: let
cfg = config.david.programs.niri;
in {
david.programs.niri = lib.mkIf cfg.enable { david.programs.niri = lib.mkIf cfg.enable {
waybar.settings = waybar.settings = let
let cfg = config.david.programs.niri.waybar;
cfg = config.david.programs.niri.waybar; in [
in (cfg.template // (cfg.helper.mkBacklight "ddcci13") // {output = "DP-1";})
[ (cfg.template // (cfg.helper.mkBacklight "nvidia_0") // {output = "eDP-2";})
(cfg.template // (cfg.helper.mkBacklight "ddcci13") // { output = "DP-1"; }) ];
(cfg.template // (cfg.helper.mkBacklight "nvidia_0") // { output = "eDP-2"; })
];
wluma.extraSettings = { wluma.extraSettings = {
output = { output = {
backlight = [ backlight = [
@ -34,6 +34,6 @@ in
} }
]; ];
}; };
extraConfig = [ ]; extraConfig = [];
}; };
} }

View file

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

View file

@ -2,11 +2,9 @@
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,11 +3,9 @@
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";
@ -20,13 +18,13 @@ in
settings = settings =
( (
with lib; with lib;
pipe ./alacritty.toml [ pipe ./alacritty.toml [
builtins.readFile builtins.readFile
builtins.fromTOML builtins.fromTOML
] ]
) )
// { // {
colors = lib.mkForce { }; colors = lib.mkForce {};
font.size = lib.mkForce 16; font.size = lib.mkForce 16;
window.opacity = lib.mkForce 0.8; window.opacity = lib.mkForce 0.8;
general.import = [ general.import = [

View file

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

@ -3,11 +3,9 @@
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";
@ -89,7 +87,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@gp" ]; definedAliases = ["@gp"];
}; };
"Nix Packages" = { "Nix Packages" = {
urls = [ urls = [
@ -108,7 +106,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 = [
@ -126,7 +124,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@no" ]; definedAliases = ["@no"];
}; };
"Home Manager Options" = { "Home Manager Options" = {
urls = [ urls = [
@ -144,7 +142,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@hm" ]; definedAliases = ["@hm"];
}; };
"Nix Flakes" = { "Nix Flakes" = {
urls = [ urls = [
@ -162,7 +160,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@nf" ]; definedAliases = ["@nf"];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
urls = [ urls = [
@ -176,7 +174,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@nw" ]; definedAliases = ["@nw"];
}; };
"Rust Stdandard Lib" = { "Rust Stdandard Lib" = {
urls = [ urls = [
@ -190,7 +188,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@rs" ]; definedAliases = ["@rs"];
}; };
"GitHub" = { "GitHub" = {
urls = [ urls = [
@ -208,7 +206,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@gh" ]; definedAliases = ["@gh"];
}; };
"Rust Reference" = { "Rust Reference" = {
urls = [ urls = [
@ -222,7 +220,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@rr" ]; definedAliases = ["@rr"];
}; };
"Rust Crates" = { "Rust Crates" = {
urls = [ urls = [
@ -236,7 +234,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@rc" ]; definedAliases = ["@rc"];
}; };
"C++ Reference" = { "C++ Reference" = {
urls = [ urls = [
@ -254,7 +252,7 @@ in
]; ];
} }
]; ];
definedAliases = [ "@cr" ]; definedAliases = ["@cr"];
}; };
"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,11 +2,9 @@
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,11 +2,9 @@
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,42 +3,39 @@
config, config,
lib, lib,
... ...
}: }: {
{
options = { options = {
david.programs.ghostty = { david.programs.ghostty = {
enable = lib.mkEnableOption "ghostty"; enable = lib.mkEnableOption "ghostty";
}; };
}; };
config = config = let
let cfg = config.david.programs.ghostty;
cfg = config.david.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 = "Maple Mono NF CN";
settings = { font-feature = [
# font-family = "Maple Mono NF CN"; "calt"
font-feature = [ "zero"
"calt" "cv03"
"zero" "ss08"
"cv03" ];
"ss08" font-size = lib.mkForce 17;
]; theme = lib.mkForce "Atom One Dark";
font-size = lib.mkForce 17; background-opacity = lib.mkForce 0.8;
theme = lib.mkForce "Atom One Dark"; confirm-close-surface = "false";
background-opacity = lib.mkForce 0.8; };
confirm-close-surface = "false"; }
}; (lib.mkIf config.youthlic.programs.fish.enable {
} enableFishIntegration = true;
(lib.mkIf config.youthlic.programs.fish.enable { })
enableFishIntegration = true; (lib.mkIf config.youthlic.programs.bash.enable {
}) enableBashIntegration = true;
(lib.mkIf config.youthlic.programs.bash.enable { })
enableBashIntegration = true; ];
}) });
];
});
} }

View file

@ -3,11 +3,9 @@
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,11 +2,9 @@
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,11 +2,9 @@
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,17 +6,17 @@
osConfig ? null, osConfig ? null,
options, options,
... ...
}@args: } @ args: let
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 =
default = osConfig.youthlic.gui.enabled == "niri"; (lib.mkEnableOption "niri")
}; // {
default = osConfig.youthlic.gui.enabled == "niri";
};
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = inputs.niri-flake.lib.kdl.types.kdl-document; type = inputs.niri-flake.lib.kdl.types.kdl-document;
}; };
@ -51,35 +51,34 @@ in
swayimg swayimg
seahorse seahorse
]) ])
++ [ 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;
};
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
}; };
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
};
david.programs = { david.programs = {
fuzzel.enable = true; fuzzel.enable = true;
waybar = { waybar = {
@ -97,7 +96,7 @@ in
}; };
programs.niri = { programs.niri = {
config = config =
(lib.toList (import ./config.nix (args // { inherit pkgs; }))) ++ (lib.toList cfg.extraConfig); (lib.toList (import ./config.nix (args // {inherit pkgs;}))) ++ (lib.toList cfg.extraConfig);
package = niri; package = niri;
}; };
}) })

View file

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

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";
@ -49,7 +47,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

@ -4,17 +4,15 @@
lib, lib,
inputs, inputs,
... ...
}: }: let
let
inherit (inputs) nixpkgs emacs-overlay spacemacs; inherit (inputs) nixpkgs emacs-overlay spacemacs;
inherit (pkgs) system; inherit (pkgs) system;
cfg = config.david.programs.spacemacs; cfg = config.david.programs.spacemacs;
pkgs' = import nixpkgs { pkgs' = import nixpkgs {
localSystem = { inherit system; }; localSystem = {inherit system;};
overlays = [ emacs-overlay.overlays.default ]; overlays = [emacs-overlay.overlays.default];
}; };
in in {
{
options = { options = {
david.programs.spacemacs = { david.programs.spacemacs = {
enable = lib.mkEnableOption "spacemacs"; enable = lib.mkEnableOption "spacemacs";
@ -30,8 +28,7 @@ in
}; };
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = package = with pkgs';
with pkgs';
(emacsPackagesFor emacs-pgtk).emacsWithPackages (_epkgs: [ (emacsPackagesFor emacs-pgtk).emacsWithPackages (_epkgs: [
git git
gnutar gnutar

View file

@ -3,11 +3,9 @@
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,11 +2,9 @@
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";
@ -20,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

@ -2,11 +2,9 @@
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,11 +4,9 @@
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";
@ -25,7 +23,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"
@ -39,7 +37,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 @@
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";
@ -29,7 +27,7 @@ in
OnCalendar = "*:0/10"; OnCalendar = "*:0/10";
}; };
Install = { Install = {
WantedBy = [ "timers.target" ]; WantedBy = ["timers.target"];
}; };
}; };
services."waypaper" = { services."waypaper" = {

View file

@ -3,11 +3,9 @@
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";
@ -35,22 +33,23 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.wluma = { services.wluma = {
enable = true; enable = true;
settings = { settings =
als = { {
webcam = { als = {
video = 0; webcam = {
thresholds = { video = 0;
"0" = "night"; thresholds = {
"15" = "dark"; "0" = "night";
"30" = "dim"; "15" = "dark";
"45" = "normal"; "30" = "dim";
"60" = "bright"; "45" = "normal";
"75" = "outdoors"; "60" = "bright";
"75" = "outdoors";
};
}; };
}; };
}; }
} // cfg.extraSettings;
// cfg.extraSettings;
systemd = { systemd = {
enable = true; enable = true;
}; };

View file

@ -3,11 +3,9 @@
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";
@ -64,7 +62,7 @@ in
ty = { ty = {
binary = { binary = {
path = lib.getExe pkgs.ty; path = lib.getExe pkgs.ty;
arguments = [ "server" ]; arguments = ["server"];
}; };
}; };
}; };

View file

@ -3,11 +3,9 @@
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,8 +2,7 @@
lib, lib,
inputs, inputs,
... ...
}: }: {
{
imports = imports =
(with inputs; [ (with inputs; [
niri-flake.homeModules.niri niri-flake.homeModules.niri

View file

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

View file

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

View file

@ -2,11 +2,9 @@
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,11 +3,9 @@
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";
@ -18,7 +16,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,11 +2,9 @@
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

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

View file

@ -2,14 +2,12 @@
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

@ -3,11 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: 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";
@ -25,7 +23,8 @@ in
{ {
name = with pkgs.fishPlugins.foreign-env; pname + "-" + version; name = with pkgs.fishPlugins.foreign-env; pname + "-" + version;
src = pkgs.fishPlugins.foreign-env.overrideAttrs { src = pkgs.fishPlugins.foreign-env.overrideAttrs {
postInstall = # bash postInstall =
# bash
'' ''
ln -s $out/share/fish/vendor_functions.d $out/functions ln -s $out/share/fish/vendor_functions.d $out/functions
''; '';
@ -41,7 +40,8 @@ in
body = ''''; body = '''';
}; };
}; };
shellInitLast = # fish shellInitLast =
# fish
'' ''
if test -e ~/.config/guix/current/bin/guix if test -e ~/.config/guix/current/bin/guix
fish_add_path -pPm ~/.config/guix/current/bin fish_add_path -pPm ~/.config/guix/current/bin

View file

@ -2,13 +2,11 @@
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,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 = { programs = {

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

@ -3,26 +3,23 @@
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 ( type = lib.types.attrsOf (
lib.types.submodule ( lib.types.submodule (
{ ... }: {...}: {
{
freeformType = lib.types.anything; freeformType = lib.types.anything;
options = { options = {
language-servers = lib.mkOption { language-servers = lib.mkOption {
type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything); type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything);
default = [ "typos-lsp" ]; default = ["typos-lsp"];
example = [ "rust-analyzer" ]; example = ["rust-analyzer"];
apply = lib.unique; apply = lib.unique;
}; };
}; };
@ -30,17 +27,16 @@ in
) )
); );
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
] ]
); );
@ -56,8 +52,7 @@ in
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
extraPackages = cfg.extraPackages; extraPackages = cfg.extraPackages;
settings = settings = with lib;
with lib;
pipe ./config.toml [ pipe ./config.toml [
builtins.readFile builtins.readFile
builtins.fromTOML builtins.fromTOML
@ -86,200 +81,200 @@ in
command = "typos-lsp"; command = "typos-lsp";
}; };
}; };
} { language = cfg.languageSettings; }; } {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 [ (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
]) ])
{ {
cmake = { cmake = {
language-servers = [ language-servers = [
"neocmakelsp" "neocmakelsp"
"cmake-language-server" "cmake-language-server"
];
};
kdl = {
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
]; ];
}; };
kdl = {
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
];
};
};
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 = {
formatter = {
command = "goimports";
};
};
awk = {
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
};
fish = {
language-servers = [
"fish-lsp"
];
};
yaml = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
};
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"
];
};
};
}; };
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 = {
formatter = {
command = "goimports";
};
};
awk = {
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
};
fish = {
language-servers = [
"fish-lsp"
];
};
yaml = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
};
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,11 +2,9 @@
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,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

@ -2,11 +2,9 @@
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";
@ -16,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

@ -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

@ -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 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.spotifyd;
in
{ {
config,
lib,
...
}: let
cfg = config.youthlic.programs.spotifyd;
in {
options = { options = {
youthlic.programs.spotifyd = { youthlic.programs.spotifyd = {
enable = lib.mkEnableOption "spotifyd"; enable = lib.mkEnableOption "spotifyd";

View file

@ -2,14 +2,12 @@
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";
@ -20,10 +18,9 @@ in
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;
}; };
}) })

View file

@ -3,13 +3,11 @@
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";
@ -23,7 +21,8 @@ in
programs.yazi = { programs.yazi = {
enable = true; enable = true;
plugins = { plugins = {
inherit (pkgs.yaziPlugins) inherit
(pkgs.yaziPlugins)
ouch ouch
starship starship
piper piper
@ -81,7 +80,7 @@ in
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,13 +2,11 @@
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,11 +2,9 @@
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,38 +1,39 @@
final: _prev: { final: _prev: {
youthlic = { youthlic = {
loadImports' = loadImports' = dir: f:
dir: f:
final.pipe dir [ final.pipe dir [
final.youthlic.loadImports final.youthlic.loadImports
f f
]; ];
loadImports = loadImports = dir:
dir:
with final; with final;
if !(pathExists dir && builtins.readFileType dir == "directory") then if !(pathExists dir && builtins.readFileType dir == "directory")
[ ] then []
else else let
let
items = pipe dir [ items = pipe dir [
builtins.readDir builtins.readDir
attrNames attrNames
]; ];
in in
pipe items [ pipe items [
(concatMap ( (concatMap (
name: name: let
let path = dir + "/${name}";
path = dir + "/${name}"; type = builtins.readFileType path;
type = builtins.readFileType path; in
in if type == "directory"
if type == "directory" then then
if pathExists (path + "/default.nix") then [ path ] else youthlic.loadImports path if pathExists (path + "/default.nix")
else if type == "regular" then then [path]
if hasSuffix ".nix" name then [ path ] else [ ] else youthlic.loadImports path
else else if type == "regular"
[ ] then
)) if hasSuffix ".nix" name
(filter (name: !hasSuffix "/default.nix" (toString name))) then [path]
]; else []
else []
))
(filter (name: !hasSuffix "/default.nix" (toString name)))
];
}; };
} }

View file

@ -4,8 +4,7 @@
lib, lib,
outputs, outputs,
... ...
}: }: {
{
imports = imports =
(with inputs.nixos-hardware.nixosModules; [ (with inputs.nixos-hardware.nixosModules; [
common-cpu-intel common-cpu-intel
@ -76,11 +75,11 @@
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 = { nix = {
settings = { settings = {
system-features = [ "gccarch-skylake" ]; system-features = ["gccarch-skylake"];
}; };
}; };
hardware = { hardware = {

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,5 +1,4 @@
{ ... }: {...}: {
{
youthlic.gui = { youthlic.gui = {
enabled = "niri"; enabled = "niri";
}; };

View file

@ -7,8 +7,7 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: }: {
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
@ -21,9 +20,9 @@
"usb_storage" "usb_storage"
"sd_mod" "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

@ -2,8 +2,7 @@
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,8 +2,7 @@
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 = {
@ -72,7 +72,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,12 +1,11 @@
{ 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,8 +7,7 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: }: {
{
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
@ -20,9 +19,9 @@
"sr_mod" "sr_mod"
"virtio_blk" "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,6 +1,5 @@
{ 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,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

@ -4,8 +4,7 @@
inputs, inputs,
outputs, outputs,
... ...
}: }: {
{
imports = imports =
(with inputs.nixos-hardware.nixosModules; [ (with inputs.nixos-hardware.nixosModules; [
common-hidpi common-hidpi
@ -18,7 +17,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,5 +1,4 @@
{ ... }: {...}: {
{
disko.devices = { disko.devices = {
disk = { disk = {
disk1 = { disk1 = {

View file

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

View file

@ -7,8 +7,7 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: }: {
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
@ -20,9 +19,9 @@
"usb_storage" "usb_storage"
"sd_mod" "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

@ -3,8 +3,7 @@
lib, lib,
config, config,
... ...
}: }: {
{
nixpkgs.config.cudaSupport = true; nixpkgs.config.cudaSupport = true;
services = { services = {
hardware.bolt.enable = true; hardware.bolt.enable = true;
@ -16,13 +15,13 @@
}; };
nix = { nix = {
settings = { settings = {
system-features = [ "gccarch-alderlake" ]; 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 = {
@ -40,7 +39,7 @@
}; };
}; };
boot = { boot = {
extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ]; extraModulePackages = with config.boot.kernelPackages; [ddcci-driver];
kernelModules = [ kernelModules = [
"ddcci" "ddcci"
"ddcci-backlight" "ddcci-backlight"
@ -56,38 +55,36 @@
}; };
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 = ExecStart = let
let script = pkgs.writeShellApplication {
script = pkgs.writeShellApplication { name = "ddcci-handler";
name = "ddcci-handler"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ coreutils
coreutils ddcutil
ddcutil ];
]; text = ''
text = '' echo Trying to attach ddcci to "$1"
echo Trying to attach ddcci to "$1" success=0
success=0 i=0
i=0 id=$(echo "$1" | cut -d "-" -f 2)
id=$(echo "$1" | cut -d "-" -f 2) while ((success < 1)) && ((i++ < 5)); do
while ((success < 1)) && ((i++ < 5)); do if ddcutil getvcp 10 -b "$id"; then
if ddcutil getvcp 10 -b "$id"; then if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then
if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then success=1
success=1 echo ddcci attached to "$1"
echo ddcci attached to "$1"
fi
fi fi
echo "Try $i" fi
sleep 1; echo "Try $i"
done sleep 1;
''; done
}; '';
in };
"${lib.getExe' script "ddcci-handler"} %i"; in "${lib.getExe' script "ddcci-handler"} %i";
}; };
}; };
services.udev.extraRules = '' services.udev.extraRules = ''

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,4 @@
{ lib, ... }: {lib, ...}: {
{
config.specialisation.cosmic = { config.specialisation.cosmic = {
inheritParentConfig = true; inheritParentConfig = true;
configuration = { configuration = {

View file

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

View file

@ -2,12 +2,11 @@
inputs, inputs,
lib, lib,
... ...
}: }: {
{
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];
hardware.nvidia.prime.reverseSync.enable = lib.mkForce false; hardware.nvidia.prime.reverseSync.enable = lib.mkForce false;
}; };
}; };

View file

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

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

View file

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

@ -21,15 +21,14 @@ lib.mkMerge [
inherit (pkgs.writers) writeFish; inherit (pkgs.writers) writeFish;
cfg = config.documentation.man.man-db; cfg = config.documentation.man.man-db;
cachePath = "/var/cache/man/nixos"; cachePath = "/var/cache/man/nixos";
in in {
{
documentation.man.generateCaches = false; 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
@ -42,76 +41,76 @@ lib.mkMerge [
ExecStart = ExecStart =
writeFish "mandbsvc" # fish writeFish "mandbsvc" # fish
'' ''
set -l SystemManLoc "/run/current-system/sw/share/man" set -l SystemManLoc "/run/current-system/sw/share/man"
set -l ContentRecord "${cachePath}/man-db-state" set -l ContentRecord "${cachePath}/man-db-state"
if [ ! -d "${cachePath}" ] if [ ! -d "${cachePath}" ]
mkdir -pv "${cachePath}" || exit 1 mkdir -pv "${cachePath}" || exit 1
end end
if [ ! -f "$ContentRecord" ] if [ ! -f "$ContentRecord" ]
touch "$ContentRecord" || exit 1 touch "$ContentRecord" || exit 1
end end
# 1) Collect list of all manpage files and calculate hashes # 1) Collect list of all manpage files and calculate hashes
# of them # of them
# #
# man1/ls.1.gz # man1/ls.1.gz
# man3/func.3.gz # man3/func.3.gz
# #
# hash -> # hash ->
# #
# bbbbbbbbbbbb (man1/ls.1.gz) # bbbbbbbbbbbb (man1/ls.1.gz)
# aaaaaaaaaaaa (man3/func.3.gz) # aaaaaaaaaaaa (man3/func.3.gz)
set -l hashes "$( set -l hashes "$(
find -L "$SystemManLoc" -type f -iname "*.gz" \ find -L "$SystemManLoc" -type f -iname "*.gz" \
-exec sha256sum "{}" "+" \ -exec sha256sum "{}" "+" \
| awk '{ print $1 }' | awk '{ print $1 }'
or exit 1 or exit 1
)" )"
# 2) Sort the hashes to make them "stable", # 2) Sort the hashes to make them "stable",
# and then join them toghther into a big long string, # and then join them toghther into a big long string,
# and then hash this big string to get the hash of the directory # and then hash this big string to get the hash of the directory
# #
# bbbbbbbbbbbb # bbbbbbbbbbbb
# aaaaaaaaaaaa # aaaaaaaaaaaa
# #
# sort -> # sort ->
# #
# aaaaaaaaaaaa # aaaaaaaaaaaa
# bbbbbbbbbbbb # bbbbbbbbbbbb
# #
# join -> # join ->
# #
# aaaaaaaaaaaabbbbbbbbbbbb # aaaaaaaaaaaabbbbbbbbbbbb
# #
# hash -> # hash ->
# #
# cccccccccccc # cccccccccccc
set -l ultimate_hash ( set -l ultimate_hash (
echo $hashes \ echo $hashes \
| sort \ | sort \
| string join "" \ | string join "" \
| sha256sum - \ | sha256sum - \
| awk '{ print $1 }' | awk '{ print $1 }'
or exit 1 or exit 1
) )
set -l old_hash "$( string collect < "$ContentRecord" )" set -l old_hash "$( string collect < "$ContentRecord" )"
echo "Old hash: $old_hash" echo "Old hash: $old_hash"
echo "New hash: $ultimate_hash" echo "New hash: $ultimate_hash"
if [ "$old_hash" != "$ultimate_hash" ] if [ "$old_hash" != "$ultimate_hash" ]
echo "Hash changed, do a full man-db rebuild" echo "Hash changed, do a full man-db rebuild"
mandb -psc || exit 1 mandb -psc || exit 1
echo "Write new hash" echo "Write new hash"
echo "$ultimate_hash" > "$ContentRecord" echo "$ultimate_hash" > "$ContentRecord"
else else
echo "Hash not changed, skip" echo "Hash not changed, skip"
end end
''; '';
}; };
}; };

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 == "cosmic") { config = lib.mkIf (cfg.enabled == "cosmic") {
services = { services = {
desktopManager.cosmic = { desktopManager.cosmic = {

View file

@ -3,11 +3,9 @@
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,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") {
# Fix stylix bug # Fix stylix bug
qt.platformTheme = lib.mkForce "kde"; qt.platformTheme = lib.mkForce "kde";

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