nix: Add host polder and refractor modules

This commit is contained in:
js0ny 2025-10-21 16:14:34 +00:00
parent 1b99070718
commit 3756bbfb45
38 changed files with 284 additions and 172 deletions

110
nixcfgs/flake.lock generated
View file

@ -1,5 +1,26 @@
{ {
"nodes": { "nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1760836749,
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=",
"owner": "ryantm",
"repo": "agenix",
"rev": "2f0f812f69f3eb4140157fe15e12739adf82e32a",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"caelestia-cli": { "caelestia-cli": {
"inputs": { "inputs": {
"caelestia-shell": [ "caelestia-shell": [
@ -46,6 +67,28 @@
"type": "github" "type": "github"
} }
}, },
"darwin": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1744478979,
"narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "43975d782b418ebf4969e9ccba82466728c2851b",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -69,7 +112,7 @@
}, },
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@ -86,6 +129,27 @@
} }
}, },
"home-manager": { "home-manager": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1745494811,
"narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -142,6 +206,22 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1754028485,
"narHash": "sha256-IiiXB3BDTi6UqzAZcf2S797hWEPCRZOwyNThJIYhUfk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "59e69648d345d6e8fef86158c555730fa12af9de",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1760872779, "lastModified": 1760872779,
"narHash": "sha256-c5C907Raf9eY8f1NUXYeju9aUDlm227s/V0OptEbypA=", "narHash": "sha256-c5C907Raf9eY8f1NUXYeju9aUDlm227s/V0OptEbypA=",
@ -157,7 +237,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1760878510, "lastModified": 1760878510,
"narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=", "narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=",
@ -173,7 +253,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1758690382, "lastModified": 1758690382,
"narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
@ -192,7 +272,7 @@
"nur": { "nur": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1760925195, "lastModified": 1760925195,
@ -254,12 +334,13 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix",
"caelestia-shell": "caelestia-shell", "caelestia-shell": "caelestia-shell",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager_2",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nix-flatpak": "nix-flatpak", "nix-flatpak": "nix-flatpak",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"nur": "nur", "nur": "nur",
"plasma-manager": "plasma-manager", "plasma-manager": "plasma-manager",
"winboat": "winboat" "winboat": "winboat"
@ -280,9 +361,24 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"winboat": { "winboat": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1760827883, "lastModified": 1760827883,

View file

@ -25,6 +25,7 @@
url = "github:caelestia-dots/shell"; url = "github:caelestia-dots/shell";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
agenix.url = "github:ryantm/agenix";
}; };
outputs = outputs =
@ -38,6 +39,7 @@
nur, nur,
winboat, winboat,
caelestia-shell, caelestia-shell,
agenix,
... ...
}@inputs: }@inputs:
let let
@ -59,6 +61,7 @@
"zp" "zp"
"zephyrus" "zephyrus"
"nixvirt" "nixvirt"
"polder"
]; ];
mkNixosSystem = mkNixosSystem =
@ -67,6 +70,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
inherit specialArgs; inherit specialArgs;
modules = [ modules = [
agenix.nixosModules.default
./hosts/${hostname} ./hosts/${hostname}
{ nixpkgs.overlays = overlays; } { nixpkgs.overlays = overlays; }
]; ];

View file

@ -0,0 +1,57 @@
# ~/.config/nixcfgs/hosts/polder/default.nix
{
config,
pkgs,
nix-flatpak,
...
}:
{
imports = [
# impure build
/etc/nixos/hardware-configuration.nix
../../modules/nixos
];
system.stateVersion = "25.05";
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.kernelParams = [ "console=ttyS0,115200n8" "console=tty0" ];
boot.loader.grub.useOSProber = true;
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
time.timeZone = "Etc/UTC";
nixpkgs.config.allowUnfree = true;
networking.hostName = "polder";
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
};
};
networking = {
usePredictableInterfaceNames = false;
interfaces.eth0.ipv4.addresses = [
{
address = "158.220.98.103";
prefixLength = 20;
}
];
defaultGateway = {
address = "158.220.96.1";
interface = "eth0";
};
nameservers = [
"1.1.1.1"
"8.8.8.8"
"2606:4700:4700::1111"
"2001:4860:4860::8888"
];
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
};
}

View file

