treewide: sorting
This commit is contained in:
parent
3c2192c0f7
commit
f98ee5581a
103 changed files with 202 additions and 219 deletions
41
README.md
41
README.md
|
@ -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
|
||||
|
|
5
darwin/modules/default.nix
Normal file
5
darwin/modules/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./networking
|
||||
];
|
||||
}
|
0
darwin/networking/default.nix → darwin/modules/networking/default.nix
Normal file → Executable file
0
darwin/networking/default.nix → darwin/modules/networking/default.nix
Normal file → Executable file
29
darwin/modules/networking/dns.nix
Normal file
29
darwin/modules/networking/dns.nix
Normal 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"
|
||||
])
|
||||
];
|
||||
}
|
|
@ -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"
|
||||
];
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../networking
|
||||
../nix
|
||||
../packages
|
||||
../system
|
||||
];
|
||||
}
|
9
darwin/profiles/desktop/default.nix
Normal file
9
darwin/profiles/desktop/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../../modules
|
||||
|
||||
./nix
|
||||
./packages
|
||||
./system
|
||||
];
|
||||
}
|
61
flake.nix
61
flake.nix
|
@ -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
|
||||
# ];
|
||||
# };
|
||||
#};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./boot.nix
|
||||
./sysctl.nix
|
||||
];
|
||||
}
|
6
nixos/modules/default.nix
Normal file
6
nixos/modules/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./boot
|
||||
./networking
|
||||
];
|
||||
}
|
16
nixos/presets/core.nix → nixos/profiles/core/default.nix
Executable file → Normal file
16
nixos/presets/core.nix → nixos/profiles/core/default.nix
Executable file → Normal 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;
|
|
@ -1,7 +1,9 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./core.nix
|
||||
../packages/graphical
|
||||
../core
|
||||
|
||||
./power-management
|
||||
./graphical
|
||||
];
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_zen;
|
2
nixos/presets/server.nix → nixos/profiles/server/default.nix
Executable file → Normal file
2
nixos/presets/server.nix → nixos/profiles/server/default.nix
Executable file → Normal file
|
@ -3,6 +3,6 @@
|
|||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/minimal.nix")
|
||||
./core.nix
|
||||
../core
|
||||
];
|
||||
}
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
||||
];
|
||||
}
|
|
@ -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
|
||||
}
|
31
users/guanranwang/darwin/profiles/core/default.nix
Normal file
31
users/guanranwang/darwin/profiles/core/default.nix
Normal 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"
|
||||
];
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{...}: {
|
||||
home-manager.users.guanranwang.imports = [
|
||||
../../../home-manager/profiles/gaming/nixos
|
||||
../../../../../home-manager/profiles/gaming/darwin
|
||||
];
|
||||
}
|
17
users/guanranwang/darwin/profiles/desktop/default.nix
Normal file
17
users/guanranwang/darwin/profiles/desktop/default.nix
Normal 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"
|
||||
];
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
etcDirectory = "clash-meta";
|
||||
in {
|
||||
imports = [
|
||||
../../../../../flakes/nixos/sops-nix.nix
|
||||
../../../../../../nixos/flake-modules/sops-nix.nix
|
||||
];
|
||||
|
||||
### sops-nix
|
|
@ -7,7 +7,7 @@
|
|||
port = 43956;
|
||||
in {
|
||||
imports = [
|
||||
../../../../../flakes/nixos/sops-nix.nix
|
||||
../../../../../../nixos/flake-modules/sops-nix.nix
|
||||
];
|
||||
|
||||
### Firewall
|
|
@ -7,7 +7,7 @@
|
|||
port = "33829";
|
||||
in {
|
||||
imports = [
|
||||
../../../../../flakes/nixos/sops-nix.nix
|
||||
../../../../../../nixos/flake-modules/sops-nix.nix
|
||||
];
|
||||
|
||||
### Firewall
|
|
@ -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;
|
||||
|
||||
### Options
|
||||
myFlake.nixos.networking.dns = lib.mkDefault "alidns";
|
||||
time.timeZone = lib.mkDefault "Asia/Shanghai";
|
||||
|
||||
### Flakes
|
||||
imports = [
|
||||
### Flakes
|
||||
../../../../flakes/nixos/sops-nix.nix
|
||||
../../../../flakes/nixos/hosts.nix
|
||||
../../../../../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
Loading…
Reference in a new issue