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

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:

233
flake.nix
View File

@@ -22,7 +22,7 @@
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"xddxdd.cachix.org-1:ay1HJyNDYmlSwj5NXQG065C8LfoqqKaTNCyzeixGjf8=" "xddxdd.cachix.org-1:ay1HJyNDYmlSwj5NXQG065C8LfoqqKaTNCyzeixGjf8="
]; ];
}; };
@@ -37,7 +37,7 @@
# Official NixOS package source, using nixos-unstable branch here # Official NixOS package source, using nixos-unstable branch here
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
# for macos # for macos
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin";
darwin = { darwin = {
@@ -72,7 +72,7 @@
# use devenv to manage my development environment # use devenv to manage my development environment
devenv.url = "github:cachix/devenv/v0.6.2"; devenv.url = "github:cachix/devenv/v0.6.2";
# secrets management, lock with git commit at 2023/5/15 # secrets management, lock with git commit at 2023/5/15
agenix.url = "github:ryantm/agenix/db5637d10f797bb251b94ef9040b237f4702cde3"; agenix.url = "github:ryantm/agenix/db5637d10f797bb251b94ef9040b237f4702cde3";
@@ -85,128 +85,133 @@
# 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.
# so the system named `msi-rtx4090` will use this configuration. # so the system named `msi-rtx4090` will use this configuration.
# However, the configuration name can also be specified using `sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>`. # However, the configuration name can also be specified using `sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>`.
# The `nixpkgs.lib.nixosSystem` function is used to build this configuration, the following attribute set is its parameter. # The `nixpkgs.lib.nixosSystem` function is used to build this configuration, the following attribute set is its parameter.
# Run `sudo nixos-rebuild switch --flake .#msi-rtx4090` in the flake's directory to deploy this configuration on any NixOS system # Run `sudo nixos-rebuild switch --flake .#msi-rtx4090` in the flake's directory to deploy this configuration on any NixOS system
msi-rtx4090 = nixpkgs.lib.nixosSystem rec { msi-rtx4090 = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
# The Nix module system can modularize configurations, improving the maintainability of configurations. # The Nix module system can modularize configurations, improving the maintainability of configurations.
# #
# Each parameter in the `modules` is a Nix Module, and there is a partial introduction to it in the nixpkgs manual: # Each parameter in the `modules` is a Nix Module, and there is a partial introduction to it in the nixpkgs manual:
# <https://nixos.org/manual/nixpkgs/unstable/#module-system-introduction> # <https://nixos.org/manual/nixpkgs/unstable/#module-system-introduction>
# It is said to be partial because the documentation is not complete, only some simple introductions # It is said to be partial because the documentation is not complete, only some simple introductions
# (such is the current state of Nix documentation...) # (such is the current state of Nix documentation...)
# A Nix Module can be an attribute set, or a function that returns an attribute set. # A Nix Module can be an attribute set, or a function that returns an attribute set.
# If a Module is a function, according to the Nix Wiki description, this function can have up to four parameters: # If a Module is a function, according to the Nix Wiki description, this function can have up to four parameters:
# #
# config: The configuration of the entire system # config: The configuration of the entire system
# options: All option declarations refined with all definition and declaration references. # options: All option declarations refined with all definition and declaration references.
# pkgs: The attribute set extracted from the Nix package collection and enhanced with the nixpkgs.config option. # pkgs: The attribute set extracted from the Nix package collection and enhanced with the nixpkgs.config option.
# modulesPath: The location of the module directory of Nix. # modulesPath: The location of the module directory of Nix.
# #
# Only these four parameters can be passed by default. # Only these four parameters can be passed by default.
# If you need to pass other parameters, you must use `specialArgs` by uncomment the following line # If you need to pass other parameters, you must use `specialArgs` by uncomment the following line
specialArgs = { specialArgs = {
pkgs-stable = import inputs.nixpkgs-stable { pkgs-stable = import inputs.nixpkgs-stable {
system = system; # refer the `system` parameter form outer scope recursively system = system; # refer the `system` parameter form outer scope recursively
# To use chrome, we need to allow the installation of non-free software # To use chrome, we need to allow the installation of non-free software
config.allowUnfree = true; config.allowUnfree = true;
}; };
} // inputs; } // inputs;
modules = [
./hosts/msi-rtx4090
# make home-manager as a module of nixos
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# pass all inputs into home manager's all sub modules
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.ryan = import ./home/linux/x11.nix;
}
];
};
nixos-test = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
pkgs-stable = import inputs.nixpkgs-stable {
system = system;
config.allowUnfree = true;
};
} // inputs;
modules = [
./hosts/nixos-test
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.ryan = import ./home/linux/wayland.nix;
}
];
};
};
# configurations for MacOS
darwinConfigurations."harmonica" = darwin.lib.darwinSystem {
system = "x86_64-darwin";
specialArgs = inputs;
modules = [ modules = [
./hosts/msi-rtx4090 ./hosts/harmonica
# make home-manager as a module of nixos home-manager.darwinModules.home-manager
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
# pass all inputs into home manager's all sub modules home-manager.extraSpecialArgs = inputs;
home-manager.extraSpecialArgs = specialArgs; home-manager.users.admin = import ./home/darwin;
home-manager.users.ryan = import ./home/linux/x11.nix;
} }
]; ];
}; };
nixos-test = nixpkgs.lib.nixosSystem rec { formatter = {
system = "x86_64-linux"; x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
specialArgs = { x86_64-darwin = nixpkgs.legacyPackages.x86_64-darwin.nixpkgs-fmt;
pkgs-stable = import inputs.nixpkgs-stable {
system = system;
config.allowUnfree = true;
};
} // inputs;
modules = [
./hosts/nixos-test
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.ryan = import ./home/linux/wayland.nix;
}
];
}; };
# generate qcow2 & iso image from nixos configuration
# https://github.com/nix-community/nixos-generators
# packages.x86_64-linux = {
# qcow2 = nixos-generators.nixosGenerate {
# system = "x86_64-linux";
# modules = [
# # you can include your own nixos configuration here, i.e.
# # ./configuration.nix
# ];
# format = "qcow";
# # you can also define your own custom formats
# # customFormats = { "myFormat" = <myFormatModule>; ... };
# # format = "myFormat";
# };
# iso = nixos-generators.nixosGenerate {
# system = "x86_64-linux";
# modules = [
# # you can include your own nixos configuration here, i.e.
# # ./configuration.nix
# ];
# format = "iso";
# };
# };
}; };
# configurations for MacOS
darwinConfigurations."harmonica" = darwin.lib.darwinSystem {
system = "x86_64-darwin";
specialArgs = inputs;
modules = [
./hosts/harmonica
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.admin = import ./home/darwin;
}
];
};
# generate qcow2 & iso image from nixos configuration
# https://github.com/nix-community/nixos-generators
# packages.x86_64-linux = {
# qcow2 = nixos-generators.nixosGenerate {
# system = "x86_64-linux";
# modules = [
# # you can include your own nixos configuration here, i.e.
# # ./configuration.nix
# ];
# format = "qcow";
# # you can also define your own custom formats
# # customFormats = { "myFormat" = <myFormatModule>; ... };
# # format = "myFormat";
# };
# iso = nixos-generators.nixosGenerate {
# system = "x86_64-linux";
# modules = [
# # you can include your own nixos configuration here, i.e.
# # ./configuration.nix
# ];
# format = "iso";
# };
# };
};
} }

View File

@@ -6,13 +6,13 @@ stdenvNoCC.mkDerivation rec {
src = fetchgit { src = fetchgit {
url = "https://github.com/archcraft-os/archcraft-packages.git"; url = "https://github.com/archcraft-os/archcraft-packages.git";
rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id
sparseCheckout = [ "archcraft-fonts/files/icon-fonts/archcraft.ttf" ]; # only fetch the feather.ttf file sparseCheckout = [ "archcraft-fonts/files/icon-fonts/archcraft.ttf" ]; # only fetch the feather.ttf file
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result. # the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored. # so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
# specify sha256 to empty and build it, then an error will indicate the correct sha256 # specify sha256 to empty and build it, then an error will indicate the correct sha256
sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U="; sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U=";
}; };
installPhase = '' installPhase = ''
@@ -32,4 +32,4 @@ stdenvNoCC.mkDerivation rec {
maintainers = [ maintainers.ryan4yin ]; maintainers = [ maintainers.ryan4yin ];
platforms = platforms.all; platforms = platforms.all;
}; };
} }

View File

@@ -7,15 +7,15 @@ stdenvNoCC.mkDerivation rec {
# 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather # 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather
src = fetchgit { src = fetchgit {
url = "https://github.com/adi1090x/polybar-themes.git"; url = "https://github.com/adi1090x/polybar-themes.git";
rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id
sparseCheckout = [ "fonts/feather.ttf" ]; # only fetch the feather.ttf file sparseCheckout = [ "fonts/feather.ttf" ]; # only fetch the feather.ttf file
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result. # the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored. # so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
# specify sha256 to empty and build it, then an error will indicate the correct sha256 # specify sha256 to empty and build it, then an error will indicate the correct sha256
sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4="; sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4=";
}; };
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@@ -36,4 +36,4 @@ stdenvNoCC.mkDerivation rec {
maintainers = [ maintainers.ryan4yin ]; maintainers = [ maintainers.ryan4yin ];
platforms = platforms.all; platforms = platforms.all;
}; };
} }

View File

@@ -1,4 +1,4 @@
{...}: { { ... }: {
programs.bash = { programs.bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
@@ -15,4 +15,4 @@
httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;"; httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;";
}; };
}; };
} }

View File

@@ -1,9 +1,9 @@
{config, pkgs, ...}: { config, pkgs, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
neofetch neofetch
nnn # terminal file manager nnn # terminal file manager
# archives # archives
zip zip
@@ -12,19 +12,19 @@
p7zip p7zip
# utils # utils
ripgrep # recursively searches directories for a regex pattern ripgrep # recursively searches directories for a regex pattern
jq # A lightweight and flexible command-line JSON processor jq # A lightweight and flexible command-line JSON processor
yq-go # yaml processer https://github.com/mikefarah/yq yq-go # yaml processer https://github.com/mikefarah/yq
exa # A modern replacement for ls exa # A modern replacement for ls
fzf # A command-line fuzzy finder fzf # A command-line fuzzy finder
# networking tools # networking tools
mtr # A network diagnostic tool mtr # A network diagnostic tool
iperf3 iperf3
ldns # replacement of dig, it provide the command `drill` ldns # replacement of dig, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing nmap # A utility for network discovery and security auditing
# misc # misc
cowsay cowsay
@@ -45,8 +45,8 @@
nix-output-monitor nix-output-monitor
# productivity # productivity
hugo # static site generator hugo # static site generator
glow # markdown previewer in terminal glow # markdown previewer in terminal
]; ];
programs = { programs = {
@@ -77,4 +77,4 @@
enableBashIntegration = true; enableBashIntegration = true;
}; };
}; };
} }

View File

@@ -1,4 +1,4 @@
{config, pkgs, ...}: { config, pkgs, ... }:
{ {
imports = [ imports = [
./nushell ./nushell
@@ -11,4 +11,4 @@
./starship.nix ./starship.nix
]; ];
} }

View File

@@ -1,8 +1,8 @@
{config, pkgs, nil, ...}: { config, pkgs, nil, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
nil.packages."${pkgs.system}".default # nix language server nil.packages."${pkgs.system}".default # nix language server
# IDE # IDE
jetbrains.pycharm-community jetbrains.pycharm-community
@@ -11,7 +11,7 @@
# cloud native # cloud native
skopeo skopeo
docker-compose docker-compose
dive # explore docker layers dive # explore docker layers
kubectl kubectl
kubernetes-helm kubernetes-helm
terraform terraform
@@ -27,7 +27,7 @@
eksctl eksctl
# DO NOT install build tools for C/C++, set it per project by devShell instead # DO NOT install build tools for C/C++, set it per project by devShell instead
gnumake # used by this repo, to simplify the deployment gnumake # used by this repo, to simplify the deployment
clang-tools clang-tools
clang-analyzer clang-analyzer
# lldb # lldb
@@ -62,7 +62,7 @@
rustup rustup
# python # python
(python310.withPackages(ps: with ps; [ (python310.withPackages (ps: with ps; [
ipython ipython
pandas pandas
requests requests
@@ -89,9 +89,9 @@
# adoptopenjdk-openj9-bin-17 # adoptopenjdk-openj9-bin-17
# other tools # other tools
k6 # load testing tool k6 # load testing tool
mitmproxy # http/https proxy tool mitmproxy # http/https proxy tool
protobuf # protocol buffer compiler protobuf # protocol buffer compiler
]; ];
programs = { programs = {
@@ -104,9 +104,9 @@
}; };
direnv = { direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
enableZshIntegration = true; enableZshIntegration = true;
}; };
}; };
@@ -114,4 +114,4 @@
programs.gh = { programs.gh = {
enable = true; enable = true;
}; };
} }

View File

@@ -1,14 +1,13 @@
{ { 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!
# #
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global # https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] '' home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
rm -f ~/.gitconfig rm -f ~/.gitconfig
''; '';
@@ -58,4 +57,4 @@
}; };
}; };
}; };
} }

View File

@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
# processing audio/video # processing audio/video
{ {
@@ -9,8 +8,8 @@
ffmpeg-full ffmpeg-full
# images # images
viu # terminal image viewer viu # terminal image viewer
imagemagick imagemagick
graphviz graphviz
]; ];
} }

View File

@@ -1,4 +1,4 @@
{...}: { { ... }: {
programs.nushell = { programs.nushell = {
enable = true; enable = true;
configFile.source = ./config.nu; configFile.source = ./config.nu;
@@ -18,4 +18,4 @@
httpproxy = "let-env https_proxy = http://127.0.0.1:7890; let-env http_proxy = http://127.0.0.1:7890;"; httpproxy = "let-env https_proxy = http://127.0.0.1:7890; let-env http_proxy = http://127.0.0.1:7890;";
}; };
}; };
} }

View File

@@ -1,10 +1,10 @@
{config, ...}: { { config, ... }: {
programs.starship = { programs.starship = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
enableNushellIntegration = true; enableNushellIntegration = true;
settings = { settings = {
character = { character = {
success_symbol = "[](bold green)"; success_symbol = "[](bold green)";
@@ -12,4 +12,4 @@
}; };
}; };
}; };
} }

View File

@@ -7,4 +7,4 @@
xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml; xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml;
xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml; xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml;
} }

View File

@@ -8,7 +8,7 @@
# google-cloud-sdk telegram wireshark # google-cloud-sdk telegram wireshark
{pkgs, ...}: { pkgs, ... }:
{ {
# MacOS specific configuration # MacOS specific configuration
home.packages = with pkgs; [ home.packages = with pkgs; [

View File

@@ -3,13 +3,13 @@
{ {
imports = [ imports = [
../base/nushell ../base/nushell
../base/core.nix ../base/core.nix
../base/git.nix ../base/git.nix
../base/development.nix ../base/development.nix
../base/media.nix ../base/media.nix
../base/starship.nix ../base/starship.nix
./alacritty ./alacritty
./core.nix ./core.nix
]; ];
@@ -34,4 +34,4 @@
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }

View File

@@ -7,4 +7,4 @@
xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml; xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml;
xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml; xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml;
} }

View File

@@ -1,11 +1,11 @@
{config, pkgs, nil, ...}: { config, pkgs, nil, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
nil.packages."${pkgs.system}".default # nix language server nil.packages."${pkgs.system}".default # nix language server
# GUI IDE # GUI IDE
insomnia # REST client insomnia # REST client
# need to run `conda-install` before using it # need to run `conda-install` before using it
# need to run `conda-shell` before using command `conda` # need to run `conda-shell` before using command `conda`
@@ -33,4 +33,4 @@
programs.gh = { programs.gh = {
enable = true; enable = true;
}; };
} }

View File

@@ -1,10 +1,11 @@
{config, ...}: { config, ... }:
let 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 ~
@@ -29,4 +30,4 @@ in rec {
}; };
home.sessionVariables = systemd.user.sessionVariables; home.sessionVariables = systemd.user.sessionVariables;
} }

