This commit is contained in:
Guanran Wang 2023-10-15 14:24:40 +08:00
commit 5bd2c3dbde
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
81 changed files with 347 additions and 1183 deletions

29
.gitmodules vendored
View file

@ -1,29 +0,0 @@
[submodule "users/guanranwang/home-manager/common/dotfiles/config/alacritty/catppuccin"]
path = users/guanranwang/home-manager/common/dotfiles/config/alacritty/catppuccin
url = https://github.com/catppuccin/catppuccin.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/clash/yacd"]
path = users/guanranwang/home-manager/common/dotfiles/config/clash/yacd
url = https://github.com/haishanh/yacd.git
branch = gh-pages
[submodule "users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd"]
path = users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd
url = https://github.com/MetaCubeX/metacubexd.git
branch = gh-pages
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/fast-syntax-highlighting"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/fast-syntax-highlighting
url = https://github.com/zdharma-continuum/fast-syntax-highlighting.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/fzf-tab"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/fzf-tab
url = https://github.com/Aloxaf/fzf-tab.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/powerlevel10k"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-autosuggestions"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-history-substring-search"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-history-substring-search
url = https://github.com/zsh-users/zsh-history-substring-search.git
[submodule "users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-syntax-highlighting"]
path = users/guanranwang/home-manager/common/dotfiles/config/zsh/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { inputs, pkgs, ... }:
# README!!: # README!!:
# I HAVE NO IDEA HOW LAUNCHD DAEMON WORKS # I HAVE NO IDEA HOW LAUNCHD DAEMON WORKS
@ -23,5 +23,5 @@
"rsync_proxy" = "http://127.0.0.1:7890"; "rsync_proxy" = "http://127.0.0.1:7890";
}; };
environment.etc."clash-meta/metacubexd".source = ../../users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd; environment.etc."clash-meta/metacubexd".source = inputs.metacubexd;
} }

View file

@ -1,5 +1,6 @@
{ ... }: { ... }:
{ {
nix.settings.experimental-features = [ "nix-command" "flakes" ]; # enable flakes # Enable Flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
} }

View file

