From 530f8498a1a3b224be294aeeecdee962778ce815 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 17 Jun 2023 22:53:09 +0800 Subject: [PATCH] feat: add comments --- modules/darwin/core.nix | 13 +++++++++++-- modules/nixos/core-desktop.nix | 5 +++++ modules/nixos/core-server.nix | 5 +++++ modules/nixos/fhs-fonts.nix | 15 ++++++++++----- modules/nixos/hyprland.nix | 14 +++++++++++--- modules/nixos/i3.nix | 6 +++++- modules/nixos/remote-building.nix | 4 ++-- 7 files changed, 49 insertions(+), 13 deletions(-) diff --git a/modules/darwin/core.nix b/modules/darwin/core.nix index debbb6dd..b0e24b06 100644 --- a/modules/darwin/core.nix +++ b/modules/darwin/core.nix @@ -1,7 +1,16 @@ -# all the configuration options are documented here: -# https://daiderd.com/nix-darwin/manual/index.html#sec-options + { pkgs, ... }: { + ################################################################################### + # + # Core configuration for nix-darwin + # + # All the configuration options are documented here: + # https://daiderd.com/nix-darwin/manual/index.html#sec-options + # + ################################################################################### + + # # enable flakes globally nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/modules/nixos/core-desktop.nix b/modules/nixos/core-desktop.nix index bf83b68a..60239675 100644 --- a/modules/nixos/core-desktop.nix +++ b/modules/nixos/core-desktop.nix @@ -1,6 +1,11 @@ { lib, pkgs, ... }: { + ################################################################################### + # + # NixOS's core configuration suitable for my desktop computer + # + ################################################################################### imports = [ ./core-server.nix diff --git a/modules/nixos/core-server.nix b/modules/nixos/core-server.nix index c05e779b..13c73789 100644 --- a/modules/nixos/core-server.nix +++ b/modules/nixos/core-server.nix @@ -1,6 +1,11 @@ { lib, pkgs, ... }: { + ################################################################################### + # + # NixOS's core configuration suitable for all my machines + # + ################################################################################### # for nix server, we do not need to keep too much generations boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10; diff --git a/modules/nixos/fhs-fonts.nix b/modules/nixos/fhs-fonts.nix index 505e24e6..409da5bd 100644 --- a/modules/nixos/fhs-fonts.nix +++ b/modules/nixos/fhs-fonts.nix @@ -1,11 +1,16 @@ -# copy from https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279 -# mainly for flatpak -# bindfs resolves all symlink, -# allowing all fonts to be accessed at `/usr/share/fonts` -# without letting /nix into the sandbox. { config, pkgs, ... }: { + ################################################################################### + # + # Copy from https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279 + # Mainly for flatpak + # 1. bindfs resolves all symlink, + # 2. allowing all fonts to be accessed at `/usr/share/fonts` + # 3. without letting /nix into the sandbox. + # + ################################################################################### + system.fsPackages = [ pkgs.bindfs ]; fileSystems = let diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index 03bef472..466df58c 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -2,9 +2,17 @@ { - # i3wm: old and stable, only support X11 - # sway: compatible with i3wm, support Wayland. do not support Nvidia GPU officially. - # hyprland: project starts from 2022, support Wayland, envolving fast, good looking, support Nvidia GPU. + + ########################################################################################################## + # + # NixOS's Configuration for Hyprland Window Manager + # + # i3wm: old and stable, only support X11 + # sway: compatible with i3wm, support Wayland. do not support Nvidia GPU officially. + # hyprland: project starts from 2022, support Wayland, envolving fast, good looking, support Nvidia GPU. + # + ########################################################################################################## + environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw services.xserver = { diff --git a/modules/nixos/i3.nix b/modules/nixos/i3.nix index 326aa457..55cca168 100644 --- a/modules/nixos/i3.nix +++ b/modules/nixos/i3.nix @@ -1,7 +1,11 @@ { pkgs, ... }: - { + #################################################################### + # + # NixOS's Configuration for I3 Window Manager + # + #################################################################### # i3 related options environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw diff --git a/modules/nixos/remote-building.nix b/modules/nixos/remote-building.nix index 08d49047..6a241a09 100644 --- a/modules/nixos/remote-building.nix +++ b/modules/nixos/remote-building.nix @@ -1,13 +1,13 @@ { ... }: { - ############################################ + #################################################################### # # NixOS's Configuration for Remote Building / Distributed Building # # Related Docs: # 1. https://github.com/NixOS/nix/issues/7380 # 2. https://nixos.wiki/wiki/Distributed_build - ############################################ + #################################################################### # set local's max-job to 0 to force remote building(disable local building) # nix.settings.max-jobs = 0;