treewide: sorting

This commit is contained in:
Guanran Wang 2023-11-17 13:38:25 +08:00
parent 3c2192c0f7
commit f98ee5581a
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
103 changed files with 202 additions and 219 deletions

View file

@ -6,7 +6,7 @@ It just works™
- Flakes: Yes
- Home Manager: Yes
### Machine-specific (81fw-nixos)
### Machine-specific (Aristotle)
- File system: Btrfs
- System encryption: Yes (LUKS)
@ -18,34 +18,21 @@ It just works™
## Structure
```
 .
├──  darwin # System configuration
│ ### System configuration
├──  darwin
├──  nixos
│ ├──  flake-modules
│ ├──  hardware
│ ├──  modules
│ └──  profiles
├──  flakes # Import-able Flakes
│ ├──  darwin
│ └──  nixos
├──  machines # Hardware configuration
│ ├──  darwin
│ └──  nixos
│ ├──  81fw-lenovo-legion-y7000 ### Model
│ │ ├──  hardware.nix #### Model-specific hardware configuration
│ │ └──  machine-1 #### Machine-specific hardware configuration
│ │
│ └───  hardware ### Reusable hardware configuration
│ ├──  cpu
│ ├──  gpu
│ └──  ...
│ ### User configuration
│ # Adds user account, home-manager stuff, etc.
│ # Do whatever you want here.
├──  users
│ └──  guanranwang ## Your user
│ │
│ ├──  darwin ### (User-specific) System configuration
│ ├──  nixos
│ │
│ ├──  home-manager ### (User-specific) Home Manager configuration
│ │
│ └──  secrets ### User's secrets managed through sops-nix
│ ├──  guanranwang
│ ├──  foo
│ └──  bar
├──  flake.nix
├──  flake.lock
@ -61,7 +48,7 @@ It just works™
`$ git clone https://github.com/Guanran928/flake.git`
2.
Add your device's hardware configuration in `./machines` and `./flake.nix`
Add your device's hardware configuration in `./ (nixos/darwin) /hardware` and `./flake.nix`
3.
Install NixOS

View file

@ -0,0 +1,5 @@
{...}: {
imports = [
./networking
];
}

View file

@ -0,0 +1,29 @@
{
lib,
config,
...
}: {
options.myFlake.darwin.networking.dns = lib.mkOption {
type = lib.types.enum ["google" "alidns"];
default = "google";
example = "alidns";
description = "Select your DNS provider";
};
config.networking.dns = lib.mkMerge [
(lib.mkIf (config.myFlake.darwin.networking.dns == "google") [
### Google DNS
"8.8.8.8"
"8.8.4.4"
"2001:4860:4860::8888"
"2001:4860:4860::8844"
])
(lib.mkIf (config.myFlake.darwin.networking.dns == "alidns") [
### AliDNS
"223.5.5.5"
"223.6.6.6"
"2400:3200::1"
"2400:3200:baba::1"
])
];
}

View file

@ -1,17 +0,0 @@
{...}: {
# please configure `networking.knownNetworkServices` in ../hosts/your-machine.nix
networking.dns = [
"223.5.5.5"
"223.6.6.6"
"2400:3200::1"
"2400:3200:baba::1"
#"223.5.5.5#dns.alidns.com"
#"223.6.6.6#dns.alidns.com"
#"2400:3200::1#dns.alidns.com"
#"2400:3200:baba::1#dns.alidns.com"
#"8.8.8.8"
#"8.8.4.4"
#"2001:4860:4860::8888"
#"2001:4860:4860::8844"
];
}

View file

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

View file

@ -0,0 +1,9 @@
{...}: {
imports = [
../../modules
./nix
./packages
./system
];
}

View file