@ -2,12 +2,10 @@
{ {
nix = { nix = {
### optimiser ### Auto hard linking
settings = { settings.auto-optimise-store = true;
auto-optimise-store = true;
};
### auto delete older NixOS builds ### Automatically delete older NixOS builds
gc = { gc = {
automatic = true; automatic = true;
options = "--delete-older-than 7d"; options = "--delete-older-than 7d";

View file

@ -315,6 +315,23 @@
"type": "github" "type": "github"
} }
}, },
"metacubexd": {
"flake": false,
"locked": {
"lastModified": 1696853927,
"narHash": "sha256-HzbU/TWXfRJytSwIpdJRMdeOUXE1pMxtKtmjhkWTXzk=",
"owner": "MetaCubeX",
"repo": "metacubexd",
"rev": "0ff85616c7b9156e9d5eaee62eb811da5872a71d",
"type": "github"
},
"original": {
"owner": "MetaCubeX",
"ref": "gh-pages",
"repo": "metacubexd",
"type": "github"
}
},
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -446,9 +463,11 @@
"hyprland": "hyprland", "hyprland": "hyprland",
"impermanence": "impermanence", "impermanence": "impermanence",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"metacubexd": "metacubexd",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"sops-nix": "sops-nix" "sops-nix": "sops-nix",
"tokyonight": "tokyonight"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -542,6 +561,22 @@
"type": "github" "type": "github"
} }
}, },
"tokyonight": {
"flake": false,
"locked": {
"lastModified": 1697104289,
"narHash": "sha256-OJGgBcSTiIEnmGpYlNBmb3CzOmxb8W1Wjl7Fz0FhpbE=",
"owner": "folke",
"repo": "tokyonight.nvim",
"rev": "dce0ab49ae751f4f3617ab42d6f20c72369c7cb1",
"type": "github"
},
"original": {
"owner": "folke",
"repo": "tokyonight.nvim",
"type": "github"
}
},
"wlroots": { "wlroots": {
"flake": false, "flake": false,
"locked": { "locked": {

137
flake.nix
View file

@ -1,10 +1,18 @@
{ {
inputs = { inputs = {
# Flake inputs
## Nixpkgs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
## Flakes
berberman = { berberman = {
url = "github:berberman/flakes"; url = "github:berberman/flakes";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -17,6 +25,9 @@
url = "github:hyprwm/Hyprland"; url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs"; # MESA/OpenGL HW workaround inputs.nixpkgs.follows = "nixpkgs"; # MESA/OpenGL HW workaround
}; };
impermanence = {
url = "github:nix-community/impermanence";
};
lanzaboote = { lanzaboote = {
url = "github:nix-community/lanzaboote"; url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -25,6 +36,12 @@
url = "github:LnL7/nix-darwin"; url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# TODO: Unused
#nixos-hardware = { #nixos-hardware = {
# url = "github:NixOS/nixos-hardware/master"; # url = "github:NixOS/nixos-hardware/master";
# #inputs.nixpkgs.follows = "nixpkgs"; # #inputs.nixpkgs.follows = "nixpkgs";
@ -33,43 +50,79 @@
# url = "github:nixpak/nixpak"; # url = "github:nixpak/nixpak";
# inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
#}; #};
sops-nix = {
url = "github:Mic92/sops-nix"; ## Non-Flake
inputs.nixpkgs.follows = "nixpkgs"; ### Color scheme files
tokyonight = {
# TODO: base16.nix/Stylix when?
url = "github:folke/tokyonight.nvim";
flake = false;
}; };
disko = { ### Clash WebUI
url = "github:nix-community/disko"; metacubexd = {
inputs.nixpkgs.follows = "nixpkgs"; url = "github:MetaCubeX/metacubexd/gh-pages";
}; flake = false;
impermanence = {
url = "github:nix-community/impermanence";
}; };
}; };
outputs = { self, outputs = { self,
nixpkgs, nixpkgs,
berberman, berberman,
disko,
home-manager, home-manager,
hosts, hosts,
hyprland, hyprland,
lanzaboote, lanzaboote,
nix-darwin, nix-darwin,
sops-nix, sops-nix,
disko,
impermanence, impermanence,
tokyonight,
metacubexd,
... } @ inputs: { ... } @ inputs: {
# nix-darwin (macOS) ### NixOS
nixosConfigurations = {
"81FW-NixOS" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./nixos # Entrypoint
./machines/nixos/81fw-lenovo-legion-y7000 # Hardware-specific configurations
./machines/nixos/81fw-lenovo-legion-y7000/machine-1 # Machine-specific configurations
./users/guanranwang/nixos.nix # Home Manager entrypoint (user-specific)
{ networking.hostName = "81FW-NixOS"; } # Hostname
];
};
## Currently un-used.
"iMac-NixOS" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./nixos
./machines/nixos/imac-2017
./machines/nixos/imac-2017/machine-1
./users/guanranwang/nixos.nix
{ networking.hostName = "iMac-NixOS"; }
];
};
};
### nix-darwin (macOS)
darwinConfigurations = { darwinConfigurations = {
"iMac-macOS" = nix-darwin.lib.darwinSystem { "iMac-macOS" = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./darwin # Entrypoint ./darwin
./machines/darwin/imac-2017 # Hardware-specific configurations ./machines/darwin/imac-2017
# Machine-specific configurations (does such stuff even exist on nix-darwin)
./users/guanranwang/darwin.nix # User-specific configurations ./users/guanranwang/darwin.nix
./flakes/darwin/home-manager.nix # Flakes
{ networking.hostName = "iMac-macOS"; } { networking.hostName = "iMac-macOS"; }
]; ];
@ -77,61 +130,14 @@
}; };
# NixOS ### Home-Manager
nixosConfigurations = { # TODO: Actually figure out how this works
"81fw-nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./nixos # Entrypoint
./machines/nixos/81fw-lenovo-legion-y7000 # Hardware-specific configurations
#./machines/nixos/81fw-lenovo-legion-y7000/machine-1 # Machine-specific configurations
./users/guanranwang/nixos.nix # User-specific configurations
./flakes/nixos/berberman.nix # Flakes
./flakes/nixos/home-manager.nix
./flakes/nixos/hosts.nix
./flakes/nixos/lanzaboote.nix
./flakes/nixos/sops-nix.nix
./flakes/nixos/impermanence.nix
./flakes/nixos/disko.nix
{
_module.args.disks = [ "/dev/nvme0n1" ]; # Disko
boot.initrd.systemd.enable = true; # LUKS TPM unlocking
networking.hostName = "81fw-nixos";
}
];
};
## Currently un-used.
"imac-nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./nixos
./machines/nixos/imac-2017
./machines/nixos/imac-2017/machine-1
./users/guanranwang/nixos.nix
./flakes/nixos/berberman.nix
./flakes/nixos/home-manager.nix
./flakes/nixos/hosts.nix
./flakes/nixos/lanzaboote.nix
./flakes/nixos/sops-nix.nix
{ networking.hostName = "imac-nixos"; }
];
};
};
# Home-Manager
homeConfigurations = { homeConfigurations = {
"guanranwang@81fw-nixos" = home-manager.lib.homeManagerConfiguration { "guanranwang@81fw-nixos" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
modules = [ modules = [
sops-nix.homeManagerModules.sops sops-nix.homeManagerModules.sops
hyprland.homeManagerModules.default hyprland.homeManagerModules.default
{ {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
@ -150,7 +156,6 @@
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
modules = [ modules = [
sops-nix.homeManagerModules.sops sops-nix.homeManagerModules.sops
hyprland.homeManagerModules.default hyprland.homeManagerModules.default
{ {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {

View file

@ -1,4 +1,4 @@
{ disks ? [ "/dev/vdb" ], inputs, ... }: { inputs, disks ? [ "/dev/vdb" ], ... }:
{ {
imports = [ inputs.disko.nixosModules.disko ]; imports = [ inputs.disko.nixosModules.disko ];

View file

@ -1,10 +1,10 @@
{ pkgs, lib, inputs, ... }: { inputs, pkgs, ... }:
{ {
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ]; imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
environment.systemPackages = with pkgs; [ sbctl ]; environment.systemPackages = with pkgs; [ sbctl ];
boot.loader.systemd-boot.enable = lib.mkForce false; boot.loader.systemd-boot.enable = false;
boot.lanzaboote = { boot.lanzaboote = {
enable = true; enable = true;
pkiBundle = "/etc/secureboot"; pkiBundle = "/etc/secureboot";

View file

@ -3,5 +3,6 @@
{ {
imports = [ imports = [
./hardware.nix ./hardware.nix
../../../nixos/presets/desktop.nix
]; ];
} }

View file

@ -5,6 +5,7 @@
../hardware/misc/audio.nix ../hardware/misc/audio.nix
../hardware/misc/bluetooth.nix ../hardware/misc/bluetooth.nix
../hardware/misc/opengl.nix ../hardware/misc/opengl.nix
../hardware/misc/tpm.nix
../hardware/cpu/intel.nix ../hardware/cpu/intel.nix
../hardware/gpu/intel.nix ../hardware/gpu/intel.nix
../hardware/gpu/nvidia.nix ../hardware/gpu/nvidia.nix

View file

@ -2,6 +2,11 @@
{ {
imports = [ imports = [
./partition.nix ../../../../flakes/nixos/lanzaboote.nix
../../../../flakes/nixos/impermanence.nix
../../../../flakes/nixos/disko.nix
]; ];
_module.args.disks = [ "/dev/nvme0n1" ]; # Disko
boot.initrd.systemd.enable = true; # LUKS TPM unlocking
} }

View file

@ -1,41 +0,0 @@
{ ... }:
{
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/6288ce7a-a153-4302-a4de-5dc71f58da79";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@" ]; # nested subvol
};
#"/" = {
# device = "none";
# fsType = "tmpfs";
# options = [ "size=3G" "mode=755" ]; # mode=755 so only root can write to those files
#};
"/home" = {
device = "/dev/disk/by-uuid/6288ce7a-a153-4302-a4de-5dc71f58da79";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@home" ];
};
#"/var/lib/flatpak" = {
# device = "/dev/disk/by-uuid/6288ce7a-a153-4302-a4de-5dc71f58da79";
# fsType = "btrfs";
# options = [ "compress=zstd" "subvol=@flatpak" ];
#};
"/btrfs" = {
device = "/dev/disk/by-uuid/6288ce7a-a153-4302-a4de-5dc71f58da79";
fsType = "btrfs";
options = [ "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/C44A-313A";
fsType = "vfat";
};
};
swapDevices = [ { device = "/dev/disk/by-uuid/0ba792d3-571d-44bb-8696-82126611784d"; } ];
}

View file

@ -11,12 +11,12 @@
(modulesPath + "/installer/scan/not-detected.nix") # what is this (modulesPath + "/installer/scan/not-detected.nix") # what is this
]; ];
# from nixos-hardware
boot.kernelParams = [ "hid_apple.iso_layout=0" ];
hardware.facetimehd.enable = true; # cam already works before adding this, not sure what is the point
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
# Options from github:NixOS/nixos-hardware
boot.kernelParams = [ "hid_apple.iso_layout=0" ];
hardware.facetimehd.enable = true; # TODO: Camera already works before adding this, not sure what is the point...
# 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
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction

View file

@ -7,7 +7,9 @@
loader = { loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
systemd-boot = { systemd-boot = {
enable = lib.mkDefault true; # use lanzaboote instead for secureboot enable = lib.mkDefault true; # mkDefault for Lanzaboote
editor = false; # Disabled for security
### Utilities
#netbootxyz.enable = true; #netbootxyz.enable = true;
#memtest86.enable = true; #memtest86.enable = true;
}; };

View file

@ -4,5 +4,7 @@
imports = [ imports = [
./boot.nix ./boot.nix
./kernel.nix ./kernel.nix
./plymouth.nix
./sysctl.nix
]; ];
} }

View file

@ -1,10 +1,9 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
# NOTE: secureboot enabled in flake.nix
boot = { boot = {
#kernelPackages = pkgs.linuxPackages_latest; # latest kernel #kernelPackages = pkgs.linuxPackages_latest; # latest linux kernel
kernelPackages = pkgs.linuxPackages_zen; # zen kernel, often outdated kernelPackages = pkgs.linuxPackages_zen; # latest linux-zen kernel
#kernelPackages = pkgs.linuxKernel.Packages.linux_6_1; #kernelPackages = pkgs.linuxKernel.Packages.linux_6_1; # linux 6.1 LTS kernel
}; };
} }

5
nixos/boot/plymouth.nix Normal file
View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
boot.plymouth.enable = lib.mkDefault true; # mkDefault for headless devices, check out server.nix
}

View file

@ -8,7 +8,6 @@
./nix ./nix
./packages ./packages
./power-management ./power-management
./security
#./specialisation # dont actually use this #./specialisation # dont actually use this
./users ./users
]; ];

View file

@ -1,7 +1,7 @@
{ ... }: { ... }:
# Internationalisation settings # Internationalisation configurations
# IME settings are at /etc/nixos/modules/graphical/input.nix # Use Home Manager for IME configurations
{ {
i18n = { i18n = {
defaultLocale = "en_US.UTF-8"; defaultLocale = "en_US.UTF-8";
@ -27,4 +27,6 @@
# keyMap = "us"; # keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty. # useXkbConfig = true; # use xkbOptions in tty.
# }; # };
services.xserver.layout = "us"; # keymap in x11
} }

View file

@ -6,7 +6,6 @@
./network-manager ./network-manager
./dhcp.nix ./dhcp.nix
./dns
./firewall.nix ./firewall.nix
./proxy.nix ./proxy.nix
./timezone.nix ./timezone.nix

View file

@ -3,6 +3,6 @@
{ {
imports = [ imports = [
./dns.nix ./dns.nix
#./systemd-resolved.nix #./systemd-resolved.nix # Returns NXDOMAIN in China Mainland, will investegate...
]; ];
} }

View file

@ -7,6 +7,6 @@
dnssec = "true"; dnssec = "true";
domains = [ "~." ]; domains = [ "~." ];
fallbackDns = [ "8.8.8.8#dns.google" "8.8.4.4#dns.google" "2001:4860:4860::8888#dns.google" "2001:4860:4860::8844#dns.google" ]; fallbackDns = [ "8.8.8.8#dns.google" "8.8.4.4#dns.google" "2001:4860:4860::8888#dns.google" "2001:4860:4860::8844#dns.google" ];
#extraConfig = "DNSOverTLS=yes"; # broken as well extraConfig = "DNSOverTLS=yes";
}; };
} }

View file

@ -1,9 +1,17 @@
{ pkgs, config, ... }: { pkgs, config, inputs, ... }:
{ {
### System proxy settings
networking.proxy.default = "http://127.0.0.1:7890/"; networking.proxy.default = "http://127.0.0.1:7890/";
#environment.systemPackages = with pkgs; [ clash-meta ]; ### User running proxy service
users.groups."clash-meta" = {};
users.users."clash-meta" = {
isSystemUser = true;
group = config.users.groups."clash-meta".name;
};
### Proxy service
systemd.services."clash-meta" = { systemd.services."clash-meta" = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];
@ -27,5 +35,15 @@
}; };
}; };
environment.etc."clash-meta/metacubexd".source = ../../users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd; ### Local Clash WebUI
# You can also use the following website, just in case:
# - metacubexd:
# - GH Pages Custom Domain: http://d.metacubex.one
# - GH Pages: https://metacubex.github.io/metacubexd
# - Cloudflare Pages: https://metacubexd.pages.dev
# - yacd (Yet Another Clash Dashboard):
# - https://yacd.haishan.me
# - clash-dashboard (buggy):
# - https://clash.razord.top
environment.etc."clash-meta/metacubexd".source = inputs.metacubexd;
} }

View file

@ -1,6 +1,10 @@
{ ... }: { ... }:
{ {
nix.settings.experimental-features = [ "nix-command" "flakes" ]; # enable flakes # Enable Flakes
programs.command-not-found.enable = false; # Unavailable in Flakes build nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Does not work with Flake based configurations
system.copySystemConfiguration = false;
programs.command-not-found.enable = false;
} }

View file

@ -2,12 +2,10 @@
{ {
nix = { nix = {
### optimiser ### Auto hard linking
settings = { settings.auto-optimise-store = true;
auto-optimise-store = true;
};
### auto delete older NixOS builds ### Automatically delete older NixOS builds
gc = { gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";

View file

@ -1,4 +1,4 @@
{ ... }: { lib, ... }:
{ {
nix.settings = { nix.settings = {
@ -29,15 +29,13 @@
nixos.enable = false; nixos.enable = false;
}; };
#nix.useSandbox = false;
system = { system = {
# Copy the NixOS configuration file and link it from the resulting system # Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you # (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix. # accidentally delete configuration.nix.
# Does not work with flake based configurations # Does not work with flake based configurations
#copySystemConfiguration = true; copySystemConfiguration = lib.mkDefault true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default

View file

@ -2,9 +2,8 @@
{ {
imports = [ imports = [
./core.nix
./hardware.nix ./hardware.nix
./graphical
./overlays ./overlays
./unfree ./unfree
]; ];

View file

@ -6,7 +6,9 @@
#./flatpak.nix #./flatpak.nix
./fonts.nix ./fonts.nix
./gnome-keyring.nix
./graphical.nix ./graphical.nix
./polkit.nix
./xdg.nix ./xdg.nix
]; ];
} }

View file

@ -2,7 +2,6 @@
{ {
services.xserver = { services.xserver = {
layout = "us"; # keymap in x11
libinput = { libinput = {
enable = true; enable = true;
touchpad = { touchpad = {
@ -18,7 +17,7 @@
}; };
}; };
# Removes debounce time ### Removes debounce time
# https://www.reddit.com/r/linux_gaming/comments/ku6gth # https://www.reddit.com/r/linux_gaming/comments/ku6gth
environment.etc."libinput/local-overrides.quirks".text = '' environment.etc."libinput/local-overrides.quirks".text = ''
[Never Debounce] [Never Debounce]

View file

@ -1,8 +1,8 @@
{ ... }: { ... }:
{ {
programs.xwayland.enable = true; programs.xwayland.enable = true; # enable XWayland
hardware.nvidia.nvidiaSettings = false; # nvidia settings menu, wont do anything on wayland hardware.nvidia.nvidiaSettings = false; # NVIDIA settings menu, wont do anything on wayland
environment.sessionVariables = { environment.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # let electron applications use wayland "NIXOS_OZONE_WL" = "1"; # let electron applications use wayland
}; };

View file

@ -29,6 +29,6 @@
monospace = [ "JetBrainsMono Nerd Font" "JetBrains Mono" "FiraCode Nerd Font" "Fira Code" "Noto Sans Mono" ]; monospace = [ "JetBrainsMono Nerd Font" "JetBrains Mono" "FiraCode Nerd Font" "Fira Code" "Noto Sans Mono" ];
}; };
}; };
# fontconfig is too limited here, use `$HOME/.config/fontconfig/fonts.conf` instead # fontconfig is too limited here, and appling it globally is **bad**, use Home Manager instead
}; };
} }

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
# gnome keyring
services.gnome.gnome-keyring.enable = true;
programs.seahorse.enable = true;
security.pam.services."gnome-keyring".text = ''
auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start
password optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
'';
}

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
boot.plymouth.enable = true;
security.polkit.enable = true;
services = { services = {
# GNOME applications # GNOME applications
gvfs.enable = true; # nautilus gvfs.enable = true; # nautilus
@ -25,10 +23,5 @@
end = "${pkgs.libnotify}/bin/notify-send 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. '"; end = "${pkgs.libnotify}/bin/notify-send 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. '";
}; };
}; };
clash-verge = {
#enable = true;
autoStart = true; # not working at all, edit: works on gnome
tunMode = true;
};
}; };
} }

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
security.polkit.enable = true;
environment.systemPackages = with pkgs; [ polkit_gnome ]; environment.systemPackages = with pkgs; [ polkit_gnome ];
# polkit_gnome autostart for wms # polkit_gnome autostart for wms

