iron: format configuration

This commit is contained in:
Primrose 2025-12-08 23:54:56 +08:00
parent eb750b585d
commit 6783ce6f72
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
8 changed files with 180 additions and 160 deletions

View file

@ -5,158 +5,159 @@ let
hostname = "iron"; hostname = "iron";
username = "leana"; username = "leana";
in in
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
inherit (lib.modules) mkAliasOptionModule; let
in { inherit (lib.modules) mkAliasOptionModule;
imports = [ in
# {
# Shorthands imports = [
# #
(mkAliasOptionModule ["me"] ["users" "users" username]) # Shorthands
(mkAliasOptionModule ["hm"] ["home-manager" "users" username]) #
(mkAliasOptionModule [ "me" ] [ "users" "users" username ])
(mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ])
# #
# hostname # hostname
# #
{_module.args = {inherit hostname;};} { _module.args = { inherit hostname; }; }
# #
# nixpkgs # nixpkgs
# #
{ {
# affect the generated nix.conf, doesn't need to be turned off during nixos-install # affect the generated nix.conf, doesn't need to be turned off during nixos-install
nix = { nix = {
distributedBuilds = true; distributedBuilds = true;
settings.builders-use-substitutes = true; settings.builders-use-substitutes = true;
}; };
nixpkgs = { nixpkgs = {
overlays = overlays =
map import map import [
[ ../overlays/agenix.nix
../overlays/agenix.nix ../overlays/disko.nix
../overlays/disko.nix ../overlays/nur.nix
../overlays/nur.nix ../overlays/nix-tree.nix
../overlays/nix-tree.nix ../overlays/nil.nix
../overlays/nil.nix ../overlays/dix.nix
../overlays/dix.nix
../packages/overlay.nix ../packages/overlay.nix
] ]
# use lix everywhere and wrap it with nom # use lix everywhere and wrap it with nom
++ [ ++ [
(import (sources.lix-module + "/overlay.nix") {inherit (sources) lix;}) (import (sources.lix-module + "/overlay.nix") { inherit (sources) lix; })
(import ../overlays/nix-monitored.nix) (import ../overlays/nix-monitored.nix)
]; ];
# Set NIX_PATH and flake registry at the same time # Set NIX_PATH and flake registry at the same time
# https://github.com/NixOS/nixpkgs/pull/254405 # https://github.com/NixOS/nixpkgs/pull/254405
flake.source = sources.nixpkgs; flake.source = sources.nixpkgs;
}; };
nix.package = pkgs.nix-monitored; nix.package = pkgs.nix-monitored;
system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision; system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
} }
# #
# NixOS modules # NixOS modules
# #
./iron/nixos/hardware-configuration.nix # generated ./iron/nixos/hardware-configuration.nix # generated
./iron/nixos/fs.nix ./iron/nixos/fs.nix
./iron/nixos/battery.nix ./iron/nixos/battery.nix
./iron/nixos/connectivity.nix ./iron/nixos/connectivity.nix
./iron/nixos/input.nix ./iron/nixos/input.nix
./iron/nixos/misc.nix ./iron/nixos/misc.nix
./iron/nixos/display.nix ./iron/nixos/display.nix
./iron/nixos/locale.nix ./iron/nixos/locale.nix
./iron/nixos/programs.nix ./iron/nixos/programs.nix
../nixosModules/common/disable-command-not-found.nix ../nixosModules/common/disable-command-not-found.nix
../nixosModules/common/network.nix ../nixosModules/common/network.nix
../nixosModules/common/sudo-conf.nix ../nixosModules/common/sudo-conf.nix
../nixosModules/common/system-nixconf.nix ../nixosModules/common/system-nixconf.nix
../nixosModules/extra/leana.nix ../nixosModules/extra/leana.nix
# #
# Extern modules # Extern modules
# #
(sources.disko + "/module.nix") (sources.disko + "/module.nix")
../disko/iron/btrfs.nix ../disko/iron/btrfs.nix
(sources.agenix + "/modules/age.nix") (sources.agenix + "/modules/age.nix")
../nixosModules/extra/macbook-pro-radeon.nix ../nixosModules/extra/macbook-pro-radeon.nix
../nixosModules/extra/macbook-swap-cmd-opt.nix ../nixosModules/extra/macbook-swap-cmd-opt.nix
../nixosModules/extra/macbook-swap-fn-ctrl.nix ../nixosModules/extra/macbook-swap-fn-ctrl.nix
../nixosModules/extra/macbook-broacom-b43.nix ../nixosModules/extra/macbook-broacom-b43.nix
# #
# home-manager # home-manager
# #
(sources.home-manager + "/nixos") (sources.home-manager + "/nixos")
{ {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}]; sharedModules = [ { home.stateVersion = lib.mkDefault config.system.stateVersion; } ];
}; };
hm.imports = [ hm.imports = [
# #
# hostname # hostname
# #
{_module.args = {inherit hostname;};} { _module.args = { inherit hostname; }; }
# #
# home modules # home modules
# #
./iron/home/programs.nix ./iron/home/programs.nix
../homeModules/common/btop ../homeModules/common/btop
../homeModules/common/fish ../homeModules/common/fish
../homeModules/common/starship ../homeModules/common/starship
../homeModules/common/tmux ../homeModules/common/tmux
../homeModules/common/vim ../homeModules/common/vim
../homeModules/common/direnv.nix ../homeModules/common/direnv.nix
../homeModules/common/fzf.nix ../homeModules/common/fzf.nix
../homeModules/common/git.nix ../homeModules/common/git.nix
../homeModules/common/gpg.nix ../homeModules/common/gpg.nix
../homeModules/common/leana.nix ../homeModules/common/leana.nix
../homeModules/common/locale.nix ../homeModules/common/locale.nix
../homeModules/common/lazygit.nix ../homeModules/common/lazygit.nix
../homeModules/common/packages.nix ../homeModules/common/packages.nix
../homeModules/common/password-store.nix ../homeModules/common/password-store.nix
../homeModules/common/tealdeer.nix ../homeModules/common/tealdeer.nix
../homeModules/common/user-nixconf.nix ../homeModules/common/user-nixconf.nix
../homeModules/extra/tmux-fish-integration.nix ../homeModules/extra/tmux-fish-integration.nix
# #
# Extern modules # Extern modules
# #
(sources.agenix + "/modules/age-home.nix") (sources.agenix + "/modules/age-home.nix")
]; ];
} }
# #
# Secrets # Secrets
# #
{ {
age.secrets = { age.secrets = {
wpa_password.file = "${../secrets/wpa_password.age}"; wpa_password.file = "${../secrets/wpa_password.age}";
}; };
} }
]; ];
} }

