nixos

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 90c2a18ba63ddfa4bc907cd05268b24b3bab85b6
Author: Toni Brown <tb148@proton.me>
Date:   Sat, 16 Aug 2025 23:28:41 +0800

initial commit

Diffstat:
Aavatar.png | 0
Aconfig.nu | 5+++++
Aconfiguration.nix | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.lock | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.nix | 48++++++++++++++++++++++++++++++++++++++++++++++++
Ahardware-configuration.nix | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahome.nix | 278+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AquickCss.css | 4++++
Arime.yaml | 3+++
Awezterm.lua | 14++++++++++++++
10 files changed, 670 insertions(+), 0 deletions(-)

diff --git a/avatar.png b/avatar.png Binary files differ. diff --git a/config.nu b/config.nu @@ -0,0 +1,5 @@ +$env.config.buffer_editor = "zeditor" +$env.config.show_banner = false +$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' +$env.EDITOR = "helix" +$env.SHELL = "nu" diff --git a/configuration.nix b/configuration.nix @@ -0,0 +1,146 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ + ./hardware-configuration.nix + ]; + + fileSystems."/".options = [ + "subvol=root" + "compress=zstd" + ]; + fileSystems."/home".options = [ + "subvol=home" + "compress=zstd" + ]; + fileSystems."/nix".options = [ + "subvol=nix" + "compress=zstd" + "noatime" + ]; + boot.loader.grub = { + enable = true; + efiSupport = true; + device = "nodev"; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + nixpkgs.config.allowlistedLicenses = [ lib.licenses.unfreeRedistributable ]; + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.open = true; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + nixpkgs.overlays = [ + (final: prev: { + catppuccin-kde = prev.catppuccin-kde.override { + flavour = [ "mocha" ]; + accents = [ "mauve" ]; + winDecStyles = [ "classic" ]; + }; + catppuccin-papirus-folders = prev.catppuccin-papirus-folders.override { + flavor = "mocha"; + accent = "mauve"; + }; + fcitx5-rime = prev.fcitx5-rime.override { + rimeDataPkgs = [ + final.rime-ice + ]; + }; + }) + ]; + + environment.systemPackages = with pkgs; [ + git + vim + wget + catppuccin-cursors.mochaMauve + sarasa-gothic + ]; + + services = { + desktopManager.plasma6.enable = true; + displayManager.sddm.enable = true; + displayManager.sddm.wayland.enable = true; + }; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + services.printing.enable = true; + + networking.hostName = "nixosion"; + networking.networkmanager.enable = true; + networking.firewall.enable = false; + programs.clash-verge = { + enable = true; + autoStart = true; + tunMode = true; + serviceMode = true; + }; + nix.settings.substituters = [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ]; + + time.timeZone = "Asia/Shanghai"; + services.timesyncd = { + enable = true; + servers = [ "ntp.ntsc.ac.cn" ]; + }; + + i18n.defaultLocale = "zh_CN.UTF-8"; + services.xserver.xkb.layout = "cn(altgr-pinyin)"; + + users.users.tb148 = { + isNormalUser = true; + home = "/home/tb148"; + description = "Toni Brown"; + extraGroups = [ "wheel" ]; + }; + + catppuccin.enable = true; + catppuccin.flavor = "mocha"; + catppuccin.accent = "mauve"; + catppuccin.sddm.font = "等距更纱黑体 SC"; + catppuccin.sddm.fontSize = "12"; + xdg.icons.fallbackCursorThemes = [ "catppuccin-mocha-mauve-cursors" ]; + + programs.steam.enable = true; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "25.05"; # Did you read the comment? + +} diff --git a/flake.lock b/flake.lock @@ -0,0 +1,101 @@ +{ + "nodes": { + "catppuccin": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1754766349, + "narHash": "sha256-ykTnH2nnGnY2Z18sYWryLZFvxRxEcEfgZrl4FwoD4R8=", + "owner": "catppuccin", + "repo": "nix", + "rev": "10ebe71126157f98f180f747aec3fc4b497e3496", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754756528, + "narHash": "sha256-W1jYKMetZSOHP5m2Z5Wokdj/ct17swPHs+MiY2WT1HQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3ec1cd9a0703fbd55d865b7fd2b07d08374f0355", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "midnight": { + "flake": false, + "locked": { + "lastModified": 1754008899, + "narHash": "sha256-we2wY5n2zvlpeuq2o2JVyj39+pDLj6Iv/Bm81OtuvDU=", + "owner": "refact0r", + "repo": "midnight-discord", + "rev": "9287e825c03f15379d26dfb00039c19d5c4de210", + "type": "github" + }, + "original": { + "owner": "refact0r", + "repo": "midnight-discord", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1753694789, + "narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dc9637876d0dcc8c9e5e22986b857632effeb727", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", + "ref": "nixos-unstable", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", + "shallow": true, + "type": "git", + "url": "https://mirrors.tuna.tsinghua.edu.cn/git/nixpkgs.git" + }, + "original": { + "ref": "nixos-unstable", + "shallow": true, + "type": "git", + "url": "https://mirrors.tuna.tsinghua.edu.cn/git/nixpkgs.git" + } + }, + "root": { + "inputs": { + "catppuccin": "catppuccin", + "home-manager": "home-manager", + "midnight": "midnight", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "A simple NixOS flake"; + + inputs = { + # NixOS 官方软件源,这里使用 nixos-unstable 分支 + nixpkgs.url = "git+https://mirrors.tuna.tsinghua.edu.cn/git/nixpkgs.git?ref=nixos-unstable&shallow=1"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + catppuccin.url = "github:catppuccin/nix"; + midnight.url = "github:refact0r/midnight-discord"; + midnight.flake = false; + }; + + outputs = + { + self, + nixpkgs, + home-manager, + catppuccin, + ... + }@inputs: + { + nixosConfigurations.nixosion = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + # 这里导入之前我们使用的 configuration.nix, + # 这样旧的配置文件仍然能生效 + ./configuration.nix + catppuccin.nixosModules.catppuccin + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.tb148 = { + imports = [ + ./home.nix + catppuccin.homeModules.catppuccin + ]; + }; + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + home-manager.extraSpecialArgs = { inherit inputs; }; + } + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix @@ -0,0 +1,71 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "vmd" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/18af5e11-1470-4fa6-9577-8e8ba513857c"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/18af5e11-1470-4fa6-9577-8e8ba513857c"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/18af5e11-1470-4fa6-9577-8e8ba513857c"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/7498-1041"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/3a9c8feb-74f7-47f3-8736-82f3b9d35791"; } + ]; + + # 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp44s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix @@ -0,0 +1,278 @@ +{ + config, + lib, + pkgs, + osConfig, + inputs, + ... +}: +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "tb148"; + home.homeDirectory = "/home/tb148"; + home.file.".face.icon".source = ./avatar.png; + programs.git.userName = "Toni Brown"; + programs.git.userEmail = "tb148@proton.me"; + + xdg.userDirs = { + enable = true; + desktop = "${config.home.homeDirectory}/desktop"; + documents = "${config.home.homeDirectory}/documents"; + download = "${config.home.homeDirectory}/download"; + music = "${config.home.homeDirectory}/music"; + pictures = "${config.home.homeDirectory}/pictures"; + publicShare = "${config.home.homeDirectory}/public"; + templates = "${config.home.homeDirectory}/templates"; + videos = "${config.home.homeDirectory}/videos"; + }; + + home.packages = with pkgs; [ + catppuccin-kde + catppuccin-papirus-folders + catppuccinifier-cli + catppuccinifier-gui + ffmpeg + iosevka + nerd-fonts.iosevka + nodejs + pnpm + ponysay + sarasa-gothic + ]; + + programs.bat.enable = true; + + programs.carapace.enable = true; + + programs.direnv.enable = true; + + programs.fastfetch.enable = true; + + programs.fd.enable = true; + + programs.floorp.enable = true; + + programs.git.enable = true; + programs.git.signing.signByDefault = true; + programs.git.signing.key = "53187AD414FDFBCC"; + + programs.gpg.enable = true; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + pinentry.package = pkgs.pinentry-qt; + pinentry.program = "pinentry-qt"; + sshKeys = [ "F2F9CB00ABA433C59C7AF87A67A8D5F74D235760" ]; + }; + + programs.helix.enable = true; + + programs.hyfetch.enable = true; + + programs.lutris = { + enable = true; + protonPackages = [ pkgs.proton-ge-bin ]; + steamPackage = osConfig.programs.steam.package; + winePackages = [ pkgs.wineWow64Packages.full ]; + }; + + programs.nushell.enable = true; + programs.nushell.configFile.source = ./config.nu; + home.shell.enableNushellIntegration = true; + + programs.pay-respects.enable = true; + + programs.starship.enable = true; + programs.starship.settings = { + format = lib.concatStrings [ + "[ ](bg:red)" + "$os" + "$username" + "[ ](bg:peach fg:red)" + "$directory" + "[ ](bg:yellow fg:peach)" + "$git_branch" + "$git_state" + "$git_status" + "[ ](bg:green fg:yellow)" + "$c" + "$cpp" + "$nodejs" + "$python" + "[ ](bg:sapphire fg:green)" + "$time" + "[ ](bg:mauve fg:sapphire)" + "$cmd_duration" + "[](fg:mauve)" + "$line_break" + "$character" + ]; + os = { + disabled = false; + format = "[$symbol]($style)"; + style = "bg:red fg:crust"; + symbols.NixOS = "󱄅 "; + }; + username = { + show_always = true; + format = "[$user ]($style)"; + style_user = "bg:red fg:crust"; + style_root = "bg:red fg:crust"; + }; + directory = { + format = "[$path$read_only ]($style)"; + style = "bg:peach fg:crust"; + read_only = "󰍁 "; + truncation_symbol = "… /"; + }; + git_branch = { + format = "[$symbol$branch(:$remote_branch) ]($style)"; + style = "bg:yellow fg:crust"; + symbol = " "; + }; + git_state = { + format = "[$state ($progress_current/$progress_total )]($style)"; + style = "bg:yellow fg:crust"; + }; + git_status = { + format = "([$all_status$ahead_behind ]($style))"; + style = "bg:yellow fg:crust"; + }; + c = { + format = "[$symbol($version(-$name)) ]($style)"; + style = "bg:green fg:crust"; + symbol = "󰙱 "; + }; + cpp = { + format = "[$symbol($version(-$name)) ]($style)"; + style = "bg:green fg:crust"; + symbol = "󰙲 "; + }; + nodejs = { + format = "[$symbol($version) ]($style)"; + style = "bg:green fg:crust"; + symbol = "󰎙 "; + }; + python = { + format = "[$symbol($version)(\($virtualenv\)) ]($style)"; + style = "bg:green fg:crust"; + symbol = "󰌠 "; + }; + time = { + disabled = false; + format = "[󰅐 $time ]($style)"; + style = "bg:sapphire fg:crust"; + }; + cmd_duration = { + format = "[$duration ]($style)"; + style = "bg:mauve fg:crust"; + }; + character = { + success_symbol = "[❯](bold fg:green)"; + error_symbol = "[❯](bold fg:red)"; + vimcmd_symbol = "[❮](bold fg:green)"; + vimcmd_replace_one_symbol = "[❮](bold fg:lavender)"; + vimcmd_replace_symbol = "[❮](bold fg:lavender)"; + vimcmd_visual_symbol = "[❮](bold fg:yellow)"; + }; + }; + + programs.vesktop.enable = true; + programs.vesktop.vencord = { + settings.enabledThemes = [ + "midnight-catppuccin-mocha.theme.css" + ]; + themes."midnight-catppuccin-mocha.theme" = + builtins.readFile "${inputs.midnight}/themes/flavors/midnight-catppuccin-mocha.theme.css"; + }; + xdg.configFile."vesktop/settings/quickCss.css".source = ./quickCss.css; + + programs.wezterm.enable = true; + programs.wezterm.extraConfig = builtins.readFile ./wezterm.lua; + + programs.yazi.enable = true; + + programs.zed-editor.enable = true; + programs.zed-editor.extraPackages = with pkgs; [ + lua-language-server + nil + nixd + nixfmt + package-version-server + prettier + svelte-language-server + tailwindcss-language-server + taplo + verible + veridian + vscode-json-languageserver + yaml-language-server + ]; + programs.zed-editor.extensions = [ + "lua" + "nix" + "nu" + "svelte" + "verilog" + ]; + programs.zed-editor.userSettings = { + buffer_font_family = "Sarasa Mono SC"; + buffer_font_size = 16; + ui_font_family = "Sarasa Mono SC"; + ui_font_size = 16; + hard_tabs = true; + lsp.nixd.settings = { + options = { + nixos.expr = "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixosion.options"; + home-manager.expr = "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixosion.options.home-manager.users.type.getSubOptions []"; + }; + }; + }; + + programs.zoxide.enable = true; + + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + fcitx5-with-addons = pkgs.kdePackages.fcitx5-with-addons; + addons = with pkgs; [ + fcitx5-rime + ]; + settings.addons.classicui.globalSection = { + Theme = "catppuccin-mocha-mauve"; + Font = "等距更纱黑体 SC 10"; + }; + waylandFrontend = true; + }; + }; + xdg.dataFile."fcitx5/rime/default.custom.yaml".source = ./rime.yaml; + + catppuccin = { + enable = true; + flavor = "mocha"; + accent = "mauve"; + }; + catppuccin.cursors.enable = true; + catppuccin.fcitx5.enableRounded = true; + qt = { + enable = true; + style.name = "kvantum"; + platformTheme.name = "kvantum"; + }; + catppuccin.vesktop.enable = false; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "25.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/quickCss.css b/quickCss.css @@ -0,0 +1,4 @@ +body { + --font: "等距更纱黑体 SC"; + --code-font: "等距更纱黑体 SC"; +} diff --git a/rime.yaml b/rime.yaml @@ -0,0 +1,3 @@ +patch: + __include: rime_ice_suggestion:/ + "menu/page_size": 10 diff --git a/wezterm.lua b/wezterm.lua @@ -0,0 +1,14 @@ +local wezterm = require 'wezterm' +local config = wezterm.config_builder() +config.color_scheme = 'Catppuccin Mocha' +config.default_prog = { 'nu' } +config.initial_cols = 128 +config.initial_rows = 32 +config.font = wezterm.font_with_fallback { + 'Iosevka Nerd Font', + 'Sarasa Mono SC', +} +config.font_size = 12 +config.mux_enable_ssh_agent = false +config.use_fancy_tab_bar = false +return config;