feat: refactor flake.nix

This commit is contained in:
Ryan Yin
2023-12-20 00:48:30 +08:00
parent 809a68fa27
commit 29511fa574
28 changed files with 416 additions and 422 deletions

View File

@@ -1,7 +1,4 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
###################################################################################
#
# Core configuration for nix-darwin

View File

@@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
###################################################################################
#
# NixOS's core configuration suitable for all my machines

View File

@@ -14,4 +14,6 @@
};
openFirewall = true;
};
}

View File

@@ -1,4 +1,4 @@
{username, ...}: {
{username, config, ...}: {
# Don't allow mutation of users outside the config.
users.mutableUsers = false;
@@ -37,10 +37,10 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7PTkP3ixXTZlrJNSHnXgkmHNT+QslFi9wNYXOpVwGB ryan@harmonica"
];
};
users.users.root.initialHashedPassword = "$7$CU..../....X6uvZYnFD.i1CqqFFNl4./$4vgqzIPyw5XBr0aCDFbY/UIRRJr7h5SMGoQ/ZvX3FP2";
# fix for `sudo xxx` in kitty/wezterm and other modern terminal emulators
security.sudo.keepTerminfo = true;
users.users.root = {
initialHashedPassword = "$7$CU..../....X6uvZYnFD.i1CqqFFNl4./$4vgqzIPyw5XBr0aCDFbY/UIRRJr7h5SMGoQ/ZvX3FP2";
openssh.authorizedKeys.keys = config.users.users."${username}".openssh.authorizedKeys.keys;
};
# DO NOT promote the specified user to input password for `nix-store` and `nix-copy-closure`
security.sudo.extraRules = [

View File

@@ -12,6 +12,9 @@
# set user's default shell system-wide
users.defaultUserShell = pkgs.nushell;
# fix for `sudo xxx` in kitty/wezterm and other modern terminal emulators
security.sudo.keepTerminfo = true;
environment.variables = {
# fix https://github.com/NixOS/nixpkgs/issues/238025
TZ = "${config.time.timeZone}";

View File

@@ -3,20 +3,13 @@
# Base NixOS Configuration
# =========================================================================
# Set your time zone.
time.timeZone = "Asia/Shanghai";
imports = [
./base/i18n.nix
./base/misc.nix
./base/user-group.nix
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
nix.settings = {
# Manual optimise storage: nix-store --optimise
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
auto-optimise-store = true;
builders-use-substitutes = true;
# enable flakes globally
experimental-features = ["nix-command" "flakes"];
};
../base.nix
];
# List packages installed in system profile. To search, run:
# $ nix search wget
@@ -51,9 +44,6 @@
docker-compose
];
# replace default editor with neovim
environment.variables.EDITOR = "nvim";
virtualisation.docker = {
enable = true;
# start dockerd on boot.