View file

@ -2,10 +2,7 @@
{ {
hardware = { hardware = {
# Enable redistriutable firmware
enableRedistributableFirmware = true; enableRedistributableFirmware = true;
# Enable all firmware
#enableAllFirmware = true; #enableAllFirmware = true;
}; };

View file

@ -1 +0,0 @@
# no i dont actually own a server

View file

@ -10,15 +10,15 @@
"facetimehd-firmware" # ../hardware/hardwares/imac-2017.nix "facetimehd-firmware" # ../hardware/hardwares/imac-2017.nix
# flatpak-able # flatpak-able
"discord"
"google-chrome"
"lunar-client"
"osu-lazer-bin" "osu-lazer-bin"
"osu-lazer-bin-2023.1008.0" # what? "osu-lazer-bin-2023.1008.0" # what?
"spotify" "spotify"
"steam" "steam"
"steam-original" "steam-original"
"microsoft-edge-stable" #"discord"
"qq" #"google-chrome"
#"lunar-client"
#"microsoft-edge-stable"
#"qq"
]; ];
} }

View file

@ -4,7 +4,7 @@
imports = [ imports = [
./cpu-governor.nix ./cpu-governor.nix
./system76-scheduler.nix ./system76-scheduler.nix
#./tlp.nix # ] conflicts #./tlp.nix # ] Conflicts with each other, only choose one
./power-profiles-daemon.nix # ] ./power-profiles-daemon.nix # ]
]; ];
} }

