refactor: Use haumea for filesystem-based module system for flake outputs

refactor: Use hyphen(`-`) for variable names & folder names(except Python), replace all unserscore(`_`) with hyphen(`-`).
This commit is contained in:
Ryan Yin
2024-03-09 01:32:58 +08:00
parent d7738efed2
commit b382999a70
167 changed files with 1570 additions and 955 deletions

View File

@@ -1,7 +1,6 @@
{
pkgs,
username,
userfullname,
myvars,
nuenv,
...
} @ args: {
@@ -50,8 +49,8 @@
rsync
];
users.users.${username} = {
description = userfullname;
users.users.${myvars.username} = {
description = myvars.userfullname;
# Public Keys that can be used to login to all my PCs, Macbooks, and servers.
#
# Since its authority is so large, we must strengthen its security:
@@ -78,7 +77,7 @@
# given the users in this list the right to specify additional substituters via:
# 1. `nixConfig.substituers` in `flake.nix`
# 2. command line args `--options substituers http://xxx`
trusted-users = [username];
trusted-users = [myvars.username];
# substituers that will be considered before the official ones(https://cache.nixos.org)
substituters = [

View File

@@ -1,9 +1,9 @@
{
config,
username,
myvars,
...
}: let
homeDir = config.users.users."${username}".home;
homeDir = config.users.users."${myvars.username}".home;
in {
# https://github.com/LnL7/nix-darwin/blob/master/modules/programs/gnupg.nix
# try `pkill gpg-agent` if you have issues(such as `no pinentry`)

View File

@@ -1,7 +1,7 @@
{username, ...}: {
{myvars, ...}: {
# Define a user account. Don't forget to set a password with passwd.
users.users."${username}" = {
home = "/Users/${username}";
users.users."${myvars.username}" = {
home = "/Users/${myvars.username}";
# set user's default shell back to zsh
# `chsh -s /bin/zsh`

View File

@@ -1,6 +1,6 @@
{
config,
username,
myvars,
...
}: {
services.skhd = {
@@ -10,7 +10,7 @@
# custom log path for debugging
launchd.user.agents.skhd.serviceConfig = let
homeDir = config.users.users."${username}".home;
homeDir = config.users.users."${myvars.username}".home;
in {
StandardErrorPath = "${homeDir}/Library/Logs/skhd.stderr.log";
StandardOutPath = "${homeDir}/Library/Logs/skhd.stdout.log";

View File

@@ -2,11 +2,11 @@
pkgs,
config,
lib,
username,
myvars,
pkgs-unstable,
...
}: let
homeDir = config.users.users."${username}".home;
homeDir = config.users.users."${myvars.username}".home;
in {
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/darwin/yabai/default.nix
services.yabai = {

View File

@@ -1,4 +1,4 @@
{username, ...}: {
{myvars, ...}: {
####################################################################
#
# NixOS's Configuration for Remote Building / Distributed Building
@@ -14,7 +14,7 @@
# nix.settings.max-jobs = 0;
nix.distributedBuilds = true;
nix.buildMachines = let
sshUser = username;
sshUser = myvars.username;
# ssh key's path on local machine
sshKey = "/etc/agenix/ssh-key-romantic";
systems = [

View File

@@ -1,6 +1,6 @@
{
lib,
vars_networking,
myvars,
...
}: {
# networking.firewall.allowedTCPPorts = [ ... ];
@@ -8,7 +8,7 @@
# Or disable the firewall altogether.
networking.firewall.enable = lib.mkDefault false;
programs.ssh = vars_networking.ssh;
programs.ssh = myvars.networking.ssh;
# Enable the OpenSSH daemon.
services.openssh = {

View File

@@ -1,5 +1,5 @@
{
username,
myvars,
config,
...
}: {
@@ -7,7 +7,7 @@
users.mutableUsers = false;
users.groups = {
"${username}" = {};
"${myvars.username}" = {};
docker = {};
wireshark = {};
# for android platform tools's udev rules
@@ -19,14 +19,14 @@
uinput = {};
};
users.users."${username}" = {
users.users."${myvars.username}" = {
# generated by `mkpasswd -m scrypt`
# we have to use initialHashedPassword here when using tmpfs for /
initialHashedPassword = "$7$CU..../....KDvTIXqLTXpmCaoUy2yC9.$145eM358b7Q0sRXgEBvxctd5EAuEEdao57LmZjc05D.";
home = "/home/${username}";
home = "/home/${myvars.username}";
isNormalUser = true;
extraGroups = [
username
myvars.username
"users"
"networkmanager"
"wheel"
@@ -39,7 +39,7 @@
# root's ssh key are mainly used for remote deployment
users.users.root = {
initialHashedPassword = config.users.users."${username}".initialHashedPassword;
openssh.authorizedKeys.keys = config.users.users."${username}".openssh.authorizedKeys.keys;
initialHashedPassword = config.users.users."${myvars.username}".initialHashedPassword;
openssh.authorizedKeys.keys = config.users.users."${myvars.username}".openssh.authorizedKeys.keys;
};
}

View File

@@ -2,7 +2,7 @@
pkgs,
config,
lib,
username,
myvars,
...
}:
with lib; let
@@ -46,7 +46,7 @@ in {
settings = {
default_session = {
# Wayland Desktop Manager is installed only for user ryan via home-manager!
user = username;
user = myvars.username;
# .wayland-session is a script generated by home-manager, which links to the current wayland compositor(sway/hyprland or others).
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config here.
command = "$HOME/.wayland-session"; # start a wayland session directly without a login manager
@@ -75,7 +75,7 @@ in {
lightdm.enable = true;
autoLogin = {
enable = true;
user = username;
user = myvars.username;
};
# use a fake session to skip desktop manager
# and let Home Manager take care of the X session