@ -2,29 +2,30 @@
{...}: { {...}: {
imports = [ imports = [
../../modules/nixos ../../modules/nixos
../../modules/nixos/host-machine.nix
../../modules/nixos/waydroid.nix
../../modules/nixos/laptop.nix
../../modules/nixos/disable-nvidia.nix
../../modules/nixos/additional-packages.nix
../../modules/nixos/libvirt.nix ../../modules/nixos/libvirt.nix
../../modules/nixos/docker.nix ../../modules/nixos/docker.nix
../../modules/nixos/firefox.nix
../../modules/nixos/steam.nix
../../modules/nixos/chromium.nix
../../modules/nixos/obs-studio.nix
../../modules/nixos/wine.nix
../../modules/nixos/exp.nix ../../modules/nixos/exp.nix
../../modules/nixos/gnome-keyring.nix ../../modules/nixos/desktop/host-machine.nix
../../modules/nixos/desktop/laptop.nix
../../modules/nixos/desktop/disable-nvidia.nix
../../modules/nixos/additional-packages.nix
../../modules/nixos/desktop
../../modules/nixos/desktop/firefox.nix
../../modules/nixos/desktop/steam.nix
../../modules/nixos/desktop/chromium.nix
../../modules/nixos/desktop/obs-studio.nix
../../modules/nixos/desktop/wine.nix
../../modules/nixos/desktop/gnome-keyring.nix
../../modules/nixos/udev/basys3.nix ../../modules/nixos/udev/basys3.nix
../../modules/nixos/desktop/kde.nix ../../modules/nixos/desktop-environment/kde.nix
../../modules/nixos/desktop/hyprland.nix ../../modules/nixos/desktop-environment/hyprland.nix
../../modules/nixos/display-manager/sddm.nix ../../modules/nixos/display-manager/sddm.nix
./hardware-configuration.nix ./hardware-configuration.nix
./keyd.nix ./keyd.nix
./packages.nix ./packages.nix
]; ];
boot.kernelPackages = pkgs.linuxPackages_latest;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
networking.hostName = "zephyrus"; networking.hostName = "zephyrus";
networking.modemmanager.enable = false; networking.modemmanager.enable = false;

View file

@ -1,109 +0,0 @@
{
config,
pkgs,
...
}: {
security.pam.services.login.enableGnomeKeyring = true;
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/London";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_GB.UTF-8";
# extraLocales = [
# "en_GB.UTF-8/UTF-8"
# ];
extraLocaleSettings = {
# LC_CTYPE = "en_GB.UTF-8";
LC_ALL = "en_GB.UTF-8";
};
};
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Configure keymap in X11
services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
services.pipewire = {
enable = true;
pulse.enable = true;
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
environment.shellAliases = {
nrs = "sudo nixos-rebuild switch --flake ~/.dotfiles/nixcfgs";
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
# enableSSHSupport = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# 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;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.js0ny = {
isNormalUser = true;
extraGroups = [
"wheel"
"docker"
"libvirtd"
"dialout"
]; # Enable sudo for the user.
packages = with pkgs; [
tree
];
};
services.flatpak.enable = true;
}

View file

@ -0,0 +1,43 @@
{
config,
pkgs,
...
}: {
# Select internationalisation properties.
i18n = {
defaultLocale = "en_GB.UTF-8";
extraLocales = [
"en_GB.UTF-8/UTF-8"
];
extraLocaleSettings = {
# LC_CTYPE = "en_GB.UTF-8";
LC_ALL = "en_GB.UTF-8";
};
};
environment.shellAliases = {
nrs = "sudo nixos-rebuild switch --flake ~/.dotfiles/nixcfgs";
};
# system.copySystemConfiguration = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Define a user account. Don't forget to set a password with passwd.
users.users.js0ny = {
isNormalUser = true;
extraGroups = [
"wheel"
"docker"
"libvirtd"
"dialout"
]; # Enable sudo for the user.
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJToUo2jT3qt7eHIME9e1awabZZVmtKhbxwVz9BMSM2d js0ny@zephyrus"
];
};
programs.command-not-found.enable = true;
}

View file

@ -1,13 +1,11 @@
# ~/.config/nix-config/common/packages-headless.nix # ~/.config/nix-config/common/packages-headless.nix
{pkgs, ...}: { {pkgs, ...}: {
# nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
wget wget
curl curl
git git
tmux tmux
wl-clipboard
nix-index nix-index
file file
unzip unzip

View file

@ -1,8 +1,7 @@
{pkgs, ...}: { {pkgs, ...}: {
imports = [ imports = [
./configuration.nix ./core/configuration.nix
./packages.nix ./core/packages.nix
./fonts.nix
./rime.nix
]; ];
} }

View file

@ -0,0 +1,51 @@
{...}: {
imports = [
../rime.nix
../fonts.nix
];
services.pipewire = {
enable = true;
pulse.enable = true;
};
# Set your time zone.
time.timeZone = "Europe/London";
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Configure keymap in X11
services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
security.pam.services.login.enableGnomeKeyring = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Enable CUPS to print documents.
services.printing.enable = true;
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
};
environment.systemPackages = with pkgs; [
wl-clipboard
];
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
powertop
];
}

View file

@ -1,25 +0,0 @@
{pkgs, ...}: {
users.users.guest = {
isNormalUser = true;
description = "Guest user";
home = "/home/guest";
extraGroups = [""]; # 可选,是否允许 sudo
shell = pkgs.bash;
# hashedPassword = ""; # 空密码,意味着需要手动设置或禁用登录
# 或者直接禁止密码登录:
hashedPassword = null;
};
systemd.services."guest-reset-home" = {
description = "Reset guest home directory on boot";
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
ExecStart = ''
rm -rf /home/guest/*
cp -r /etc/skel/. /home/guest/
chown -R guest:guest /home/guest
'';
};
};
}

View file

@ -1,11 +0,0 @@
# ~/.config/nix-config/common/packages-headless.nix
{ pkgs, ... }:
{
# nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
powertop
];
}

View file

@ -1,6 +1,5 @@
{pkgs, ...}: { {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
chromium
nil nil
nixd nixd
libnotify libnotify