View file

@ -1,9 +1,17 @@
{ config, ... }: { config, ... }:
# Imported by default, check out ./desktop.nix or ./server.nix
{ {
# Installed packages (System wide) # Installed packages (System wide)
environment = { environment = {
defaultPackages = []; #defaultPackages = [];
};
users.mutableUsers = false;
environment.etc.machine-id.text = "b08dfa6083e7567a1921a715000001fb"; # whonix id
security = {
apparmor.enable = true;
sudo.execWheelOnly = true;
}; };
# Programs # Programs
@ -25,9 +33,18 @@
NixOS ${config.system.nixos.label} ${config.system.nixos.codeName} (\m) - \l NixOS ${config.system.nixos.label} ${config.system.nixos.codeName} (\m) - \l
--my-next-gpu-wont-be-nvidia --my-next-gpu-wont-be-nvidia
''; '';
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
#cron.enable = true; #cron.enable = true;
#dbus.enable = true; #dbus.enable = true;
openssh.enable = true;
# BTRFS De-Dupe # BTRFS De-Dupe
# bruh how to make it not a background job # bruh how to make it not a background job
# i want to run it manually # i want to run it manually

View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./core.nix
../packages/graphical
];
}

9
nixos/presets/server.nix Executable file
View file

@ -0,0 +1,9 @@
{ ... }:
# no i dont actually own a server
{
imports = [
./core.nix
];
boot.plymouth.enable = false;
}

View file

@ -1,13 +0,0 @@
{ ... }:
{
imports = [
./security.nix
./gnome-keyring.nix
./machine-id.nix
./polkit.nix
./sysctl.nix
./tpm.nix
];
}

View file

@ -1,11 +0,0 @@
{ pkgs, ... }:
{
# gnome keyring
services.gnome.gnome-keyring.enable = true;
security.pam.services."gnome-keyring".text = ''
auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start
password optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
'';
}

View file

@ -1,6 +0,0 @@
{ ... }:
{
# whonix id
environment.etc.machine-id.text = "b08dfa6083e7567a1921a715000001fb";
}

View file

@ -1,15 +0,0 @@
{ ... }:
{
security = {
apparmor.enable = true;
sudo.execWheelOnly = true;
};
boot.loader.systemd-boot.editor = false;
services.openssh.settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
}

View file

@ -3,6 +3,5 @@
{ {
imports = [ imports = [
./users.nix ./users.nix
./system-users.nix
]; ];
} }

View file

@ -1,9 +0,0 @@
{ ... }:
{
users.users."clash-meta" = {
isSystemUser = true;
group = "clash-meta";
};
users.groups.clash-meta = {};
}

View file

@ -1,5 +1,5 @@
{ ... }: { ... }:
{ {
users.mutableUsers = false;
} }

View file

@ -12,6 +12,10 @@
}; };
}; };
# Flakes. # Flakes
imports = [
../../flakes/darwin/home-manager.nix
];
### home-manager
home-manager.users.guanranwang = import ./home-manager/darwin; # NOTE: using flakes home-manager.users.guanranwang = import ./home-manager/darwin; # NOTE: using flakes
} }

