Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Jan 26, 2024
1 parent 6caf7cc commit 4328323
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 195 deletions.
126 changes: 59 additions & 67 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,75 +1,16 @@
{
description = "Daily configuration based on Nix and Flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";

darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";

haumea.url = "github:nix-community/haumea";
haumea.inputs.nixpkgs.follows = "nixpkgs";

fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";

hyprland.url = "github:hyprwm/Hyprland";
hyprland.inputs.nixpkgs.follows = "nixpkgs";

nvfetcher.url = "github:berberman/nvfetcher";
nvfetcher.inputs.nixpkgs.follows = "nixpkgs";

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";

neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";

fh.url = "github:DeterminateSystems/fh";
fh.inputs.nixpkgs.follows = "nixpkgs";
fh.inputs.fenix.follows = "fenix";

nix-ld.url = "github:Mic92/nix-ld";
nix-ld.inputs.nixpkgs.follows = "nixpkgs";

nixos-vscode-server.url = "github:nix-community/nixos-vscode-server";
nixos-vscode-server.inputs.nixpkgs.follows = "nixpkgs";

agenix.url = "github:ryantm/agenix";
agenix.inputs.darwin.follows = "darwin";
agenix.inputs.home-manager.follows = "home-manager";
agenix.inputs.nixpkgs.follows = "nixpkgs";

arion.url = "github:hercules-ci/arion";
arion.inputs.nixpkgs.follows = "nixpkgs";

default-systems.url = "github:nix-systems/default";

flake-root.url = "github:srid/flake-root";

flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs = {self, ...} @ inputs: let
globals = {
root = ./.;
nixpkgs = {
config = {
allowUnfree = true;
};
overlays = [
inputs.agenix.overlays.default
inputs.arion.overlays.default
inputs.fenix.overlays.default
inputs.fh.overlays.default
inputs.neovim-nightly-overlay.overlay
];
nixpkgs.overlays = [
inputs.agenix.overlays.default
inputs.arion.overlays.default
inputs.fenix.overlays.default
];
nixpkgs.config = {
allowUnfree = true;
};
inherit self inputs;
inherit (self) outputs;
Expand All @@ -94,7 +35,8 @@
}: rec {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
inherit (globals.nixpkgs) config overlays;
inherit (globals.nixpkgs) config;
inherit (globals.nixpkgs) overlays;
};

treefmt.config = {
Expand Down Expand Up @@ -137,10 +79,60 @@
};
};

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";

darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";

haumea.url = "github:nix-community/haumea";
haumea.inputs.nixpkgs.follows = "nixpkgs";

fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";

hyprland.url = "github:hyprwm/Hyprland";
hyprland.inputs.nixpkgs.follows = "nixpkgs";

nvfetcher.url = "github:berberman/nvfetcher";
nvfetcher.inputs.nixpkgs.follows = "nixpkgs";

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";

nix-ld.url = "github:Mic92/nix-ld";
nix-ld.inputs.nixpkgs.follows = "nixpkgs";

nixos-vscode-server.url = "github:nix-community/nixos-vscode-server";
nixos-vscode-server.inputs.nixpkgs.follows = "nixpkgs";

agenix.url = "github:ryantm/agenix";
agenix.inputs.darwin.follows = "darwin";
agenix.inputs.home-manager.follows = "home-manager";
agenix.inputs.nixpkgs.follows = "nixpkgs";

arion.url = "github:hercules-ci/arion";
arion.inputs.nixpkgs.follows = "nixpkgs";

default-systems.url = "github:nix-systems/default";

flake-root.url = "github:srid/flake-root";

flake-parts.url = "github:hercules-ci/flake-parts";
};

nixConfig = {
extra-trusted-substituters = [
"https://cache.garnix.io"
"https://hyprland.cachix.org"
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
"https://mirrors.ustc.edu.cn/nix-channels/store"
"https://nichijou.cachix.org"
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
Expand Down
2 changes: 2 additions & 0 deletions src/commonProfiles/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ with builtins // lib; {
trusted-substituters = [
"https://cache.garnix.io"
"https://hyprland.cachix.org"
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
"https://mirrors.ustc.edu.cn/nix-channels/store"
"https://nichijou.cachix.org"
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
Expand Down
31 changes: 13 additions & 18 deletions src/commonProfiles/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@
...
}:
with builtins // lib; {
environment.systemPackages =
(with pkgs; [
cachix
clash-meta
curl
duf
eza
gh
git
helix
nettools
tmux
vim
wget
])
++ (optionals pkgs.stdenv.isLinux (with pkgs; [
cloudflare-warp
]));
environment.systemPackages = with pkgs; [
curl
duf
eza
gh
git
helix
tmux
vim
wget
];

programs.fish.enable = true;
programs.zsh.enable = true;

}
5 changes: 4 additions & 1 deletion src/nixosConfigurations/hakase/_configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# Enable the Desktop Environments.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.desktopManager.xfce.enable = true;

# Enable xwayland.
programs.xwayland.enable = true;
Expand All @@ -29,4 +28,8 @@

# Disable automatic suspend.
services.autosuspend.enable = false;

# Configure network proxy.
networking.proxy.default = "http://satoshi.mck.cn.yousiki.top:7890";
networking.proxy.noProxy = "127.0.0.1,localhost,yousiki.top,ybh1998.space,pku.edu.cn";
}
28 changes: 8 additions & 20 deletions src/nixosConfigurations/hakase/_hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,16 @@
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];