View file

@ -3,16 +3,19 @@
lib, lib,
config, config,
... ...
}: { }:
{
home.sessionPath = [ home.sessionPath = [
"${config.home.homeDirectory}/.local/bin" "${config.home.homeDirectory}/.local/bin"
]; ];
home.sessionVariables = let home.sessionVariables =
fishCfg = config.programs.fish; let
in { fishCfg = config.programs.fish;
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); in
}; {
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package);
};
home.packages = [ home.packages = [
pkgs.nmap pkgs.nmap

View file

@ -2,11 +2,13 @@
config, config,
lib, lib,
... ...
}: { }:
users.users.root.openssh.authorizedKeys.keys = let {
# TODO: put iron keys in identities users.users.root.openssh.authorizedKeys.keys =
ids = import ../../../identities.nix; let
in # TODO: put iron keys in identities
ids = import ../../../identities.nix;
in
builtins.concatMap builtins.attrValues (builtins.attrValues ids); builtins.concatMap builtins.attrValues (builtins.attrValues ids);
networking = { networking = {

View file

@ -1,4 +1,4 @@
{ {
me.extraGroups = ["video"]; me.extraGroups = [ "video" ];
programs.light.enable = true; programs.light.enable = true;
} }

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
services.btrfs.autoScrub = { services.btrfs.autoScrub = {
enable = true; enable = true;
fileSystems = [ fileSystems = [

View file

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

View file

@ -1,4 +1,5 @@
{lib, ...}: { { lib, ... }:
{
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# `timedatectl list-timezones` # `timedatectl list-timezones`
time.timeZone = "Asia/Taipei"; time.timeZone = "Asia/Taipei";
@ -28,16 +29,16 @@
let let
genLocale = locale: lib.flip lib.genAttrs (_: locale); genLocale = locale: lib.flip lib.genAttrs (_: locale);
in in
# - xscreensaver freaks out on the time display # - xscreensaver freaks out on the time display
# - evolution add event becomes hard to use # - evolution add event becomes hard to use
# https://gitlab.gnome.org/GNOME/evolution/-/issues/3120 # https://gitlab.gnome.org/GNOME/evolution/-/issues/3120
genLocale "fr_FR.UTF-8" [ genLocale "fr_FR.UTF-8" [
"LC_TIME" "LC_TIME"
] ]
// genLocale "zh_TW.UTF-8" [ // genLocale "zh_TW.UTF-8" [
"LC_MONETARY" "LC_MONETARY"
"LC_ADDRESS" "LC_ADDRESS"
]; ];
}; };
# Wireless Regulatory Domain, uses ISO / IEC 3166 country code # Wireless Regulatory Domain, uses ISO / IEC 3166 country code

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
environment.systemPackages = [ environment.systemPackages = [
pkgs.man-pages pkgs.man-pages
pkgs.man-pages-posix pkgs.man-pages-posix