@ -1 +0,0 @@
Subproject commit aa608f17a525eccbf6f60ab29e46839b26c3eb0e

View file

@ -1,32 +0,0 @@
# TokyoNight Alacritty Colors
colors:
# Default colors
primary:
background: '0xe1e2e7'
foreground: '0x3760bf'
# Normal colors
normal:
black: '0xe9e9ed'
red: '0xf52a65'
green: '0x587539'
yellow: '0x8c6c3e'
blue: '0x2e7de9'
magenta: '0x9854f1'
cyan: '0x007197'
white: '0x6172b0'
# Bright colors
bright:
black: '0xa1a6c5'
red: '0xf52a65'
green: '0x587539'
yellow: '0x8c6c3e'
blue: '0x2e7de9'
magenta: '0x9854f1'
cyan: '0x007197'
white: '0x3760bf'
indexed_colors:
- { index: 16, color: '0xb15c00' }
- { index: 17, color: '0xc64343' }

View file

@ -1,32 +0,0 @@
# TokyoNight Alacritty Colors
colors:
# Default colors
primary:
background: '0x222436'
foreground: '0xc8d3f5'
# Normal colors
normal:
black: '0x1b1d2b'
red: '0xff757f'
green: '0xc3e88d'
yellow: '0xffc777'
blue: '0x82aaff'
magenta: '0xc099ff'
cyan: '0x86e1fc'
white: '0x828bb8'
# Bright colors
bright:
black: '0x444a73'
red: '0xff757f'
green: '0xc3e88d'
yellow: '0xffc777'
blue: '0x82aaff'
magenta: '0xc099ff'
cyan: '0x86e1fc'
white: '0xc8d3f5'
indexed_colors:
- { index: 16, color: '0xff966c' }
- { index: 17, color: '0xc53b53' }

View file

@ -1,32 +0,0 @@
# TokyoNight Alacritty Colors
colors:
# Default colors
primary:
background: '0x1a1b26'
foreground: '0xc0caf5'
# Normal colors
normal:
black: '0x15161e'
red: '0xf7768e'
green: '0x9ece6a'
yellow: '0xe0af68'
blue: '0x7aa2f7'
magenta: '0xbb9af7'
cyan: '0x7dcfff'
white: '0xa9b1d6'
# Bright colors
bright:
black: '0x414868'
red: '0xf7768e'
green: '0x9ece6a'
yellow: '0xe0af68'
blue: '0x7aa2f7'
magenta: '0xbb9af7'
cyan: '0x7dcfff'
white: '0xc0caf5'
indexed_colors:
- { index: 16, color: '0xff9e64' }
- { index: 17, color: '0xdb4b4b' }

View file

@ -1,32 +0,0 @@
# TokyoNight Alacritty Colors
colors:
# Default colors
primary:
background: '0x24283b'
foreground: '0xc0caf5'
# Normal colors
normal:
black: '0x1d202f'
red: '0xf7768e'
green: '0x9ece6a'
yellow: '0xe0af68'
blue: '0x7aa2f7'
magenta: '0xbb9af7'
cyan: '0x7dcfff'
white: '0xa9b1d6'
# Bright colors
bright:
black: '0x414868'
red: '0xf7768e'
green: '0x9ece6a'
yellow: '0xe0af68'
blue: '0x7aa2f7'
magenta: '0xbb9af7'
cyan: '0x7dcfff'
white: '0xc0caf5'
indexed_colors:
- { index: 16, color: '0xff9e64' }
- { index: 17, color: '0xdb4b4b' }

@ -1 +0,0 @@
Subproject commit d1b0fb780966303aa4c7867c3da830291c62d902

View file

@ -1,66 +0,0 @@
# https://draculatheme.com/kitty
#
# Installation instructions:
#
# cp dracula.conf ~/.config/kitty/
# echo "include dracula.conf" >> ~/.config/kitty/kitty.conf
#
# Then reload kitty for the config to take affect.
# Alternatively copy paste below directly into kitty.conf
foreground #f8f8f2
background #282a36
selection_foreground #ffffff
selection_background #44475a
url_color #8be9fd
# black
color0 #21222c
color8 #6272a4
# red
color1 #ff5555
color9 #ff6e6e
# green
color2 #50fa7b
color10 #69ff94
# yellow
color3 #f1fa8c
color11 #ffffa5
# blue
color4 #bd93f9
color12 #d6acff
# magenta
color5 #ff79c6
color13 #ff92df
# cyan
color6 #8be9fd
color14 #a4ffff
# white
color7 #f8f8f2
color15 #ffffff
# Cursor colors
cursor #f8f8f2
cursor_text_color background
# Tab bar colors
active_tab_foreground #282a36
active_tab_background #f8f8f2
inactive_tab_foreground #282a36
inactive_tab_background #6272a4
# Marks
mark1_foreground #282a36
mark1_background #ff5555
# Splits/Windows
active_border_color #f8f8f2
inactive_border_color #6272a4

View file

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Frappe
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/frappe.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #C6D0F5
background #303446
selection_foreground #303446
selection_background #F2D5CF
# Cursor colors
cursor #F2D5CF
cursor_text_color #303446
# URL underline color when hovering with mouse
url_color #F2D5CF
# Kitty window border colors
active_border_color #BABBF1
inactive_border_color #737994
bell_border_color #E5C890
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #232634
active_tab_background #CA9EE6
inactive_tab_foreground #C6D0F5
inactive_tab_background #292C3C
tab_bar_background #232634
# Colors for marks (marked text in the terminal)
mark1_foreground #303446
mark1_background #BABBF1
mark2_foreground #303446
mark2_background #CA9EE6
mark3_foreground #303446
mark3_background #85C1DC
# The 16 terminal colors
# black
color0 #51576D
color8 #626880
# red
color1 #E78284
color9 #E78284
# green
color2 #A6D189
color10 #A6D189
# yellow
color3 #E5C890
color11 #E5C890
# blue
color4 #8CAAEE
color12 #8CAAEE
# magenta
color5 #F4B8E4
color13 #F4B8E4
# cyan
color6 #81C8BE
color14 #81C8BE
# white
color7 #B5BFE2
color15 #A5ADCE

View file

@ -1,14 +0,0 @@
#
# Kitty config
# ~/.config/kitty/kitty.conf
#
include tokyonight_night.conf
#font_family JetBrainsMono Nerd Font
font_family monospace
font_size 12
confirm_os_window_close 0
window_padding_width 12
adjust_line_height 0
#background_opacity 0.9
#shell fish

