init: macmini nixos configuration.
This commit is contained in:
62
flake.lock
generated
Normal file
62
flake.lock
generated
Normal 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
22
flake.nix
Normal 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
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
host/hardware-configuration.nix
Normal file
33
host/hardware-configuration.nix
Normal 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
34
host/macmini.nix
Normal 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";
|
||||
}
|
||||
57
modules/programs/bash/amro.omp.json
Normal file
57
modules/programs/bash/amro.omp.json
Normal 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
|
||||
}
|
||||
24
modules/programs/bash/default.nix
Normal file
24
modules/programs/bash/default.nix
Normal 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)"
|
||||
'';
|
||||
};
|
||||
}
|
||||
11
modules/programs/tools.nix
Normal file
11
modules/programs/tools.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
nil
|
||||
neovim
|
||||
wget
|
||||
git
|
||||
fastfetch
|
||||
];
|
||||
}
|
||||
38
modules/services/ddns-go.nix
Normal file
38
modules/services/ddns-go.nix
Normal 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 = { };
|
||||
}
|
||||
38
modules/services/gitea.nix
Normal file
38
modules/services/gitea.nix
Normal 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
|
||||
];
|
||||
};
|
||||
}
|
||||
3
modules/services/nignx.nix
Normal file
3
modules/services/nignx.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{ ... }:
|
||||
|
||||
{ }
|
||||
4
modules/services/qqbot.nix
Normal file
4
modules/services/qqbot.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
|
||||
}
|
||||
16
modules/system/boot.nix
Normal file
16
modules/system/boot.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
10
modules/system/networking.nix
Normal file
10
modules/system/networking.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.openssh.enable = true;
|
||||
|
||||
networking = {
|
||||
hostName = "macmini";
|
||||
firewall.enable = false;
|
||||
networkmanager.enable = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user