fileSystems."/" = {
device = "/dev/disk/by-uuid/f4dd6d7c-e625-4a74-9325-85691ff9c351";
fsType = "btrfs";
options = ["subvol=@" "compress=zstd"];
};

fileSystems."/boot" = {
device = "/dev/disk/by-uuid/4ABE-0CAF";
fsType = "vfat";
};

fileSystems."/mnt/ssd" = {
device = "/dev/disk/by-uuid/11db0944-b7ae-4e84-8dbd-13de8537efd1";
fsType = "btrfs";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/facf9680-93f9-4799-9277-54aee06a418b";
fsType = "btrfs";
options = ["compress=zstd"];
};
};

fileSystems."/mnt/hdd" = {
device = "/dev/disk/by-uuid/0c2264ed-46f9-4868-bab0-2efa61c7bb1f";
fsType = "btrfs";
options = ["compress=zstd"];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/899E-B417";
fsType = "vfat";
};

swapDevices = [
{
Expand Down
16 changes: 0 additions & 16 deletions src/nixosConfigurations/hakase/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
globals.outputs.commonProfiles.nix
globals.outputs.commonProfiles.packages
globals.outputs.nixosProfiles.base
globals.outputs.nixosProfiles.desktop.fonts
globals.outputs.nixosProfiles.desktop.hyprland
globals.outputs.nixosProfiles.nvidia-gpu
globals.outputs.nixosProfiles.secrets
globals.outputs.nixosProfiles.virtualisation.adrive-webdav
globals.outputs.nixosProfiles.virtualisation.base
globals.outputs.nixosProfiles.virtualisation.traefik
globals.outputs.nixosProfiles.vscode-server
globals.inputs.home-manager.nixosModules.home-manager
{
Expand All @@ -22,17 +16,7 @@
users.yousiki = {
imports = [
globals.outputs.homeProfiles.base
globals.outputs.homeProfiles.desktop.applications
globals.outputs.homeProfiles.desktop.fcitx5
globals.outputs.homeProfiles.desktop.hyprland
globals.outputs.homeProfiles.desktop.kitty
globals.outputs.homeProfiles.lang.c
globals.outputs.homeProfiles.lang.latex
globals.outputs.homeProfiles.lang.nix
globals.outputs.homeProfiles.lang.python
globals.outputs.homeProfiles.lang.rust
globals.outputs.homeProfiles.secrets
globals.outputs.homeProfiles.shell.combined
];
};
};
Expand Down
48 changes: 12 additions & 36 deletions src/nixosProfiles/base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,31 @@
lib,
pkgs,
...
}: {
}: with builtins // lib; {
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.yousiki = {
isNormalUser = true;
extraGroups = ["wheel" "sudo" "docker" "podman" "lxd"];
shell = pkgs.zsh;
};

# Enable ssh.
services.openssh.enable = true;
services.openssh.openFirewall = true;
# Make sure zsh is enabled.
programs.zsh.enable = true;

# Enable mosh.
programs.mosh.enable = true;
# Enable ssh.
services.openssh.enable = mkDefault true;
services.openssh.openFirewall = mkDefault true;

# networking.wireless.enable = true;
networking.networkmanager.enable = true;

networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [22];
networking.firewall.allowedUDPPortRanges = [
# Mosh uses UDP ports in range [60000, 61000]
{
from = 60000;
to = 61000;
}
];

time.timeZone = "Asia/Shanghai";

# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
i18n.supportedLocales = ["all"];
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty.
# };

services.xserver = {
layout = "cn";
Expand All @@ -63,17 +39,17 @@
sound.enable = true;
hardware.pulseaudio.enable = true;
security.rtkit.enable = true;

hardware.bluetooth.enable = true;

hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true;

programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};

hardware.bluetooth.enable = true;

hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true;

system.stateVersion = "23.05";
system.stateVersion = "23.11";
}
1 change: 1 addition & 0 deletions src/nixosProfiles/desktop/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ in {
xwayland.enable = true;
package = hyprlandPkgs.hyprland;
portalPackage = hyprlandPkgs.xdg-desktop-portal-hyprland;
enableNvidiaPatches = nixpkgs.config.cudaSupport;
};
}
1 change: 0 additions & 1 deletion src/nixosProfiles/nvidia-gpu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ with builtins // lib; {
nvtop
python311Packages.gpustat
];
programs.hyprland.enableNvidiaPatches = mkForce true;
}
Loading

0 comments on commit 4328323

Please sign in to comment.