View file

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Latte
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/latte.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #4C4F69
background #EFF1F5
selection_foreground #EFF1F5
selection_background #DC8A78
# Cursor colors
cursor #DC8A78
cursor_text_color #EFF1F5
# URL underline color when hovering with mouse
url_color #DC8A78
# Kitty window border colors
active_border_color #7287FD
inactive_border_color #9CA0B0
bell_border_color #DF8E1D
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #EFF1F5
active_tab_background #8839EF
inactive_tab_foreground #4C4F69
inactive_tab_background #9CA0B0
tab_bar_background #BCC0CC
# Colors for marks (marked text in the terminal)
mark1_foreground #EFF1F5
mark1_background #7287fD
mark2_foreground #EFF1F5
mark2_background #8839EF
mark3_foreground #EFF1F5
mark3_background #209FB5
# The 16 terminal colors
# black
color0 #5C5F77
color8 #6C6F85
# red
color1 #D20F39
color9 #D20F39
# green
color2 #40A02B
color10 #40A02B
# yellow
color3 #DF8E1D
color11 #DF8E1D
# blue
color4 #1E66F5
color12 #1E66F5
# magenta
color5 #EA76CB
color13 #EA76CB
# cyan
color6 #179299
color14 #179299
# white
color7 #ACB0BE
color15 #BCC0CC

View file

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Macchiato
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/macchiato.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #CAD3F5
background #24273A
selection_foreground #24273A
selection_background #F4DBD6
# Cursor colors
cursor #F4DBD6
cursor_text_color #24273A
# URL underline color when hovering with mouse
url_color #F4DBD6
# Kitty window border colors
active_border_color #B7BDF8
inactive_border_color #6E738D
bell_border_color #EED49F
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #181926
active_tab_background #C6A0F6
inactive_tab_foreground #CAD3F5
inactive_tab_background #1E2030
tab_bar_background #181926
# Colors for marks (marked text in the terminal)
mark1_foreground #24273A
mark1_background #B7BDF8
mark2_foreground #24273A
mark2_background #C6A0F6
mark3_foreground #24273A
mark3_background #7DC4E4
# The 16 terminal colors
# black
color0 #494D64
color8 #5B6078
# red
color1 #ED8796
color9 #ED8796
# green
color2 #A6DA95
color10 #A6DA95
# yellow
color3 #EED49F
color11 #EED49F
# blue
color4 #8AADF4
color12 #8AADF4
# magenta
color5 #F5BDE6
color13 #F5BDE6
# cyan
color6 #8BD5CA
color14 #8BD5CA
# white
color7 #B8C0E0
color15 #A5ADCB

View file

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Mocha
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #CDD6F4
background #1E1E2E
selection_foreground #1E1E2E
selection_background #F5E0DC
# Cursor colors
cursor #F5E0DC
cursor_text_color #1E1E2E
# URL underline color when hovering with mouse
url_color #F5E0DC
# Kitty window border colors
active_border_color #B4BEFE
inactive_border_color #6C7086
bell_border_color #F9E2AF
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111B
active_tab_background #CBA6F7
inactive_tab_foreground #CDD6F4
inactive_tab_background #181825
tab_bar_background #11111B
# Colors for marks (marked text in the terminal)
mark1_foreground #1E1E2E
mark1_background #B4BEFE
mark2_foreground #1E1E2E
mark2_background #CBA6F7
mark3_foreground #1E1E2E
mark3_background #74C7EC
# The 16 terminal colors
# black
color0 #45475A
color8 #585B70
# red
color1 #F38BA8
color9 #F38BA8
# green
color2 #A6E3A1
color10 #A6E3A1
# yellow
color3 #F9E2AF
color11 #F9E2AF
# blue
color4 #89B4FA
color12 #89B4FA
# magenta
color5 #F5C2E7
color13 #F5C2E7
# cyan
color6 #94E2D5
color14 #94E2D5
# white
color7 #BAC2DE
color15 #A6ADC8

View file

@ -1,50 +0,0 @@
# vim:ft=kitty
## name: Tokyo Night Day
## license: MIT
## author: Folke Lemaitre
## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty/tokyonight_day.conf
background #e1e2e7
foreground #3760bf
selection_background #b6bfe2
selection_foreground #3760bf
url_color #387068
cursor #3760bf
cursor_text_color #e1e2e7
# Tabs
active_tab_background #2e7de9
active_tab_foreground #e9e9ec
inactive_tab_background #c4c8da
inactive_tab_foreground #8990b3
#tab_bar_background #e9e9ed
# Windows
active_border_color #2e7de9
inactive_border_color #c4c8da
# normal
color0 #e9e9ed
color1 #f52a65
color2 #587539
color3 #8c6c3e
color4 #2e7de9
color5 #9854f1
color6 #007197
color7 #6172b0
# bright
color8 #a1a6c5
color9 #f52a65
color10 #587539
color11 #8c6c3e
color12 #2e7de9
color13 #9854f1
color14 #007197
color15 #3760bf
# extended colors
color16 #b15c00
color17 #c64343

View file

@ -1,50 +0,0 @@
# vim:ft=kitty
## name: Tokyo Night Moon
## license: MIT
## author: Folke Lemaitre
## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty/tokyonight_moon.conf
background #222436
foreground #c8d3f5
selection_background #2d3f76
selection_foreground #c8d3f5
url_color #4fd6be
cursor #c8d3f5
cursor_text_color #222436
# Tabs
active_tab_background #82aaff
active_tab_foreground #1e2030
inactive_tab_background #2f334d
inactive_tab_foreground #545c7e
#tab_bar_background #1b1d2b
# Windows
active_border_color #82aaff
inactive_border_color #2f334d
# normal
color0 #1b1d2b
color1 #ff757f
color2 #c3e88d
color3 #ffc777
color4 #82aaff
color5 #c099ff
color6 #86e1fc
color7 #828bb8
# bright
color8 #444a73
color9 #ff757f
color10 #c3e88d
color11 #ffc777
color12 #82aaff
color13 #c099ff
color14 #86e1fc
color15 #c8d3f5
# extended colors
color16 #ff966c
color17 #c53b53

View file

@ -1,50 +0,0 @@
# vim:ft=kitty
## name: Tokyo Night
## license: MIT
## author: Folke Lemaitre
## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty/tokyonight_night.conf
background #1a1b26
foreground #c0caf5
selection_background #283457
selection_foreground #c0caf5
url_color #73daca
cursor #c0caf5
cursor_text_color #1a1b26
# Tabs
active_tab_background #7aa2f7
active_tab_foreground #16161e
inactive_tab_background #292e42
inactive_tab_foreground #545c7e
#tab_bar_background #15161e
# Windows
active_border_color #7aa2f7
inactive_border_color #292e42
# normal
color0 #15161e
color1 #f7768e
color2 #9ece6a
color3 #e0af68
color4 #7aa2f7
color5 #bb9af7
color6 #7dcfff
color7 #a9b1d6
# bright
color8 #414868
color9 #f7768e
color10 #9ece6a
color11 #e0af68
color12 #7aa2f7
color13 #bb9af7
color14 #7dcfff
color15 #c0caf5
# extended colors
color16 #ff9e64
color17 #db4b4b