@ -188,64 +188,43 @@
specialArgs = {inherit inputs;};
modules = [
# OS
./nixos/presets/desktop.nix
./nixos/presets/core/zram-generator.nix
./nixos/presets/desktop/gaming.nix
./nixos/presets/desktop/virtualbox.nix
./nixos/presets/desktop/wayland.nix
./nixos/presets/desktop/virt-manager.nix
./nixos/profiles/desktop
./nixos/profiles/core/addtional/zram-generator.nix
./nixos/profiles/desktop/addtional/gaming.nix
./nixos/profiles/desktop/addtional/virtualbox.nix
./nixos/profiles/desktop/addtional/wayland.nix
./nixos/profiles/desktop/addtional/virt-manager.nix
# User
./users/guanranwang/nixos/presets/desktop.nix
./users/guanranwang/nixos/presets/core/clash-meta-client.nix
./users/guanranwang/nixos/presets/desktop/gaming.nix
./users/guanranwang/nixos/presets/desktop/torrenting.nix
./users/guanranwang/nixos/profiles/desktop
./users/guanranwang/nixos/profiles/core/addtional/clash-meta-client.nix
./users/guanranwang/nixos/profiles/desktop/addtional/gaming.nix
./users/guanranwang/nixos/profiles/desktop/addtional/torrenting.nix
# Hardware
./machines/nixos/81fw-lenovo-legion-y7000
./machines/nixos/81fw-lenovo-legion-y7000/Aristotle
./nixos/hardware/81fw-lenovo-legion-y7000/Aristotle
{
networking.hostName = "Aristotle"; # Hostname
time.timeZone = "Asia/Shanghai"; # Timezone
### Options
myFlake.nixos.boot.noLoaderMenu = true;
myFlake.nixos.networking.dns = "alidns";
}
{networking.hostName = "Aristotle";}
];
};
};
### nix-darwin
### Darwin
darwinConfigurations = {
"Plato" = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin";
specialArgs = {inherit inputs;};
modules = [
./darwin/presets/desktop.nix
./users/guanranwang/darwin/presets/desktop.nix
./users/guanranwang/darwin/presets/core/proxy.nix
./machines/darwin/imac-2017
./darwin/profiles/desktop
{
networking.hostName = "Plato";
time.timeZone = "Asia/Shanghai";
}
./users/guanranwang/darwin/profiles/desktop
./users/guanranwang/darwin/profiles/core/addtional/networking/clash-meta-client.nix
./darwin/hardware/imac-2017
{networking.hostName = "Plato";}
];
};
};
### Standalone Home-Manager
#homeConfigurations = {
# "guanranwang@81fw-nixos" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux;
# extraSpecialArgs = {inherit inputs;};
# modules = [
# sops-nix.homeManagerModules.sops
# hyprland.homeManagerModules.default
# ];
# };
#};
};
}

View file

