init: macmini nixos configuration.

This commit is contained in:
Sky
2026-01-27 07:44:31 +00:00
commit a4b60e72a8
13 changed files with 352 additions and 0 deletions

62
flake.lock generated Normal file
View File

@@ -0,0 +1,62 @@
{
"nodes": {
"catppuccin": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1769432988,
"narHash": "sha256-q4arZjXnLiuMnLzO972lrXIGdzyGb4DGaIt69CcCYdE=",
"owner": "catppuccin",
"repo": "nix",
"rev": "d7a8632c0d8d144478aac1a8c8d5083b770cbb03",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1769018530,
"narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "88d3861acdd3d2f0e361767018218e51810df8a1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1769018530,
"narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "88d3861acdd3d2f0e361767018218e51810df8a1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"catppuccin": "catppuccin",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

22
flake.nix Normal file
View File

@@ -0,0 +1,22 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# napcat = {
# url = "https://github.com/initialencounter/napcat.nix";
# };
catppuccin.url = "github:catppuccin/nix";
};
outputs =
inputs@{ nixpkgs, ... }:
{
nixosConfigurations = {
macmini = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [
./host/macmini.nix
];
};
};
};
}

View File

@@ -0,0 +1,33 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7ef653d0-f317-40fa-a9d0-8f0c8050410d";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/CF42-F4D2";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/a1931d27-cafb-4269-83f7-808d1509fa0c"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

34
host/macmini.nix Normal file
View File

@@ -0,0 +1,34 @@
{
pkgs,
...
}:
{
imports = [
./hardware-configuration.nix
../modules/services/ddns-go.nix
../modules/services/nignx.nix
../modules/services/gitea.nix
../modules/system/boot.nix
../modules/system/networking.nix
../modules/programs/bash
../modules/programs/tools.nix
];
time.timeZone = "Aisa/Shanghai";
i18n.defaultLocale = "en_US.UTF-8";
users.users.sky = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
tree
];
};
system.stateVersion = "25.11";
}

View File

@@ -0,0 +1,57 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "#45F1C2",
"style": "plain",
"template": "\uf313 {{ .UserName }} on",
"type": "session"
},
{
"foreground": "#0CA0D8",
"properties": {
"folder_separator_icon": "/",
"style": "full"
},
"style": "plain",
"template": " \uf07b {{ .Path }} ",
"type": "path"
},
{
"foreground": "#14A5AE",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_upstream_icon": true
},
"style": "plain",
"template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ",
"type": "git"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#cd5e42",
"style": "plain",
"template": "\ue3bf ",
"type": "root"
},
{
"foreground": "#CD4277",
"style": "plain",
"template": "# ",
"type": "text"
}
],
"type": "prompt"
}
],
"version": 3
}

View File

@@ -0,0 +1,24 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
direnv
fzf
];
programs.direnv = {
enable = true;
};
programs.bash = {
enable = true;
shellInit =
let
theme = ./amro.omp.json;
in
''
eval "$(${pkgs.oh-my-posh}/bin/oh-my-posh init bash --config ${theme})"
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
eval "$(${pkgs.fzf}/bin/fzf --bash)"
'';
};
}

View File

@@ -0,0 +1,11 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nil
neovim
wget
git
fastfetch
];
}

View File

@@ -0,0 +1,38 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ddns-go
];
systemd.services.ddns-go = {
description = "DDNS-Go";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.ddns-go}/bin/ddns-go -l [::]:9876 -f 300";
Restart = "always";
RestartSec = 3;
User = "ddns-go";
Group = "ddns-go";
StateDirectory = "ddns-go";
Environment = "HOME=/var/lib/ddns-go";
NoNewPrivileges = true;
PrivateTmp = true;
ProtectSystem = "strict";
ReadWritePaths = "/var/lib/ddns-go";
};
};
users.users.ddns-go = {
isSystemUser = true;
group = "ddns-go";
home = "/var/lib/ddns-go";
createHome = true;
};
users.groups.ddns-go = { };
}

View File

@@ -0,0 +1,38 @@
{ inputs, pkgs, ... }:
{
imports = [
inputs.catppuccin.nixosModules.catppuccin
];
# Catppuccin Mocha Style
catppuccin.gitea = {
enable = true;
accent = "sky";
flavor = "mocha";
};
services.gitea = {
enable = true;
user = "git";
group = "git";
stateDir = "/var/lib/gitea";
database = {
type = "sqlite3";
};
};
users.groups.git = { };
users.users.git = {
isNormalUser = true;
home = "/var/lib/gitea";
extraGroups = [ "git" ];
packages = with pkgs; [
gitea
];
};
}

View File

@@ -0,0 +1,3 @@
{ ... }:
{ }

View File

@@ -0,0 +1,4 @@
{ inputs, ... }:
{
}

16
modules/system/boot.nix Normal file
View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
};
}

View File

@@ -0,0 +1,10 @@
{ ... }:
{
services.openssh.enable = true;
networking = {
hostName = "macmini";
firewall.enable = false;
networkmanager.enable = true;
};
}