View file

@ -1,50 +0,0 @@
# vim:ft=kitty
## name: Tokyo Night Storm
## license: MIT
## author: Folke Lemaitre
## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty/tokyonight_storm.conf
background #24283b
foreground #c0caf5
selection_background #2e3c64
selection_foreground #c0caf5
url_color #73daca
cursor #c0caf5
cursor_text_color #24283b
# Tabs
active_tab_background #7aa2f7
active_tab_foreground #1f2335
inactive_tab_background #292e42
inactive_tab_foreground #545c7e
#tab_bar_background #1d202f
# Windows
active_border_color #7aa2f7
inactive_border_color #292e42
# normal
color0 #1d202f
color1 #f7768e
color2 #9ece6a
color3 #e0af68
color4 #7aa2f7
color5 #bb9af7
color6 #7dcfff
color7 #a9b1d6
# bright
color8 #414868
color9 #f7768e
color10 #9ece6a
color11 #e0af68
color12 #7aa2f7
color13 #bb9af7
color14 #7dcfff
color15 #c0caf5
# extended colors
color16 #ff9e64
color17 #db4b4b

@ -1 +0,0 @@
Subproject commit cf318e06a9b7c9f2219d78f41b46fa6e06011fd9

@ -1 +0,0 @@
Subproject commit c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9

@ -1 +0,0 @@
Subproject commit 873c4ff09c559a507d33e528df7e27a8a48705d7

View file

@ -1,109 +0,0 @@
# ------------------------------------------------------------------------------
# Description
# -----------
#
# sudo or sudo -e (replacement for sudoedit) will be inserted before the command
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Dongweiming <ciici123@gmail.com>
# * Subhaditya Nath <github.com/subnut>
# * Marc Cornellà <github.com/mcornella>
# * Carlo Sala <carlosalag@protonmail.com>
#
# ------------------------------------------------------------------------------
__sudo-replace-buffer() {
local old=$1 new=$2 space=${2:+ }
# if the cursor is positioned in the $old part of the text, make
# the substitution and leave the cursor after the $new text
if [[ $CURSOR -le ${#old} ]]; then
BUFFER="${new}${space}${BUFFER#$old }"
CURSOR=${#new}
# otherwise just replace $old with $new in the text before the cursor
else
LBUFFER="${new}${space}${LBUFFER#$old }"
fi
}
sudo-command-line() {
# If line is empty, get the last run command from history
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
# Save beginning space
local WHITESPACE=""
if [[ ${LBUFFER:0:1} = " " ]]; then
WHITESPACE=" "
LBUFFER="${LBUFFER:1}"
fi
{
# If $SUDO_EDITOR or $VISUAL are defined, then use that as $EDITOR
# Else use the default $EDITOR
local EDITOR=${SUDO_EDITOR:-${VISUAL:-$EDITOR}}
# If $EDITOR is not set, just toggle the sudo prefix on and off
if [[ -z "$EDITOR" ]]; then
case "$BUFFER" in
sudo\ -e\ *) __sudo-replace-buffer "sudo -e" "" ;;
sudo\ *) __sudo-replace-buffer "sudo" "" ;;
*) LBUFFER="sudo $LBUFFER" ;;
esac
return
fi
# Check if the typed command is really an alias to $EDITOR
# Get the first part of the typed command
local cmd="${${(Az)BUFFER}[1]}"
# Get the first part of the alias of the same name as $cmd, or $cmd if no alias matches
local realcmd="${${(Az)aliases[$cmd]}[1]:-$cmd}"
# Get the first part of the $EDITOR command ($EDITOR may have arguments after it)
local editorcmd="${${(Az)EDITOR}[1]}"
# Note: ${var:c} makes a $PATH search and expands $var to the full path
# The if condition is met when:
# - $realcmd is '$EDITOR'
# - $realcmd is "cmd" and $EDITOR is "cmd"
# - $realcmd is "cmd" and $EDITOR is "cmd --with --arguments"
# - $realcmd is "/path/to/cmd" and $EDITOR is "cmd"
# - $realcmd is "/path/to/cmd" and $EDITOR is "/path/to/cmd"
# or
# - $realcmd is "cmd" and $EDITOR is "cmd"
# - $realcmd is "cmd" and $EDITOR is "/path/to/cmd"
# or
# - $realcmd is "cmd" and $EDITOR is /alternative/path/to/cmd that appears in $PATH
if [[ "$realcmd" = (\$EDITOR|$editorcmd|${editorcmd:c}) \
|| "${realcmd:c}" = ($editorcmd|${editorcmd:c}) ]] \
|| builtin which -a "$realcmd" | command grep -Fx -q "$editorcmd"; then
__sudo-replace-buffer "$cmd" "sudo -e"
return
fi
# Check for editor commands in the typed command and replace accordingly
case "$BUFFER" in
$editorcmd\ *) __sudo-replace-buffer "$editorcmd" "sudo -e" ;;
\$EDITOR\ *) __sudo-replace-buffer '$EDITOR' "sudo -e" ;;
sudo\ -e\ *) __sudo-replace-buffer "sudo -e" "$EDITOR" ;;
sudo\ *) __sudo-replace-buffer "sudo" "" ;;
*) LBUFFER="sudo $LBUFFER" ;;
esac
} always {
# Preserve beginning space
LBUFFER="${WHITESPACE}${LBUFFER}"
# Redisplay edit buffer (compatibility with zsh-syntax-highlighting)
zle && zle redisplay # only run redisplay if zle is enabled
}
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
bindkey -M emacs '\e\e' sudo-command-line
bindkey -M vicmd '\e\e' sudo-command-line
bindkey -M viins '\e\e' sudo-command-line

@ -1 +0,0 @@
Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5

@ -1 +0,0 @@
Subproject commit 400e58a87f72ecec14f783fbd29bc6be4ff1641c

