feat: add comments, format all nix files

This commit is contained in:
Ryan Yin
2023-06-13 01:05:13 +08:00
parent 86114a4db1
commit dc0fc97cb9
47 changed files with 438 additions and 420 deletions
+3
View File
@@ -31,6 +31,9 @@ darwin-debug: darwin-set-proxy
--extra-experimental-features 'nix-command flakes' --extra-experimental-features 'nix-command flakes'
./result/sw/bin/darwin-rebuild switch --flake . --show-trace --verbose ./result/sw/bin/darwin-rebuild switch --flake . --show-trace --verbose
fmt:
# format the nix files in this repo
nix fmt
.PHONY: clean .PHONY: clean
clean: clean:
+11 -6
View File
@@ -85,12 +85,12 @@
# parameters in `outputs` are defined in `inputs` and can be referenced by their names. # parameters in `outputs` are defined in `inputs` and can be referenced by their names.
# However, `self` is an exception, This special parameter points to the `outputs` itself (self-reference) # However, `self` is an exception, This special parameter points to the `outputs` itself (self-reference)
# The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function.
outputs = inputs@{ outputs =
self, inputs@{ self
nixpkgs, , nixpkgs
darwin, , darwin
home-manager, , home-manager
... , ...
}: { }: {
nixosConfigurations = { nixosConfigurations = {
# By default, NixOS will try to refer the nixosConfiguration with its hostname. # By default, NixOS will try to refer the nixosConfiguration with its hostname.
@@ -183,6 +183,11 @@
]; ];
}; };
formatter = {
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
x86_64-darwin = nixpkgs.legacyPackages.x86_64-darwin.nixpkgs-fmt;
};
# generate qcow2 & iso image from nixos configuration # generate qcow2 & iso image from nixos configuration
# https://github.com/nix-community/nixos-generators # https://github.com/nix-community/nixos-generators
# packages.x86_64-linux = { # packages.x86_64-linux = {
+4 -5
View File
@@ -1,8 +1,7 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
# `programs.git` will generate the config file: ~/.config/git/config # `programs.git` will generate the config file: ~/.config/git/config
# to make git use this config file, `~/.gitconfig` should not exist! # to make git use this config file, `~/.gitconfig` should not exist!
+3 -4
View File
@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
# processing audio/video # processing audio/video
{ {
+2 -1
View File
@@ -4,7 +4,8 @@ let
d = config.xdg.dataHome; d = config.xdg.dataHome;
c = config.xdg.configHome; c = config.xdg.configHome;
cache = config.xdg.cacheHome; cache = config.xdg.cacheHome;
in rec { in
rec {
# add environment variables # add environment variables
systemd.user.sessionVariables = { systemd.user.sessionVariables = {
# clean up ~ # clean up ~
+2 -3
View File
@@ -1,6 +1,5 @@
{ { pkgs
pkgs, , ...
...
}: { }: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
+3 -4
View File
@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
+3 -4
View File
@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
# media - control and enjoy audio/video # media - control and enjoy audio/video
{ {
+4 -5
View File
@@ -1,8 +1,7 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: { }: {
imports = [ imports = [
./wayland-apps.nix ./wayland-apps.nix
+3 -4
View File
@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , pkgs-stable
pkgs-stable, , ...
...
}: }:
{ {
+4 -5
View File
@@ -1,8 +1,7 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: { }: {
# i3 配置,基于 https://github.com/endeavouros-team/endeavouros-i3wm-setup # i3 配置,基于 https://github.com/endeavouros-team/endeavouros-i3wm-setup
# 直接从当前文件夹中读取配置文件作为配置内容 # 直接从当前文件夹中读取配置文件作为配置内容
+2 -3
View File
@@ -1,6 +1,5 @@
{ { pkgs
pkgs, , ...
...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
firefox firefox
+3 -1
View File
@@ -36,7 +36,9 @@
"xfs" "xfs"
#"zfs" #"zfs"
"ntfs" "ntfs"
"fat" "vfat" "exfat" "fat"
"vfat"
"exfat"
"cifs" # mount windows share "cifs" # mount windows share
]; ];
+7 -5
View File
@@ -5,7 +5,8 @@
{ {
imports = imports =
[ (modulesPath + "/installer/scan/not-detected.nix") [
(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" ];
@@ -14,19 +15,20 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3"; {
device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=@" ]; options = [ "subvol=@" ];
}; };
fileSystems."/boot/efi" = fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/87ED-8B2E"; {
device = "/dev/disk/by-uuid/87ED-8B2E";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices =
[ { device = "/dev/disk/by-uuid/17391ca0-8cdb-4598-a40b-fd9548fd9b37"; } [{ device = "/dev/disk/by-uuid/17391ca0-8cdb-4598-a40b-fd9548fd9b37"; }];
];
# 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
+3 -1
View File
@@ -33,7 +33,9 @@
"xfs" "xfs"
#"zfs" #"zfs"
"ntfs" "ntfs"
"fat" "vfat" "exfat" "fat"
"vfat"
"exfat"
"cifs" # mount windows share "cifs" # mount windows share
]; ];
+4 -2
View File
@@ -5,7 +5,8 @@
{ {
imports = imports =
[ (modulesPath + "/profiles/qemu-guest.nix") [
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
@@ -14,7 +15,8 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/b779eb19-e43d-4f07-a91f-eb08bd8e1202"; {
device = "/dev/disk/by-uuid/b779eb19-e43d-4f07-a91f-eb08bd8e1202";
fsType = "ext4"; fsType = "ext4";
}; };
+4 -2
View File
@@ -50,11 +50,13 @@
font-awesome font-awesome
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
fonts = [
"FiraCode" "FiraCode"
"JetBrainsMono" "JetBrainsMono"
"Iosevka" "Iosevka"
];}) ];
})
]; ];
}; };
+8 -4
View File
@@ -69,11 +69,13 @@
source-han-serif # 思源宋体 source-han-serif # 思源宋体
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
fonts = [
"FiraCode" "FiraCode"
"JetBrainsMono" "JetBrainsMono"
"Iosevka" "Iosevka"
];}) ];
})
(pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { }) (pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { })
@@ -143,14 +145,16 @@
})) }))
# create a fhs environment by command `fhs`, so we can run non-nixos packages in nixos! # create a fhs environment by command `fhs`, so we can run non-nixos packages in nixos!
(let base = pkgs.appimageTools.defaultFhsEnvArgs; in (
let base = pkgs.appimageTools.defaultFhsEnvArgs; in
pkgs.buildFHSUserEnv (base // { pkgs.buildFHSUserEnv (base // {
name = "fhs"; name = "fhs";
targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ]; targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ];
profile = "export FHS=1"; profile = "export FHS=1";
runScript = "bash"; runScript = "bash";
extraOutputsToInstall = [ "dev" ]; extraOutputsToInstall = [ "dev" ];
})) })
)
]; ];
# replace default editor with neovim # replace default editor with neovim
+4 -2
View File
@@ -55,11 +55,13 @@
source-han-sans # 思源黑体 source-han-sans # 思源黑体
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
fonts = [
"FiraCode" "FiraCode"
"JetBrainsMono" "JetBrainsMono"
"Iosevka" "Iosevka"
];}) ];
})
]; ];
# user defined fonts # user defined fonts
+4 -2
View File
@@ -7,7 +7,8 @@
{ {
system.fsPackages = [ pkgs.bindfs ]; system.fsPackages = [ pkgs.bindfs ];
fileSystems = let fileSystems =
let
mkRoSymBind = path: { mkRoSymBind = path: {
device = path; device = path;
fsType = "fuse.bindfs"; fsType = "fuse.bindfs";
@@ -18,7 +19,8 @@
paths = config.fonts.fonts; paths = config.fonts.fonts;
pathsToLink = [ "/share/fonts" ]; pathsToLink = [ "/share/fonts" ];
}; };
in { in
{
# Create an FHS mount to support flatpak host icons/fonts # Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons"); "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons");
"/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts"); "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts");