diff --git a/Makefile b/Makefile index 79e072b7..8542d8c4 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,9 @@ darwin-debug: darwin-set-proxy --extra-experimental-features 'nix-command flakes' ./result/sw/bin/darwin-rebuild switch --flake . --show-trace --verbose +fmt: + # format the nix files in this repo + nix fmt .PHONY: clean clean: diff --git a/flake.nix b/flake.nix index 63035d16..78a29a59 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,7 @@ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "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 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; - + # for macos nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; darwin = { @@ -72,7 +72,7 @@ # use devenv to manage my development environment devenv.url = "github:cachix/devenv/v0.6.2"; - + # secrets management, lock with git commit at 2023/5/15 agenix.url = "github:ryantm/agenix/db5637d10f797bb251b94ef9040b237f4702cde3"; @@ -85,128 +85,133 @@ # 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) # 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@{ - self, - nixpkgs, - darwin, - home-manager, - ... - }: { - nixosConfigurations = { - # By default, NixOS will try to refer the nixosConfiguration with its hostname. - # 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#`. - # 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 - msi-rtx4090 = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; + outputs = + inputs@{ self + , nixpkgs + , darwin + , home-manager + , ... + }: { + nixosConfigurations = { + # By default, NixOS will try to refer the nixosConfiguration with its hostname. + # 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#`. + # 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 + msi-rtx4090 = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; - # 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: - # - # It is said to be partial because the documentation is not complete, only some simple introductions - # (such is the current state of Nix documentation...) - # 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: - # - # config: The configuration of the entire system - # 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. - # modulesPath: The location of the module directory of Nix. - # - # 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 - specialArgs = { - pkgs-stable = import inputs.nixpkgs-stable { - system = system; # refer the `system` parameter form outer scope recursively - # To use chrome, we need to allow the installation of non-free software - config.allowUnfree = true; - }; - } // inputs; + # 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: + # + # It is said to be partial because the documentation is not complete, only some simple introductions + # (such is the current state of Nix documentation...) + # 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: + # + # config: The configuration of the entire system + # 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. + # modulesPath: The location of the module directory of Nix. + # + # 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 + specialArgs = { + pkgs-stable = import inputs.nixpkgs-stable { + system = system; # refer the `system` parameter form outer scope recursively + # To use chrome, we need to allow the installation of non-free software + config.allowUnfree = true; + }; + } // 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 = [ - ./hosts/msi-rtx4090 + ./hosts/harmonica - # 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.darwinModules.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; + home-manager.extraSpecialArgs = inputs; + home-manager.users.admin = import ./home/darwin; } ]; }; - 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; - } - ]; + 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 + # 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" = ; ... }; + # # 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" = ; ... }; - # # 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"; - # }; - # }; - }; } diff --git a/fonts/archcraft-icon-font.nix b/fonts/archcraft-icon-font.nix index fd5aac70..96b21bb5 100644 --- a/fonts/archcraft-icon-font.nix +++ b/fonts/archcraft-icon-font.nix @@ -6,13 +6,13 @@ stdenvNoCC.mkDerivation rec { src = fetchgit { url = "https://github.com/archcraft-os/archcraft-packages.git"; - rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id - sparseCheckout = [ "archcraft-fonts/files/icon-fonts/archcraft.ttf" ]; # only fetch the feather.ttf file + rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id + 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. # 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 - sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U="; + sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U="; }; installPhase = '' @@ -32,4 +32,4 @@ stdenvNoCC.mkDerivation rec { maintainers = [ maintainers.ryan4yin ]; platforms = platforms.all; }; -} \ No newline at end of file +} diff --git a/fonts/icomoon-feather-icon-font.nix b/fonts/icomoon-feather-icon-font.nix index dfeb8825..218c88d6 100644 --- a/fonts/icomoon-feather-icon-font.nix +++ b/fonts/icomoon-feather-icon-font.nix @@ -7,15 +7,15 @@ stdenvNoCC.mkDerivation rec { # 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather src = fetchgit { url = "https://github.com/adi1090x/polybar-themes.git"; - rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id - sparseCheckout = [ "fonts/feather.ttf" ]; # only fetch the feather.ttf file + rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id + 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. # 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 - sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4="; + sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4="; }; - + installPhase = '' runHook preInstall @@ -36,4 +36,4 @@ stdenvNoCC.mkDerivation rec { maintainers = [ maintainers.ryan4yin ]; platforms = platforms.all; }; -} \ No newline at end of file +} diff --git a/home/base/bash.nix b/home/base/bash.nix index 1936dd75..b4b1ee75 100644 --- a/home/base/bash.nix +++ b/home/base/bash.nix @@ -1,4 +1,4 @@ -{...}: { +{ ... }: { programs.bash = { enable = 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;"; }; }; -} \ No newline at end of file +} diff --git a/home/base/core.nix b/home/base/core.nix index 19c7cdef..0dc4856a 100644 --- a/home/base/core.nix +++ b/home/base/core.nix @@ -1,9 +1,9 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { home.packages = with pkgs; [ neofetch - nnn # terminal file manager + nnn # terminal file manager # archives zip @@ -12,19 +12,19 @@ p7zip # utils - ripgrep # recursively searches directories for a regex pattern - jq # A lightweight and flexible command-line JSON processor - yq-go # yaml processer https://github.com/mikefarah/yq - exa # A modern replacement for ‘ls’ - fzf # A command-line fuzzy finder + ripgrep # recursively searches directories for a regex pattern + jq # A lightweight and flexible command-line JSON processor + yq-go # yaml processer https://github.com/mikefarah/yq + exa # A modern replacement for ‘ls’ + fzf # A command-line fuzzy finder # networking tools - mtr # A network diagnostic tool + mtr # A network diagnostic tool 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 socat # replacement of openbsd-netcat - nmap # A utility for network discovery and security auditing + nmap # A utility for network discovery and security auditing # misc cowsay @@ -45,8 +45,8 @@ nix-output-monitor # productivity - hugo # static site generator - glow # markdown previewer in terminal + hugo # static site generator + glow # markdown previewer in terminal ]; programs = { @@ -77,4 +77,4 @@ enableBashIntegration = true; }; }; -} \ No newline at end of file +} diff --git a/home/base/default.nix b/home/base/default.nix index 5144980d..b838c2db 100644 --- a/home/base/default.nix +++ b/home/base/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { imports = [ ./nushell @@ -11,4 +11,4 @@ ./starship.nix ]; -} \ No newline at end of file +} diff --git a/home/base/development.nix b/home/base/development.nix index 6ed0390b..55a9b0a0 100644 --- a/home/base/development.nix +++ b/home/base/development.nix @@ -1,8 +1,8 @@ -{config, pkgs, nil, ...}: +{ config, pkgs, nil, ... }: { home.packages = with pkgs; [ - nil.packages."${pkgs.system}".default # nix language server + nil.packages."${pkgs.system}".default # nix language server # IDE jetbrains.pycharm-community @@ -11,7 +11,7 @@ # cloud native skopeo docker-compose - dive # explore docker layers + dive # explore docker layers kubectl kubernetes-helm terraform @@ -27,7 +27,7 @@ eksctl # 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-analyzer # lldb @@ -62,7 +62,7 @@ rustup # python - (python310.withPackages(ps: with ps; [ + (python310.withPackages (ps: with ps; [ ipython pandas requests @@ -89,9 +89,9 @@ # adoptopenjdk-openj9-bin-17 # other tools - k6 # load testing tool - mitmproxy # http/https proxy tool - protobuf # protocol buffer compiler + k6 # load testing tool + mitmproxy # http/https proxy tool + protobuf # protocol buffer compiler ]; programs = { @@ -104,9 +104,9 @@ }; direnv = { - enable = true; - nix-direnv.enable = true; - enableZshIntegration = true; + enable = true; + nix-direnv.enable = true; + enableZshIntegration = true; }; }; @@ -114,4 +114,4 @@ programs.gh = { enable = true; }; -} \ No newline at end of file +} diff --git a/home/base/git.nix b/home/base/git.nix index 26380841..caba6b11 100644 --- a/home/base/git.nix +++ b/home/base/git.nix @@ -1,14 +1,13 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { # `programs.git` will generate the config file: ~/.config/git/config # to make git use this config file, `~/.gitconfig` should not exist! # # 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 ''; @@ -58,4 +57,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/home/base/media.nix b/home/base/media.nix index d4761e45..820bdd94 100644 --- a/home/base/media.nix +++ b/home/base/media.nix @@ -1,7 +1,6 @@ -{ - pkgs, - config, - ... +{ pkgs +, config +, ... }: # processing audio/video { @@ -9,8 +8,8 @@ ffmpeg-full # images - viu # terminal image viewer + viu # terminal image viewer imagemagick graphviz ]; -} \ No newline at end of file +} diff --git a/home/base/nushell/default.nix b/home/base/nushell/default.nix index 40488ea0..a2d7fd76 100644 --- a/home/base/nushell/default.nix +++ b/home/base/nushell/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ ... }: { programs.nushell = { enable = true; 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;"; }; }; -} \ No newline at end of file +} diff --git a/home/base/starship.nix b/home/base/starship.nix index 5b6bafbf..c614cef7 100644 --- a/home/base/starship.nix +++ b/home/base/starship.nix @@ -1,10 +1,10 @@ -{config, ...}: { +{ config, ... }: { programs.starship = { enable = true; - + enableBashIntegration = true; enableNushellIntegration = true; - + settings = { character = { success_symbol = "[›](bold green)"; @@ -12,4 +12,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/home/darwin/alacritty/default.nix b/home/darwin/alacritty/default.nix index 15a5f544..b1f36886 100644 --- a/home/darwin/alacritty/default.nix +++ b/home/darwin/alacritty/default.nix @@ -7,4 +7,4 @@ xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml; xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml; -} \ No newline at end of file +} diff --git a/home/darwin/core.nix b/home/darwin/core.nix index e7249d12..9b3ffb52 100644 --- a/home/darwin/core.nix +++ b/home/darwin/core.nix @@ -8,7 +8,7 @@ # google-cloud-sdk telegram wireshark -{pkgs, ...}: +{ pkgs, ... }: { # MacOS specific configuration home.packages = with pkgs; [ diff --git a/home/darwin/default.nix b/home/darwin/default.nix index cfc4f955..93064354 100644 --- a/home/darwin/default.nix +++ b/home/darwin/default.nix @@ -3,13 +3,13 @@ { imports = [ ../base/nushell - + ../base/core.nix ../base/git.nix ../base/development.nix ../base/media.nix ../base/starship.nix - + ./alacritty ./core.nix ]; @@ -34,4 +34,4 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; -} \ No newline at end of file +} diff --git a/home/linux/base/alacritty/default.nix b/home/linux/base/alacritty/default.nix index 15a5f544..b1f36886 100644 --- a/home/linux/base/alacritty/default.nix +++ b/home/linux/base/alacritty/default.nix @@ -7,4 +7,4 @@ xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml; xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml; -} \ No newline at end of file +} diff --git a/home/linux/base/development.nix b/home/linux/base/development.nix index b28e8852..7d3f6a08 100644 --- a/home/linux/base/development.nix +++ b/home/linux/base/development.nix @@ -1,11 +1,11 @@ -{config, pkgs, nil, ...}: +{ config, pkgs, nil, ... }: { home.packages = with pkgs; [ - nil.packages."${pkgs.system}".default # nix language server + nil.packages."${pkgs.system}".default # nix language server # GUI IDE - insomnia # REST client + insomnia # REST client # need to run `conda-install` before using it # need to run `conda-shell` before using command `conda` @@ -33,4 +33,4 @@ programs.gh = { enable = true; }; -} \ No newline at end of file +} diff --git a/home/linux/base/shell.nix b/home/linux/base/shell.nix index 3c81ec62..f93f0db7 100644 --- a/home/linux/base/shell.nix +++ b/home/linux/base/shell.nix @@ -1,10 +1,11 @@ -{config, ...}: +{ config, ... }: let d = config.xdg.dataHome; c = config.xdg.configHome; cache = config.xdg.cacheHome; -in rec { +in +rec { # add environment variables systemd.user.sessionVariables = { # clean up ~ @@ -29,4 +30,4 @@ in rec { }; home.sessionVariables = systemd.user.sessionVariables; -} \ No newline at end of file +} diff --git a/home/linux/base/ssh.nix b/home/linux/base/ssh.nix index 9c3edfcc..4ebc6909 100644 --- a/home/linux/base/ssh.nix +++ b/home/linux/base/ssh.nix @@ -1,6 +1,5 @@ -{ - pkgs, - ... +{ pkgs +, ... }: { programs.ssh = { enable = true; @@ -36,4 +35,4 @@ # check imported keys by `ssh-add -l` # TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login. }; -} \ No newline at end of file +} diff --git a/home/linux/base/system-tools.nix b/home/linux/base/system-tools.nix index 7b7a7859..c2280a72 100644 --- a/home/linux/base/system-tools.nix +++ b/home/linux/base/system-tools.nix @@ -1,31 +1,31 @@ -{pkgs, config, ...}: +{ pkgs, config, ... }: { # Linux Only Packages, not available on Darwin home.packages = with pkgs; [ - btop # replacement of htop/nmon + btop # replacement of htop/nmon htop iotop nmon ## networking tools - wireguard-tools # manage wireguard vpn manually, via wg-quick + wireguard-tools # manage wireguard vpn manually, via wg-quick iftop # misc libnotify # system call monitoring - strace # system call monitoring - ltrace # library call monitoring - lsof # list open files + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files # system tools ethtool sysstat - lm_sensors # for `sensors` command - cifs-utils # for mounting windows shares + lm_sensors # for `sensors` command + cifs-utils # for mounting windows shares ]; # auto mount usb drives diff --git a/home/linux/base/xdg.nix b/home/linux/base/xdg.nix index 577d595a..dd05d55d 100644 --- a/home/linux/base/xdg.nix +++ b/home/linux/base/xdg.nix @@ -2,10 +2,10 @@ # 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: # https://www.freedesktop.org/wiki/Specifications/ -{config, pkgs, ...}: +{ config, 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 ]; @@ -22,13 +22,13 @@ # ls /etc/profiles/per-user/ryan/share/applications/ mimeApps = { enable = true; - defaultApplications = + defaultApplications = let - browser = ["firefox.desktop"]; + browser = [ "firefox.desktop" ]; in { "application/json" = browser; - "application/pdf" = browser; # TODO: pdf viewer + "application/pdf" = browser; # TODO: pdf viewer "text/html" = browser; "text/xml" = browser; @@ -48,18 +48,18 @@ "x-scheme-handler/http" = browser; "x-scheme-handler/https" = browser; "x-scheme-handler/unknown" = browser; - - "x-scheme-handler/discord" = ["discord.desktop"]; - "x-scheme-handler/tg" = ["telegramdesktop.desktop"]; - "audio/*" = ["mpv.desktop"]; - "video/*" = ["mpv.dekstop"]; - "image/*" = ["imv.desktop"]; + "x-scheme-handler/discord" = [ "discord.desktop" ]; + "x-scheme-handler/tg" = [ "telegramdesktop.desktop" ]; + + "audio/*" = [ "mpv.desktop" ]; + "video/*" = [ "mpv.dekstop" ]; + "image/*" = [ "imv.desktop" ]; }; associations.removed = let - browser = ["google-chrome.desktop"]; + browser = [ "google-chrome.desktop" ]; in { "text/html" = browser; diff --git a/home/linux/desktop/creative.nix b/home/linux/desktop/creative.nix index aa8ed11b..7a9a6c55 100644 --- a/home/linux/desktop/creative.nix +++ b/home/linux/desktop/creative.nix @@ -1,17 +1,16 @@ -{ - pkgs, - config, - ... +{ pkgs +, config +, ... }: { home.packages = with pkgs; [ # creative # blender # 3d modeling # gimp # image editing, I prefer using figma in browser instead of this one - inkscape # vector graphics - krita # digital painting + inkscape # vector graphics + krita # digital painting musescore # music notation - reaper # audio production + reaper # audio production # this app consumes a lot of storage, so do not install it currently # kicad # 3d printing, eletrical engineering @@ -21,4 +20,4 @@ # live streaming obs-studio.enable = true; }; -} \ No newline at end of file +} diff --git a/home/linux/desktop/default.nix b/home/linux/desktop/default.nix index 77cba869..9c7727df 100644 --- a/home/linux/desktop/default.nix +++ b/home/linux/desktop/default.nix @@ -16,13 +16,13 @@ # instant messaging telegram-desktop 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) remmina - freerdp # required by remmina + freerdp # required by remmina # misc flameshot ]; -} \ No newline at end of file +} diff --git a/home/linux/desktop/media.nix b/home/linux/desktop/media.nix index ad112946..803a1412 100644 --- a/home/linux/desktop/media.nix +++ b/home/linux/desktop/media.nix @@ -1,7 +1,6 @@ -{ - pkgs, - config, - ... +{ pkgs +, config +, ... }: # media - control and enjoy audio/video { @@ -10,7 +9,7 @@ pavucontrol playerctl pulsemixer - imv # simple image viewer + imv # simple image viewer nvtop @@ -24,12 +23,12 @@ programs = { mpv = { enable = true; - defaultProfiles = ["gpu-hq"]; - scripts = [pkgs.mpvScripts.mpris]; + defaultProfiles = [ "gpu-hq" ]; + scripts = [ pkgs.mpvScripts.mpris ]; }; }; services = { playerctld.enable = true; }; -} \ No newline at end of file +} diff --git a/home/linux/fcitx5/default.nix b/home/linux/fcitx5/default.nix index 45cc8313..da140570 100644 --- a/home/linux/fcitx5/default.nix +++ b/home/linux/fcitx5/default.nix @@ -1,24 +1,24 @@ -{pkgs, config, lib, ... }: { +{ pkgs, config, lib, ... }: { 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 管理的配置被覆盖 # 解决方法是通过如下内置,每次 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" ''; i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ - # for flypy chinese input method - fcitx5-rime - # needed enable rime using configtool after installed - fcitx5-configtool - fcitx5-chinese-addons - # fcitx5-mozc # japanese input method - fcitx5-gtk # gtk im module - ]; + # for flypy chinese input method + fcitx5-rime + # needed enable rime using configtool after installed + fcitx5-configtool + fcitx5-chinese-addons + # fcitx5-mozc # japanese input method + fcitx5-gtk # gtk im module + ]; }; systemd.user.sessionVariables = { @@ -28,6 +28,6 @@ QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; INPUT_METHOD = "fcitx"; - IMSETTINGS_MODULE = "fcitx"; + IMSETTINGS_MODULE = "fcitx"; }; -} \ No newline at end of file +} diff --git a/home/linux/hyprland/default.nix b/home/linux/hyprland/default.nix index d9e68d5a..90df3fdf 100644 --- a/home/linux/hyprland/default.nix +++ b/home/linux/hyprland/default.nix @@ -1,8 +1,7 @@ -{ - pkgs, - config, - lib, - ... +{ pkgs +, config +, lib +, ... }: { imports = [ ./wayland-apps.nix @@ -25,8 +24,8 @@ fonts.fontconfig.enable = true; systemd.user.sessionVariables = { - "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 + "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_WEBRENDER" = "1"; # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ diff --git a/home/linux/hyprland/wayland-apps.nix b/home/linux/hyprland/wayland-apps.nix index 32bb64e6..11e17688 100644 --- a/home/linux/hyprland/wayland-apps.nix +++ b/home/linux/hyprland/wayland-apps.nix @@ -1,8 +1,7 @@ -{ - pkgs, - pkgs-stable, - ... -}: +{ pkgs +, pkgs-stable +, ... +}: { # TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it. @@ -31,7 +30,7 @@ firefox = { enable = true; enableGnomeExtensions = false; - package = pkgs-stable.firefox-wayland; # firefox with wayland support + package = pkgs-stable.firefox-wayland; # firefox with wayland support }; vscode = { diff --git a/home/linux/i3/default.nix b/home/linux/i3/default.nix index bf512542..cba18122 100644 --- a/home/linux/i3/default.nix +++ b/home/linux/i3/default.nix @@ -1,8 +1,7 @@ -{ - pkgs, - config, - lib, - ... +{ pkgs +, config +, lib +, ... }: { # i3 配置,基于 https://github.com/endeavouros-team/endeavouros-i3wm-setup # 直接从当前文件夹中读取配置文件作为配置内容 @@ -20,7 +19,7 @@ source = ./scripts; # copy the scripts directory recursively recursive = true; - executable = true; # make all scripts executable + executable = true; # make all scripts executable }; # rofi is a application launcher and dmenu replacement @@ -56,4 +55,4 @@ package = pkgs.qogir-theme; size = 64; }; -} \ No newline at end of file +} diff --git a/home/linux/i3/x11-apps.nix b/home/linux/i3/x11-apps.nix index b216554a..0e298829 100644 --- a/home/linux/i3/x11-apps.nix +++ b/home/linux/i3/x11-apps.nix @@ -1,6 +1,5 @@ -{ - pkgs, - ... +{ pkgs +, ... }: { home.packages = with pkgs; [ firefox diff --git a/hosts/harmonica/default.nix b/hosts/harmonica/default.nix index 45610c37..8e401396 100644 --- a/hosts/harmonica/default.nix +++ b/hosts/harmonica/default.nix @@ -3,6 +3,6 @@ { imports = [ - ../../modules/darwin/core.nix + ../../modules/darwin/core.nix ]; } diff --git a/hosts/msi-rtx4090/cifs-mount.nix b/hosts/msi-rtx4090/cifs-mount.nix index 520c2e0d..4a910786 100644 --- a/hosts/msi-rtx4090/cifs-mount.nix +++ b/hosts/msi-rtx4090/cifs-mount.nix @@ -3,11 +3,11 @@ { # mount a smb/cifs share fileSystems."/home/ryan/SMB-Downloads" = { - device = "//192.168.5.194/Downloads"; - fsType = "cifs"; - options = [ - "vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=${config.age.secrets.smb-credentials.path},nofail" - ]; + device = "//192.168.5.194/Downloads"; + fsType = "cifs"; + options = [ + "vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=${config.age.secrets.smb-credentials.path},nofail" + ]; }; } diff --git a/hosts/msi-rtx4090/default.nix b/hosts/msi-rtx4090/default.nix index c0a2c545..e86b2721 100644 --- a/hosts/msi-rtx4090/default.nix +++ b/hosts/msi-rtx4090/default.nix @@ -30,13 +30,15 @@ # Enable binfmt emulation of aarch64-linux, this is required for cross compilation. boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; # supported fil systems, so we can mount any removable disks with these filesystems - boot.supportedFilesystems = [ + boot.supportedFilesystems = [ "ext4" "btrfs" "xfs" #"zfs" "ntfs" - "fat" "vfat" "exfat" + "fat" + "vfat" + "exfat" "cifs" # mount windows share ]; @@ -51,7 +53,7 @@ networking = { 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 # proxy.default = "http://user:password@proxy:port/"; @@ -59,25 +61,25 @@ networkmanager.enable = true; - enableIPv6 = false; # disable ipv6 + enableIPv6 = false; # disable ipv6 interfaces.enp5s0 = { useDHCP = false; - ipv4.addresses = [ { + ipv4.addresses = [{ address = "192.168.5.66"; prefixLength = 24; - } ]; + }]; }; defaultGateway = "192.168.5.201"; nameservers = [ - "119.29.29.29" # DNSPod - "223.5.5.5" # AliDNS + "119.29.29.29" # DNSPod + "223.5.5.5" # AliDNS ]; }; # 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 = { package = config.boot.kernelPackages.nvidiaPackages.stable; modesetting.enable = true; diff --git a/hosts/msi-rtx4090/hardware-configuration.nix b/hosts/msi-rtx4090/hardware-configuration.nix index 7cad98f7..fe07de6b 100644 --- a/hosts/msi-rtx4090/hardware-configuration.nix +++ b/hosts/msi-rtx4090/hardware-configuration.nix @@ -5,7 +5,8 @@ { 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" ]; @@ -14,19 +15,20 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3"; + { + device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3"; fsType = "btrfs"; options = [ "subvol=@" ]; }; fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/87ED-8B2E"; + { + device = "/dev/disk/by-uuid/87ED-8B2E"; fsType = "vfat"; }; 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 # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/nixos-test/default.nix b/hosts/nixos-test/default.nix index 6cfb6162..449f8503 100644 --- a/hosts/nixos-test/default.nix +++ b/hosts/nixos-test/default.nix @@ -27,13 +27,15 @@ # Enable binfmt emulation of aarch64-linux, this is required for cross compilation. boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; # supported fil systems, so we can mount any removable disks with these filesystems - boot.supportedFilesystems = [ + boot.supportedFilesystems = [ "ext4" "btrfs" "xfs" #"zfs" "ntfs" - "fat" "vfat" "exfat" + "fat" + "vfat" + "exfat" "cifs" # mount windows share ]; @@ -41,7 +43,7 @@ boot.loader = { grub = { enable = true; - device = "/dev/sda"; # "nodev" + device = "/dev/sda"; # "nodev" efiSupport = false; useOSProber = true; #efiInstallAsRemovable = true; # in case canTouchEfiVariables doesn't work for your system @@ -50,7 +52,7 @@ networking = { 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 # proxy.default = "http://user:password@proxy:port/"; @@ -59,15 +61,15 @@ networkmanager.enable = true; interfaces.ens18 = { useDHCP = false; - ipv4.addresses = [ { + ipv4.addresses = [{ address = "192.168.5.48"; prefixLength = 24; - } ]; + }]; }; defaultGateway = "192.168.5.201"; nameservers = [ - "119.29.29.29" # DNSPod - "223.5.5.5" # AliDNS + "119.29.29.29" # DNSPod + "223.5.5.5" # AliDNS ]; }; diff --git a/hosts/nixos-test/hardware-configuration.nix b/hosts/nixos-test/hardware-configuration.nix index eb10488f..a53d8009 100644 --- a/hosts/nixos-test/hardware-configuration.nix +++ b/hosts/nixos-test/hardware-configuration.nix @@ -5,7 +5,8 @@ { 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" ]; @@ -14,7 +15,8 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/b779eb19-e43d-4f07-a91f-eb08bd8e1202"; + { + device = "/dev/disk/by-uuid/b779eb19-e43d-4f07-a91f-eb08bd8e1202"; fsType = "ext4"; }; diff --git a/modules/darwin/core.nix b/modules/darwin/core.nix index 4f648797..1776abcf 100644 --- a/modules/darwin/core.nix +++ b/modules/darwin/core.nix @@ -50,11 +50,13 @@ font-awesome # nerdfonts - (nerdfonts.override { fonts = [ - "FiraCode" - "JetBrainsMono" - "Iosevka" - ];}) + (nerdfonts.override { + fonts = [ + "FiraCode" + "JetBrainsMono" + "Iosevka" + ]; + }) ]; }; @@ -64,4 +66,4 @@ home = "/Users/admin"; description = "admin"; }; -} \ No newline at end of file +} diff --git a/modules/nixos/core-desktop.nix b/modules/nixos/core-desktop.nix index 3e9a61ba..7cc8d801 100644 --- a/modules/nixos/core-desktop.nix +++ b/modules/nixos/core-desktop.nix @@ -57,23 +57,25 @@ # Noto 系列字体是 Google 主导的,名字的含义是「没有豆腐」(no tofu),因为缺字时显示的方框或者方框被叫作 tofu # Noto 系列字族名只支持英文,命名规则是 Noto + Sans 或 Serif + 文字名称。 # 其中汉字部分叫 Noto Sans/Serif CJK SC/TC/HK/JP/KR,最后一个词是地区变种。 - noto-fonts # 大部分文字的常见样式,不包含汉字 - noto-fonts-cjk # 汉字部分 - noto-fonts-emoji # 彩色的表情符号字体 - noto-fonts-extra # 提供额外的字重和宽度变种 + noto-fonts # 大部分文字的常见样式,不包含汉字 + noto-fonts-cjk # 汉字部分 + noto-fonts-emoji # 彩色的表情符号字体 + noto-fonts-extra # 提供额外的字重和宽度变种 # 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的 - source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro,以及带字重的变体,加上 Source Sans 3 VF - source-serif # 衬线字体,不含汉字。字族名叫 Source Code Pro,以及带字重的变体 - source-han-sans # 思源黑体 - source-han-serif # 思源宋体 + source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro,以及带字重的变体,加上 Source Sans 3 VF + source-serif # 衬线字体,不含汉字。字族名叫 Source Code Pro,以及带字重的变体 + source-han-sans # 思源黑体 + source-han-serif # 思源宋体 # nerdfonts - (nerdfonts.override { fonts = [ - "FiraCode" - "JetBrainsMono" - "Iosevka" - ];}) + (nerdfonts.override { + fonts = [ + "FiraCode" + "JetBrainsMono" + "Iosevka" + ]; + }) (pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { }) @@ -105,7 +107,7 @@ enable = true; settings = { X11Forwarding = true; - PermitRootLogin = "no"; # disable root login + PermitRootLogin = "no"; # disable root login PasswordAuthentication = false; # disable password login }; 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. wget curl - git # used by nix flakes - git-lfs # used by huggingface models + git # used by nix flakes + git-lfs # used by huggingface models 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! - (let base = pkgs.appimageTools.defaultFhsEnvArgs; in - pkgs.buildFHSUserEnv (base // { - name = "fhs"; - targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [pkgs.pkg-config]; - profile = "export FHS=1"; - runScript = "bash"; - extraOutputsToInstall = ["dev"]; - })) + ( + let base = pkgs.appimageTools.defaultFhsEnvArgs; in + pkgs.buildFHSUserEnv (base // { + name = "fhs"; + targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ]; + profile = "export FHS=1"; + runScript = "bash"; + extraOutputsToInstall = [ "dev" ]; + }) + ) ]; # replace default editor with neovim @@ -182,16 +186,16 @@ # enable bluetooth & gui paring tools - blueman # or you can use cli: - # $ bluetoothctl - # [bluetooth] # power on - # [bluetooth] # agent on - # [bluetooth] # default-agent - # [bluetooth] # scan on - # ...put device in pairing mode and wait [hex-address] to appear here... - # [bluetooth] # pair [hex-address] - # [bluetooth] # connect [hex-address] - # Bluetooth devices automatically connect with bluetoothctl as well: - # [bluetooth] # trust [hex-address] + # $ bluetoothctl + # [bluetooth] # power on + # [bluetooth] # agent on + # [bluetooth] # default-agent + # [bluetooth] # scan on + # ...put device in pairing mode and wait [hex-address] to appear here... + # [bluetooth] # pair [hex-address] + # [bluetooth] # connect [hex-address] + # Bluetooth devices automatically connect with bluetoothctl as well: + # [bluetooth] # trust [hex-address] hardware.bluetooth.enable = true; services.blueman.enable = true; @@ -212,9 +216,9 @@ geoclue2.enable = true; - udev.packages = with pkgs; [ + udev.packages = with pkgs; [ gnome.gnome-settings-daemon - platformio # udev rules for platformio + platformio # udev rules for platformio android-udev-rules ]; }; @@ -235,8 +239,8 @@ # and vscode has open like `External Uri Openers` xdgOpenUsePortal = false; extraPortals = with pkgs; [ - xdg-desktop-portal-wlr # for wlroots based compositors(hyprland/sway) - xdg-desktop-portal-gtk # for gtk + xdg-desktop-portal-wlr # for wlroots based compositors(hyprland/sway) + xdg-desktop-portal-gtk # for gtk # xdg-desktop-portal-kde # for kde ]; }; @@ -251,4 +255,4 @@ # for power management services.upower.enable = true; -} \ No newline at end of file +} diff --git a/modules/nixos/core-server.nix b/modules/nixos/core-server.nix index c3bd3ba8..c58b3546 100644 --- a/modules/nixos/core-server.nix +++ b/modules/nixos/core-server.nix @@ -51,15 +51,17 @@ font-awesome # 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的 - source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro,以及带字重的变体,加上 Source Sans 3 VF - source-han-sans # 思源黑体 + source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro,以及带字重的变体,加上 Source Sans 3 VF + source-han-sans # 思源黑体 # nerdfonts - (nerdfonts.override { fonts = [ - "FiraCode" - "JetBrainsMono" - "Iosevka" - ];}) + (nerdfonts.override { + fonts = [ + "FiraCode" + "JetBrainsMono" + "Iosevka" + ]; + }) ]; # user defined fonts @@ -82,7 +84,7 @@ enable = true; settings = { X11Forwarding = true; - PermitRootLogin = "no"; # disable root login + PermitRootLogin = "no"; # disable root login PasswordAuthentication = false; # disable password login }; openFirewall = true; @@ -95,8 +97,8 @@ wget curl aria2 - git # used by nix flakes - git-lfs # used by huggingface models + git # used by nix flakes + git-lfs # used by huggingface models ]; # replace default editor with neovim @@ -107,4 +109,4 @@ enable = true; }; services.upower.enable = true; -} \ No newline at end of file +} diff --git a/modules/nixos/fhs-fonts.nix b/modules/nixos/fhs-fonts.nix index bb0937b2..505e24e6 100644 --- a/modules/nixos/fhs-fonts.nix +++ b/modules/nixos/fhs-fonts.nix @@ -7,20 +7,22 @@ { system.fsPackages = [ pkgs.bindfs ]; - fileSystems = let - mkRoSymBind = path: { - device = path; - fsType = "fuse.bindfs"; - options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; + fileSystems = + let + mkRoSymBind = path: { + device = path; + 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"); - }; -} \ No newline at end of file +} diff --git a/modules/nixos/gui-apps.nix b/modules/nixos/gui-apps.nix index ee7991a2..5e0af927 100644 --- a/modules/nixos/gui-apps.nix +++ b/modules/nixos/gui-apps.nix @@ -14,4 +14,4 @@ ]; # flatpack is recommended to install other apps such as netease-cloud-music/qqmusic/... -} \ No newline at end of file +} diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index 41b6636b..03bef472 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: +{ pkgs, ... }: { @@ -34,7 +34,7 @@ nvidiaPatches = true; }; - programs.light.enable = true; # monitor backlight control + programs.light.enable = true; # monitor backlight control # thunar file manager(part of xfce) related options @@ -48,29 +48,29 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - waybar # the status bar - swaybg # the wallpaper - swayidle # the idle timeout - swaylock # locking the screen - wlogout # logout menu - wl-clipboard # copying and pasting + waybar # the status bar + swaybg # the wallpaper + swayidle # the idle timeout + swaylock # locking the screen + wlogout # logout menu + wl-clipboard # copying and pasting - wf-recorder # creen recording - grim # taking screenshots - slurp # selecting a region to screenshot + wf-recorder # creen recording + grim # taking screenshots + slurp # selecting a region to screenshot # TODO replace by `flameshot gui --raw | wl-copy` - wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland - mako # the notification daemon, the same as dunst + wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland + 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 - mpc-cli # command-line mpd client - ncmpcpp # a mpd client with a UI - networkmanagerapplet # provide GUI app: nm-connection-editor + mpd # for playing system sounds + mpc-cli # command-line mpd client + ncmpcpp # a mpd client with a UI + networkmanagerapplet # provide GUI app: nm-connection-editor - xfce.thunar # xfce4's file manager + xfce.thunar # xfce4's file manager ]; } diff --git a/modules/nixos/i3.nix b/modules/nixos/i3.nix index f75e4217..326aa457 100644 --- a/modules/nixos/i3.nix +++ b/modules/nixos/i3.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: +{ pkgs, ... }: { @@ -21,26 +21,26 @@ windowManager.i3 = { enable = true; extraPackages = with pkgs; [ - rofi # application launcher, the same as dmenu - dunst # notification daemon - i3blocks # status bar - i3lock # default i3 screen locker - xautolock # lock screen after some time - i3status # provide information to i3bar - i3-gaps # i3 with gaps - picom # transparency and shadows - feh # set wallpaper - acpi # battery information - arandr # screen layout manager - dex # autostart applications - xbindkeys # bind keys to commands - xorg.xbacklight # control screen brightness, the same as light - xorg.xdpyinfo # get screen information - scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot - sysstat # get system information + rofi # application launcher, the same as dmenu + dunst # notification daemon + i3blocks # status bar + i3lock # default i3 screen locker + xautolock # lock screen after some time + i3status # provide information to i3bar + i3-gaps # i3 with gaps + picom # transparency and shadows + feh # set wallpaper + acpi # battery information + arandr # screen layout manager + dex # autostart applications + xbindkeys # bind keys to commands + xorg.xbacklight # control screen brightness, the same as light + xorg.xdpyinfo # get screen information + scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot + sysstat # get system information - xfce.thunar # xfce4's file manager - ]; + xfce.thunar # xfce4's file manager + ]; }; # Configure keymap in X11 @@ -55,4 +55,4 @@ ]; services.gvfs.enable = true; # Mount, trash, and other functionalities services.tumbler.enable = true; # Thumbnail support for images -} \ No newline at end of file +} diff --git a/modules/nixos/user_group.nix b/modules/nixos/user_group.nix index c5d47fe7..fd9fa6e5 100644 --- a/modules/nixos/user_group.nix +++ b/modules/nixos/user_group.nix @@ -1,10 +1,10 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { users.groups = { - ryan = {}; - docker = {}; - wireshark = {}; + ryan = { }; + docker = { }; + wireshark = { }; }; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.ryan = { @@ -13,7 +13,7 @@ description = "ryan"; extraGroups = [ "ryan" "users" "networkmanager" "wheel" "docker" "wireshark" "adbusers" ]; openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj" ]; }; -} \ No newline at end of file +} diff --git a/overlays/default.nix b/overlays/default.nix index 9582515f..a2f58c93 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,6 @@ args: - # execute and import all overlay files in the current directory with the given args - builtins.map +# execute and import all overlay files in the current directory with the given args +builtins.map (f: (import (./. + "/${f}") args)) # execute and import the overlay file (builtins.filter # find all overlay files in the current directory (f: f != "default.nix") diff --git a/overlays/fcitx5/default.nix b/overlays/fcitx5/default.nix index 3b463753..543c1d2b 100644 --- a/overlays/fcitx5/default.nix +++ b/overlays/fcitx5/default.nix @@ -1,6 +1,6 @@ # 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override # 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix -{...}: +{ ... }: (self: super: { # 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」 diff --git a/secrets/default.nix b/secrets/default.nix index 294296cc..f2fecc1d 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -2,11 +2,11 @@ { imports = [ - agenix.nixosModules.default + agenix.nixosModules.default ]; 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! @@ -32,4 +32,4 @@ # encrypted file path file = ./encrypt/smb-credentials.age; }; -} \ No newline at end of file +} diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 23237f8f..a19207d1 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -17,4 +17,4 @@ in "./encrypt/wg-business.conf.age".publicKeys = users ++ systems; "./encrypt/smb-credentials.age".publicKeys = users ++ systems; # "./encrypt/secret123.age".publicKeys = [ user1 system1 ]; -} \ No newline at end of file +}