change directory structure

This commit is contained in:
2025-10-29 01:28:17 +09:00
parent 18f1ef1e20
commit 3dc7ef3d9d
35 changed files with 390 additions and 266 deletions
+3 -1
View File
@@ -10,4 +10,6 @@
!/hosts/ !/hosts/
!/modules/ !/modules/
!/home-manager/ !/home-manager/
!/shells/ !/shells/
!/images/
!/profiles/
+32
View File
@@ -0,0 +1,32 @@
# dotfiles
NixOS + Home Manager
## Pickup Software
- Window Manager: Niri
- Lancher: Vicinae
- Bar: Noctalia
- Editor: msedit, neovim, vscode
- Terminal: ghostty, oh-my-zsh
## Directory Structure
- hosts/{host-name}<br/>
Hardware-specific configurations that abstract differences between hardware. Keep these minimal. Add new configurations when running NixOS on new hardware without existing support.
- default.nix<br/>
Moved from `/etc/nixos/configuration.nix`
- hardware-configuration.nix<br/>
Run `sudo nixos-generate-config` or moved from `/etc/nixos/hardware-configuration.nix`
- variables.nix<br/>
Config
- images
- modules
- core<br/>
Files related to NixOS configuration
- drivers<br/>
Files related to drivers such as GPUs
- home<br/>
Home-manager configuration files
- profiles<br/>
Build configurations for each environment by combining NixOS configurations and home-manager configurations.
- shells<br/>
Shell environment.
- wallpapers
+14 -37
View File
@@ -1,44 +1,30 @@
{ {
description = "Multi host Nix(OS) + Home Manager + flake"; description = "moons nix configurations and development shells";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager.url = "github:nix-community/home-manager/release-25.05"; home-manager = {
# home-manager.inputs.nixpkgs.follows = "nixpkgs"; url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix"; };
impermanence.url = "github:nix-community/impermanence";
vicinae.url = "github:vicinaehq/vicinae"; vicinae.url = "github:vicinaehq/vicinae";
}; };
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, sops-nix, impermanence, vicinae, ...}: outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, ...}:
let let
mkSystem = { host, system, extraModules ? [ ] }: mkSystem = { host, system, profile, extraModules ? [ ] }:
let
pkgsUnstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; };
in
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit inputs pkgsUnstable; inherit inputs;
inherit host;
inherit profile;
}; };
modules = [ modules = [
# host config ./profiles/${profile}.nix
./hosts/${host}/default.nix
# Home Manager
home-manager.nixosModules.home-manager
{ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; }
# common NixOS module
./modules/nixos/base.nix
./modules/nixos/cli.nix
./modules/nixos/sops.nix
./modules/nixos/impermanence.nix
./modules/nixos/font.nix
] ++ extraModules; ] ++ extraModules;
}; };
in { in {
@@ -46,17 +32,8 @@
x1g9 = mkSystem { x1g9 = mkSystem {
host = "x1g9"; host = "x1g9";
system = "x86_64-linux"; system = "x86_64-linux";
extraModules = [ profile = "cli-minimal";
# X1 Carbon Gen 9 Hardware Profile extraModules = [ ];
nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
# GUI and x1g9 only App
./modules/nixos/desktop.nix
];
};
dev-server = mkSystem {
host = "dev-server";
system = "x86_64-linux";
}; };
}; };
-4
View File
@@ -1,4 +0,0 @@
{ ... } :
{
home.sessionVariables.BROWSER = "google-chrome-stable";
}
-14
View File
@@ -1,14 +0,0 @@
{ pkgs, lib, config, ... }:
let
isDrawin = pkgs.stdenv.isDrawin;
in
{
home.username = "moons";
home.homeDirectory = lib.mkDefault (if isDrawin then "/Users/moons" else "/home/moons");
programs.home-manager.enable = true;
home.stateVersion = "25.05";
imports = [
../../modules/hm/cli.nix
];
}
+2 -19
View File
@@ -2,29 +2,12 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’). # and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, inputs, ... }: { inputs, ... }:
{ {
imports = imports =
[ [
./hardware-configuration.nix ./hardware-configuration.nix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
]; ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Define your hostname.
networking.hostName = "x1g9";
home-manager.users.moons = {
imports = [
../../home-manager/moons/default.nix
../../modules/hm/gui.nix
../../home-manager/hosts/x1g9.nix
inputs.vicinae.homeManagerModules.default
../../modules/hm/vicinae.nix
];
};
} }
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
}
+17
View File
@@ -0,0 +1,17 @@
{ ... }:
{
imports = [
./boot.nix
./environment.nix
./fonts.nix
./greetd.nix
./hardware.nix
./i18n.nix
./network.nix
./packages.nix
./services.nix
./system.nix
./user.nix
./xserver.nix
];
}
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
environment.sessionVariables = {
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
QT_QPA_PLATFORM = "wayland;xcb";
};
}
@@ -1,17 +1,15 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
fonts = { fonts = {
packages = (with pkgs; packages = with pkgs; [
[
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
noto-fonts-emoji noto-fonts-emoji
terminus_font terminus_font
cantarell-fonts cantarell-fonts
font-awesome font-awesome
] ];
);
fontDir.enable = true; fontDir.enable = true;
fontconfig = { fontconfig = {
defaultFonts = { defaultFonts = {
@@ -27,4 +25,4 @@
}; };
}; };
}; };
} }
+12
View File
@@ -0,0 +1,12 @@
{ pkgs, username, ... }: {
services.greetd = {
enable = true;
vt = 3;
settings = {
default_session = {
user = "greeter";
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
};
};
};
}
+16
View File
@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
hardware = {
sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
disabledDefaultBackends = [ "escl" ];
};
graphics.enable = true;
enableRedistributableFirmware = true;
keyboard.qmk.enable = true;
bluetooth.enable = true;
bluetooth.powerOnBoot = true;
};
local.hardware-clock.enable = false;
}
+32
View File
@@ -0,0 +1,32 @@
{ ... }:
{
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-configtool
];
settings.inputMethod = {
GroupOrder = {
"0" = "Default";
};
"Groups/0" = {
Name = "Default";
"Default Layout" = "jp";
DefaultIM = "mozc";
};
"Groups/0/Items/0" = {
Name = "ja";
Layout = "";
};
"Groups/0/Items/1" = {
Name = "mozc";
Layout = "";
};
}
};
};
}
+7
View File
@@ -0,0 +1,7 @@
{ host, ... }:
{
networking = {
hostName = "${host}";
networkmanager.enable = true;
};
}
+37
View File
@@ -0,0 +1,37 @@
{ pkgs, inputs, ... }:
{
programs = {
hyprland = {
enable = true;
withUWSM = false;
};
dconf.enable = true;
seahorse.enable = true;
fuse.userAllowOther = true;
adb.enable = true;
hyprlock.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
zsh = {
enable = true;
}
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
greetd.tuigreet # The Login Manager (Sometimes Referred To As Display Manager)
htop # Simple Terminal Based System Monitor
unrar # Tool For Handling .rar Files
unzip # Tool For Handling .zip Files
uwsm # Universal Wayland Session Manager (optional must be enabled)
wget # Tool For Fetching Files With Links
curl # Tool For Fetching Files With Links
alacritty # A GPU Accelerated Terminal Emulator
fuzzel # A Simple And Lightweight Application Launcher
msedit # A Simple Text Editor Inspired By Windows Notepad
git # Version Control System
];
}
+27
View File
@@ -0,0 +1,27 @@
{ ... }: {
services = {
openssh = {
enable = false; # Enable SSH
settings = {
PermitRootLogin = "no"; # Prevent root from SSH login
PasswordAuthentication = false;
KbdInteractiveAuthentication = true;
};
ports = [ 22 ];
};
blueman.enable = true; # Bluetooth Support
tumbler.enable = true; # Image/video preview
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
};
}
+33
View File
@@ -0,0 +1,33 @@
{ ... }:
{
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://vicinae.cachix.org" ];
trusted-public-keys = [ "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" ];
};
};
# Localization settings
time.timeZone = "Asia/Tokyo";
i18n.defaultLocale = "ja_JP.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "ja_JP.UTF-8";
LC_IDENTIFICATION = "ja_JP.UTF-8";
LC_MEASUREMENT = "ja_JP.UTF-8";
LC_MONETARY = "ja_JP.UTF-8";
LC_NAME = "ja_JP.UTF-8";
LC_NUMERIC = "ja_JP.UTF-8";
LC_PAPER = "ja_JP.UTF-8";
LC_TELEPHONE = "ja_JP.UTF-8";
LC_TIME = "ja_JP.UTF-8";
};
environment.variables = {
NIXOS_OZONE_WL = "1";
};
console.keyMap = "jp106";
system.stateVersion = "25.05";
}
+37
View File
@@ -0,0 +1,37 @@
{ pkgs, inputs, username, host, profile, ...}:
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager = {
enable = true;
useUserPackages = true;
useGlobalPkgs = false;
backupFileExtension = "backup";
extraSpecialArgs = { inherit inputs username host profile; };
users.moons = {
imports = [ ./../home ];
home = {
username = "moons";
homeDirectory = "/home/moons";
stateVersion = "25.05";
};
};
};
users.mutableUsers = true;
users.users.moons = {
isNormalUser = true;
description = "moons-14";
extraGroups = [
"adbusers"
"docker" #access to docker as non-root
"libvirtd" #Virt manager/QEMU access
"lp"
"networkmanager"
"scanner"
"wheel" #subdo access
"vboxusers" #Virtual Box
];
shell = pkgs.zsh;
ignoreShellProgramCheck = true;
};
nix.settings.allowed-users = [ "moons" ];
}
+13
View File
@@ -0,0 +1,13 @@
{ ... }:
{
services = {
xserver = {
enable = true;
xkb = {
layout = "jp";
variant = "";
options = "ctrl:nocaps";
};
};
};
}
+6
View File
@@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./intel-drivers.nix
];
}
+21
View File
@@ -0,0 +1,21 @@
{ lib, pkgs, config, ... }:
with lib; let
cfg = config.drivers.intel;
in
{
options.drivers.intel = {
enable = mkEnableOption "Enable Intel Graphics Drivers";
};
config = mkIf cfg.enable {
# OpenGL
hardware.graphics = {
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
};
}
-16
View File
@@ -1,16 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
htop
git
];
programs.zsh.enable = true;
programs.git = {
enable = true;
userName = "moons-14";
userEmail = "moons@moons14.com";
extraConfig = { init.defaultBranch = "main"; };
};
}
-37
View File
@@ -1,37 +0,0 @@
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
esbenp.prettier-vscode
];
userSettings = {
"editor.formatOnSave" = true;
};
};
# input method config
home.file.".config/fcitx5/config" = {
recursive = true;
source = ./fcitx5/config;
};
i18n.inputMethod.fcitx5.settings.inputMethod = {
GroupOrder = {
"0" = "Default";
};
"Groups/0" = {
Name = "Default";
"Default Layout" = "jp";
DefaultIM = "mozc";
};
"Groups/0/Items/0" = {
Name = "ja";
Layout = "";
};
"Groups/0/Items/1" = {
Name = "mozc";
Layout = "";
};
};
}
-19
View File
@@ -1,19 +0,0 @@
{ pkgs, ... }:
{
services.vicinae = {
enable = true;
autoStart = true;
settings = {
faviconService = "twenty";
font.size = 11;
popToRootOnClose = false;
rootSearch.searchFiles = false;
theme.name = "vicinae-dark";
window = {
csd = true;
opacity = 0.95;
rounding = 10;
};
};
};
}
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./git.nix
./fcitx5
];
}
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
home.file."~/.config/fcitx5/config" = {
recursive = true;
source = ./config;
};
}
+29
View File
@@ -0,0 +1,29 @@
{ host, ... }:
{
programs.git = {
enable = true;
userName = "moons-14";
userEmail = "moons@moons14.com";
extraConfig = {
push.default = "simple";
credential.helper = "cache --timeout=7200";
init.defaultBranch = "main";
log.decorate = "full"; # Show branch/tag info in git log
log.date = "iso"; # ISO 8601 date format
# Conflict resolution style for readable diffs
merge.conflictStyle = "diff3";
};
# Optional: FOSS-friendly Git aliases
aliases = {
br = "branch --sort=-committerdate";
co = "checkout";
df = "diff";
com = "commit -a";
gs = "stash";
gp = "pull";
lg = "log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %C(green)(%cr)%C(bold blue) <%an>%Creset' --abbrev-commit";
st = "status";
};
};
}
+14
View File
@@ -0,0 +1,14 @@
{ pkgs, ... }: {
nixpkgs.config.allowUnfree = true;
programs.vscode = {
enable = true;
profiles = {
default = {
extensions = with pkgs.vscode-extensions; [
esbenp.prettier-vscode
];
};
};
};
}
-28
View File
@@ -1,28 +0,0 @@
{ pkgs, lib, ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Asia/Tokyo";
i18n.defaultLocale = "ja_JP.UTF-8";
services.xserver.xkb.layout = "jp";
services.xserver.xkb.variant = "";
services.xserver.xkb.options = "ctrl:nocaps";
console.keyMap = "jp106";
# common user
users.users.moons = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "docker" ];
shell = pkgs.zsh;
};
programs.zsh.enable = true;
services.openssh.enable = true;
# basic network setting
networking.networkmanager.enable = true;
nix.settings = {
extra-substituters = [ "https://vicinae.cachix.org" ];
extra-trusted-public-keys = [ "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" ];
};
}
-8
View File
@@ -1,8 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
git
htop
unzip wget curl
];
}
-65
View File
@@ -1,65 +0,0 @@
{ pkgs, lib, ... }:
{
nixpkgs.config = {
allowUnfreePredicate = pkg: lib.elem (lib.getName pkg) [
"google-chrome"
"vscode"
"1password"
"1password-gui"
"1password-cli"
];
};
services.xserver.enable = true;
programs.hyperland.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
services.greetd ={
enable = true;
settings = {
default_session = {
command = "tuigreet --time --remember --cmd 'uwsm start -- niri'";
user = "greeter";
};
};
};
environment.systemPackages = with pkgs; [
greetd.tuigreet
alacritty
fuzzel
swaybg
xwayland-satellite
google-chrome
vscode
_1password-gui _1password
kitty
];
environment.sessionVariables = {
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
QT_QPA_PLATFORM = "wayland;xcb";
};
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-configtool
];
};
};
programs._1password.enable = true;
programs._1password-gui.enable = true;
}
-5
View File
@@ -1,5 +0,0 @@
{ inputs, ... }:
{
imports = [ inputs.impermanence.nixosModules.impermanence ];
}
-7
View File
@@ -1,7 +0,0 @@
{ inputs, ... }:
{
imports = [ inputs.sops-nix.nixosModules.sops ];
# sops.age.sshKeyPaths = [];
# sops.defaultSopsFile = ../secrest/secrets.yaml;
}
+6
View File
@@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./../modules/core
];
}