@ -1,10 +0,0 @@
{...}: {
imports = [
../../../../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

@ -0,0 +1,11 @@
{...}: {
imports = [
../default.nix
../../../../nixos/flake-modules/lanzaboote.nix
../../../../nixos/flake-modules/impermanence.nix
../../../../nixos/flake-modules/disko.nix
];
_module.args.disks = ["/dev/nvme0n1"]; # Disko
boot.initrd.systemd.enable = true; # LUKS TPM unlocking
}

View file

@ -1,6 +1,5 @@
{...}: {
imports = [
./boot.nix
./sysctl.nix
];
}

View file

@ -0,0 +1,6 @@
{...}: {
imports = [
./boot
./networking
];
}

View file

@ -1,13 +1,11 @@
{config, ...}:
# Imported by default, check out ./desktop.nix or ./server.nix
{
{config, ...}: {
# Imported by default, check out ./desktop.nix or ./server.nix
imports = [
../boot
../networking
../nix
../packages
../power-management
#../specialisation # dont actually use this
../../modules # idk where should i import it
./nix
./packages
./sysctl.nix
];
users.mutableUsers = false;

View file

@ -1,7 +1,9 @@
{pkgs, ...}: {
imports = [
./core.nix
../packages/graphical
../core
./power-management
./graphical
];
boot.kernelPackages = pkgs.linuxPackages_zen;

View file

@ -3,6 +3,6 @@
{
imports = [
(modulesPath + "/profiles/minimal.nix")
./core.nix
../core
];
}

View file

@ -1,21 +0,0 @@
{...}: {
specialisation = {
bspwm.configuration = {
system.nixos.tags = ["bspwm"];
services.xserver = {
displayManager.startx.enable = true;
windowManager.bspwm.enable = true;
};
};
plasma.configuration = {
system.nixos.tags = ["plasma"];
services.xserver = {
desktopManager.plasma5.enable = true;
displayManager.sddm = {
enable = true;
settings.General.DisplayServer = "wayland";
};
};
};
};
}

View file

@ -1,21 +0,0 @@
{pkgs, ...}: {
users = {
knownUsers = ["guanranwang"];
users."guanranwang" = {
createHome = true;
description = "Guanran Wang";
home = "/Users/guanranwang";
shell = pkgs.fish;
uid = 501;
};
};
imports = [
../../../../flakes/darwin/home-manager.nix
];
home-manager.users.guanranwang.imports = [
../..
../../profiles/command-line/darwin
];
}

View file

@ -1,19 +0,0 @@
{...}: {
imports = [
./core.nix
];
### home-manager
home-manager.users.guanranwang.imports = [
./core.nix
../../modules/terms/alacritty.nix
../../modules/shell/fish.nix
../../modules/shell/bash.nix
../../modules/editor/helix.nix
../../modules/editor/neovim.nix
../../modules/editor/vscode.nix
../home.nix
]; # NOTE: using flakes
}

View file

@ -0,0 +1,31 @@
{
pkgs,
lib,
...
}: {
users = {
knownUsers = ["guanranwang"];
users."guanranwang" = {
createHome = true;
description = "Guanran Wang";
home = "/Users/guanranwang";
shell = pkgs.fish;
uid = 501;
};
};
### Options
myFlake.darwin.networking.dns = lib.mkDefault "alidns";
time.timeZone = lib.mkDefault "Asia/Shanghai";
### Flakes
imports = [
../../../../../darwin/flake-modules/home-manager.nix
];
### home-manager
home-manager.users.guanranwang.imports = map (n: ../../../home-manager/${n}) [
"default.nix"
"profiles/command-line/darwin"
];
}

View file

@ -1,5 +1,5 @@
{...}: {
home-manager.users.guanranwang.imports = [
../../../home-manager/profiles/gaming/nixos
../../../../../home-manager/profiles/gaming/darwin
];
}

View file

@ -0,0 +1,17 @@
{...}: {
imports = [
../core
];
### home-manager
home-manager.users.guanranwang.imports = map (n: ../../../home-manager/${n}) [
"modules/terms/alacritty.nix"
"modules/shell/fish.nix"
"modules/shell/bash.nix"
"modules/editor/helix.nix"
"modules/editor/neovim.nix"
"modules/editor/vscode.nix"
"profiles/graphical-stuff/darwin"
];
}

View file

@ -6,17 +6,11 @@
};
home.packages = with pkgs; [
### Sans
### Inter
inter
### Monospace
jetbrains-mono
(nerdfonts.override {
fonts = [
"JetBrainsMono"
"NerdFontsSymbolsOnly"
];
})
### JetBrains Mono Nerd Font
(nerdfonts.override {fonts = ["JetBrainsMono"];})
### Adobe Source Han
source-han-sans

View file

@ -7,7 +7,7 @@
etcDirectory = "clash-meta";
in {
imports = [
../../../../../flakes/nixos/sops-nix.nix
../../../../../../nixos/flake-modules/sops-nix.nix
];
### sops-nix

View file

@ -7,7 +7,7 @@
port = 43956;
in {
imports = [
../../../../../flakes/nixos/sops-nix.nix
../../../../../../nixos/flake-modules/sops-nix.nix
];
### Firewall

View file

@ -7,7 +7,7 @@
port = "33829";
in {
imports = [
../../../../../flakes/nixos/sops-nix.nix
../../../../../../nixos/flake-modules/sops-nix.nix
];
### Firewall

View file

@ -1,6 +1,7 @@
{
pkgs,
config,
lib,
...
}: {
users.users."guanranwang" = {
@ -19,20 +20,24 @@
packages = [];
};
# for default shell
### for default shell
programs.fish.enable = true;
imports = [
### Options
myFlake.nixos.networking.dns = lib.mkDefault "alidns";
time.timeZone = lib.mkDefault "Asia/Shanghai";
### Flakes
../../../../flakes/nixos/sops-nix.nix
../../../../flakes/nixos/hosts.nix
imports = [
../../../../../nixos/flake-modules/sops-nix.nix
../../../../../nixos/flake-modules/hosts.nix
];
### sops-nix
nix.extraOptions = "!include ${config.sops.secrets.nix-access-tokens.path}";
users.groups."nix-access-tokens" = {};
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFile = ../../../secrets/secrets.yaml;
age.sshKeyPaths = ["/nix/persist/system/etc/ssh/ssh_host_ed25519_key"];
gnupg.sshKeyPaths = [];
secrets = {
@ -46,8 +51,8 @@
};
### home-manager
home-manager.users.guanranwang.imports = [
../../home-manager
../../home-manager/profiles/command-line/nixos
home-manager.users.guanranwang.imports = map (n: ../../../home-manager/${n}) [
"default.nix"
"profiles/command-line/nixos"
];
}

Some files were not shown because too many files have changed in this diff Show more