View File

@@ -1,6 +1,5 @@
{ { pkgs
pkgs, , ...
...
}: { }: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@@ -36,4 +35,4 @@
# check imported keys by `ssh-add -l` # check imported keys by `ssh-add -l`
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login. # TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
}; };
} }

View File

@@ -1,31 +1,31 @@
{pkgs, config, ...}: { pkgs, config, ... }:
{ {
# Linux Only Packages, not available on Darwin # Linux Only Packages, not available on Darwin
home.packages = with pkgs; [ home.packages = with pkgs; [
btop # replacement of htop/nmon btop # replacement of htop/nmon
htop htop
iotop iotop
nmon nmon
## networking tools ## networking tools
wireguard-tools # manage wireguard vpn manually, via wg-quick wireguard-tools # manage wireguard vpn manually, via wg-quick
iftop iftop
# misc # misc
libnotify libnotify
# system call monitoring # system call monitoring
strace # system call monitoring strace # system call monitoring
ltrace # library call monitoring ltrace # library call monitoring
lsof # list open files lsof # list open files
# system tools # system tools
ethtool ethtool
sysstat sysstat
lm_sensors # for `sensors` command lm_sensors # for `sensors` command
cifs-utils # for mounting windows shares cifs-utils # for mounting windows shares
]; ];
# auto mount usb drives # auto mount usb drives

View File

@@ -2,10 +2,10 @@
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and # It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable: # other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/ # https://www.freedesktop.org/wiki/Specifications/
{config, pkgs, ...}: { config, pkgs, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open` xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs xdg-user-dirs
]; ];
@@ -22,13 +22,13 @@
# ls /etc/profiles/per-user/ryan/share/applications/ # ls /etc/profiles/per-user/ryan/share/applications/
mimeApps = { mimeApps = {
enable = true; enable = true;
defaultApplications = defaultApplications =
let let
browser = ["firefox.desktop"]; browser = [ "firefox.desktop" ];
in in
{ {
"application/json" = browser; "application/json" = browser;
"application/pdf" = browser; # TODO: pdf viewer "application/pdf" = browser; # TODO: pdf viewer
"text/html" = browser; "text/html" = browser;
"text/xml" = browser; "text/xml" = browser;
@@ -48,18 +48,18 @@
"x-scheme-handler/http" = browser; "x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser; "x-scheme-handler/https" = browser;
"x-scheme-handler/unknown" = browser; "x-scheme-handler/unknown" = browser;
"x-scheme-handler/discord" = ["discord.desktop"];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
"audio/*" = ["mpv.desktop"]; "x-scheme-handler/discord" = [ "discord.desktop" ];
"video/*" = ["mpv.dekstop"]; "x-scheme-handler/tg" = [ "telegramdesktop.desktop" ];
"image/*" = ["imv.desktop"];
"audio/*" = [ "mpv.desktop" ];
"video/*" = [ "mpv.dekstop" ];
"image/*" = [ "imv.desktop" ];
}; };
associations.removed = associations.removed =
let let
browser = ["google-chrome.desktop"]; browser = [ "google-chrome.desktop" ];
in in
{ {
"text/html" = browser; "text/html" = browser;

View File

@@ -1,17 +1,16 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
# creative # creative
# blender # 3d modeling # blender # 3d modeling
# gimp # image editing, I prefer using figma in browser instead of this one # gimp # image editing, I prefer using figma in browser instead of this one
inkscape # vector graphics inkscape # vector graphics
krita # digital painting krita # digital painting
musescore # music notation musescore # music notation
reaper # audio production reaper # audio production
# this app consumes a lot of storage, so do not install it currently # this app consumes a lot of storage, so do not install it currently
# kicad # 3d printing, eletrical engineering # kicad # 3d printing, eletrical engineering
@@ -21,4 +20,4 @@
# live streaming # live streaming
obs-studio.enable = true; obs-studio.enable = true;
}; };
} }

View File

@@ -16,13 +16,13 @@
# instant messaging # instant messaging
telegram-desktop telegram-desktop
discord discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect) # remote desktop(rdp connect)
remmina remmina
freerdp # required by remmina freerdp # required by remmina
# misc # misc
flameshot flameshot
]; ];
} }

View File

@@ -1,7 +1,6 @@
{ { pkgs
pkgs, , config
config, , ...
...
}: }:
# media - control and enjoy audio/video # media - control and enjoy audio/video
{ {
@@ -10,7 +9,7 @@
pavucontrol pavucontrol
playerctl playerctl
pulsemixer pulsemixer
imv # simple image viewer imv # simple image viewer
nvtop nvtop
@@ -24,12 +23,12 @@
programs = { programs = {
mpv = { mpv = {
enable = true; enable = true;
defaultProfiles = ["gpu-hq"]; defaultProfiles = [ "gpu-hq" ];
scripts = [pkgs.mpvScripts.mpris]; scripts = [ pkgs.mpvScripts.mpris ];
}; };
}; };
services = { services = {
playerctld.enable = true; playerctld.enable = true;
}; };
} }

View File

@@ -1,24 +1,24 @@
{pkgs, config, lib, ... }: { { pkgs, config, lib, ... }: {
home.file.".config/fcitx5/profile".source = ./profile; home.file.".config/fcitx5/profile".source = ./profile;
home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup
# fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖 # fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖
# 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件 # 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] '' home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
rm -f "${config.xdg.configHome}/fcitx5/profile" rm -f "${config.xdg.configHome}/fcitx5/profile"
''; '';
i18n.inputMethod = { i18n.inputMethod = {
enabled = "fcitx5"; enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5.addons = with pkgs; [
# for flypy chinese input method # for flypy chinese input method
fcitx5-rime fcitx5-rime
# needed enable rime using configtool after installed # needed enable rime using configtool after installed
fcitx5-configtool fcitx5-configtool
fcitx5-chinese-addons fcitx5-chinese-addons
# fcitx5-mozc # japanese input method # fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module fcitx5-gtk # gtk im module
]; ];
}; };
systemd.user.sessionVariables = { systemd.user.sessionVariables = {
@@ -28,6 +28,6 @@
QT_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx"; XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx"; INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx"; IMSETTINGS_MODULE = "fcitx";
}; };
} }

View File

@@ -1,8 +1,7 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: { }: {
imports = [ imports = [
./wayland-apps.nix ./wayland-apps.nix
@@ -25,8 +24,8 @@
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
systemd.user.sessionVariables = { systemd.user.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland "NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland "MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"MOZ_WEBRENDER" = "1"; "MOZ_WEBRENDER" = "1";
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/

View File

@@ -1,8 +1,7 @@
{ { pkgs
pkgs, , pkgs-stable
pkgs-stable, , ...
... }:
}:
{ {
# TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it. # TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it.
@@ -31,7 +30,7 @@
firefox = { firefox = {
enable = true; enable = true;
enableGnomeExtensions = false; enableGnomeExtensions = false;
package = pkgs-stable.firefox-wayland; # firefox with wayland support package = pkgs-stable.firefox-wayland; # firefox with wayland support
}; };
vscode = { vscode = {

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
# 直接从当前文件夹中读取配置文件作为配置内容 # 直接从当前文件夹中读取配置文件作为配置内容
@@ -20,7 +19,7 @@
source = ./scripts; source = ./scripts;
# copy the scripts directory recursively # copy the scripts directory recursively
recursive = true; recursive = true;
executable = true; # make all scripts executable executable = true; # make all scripts executable
}; };
# rofi is a application launcher and dmenu replacement # rofi is a application launcher and dmenu replacement
@@ -56,4 +55,4 @@
package = pkgs.qogir-theme; package = pkgs.qogir-theme;
size = 64; size = 64;
}; };
} }

View File

@@ -1,6 +1,5 @@
{ { pkgs
pkgs, , ...
...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
firefox firefox

View File

@@ -3,6 +3,6 @@
{ {
imports = [ imports = [
../../modules/darwin/core.nix ../../modules/darwin/core.nix
]; ];
} }

View File

@@ -3,11 +3,11 @@
{ {
# mount a smb/cifs share # mount a smb/cifs share
fileSystems."/home/ryan/SMB-Downloads" = { fileSystems."/home/ryan/SMB-Downloads" = {
device = "//192.168.5.194/Downloads"; device = "//192.168.5.194/Downloads";
fsType = "cifs"; fsType = "cifs";
options = [ options = [
"vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=${config.age.secrets.smb-credentials.path},nofail" "vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=${config.age.secrets.smb-credentials.path},nofail"
]; ];
}; };
} }

View File

@@ -30,13 +30,15 @@
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation. # Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# supported fil systems, so we can mount any removable disks with these filesystems # supported fil systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [ boot.supportedFilesystems = [
"ext4" "ext4"
"btrfs" "btrfs"
"xfs" "xfs"
#"zfs" #"zfs"
"ntfs" "ntfs"
"fat" "vfat" "exfat" "fat"
"vfat"
"exfat"
"cifs" # mount windows share "cifs" # mount windows share
]; ];
@@ -51,7 +53,7 @@
networking = { networking = {
hostName = "msi-rtx4090"; # Define your hostname. hostName = "msi-rtx4090"; # Define your hostname.
wireless.enable = false; # Enables wireless support via wpa_supplicant. wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/"; # proxy.default = "http://user:password@proxy:port/";
@@ -59,25 +61,25 @@
networkmanager.enable = true; networkmanager.enable = true;
enableIPv6 = false; # disable ipv6 enableIPv6 = false; # disable ipv6
interfaces.enp5s0 = { interfaces.enp5s0 = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [ { ipv4.addresses = [{
address = "192.168.5.66"; address = "192.168.5.66";
prefixLength = 24; prefixLength = 24;
} ]; }];
}; };
defaultGateway = "192.168.5.201"; defaultGateway = "192.168.5.201";
nameservers = [ nameservers = [
"119.29.29.29" # DNSPod "119.29.29.29" # DNSPod
"223.5.5.5" # AliDNS "223.5.5.5" # AliDNS
]; ];
}; };
# for Nvidia GPU # for Nvidia GPU
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default services.xserver.videoDrivers = [ "nvidia" ]; # will install nvidia-vaapi-driver by default
hardware.nvidia = { hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable; package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true; modesetting.enable = true;

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

View File

@@ -27,13 +27,15 @@
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation. # Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# supported fil systems, so we can mount any removable disks with these filesystems # supported fil systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [ boot.supportedFilesystems = [
"ext4" "ext4"
"btrfs" "btrfs"
"xfs" "xfs"
#"zfs" #"zfs"
"ntfs" "ntfs"
"fat" "vfat" "exfat" "fat"
"vfat"
"exfat"
"cifs" # mount windows share "cifs" # mount windows share
]; ];
@@ -41,7 +43,7 @@
boot.loader = { boot.loader = {
grub = { grub = {
enable = true; enable = true;
device = "/dev/sda"; # "nodev" device = "/dev/sda"; # "nodev"
efiSupport = false; efiSupport = false;
useOSProber = true; useOSProber = true;
#efiInstallAsRemovable = true; # in case canTouchEfiVariables doesn't work for your system #efiInstallAsRemovable = true; # in case canTouchEfiVariables doesn't work for your system
@@ -50,7 +52,7 @@
networking = { networking = {
hostName = "nixos-test"; # Define your hostname. hostName = "nixos-test"; # Define your hostname.
wireless.enable = false; # Enables wireless support via wpa_supplicant. wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/"; # proxy.default = "http://user:password@proxy:port/";
@@ -59,15 +61,15 @@
networkmanager.enable = true; networkmanager.enable = true;
interfaces.ens18 = { interfaces.ens18 = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [ { ipv4.addresses = [{
address = "192.168.5.48"; address = "192.168.5.48";
prefixLength = 24; prefixLength = 24;
} ]; }];
}; };
defaultGateway = "192.168.5.201"; defaultGateway = "192.168.5.201";
nameservers = [ nameservers = [
"119.29.29.29" # DNSPod "119.29.29.29" # DNSPod
"223.5.5.5" # AliDNS "223.5.5.5" # AliDNS
]; ];
}; };

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";
}; };

View File

@@ -50,11 +50,13 @@
font-awesome font-awesome
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
"FiraCode" fonts = [
"JetBrainsMono" "FiraCode"
"Iosevka" "JetBrainsMono"
];}) "Iosevka"
];
})
]; ];
}; };
@@ -64,4 +66,4 @@
home = "/Users/admin"; home = "/Users/admin";
description = "admin"; description = "admin";
}; };
} }

View File

@@ -57,23 +57,25 @@
# Noto 系列字体是 Google 主导的名字的含义是「没有豆腐」no tofu因为缺字时显示的方框或者方框被叫作 tofu # Noto 系列字体是 Google 主导的名字的含义是「没有豆腐」no tofu因为缺字时显示的方框或者方框被叫作 tofu
# Noto 系列字族名只支持英文,命名规则是 Noto + Sans 或 Serif + 文字名称。 # Noto 系列字族名只支持英文,命名规则是 Noto + Sans 或 Serif + 文字名称。
# 其中汉字部分叫 Noto Sans/Serif CJK SC/TC/HK/JP/KR最后一个词是地区变种。 # 其中汉字部分叫 Noto Sans/Serif CJK SC/TC/HK/JP/KR最后一个词是地区变种。
noto-fonts # 大部分文字的常见样式,不包含汉字 noto-fonts # 大部分文字的常见样式,不包含汉字
noto-fonts-cjk # 汉字部分 noto-fonts-cjk # 汉字部分
noto-fonts-emoji # 彩色的表情符号字体 noto-fonts-emoji # 彩色的表情符号字体
noto-fonts-extra # 提供额外的字重和宽度变种 noto-fonts-extra # 提供额外的字重和宽度变种
# 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的 # 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的
source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro以及带字重的变体加上 Source Sans 3 VF source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro以及带字重的变体加上 Source Sans 3 VF
source-serif # 衬线字体,不含汉字。字族名叫 Source Code Pro以及带字重的变体 source-serif # 衬线字体,不含汉字。字族名叫 Source Code Pro以及带字重的变体
source-han-sans # 思源黑体 source-han-sans # 思源黑体
source-han-serif # 思源宋体 source-han-serif # 思源宋体
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
"FiraCode" fonts = [
"JetBrainsMono" "FiraCode"
"Iosevka" "JetBrainsMono"
];}) "Iosevka"
];
})
(pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { }) (pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { })
@@ -105,7 +107,7 @@
enable = true; enable = true;
settings = { settings = {
X11Forwarding = true; X11Forwarding = true;
PermitRootLogin = "no"; # disable root login PermitRootLogin = "no"; # disable root login
PasswordAuthentication = false; # disable password login PasswordAuthentication = false; # disable password login
}; };
openFirewall = true; openFirewall = true;
@@ -122,8 +124,8 @@
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget wget
curl curl
git # used by nix flakes git # used by nix flakes
git-lfs # used by huggingface models git-lfs # used by huggingface models
devenv.packages."${pkgs.system}".devenv devenv.packages."${pkgs.system}".devenv
@@ -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 (
pkgs.buildFHSUserEnv (base // { let base = pkgs.appimageTools.defaultFhsEnvArgs; in
name = "fhs"; pkgs.buildFHSUserEnv (base // {
targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [pkgs.pkg-config]; name = "fhs";
profile = "export FHS=1"; targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ];
runScript = "bash"; profile = "export FHS=1";
extraOutputsToInstall = ["dev"]; runScript = "bash";
})) extraOutputsToInstall = [ "dev" ];
})
)
]; ];
# replace default editor with neovim # replace default editor with neovim
@@ -182,16 +186,16 @@
# enable bluetooth & gui paring tools - blueman # enable bluetooth & gui paring tools - blueman
# or you can use cli: # or you can use cli:
# $ bluetoothctl # $ bluetoothctl
# [bluetooth] # power on # [bluetooth] # power on
# [bluetooth] # agent on # [bluetooth] # agent on
# [bluetooth] # default-agent # [bluetooth] # default-agent
# [bluetooth] # scan on # [bluetooth] # scan on
# ...put device in pairing mode and wait [hex-address] to appear here... # ...put device in pairing mode and wait [hex-address] to appear here...
# [bluetooth] # pair [hex-address] # [bluetooth] # pair [hex-address]
# [bluetooth] # connect [hex-address] # [bluetooth] # connect [hex-address]
# Bluetooth devices automatically connect with bluetoothctl as well: # Bluetooth devices automatically connect with bluetoothctl as well:
# [bluetooth] # trust [hex-address] # [bluetooth] # trust [hex-address]
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
services.blueman.enable = true; services.blueman.enable = true;
@@ -212,9 +216,9 @@
geoclue2.enable = true; geoclue2.enable = true;
udev.packages = with pkgs; [ udev.packages = with pkgs; [
gnome.gnome-settings-daemon gnome.gnome-settings-daemon
platformio # udev rules for platformio platformio # udev rules for platformio
android-udev-rules android-udev-rules
]; ];
}; };
@@ -235,8 +239,8 @@
# and vscode has open like `External Uri Openers` # and vscode has open like `External Uri Openers`
xdgOpenUsePortal = false; xdgOpenUsePortal = false;
extraPortals = with pkgs; [ extraPortals = with pkgs; [
xdg-desktop-portal-wlr # for wlroots based compositors(hyprland/sway) xdg-desktop-portal-wlr # for wlroots based compositors(hyprland/sway)
xdg-desktop-portal-gtk # for gtk xdg-desktop-portal-gtk # for gtk
# xdg-desktop-portal-kde # for kde # xdg-desktop-portal-kde # for kde
]; ];
}; };
@@ -251,4 +255,4 @@
# for power management # for power management
services.upower.enable = true; services.upower.enable = true;
} }

View File

@@ -51,15 +51,17 @@
font-awesome font-awesome
# 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的 # 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的
source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro以及带字重的变体加上 Source Sans 3 VF source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro以及带字重的变体加上 Source Sans 3 VF
source-han-sans # 思源黑体 source-han-sans # 思源黑体
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ (nerdfonts.override {
"FiraCode" fonts = [
"JetBrainsMono" "FiraCode"
"Iosevka" "JetBrainsMono"
];}) "Iosevka"
];
})
]; ];
# user defined fonts # user defined fonts
@@ -82,7 +84,7 @@
enable = true; enable = true;
settings = { settings = {
X11Forwarding = true; X11Forwarding = true;
PermitRootLogin = "no"; # disable root login PermitRootLogin = "no"; # disable root login
PasswordAuthentication = false; # disable password login PasswordAuthentication = false; # disable password login
}; };
openFirewall = true; openFirewall = true;
@@ -95,8 +97,8 @@
wget wget
curl curl
aria2 aria2
git # used by nix flakes git # used by nix flakes
git-lfs # used by huggingface models git-lfs # used by huggingface models
]; ];
# replace default editor with neovim # replace default editor with neovim
@@ -107,4 +109,4 @@
enable = true; enable = true;
}; };
services.upower.enable = true; services.upower.enable = true;
} }

View File

@@ -7,20 +7,22 @@
{ {
system.fsPackages = [ pkgs.bindfs ]; system.fsPackages = [ pkgs.bindfs ];
fileSystems = let fileSystems =
mkRoSymBind = path: { let
device = path; mkRoSymBind = path: {
fsType = "fuse.bindfs"; device = path;
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; fsType = "fuse.bindfs";
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
};
aggregatedFonts = pkgs.buildEnv {
name = "system-fonts";
paths = config.fonts.fonts;
pathsToLink = [ "/share/fonts" ];
};
in
{
# Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons");
"/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts");
}; };
aggregatedFonts = pkgs.buildEnv { }
name = "system-fonts";
paths = config.fonts.fonts;
pathsToLink = [ "/share/fonts" ];
};
in {
# Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons");
"/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts");
};
}

View File

@@ -14,4 +14,4 @@
]; ];
# flatpack is recommended to install other apps such as netease-cloud-music/qqmusic/... # flatpack is recommended to install other apps such as netease-cloud-music/qqmusic/...
} }

View File

@@ -1,4 +1,4 @@
{pkgs, ...}: { pkgs, ... }:
{ {
@@ -34,7 +34,7 @@
nvidiaPatches = true; nvidiaPatches = true;
}; };
programs.light.enable = true; # monitor backlight control programs.light.enable = true; # monitor backlight control
# thunar file manager(part of xfce) related options # thunar file manager(part of xfce) related options
@@ -48,29 +48,29 @@
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
waybar # the status bar waybar # the status bar
swaybg # the wallpaper swaybg # the wallpaper
swayidle # the idle timeout swayidle # the idle timeout
swaylock # locking the screen swaylock # locking the screen
wlogout # logout menu wlogout # logout menu
wl-clipboard # copying and pasting wl-clipboard # copying and pasting
wf-recorder # creen recording wf-recorder # creen recording
grim # taking screenshots grim # taking screenshots
slurp # selecting a region to screenshot slurp # selecting a region to screenshot
# TODO replace by `flameshot gui --raw | wl-copy` # TODO replace by `flameshot gui --raw | wl-copy`
wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland
mako # the notification daemon, the same as dunst mako # the notification daemon, the same as dunst
yad # a fork of zenity, for creating dialogs yad # a fork of zenity, for creating dialogs
# 用于播放系统音效 # 用于播放系统音效
mpd # for playing system sounds mpd # for playing system sounds
mpc-cli # command-line mpd client mpc-cli # command-line mpd client
ncmpcpp # a mpd client with a UI ncmpcpp # a mpd client with a UI
networkmanagerapplet # provide GUI app: nm-connection-editor networkmanagerapplet # provide GUI app: nm-connection-editor
xfce.thunar # xfce4's file manager xfce.thunar # xfce4's file manager
]; ];
} }

View File

@@ -1,4 +1,4 @@
{pkgs, ...}: { pkgs, ... }:
{ {
@@ -21,26 +21,26 @@
windowManager.i3 = { windowManager.i3 = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
rofi # application launcher, the same as dmenu rofi # application launcher, the same as dmenu
dunst # notification daemon dunst # notification daemon
i3blocks # status bar i3blocks # status bar
i3lock # default i3 screen locker i3lock # default i3 screen locker
xautolock # lock screen after some time xautolock # lock screen after some time
i3status # provide information to i3bar i3status # provide information to i3bar
i3-gaps # i3 with gaps i3-gaps # i3 with gaps
picom # transparency and shadows picom # transparency and shadows
feh # set wallpaper feh # set wallpaper
acpi # battery information acpi # battery information
arandr # screen layout manager arandr # screen layout manager
dex # autostart applications dex # autostart applications
xbindkeys # bind keys to commands xbindkeys # bind keys to commands
xorg.xbacklight # control screen brightness, the same as light xorg.xbacklight # control screen brightness, the same as light
xorg.xdpyinfo # get screen information xorg.xdpyinfo # get screen information
scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot
sysstat # get system information sysstat # get system information
xfce.thunar # xfce4's file manager xfce.thunar # xfce4's file manager
]; ];
}; };
# Configure keymap in X11 # Configure keymap in X11
@@ -55,4 +55,4 @@
]; ];
services.gvfs.enable = true; # Mount, trash, and other functionalities services.gvfs.enable = true; # Mount, trash, and other functionalities
services.tumbler.enable = true; # Thumbnail support for images services.tumbler.enable = true; # Thumbnail support for images
} }

View File

@@ -1,10 +1,10 @@
{config, pkgs, ...}: { config, pkgs, ... }:
{ {
users.groups = { users.groups = {
ryan = {}; ryan = { };
docker = {}; docker = { };
wireshark = {}; wireshark = { };
}; };
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.ryan = { users.users.ryan = {
@@ -13,7 +13,7 @@
description = "ryan"; description = "ryan";
extraGroups = [ "ryan" "users" "networkmanager" "wheel" "docker" "wireshark" "adbusers" ]; extraGroups = [ "ryan" "users" "networkmanager" "wheel" "docker" "wireshark" "adbusers" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj"
]; ];
}; };
} }

View File

@@ -1,6 +1,6 @@
args: args:
# execute and import all overlay files in the current directory with the given args # execute and import all overlay files in the current directory with the given args
builtins.map builtins.map
(f: (import (./. + "/${f}") args)) # execute and import the overlay file (f: (import (./. + "/${f}") args)) # execute and import the overlay file
(builtins.filter # find all overlay files in the current directory (builtins.filter # find all overlay files in the current directory
(f: f != "default.nix") (f: f != "default.nix")

View File

@@ -1,6 +1,6 @@
# 为了不使用默认的 rime-data改用我自定义的小鹤音形数据这里需要 override # 为了不使用默认的 rime-data改用我自定义的小鹤音形数据这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix # 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
{...}: { ... }:
(self: super: { (self: super: {
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」 # 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」

View File

@@ -2,11 +2,11 @@
{ {
imports = [ imports = [
agenix.nixosModules.default agenix.nixosModules.default
]; ];
environment.systemPackages = [ environment.systemPackages = [
agenix.packages."${pkgs.system}".default agenix.packages."${pkgs.system}".default
]; ];
# if you changed this key, you need to regenerate all encrypt files from the decrypt contents! # if you changed this key, you need to regenerate all encrypt files from the decrypt contents!
@@ -32,4 +32,4 @@
# encrypted file path # encrypted file path
file = ./encrypt/smb-credentials.age; file = ./encrypt/smb-credentials.age;
}; };
} }

View File

@@ -17,4 +17,4 @@ in
"./encrypt/wg-business.conf.age".publicKeys = users ++ systems; "./encrypt/wg-business.conf.age".publicKeys = users ++ systems;
"./encrypt/smb-credentials.age".publicKeys = users ++ systems; "./encrypt/smb-credentials.age".publicKeys = users ++ systems;
# "./encrypt/secret123.age".publicKeys = [ user1 system1 ]; # "./encrypt/secret123.age".publicKeys = [ user1 system1 ];
} }