@ -1 +0,0 @@
Subproject commit 143b25eb98aa3227af63bd7f04413e1b3e7888ec

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, inputs, ... }:
{ {
home = { home = {
@ -55,15 +55,33 @@
}; };
zsh = { zsh = {
enable = true; enable = true;
### XDG
dotDir = ".config/zsh";
### Plugins
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
enableAutosuggestions = true; enableAutosuggestions = true;
dotDir = ".config/zsh"; plugins = [
initExtra = '' {
source ${config.xdg.configHome}/zsh/plugins/sudo/sudo.plugin.zsh name = "fzf-tab";
source ${config.xdg.configHome}/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
zstyle ':fzf-tab:*' fzf-command sk }
''; {
# should I use flake inputs / fetchurl?
name = "sudo";
src = (pkgs.fetchFromGitHub {
owner = "ohmyzsh";
repo = "ohmyzsh";
rev = "f8bf8f0029a475831ebfba0799975ede20e08742";
hash = "sha256-9cJQQycahO+vo/YcAHjF+PVhsWxu7pa4MsK8Dgr69k0=";
sparseCheckout = [
"plugins/sudo"
];
} + "/plugins/sudo");
}
];
initExtra = "zstyle ':fzf-tab:*' fzf-command sk";
### History
history = { history = {
path = "${config.xdg.configHome}/zsh/.zsh_history"; path = "${config.xdg.configHome}/zsh/.zsh_history";
save = 1000000; save = 1000000;
@ -106,7 +124,7 @@
alacritty = { alacritty = {
enable = true; enable = true;
settings = { settings = {
import = [ "${config.xdg.configHome}/alacritty/tokyonight/tokyonight_night.yml" ]; import = [ "${inputs.tokyonight}/extras/alacritty/tokyonight_night.yml" ];
cursor.style = "beam"; cursor.style = "beam";
env.WINIT_X11_SCALE_FACTOR = "1"; env.WINIT_X11_SCALE_FACTOR = "1";
window = { window = {
@ -138,6 +156,17 @@
}; };
}; };
kitty = {
enable = true;
settings = {
include = "${inputs.tokyonight}/extras/kitty/tokyonight_night.conf";
font_size = 12;
confirm_os_window_close = 0;
window_padding_width = 6;
adjust_line_height = 0;
};
};
# Editors # Editors
### VSCode ### VSCode
vscode = { vscode = {

View file

@ -7,21 +7,9 @@ let
in in
{ {
xdg.configFile = { xdg.configFile = {
"clash-meta" = {
source = "${configPath}/clash";
recursive = true;
};
"alacritty" = {
source = "${configPath}/alacritty";
recursive = true;
};
"fish" = { "fish" = {
source = "${configPath}/fish"; source = "${configPath}/fish";
recursive = true; recursive = true;
}; };
"zsh/plugins" = {
source = "${configPath}/zsh";
recursive = true;
};
}; };
} }

View file

@ -36,13 +36,14 @@
}; };
packages = with pkgs; [ packages = with pkgs; [
#fastfetch ## CLI
### outdated macOS components
prismlauncher coreutils
keka # un-archive-r vim
iterm2 gnugrep
element-desktop openssh
screen
### Misc
eza eza
bottom bottom
bat bat
@ -54,19 +55,23 @@
android-tools android-tools
skim skim
## GUI
### Music
spotify spotify
spicetify-cli spicetify-cli
yesplaymusic yesplaymusic
mpv mpv
### Tools
keka # un-archive-r
iterm2
### Misc
prismlauncher
element-desktop
# replace outdated macOS components
coreutils
vim
gnugrep
openssh
screen
# LSP ## Misc
### LSP
nixd nixd
nil nil
]; ];

View file

@ -8,18 +8,10 @@ let
in in
{ {
xdg.configFile = { xdg.configFile = {
"alacritty" = {
source = "${configPath}/alacritty";
recursive = true;
};
"foot" = { "foot" = {
source = "${configPath}/foot"; source = "${configPath}/foot";
recursive = true; recursive = true;
}; };
"kitty" = {
source = "${configPath}/kitty";
recursive = true;
};
"fish" = { "fish" = {
source = "${configPath}/fish"; source = "${configPath}/fish";
recursive = true; recursive = true;
@ -40,10 +32,6 @@ in
source = "${configPath}/rofi"; source = "${configPath}/rofi";
recursive = true; recursive = true;
}; };
"zsh/plugins" = {
source = "${configPath}/zsh";
recursive = true;
};
"mpv" = { "mpv" = {
source = "${configPath}/mpv"; source = "${configPath}/mpv";
recursive = true; recursive = true;

View file

@ -5,9 +5,11 @@
i18n.inputMethod = { i18n.inputMethod = {
enabled = "fcitx5"; enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5.addons = with pkgs; [
fcitx5-chinese-addons #fcitx5-chinese-addons
fcitx5-pinyin-moegirl # flakes #fcitx5-pinyin-moegirl # Using Berberman's FLake overlay
fcitx5-pinyin-zhwiki #fcitx5-pinyin-zhwiki
fcitx5-rime
]; ];
}; };
@ -18,4 +20,11 @@
#QT_IM_MODULE = "fcitx"; #QT_IM_MODULE = "fcitx";
#XMODIFIERS = "@im=fcitx"; #XMODIFIERS = "@im=fcitx";
}; };
xdg.dataFile."fcitx5/rime/terra_pinyin.custom.yaml".text = ''
patch:
switches:
- name: simplification
reset: 1
'';
} }

View file

@ -12,27 +12,30 @@
# Flakes. # Flakes
imports = [
../../flakes/nixos/home-manager.nix
../../flakes/nixos/sops-nix.nix
../../flakes/nixos/hosts.nix
../../flakes/nixos/berberman.nix
];
### home-manager
home-manager.users.guanranwang = import ./home-manager/nixos; home-manager.users.guanranwang = import ./home-manager/nixos;
### sops-nix
sops = { sops = {
defaultSopsFile = ./secrets/secrets.yaml; defaultSopsFile = ./secrets/secrets.yaml;
age.sshKeyPaths = [ "/nix/persist/system/etc/ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = [ "/nix/persist/system/etc/ssh/ssh_host_ed25519_key" ];
gnupg.sshKeyPaths = []; gnupg.sshKeyPaths = [];
secrets = { secrets = {
"clash-config" = { "hashed-passwd".neededForUsers = true; # Hashed user password
"wireless/home".path = "/var/lib/iwd/wangxiaobo.psk"; # Home wifi password
"clash-config" = { # Clash.Meta configuration
#mode = "0444"; # readable #mode = "0444"; # readable
owner = config.users.users."clash-meta".name; owner = config.users.users."clash-meta".name;
group = config.users.users."clash-meta".group; group = config.users.users."clash-meta".group;
restartUnits = [ "clash-meta.service" ]; restartUnits = [ "clash-meta.service" ];
path = "/etc/clash-meta/config.yaml"; path = "/etc/clash-meta/config.yaml";
}; };
"hashed-passwd".neededForUsers = true;
"wireless/home" = {};
}; };
}; };
systemd.tmpfiles.rules = [
"C /var/lib/iwd/wangxiaobo.psk - - - - ${config.sops.secrets."wireless/home".path}"
];
} }