started modifing configuration structure

This commit is contained in:
2024-12-22 16:56:40 +09:00
parent 1030d3e37f
commit 87d132cb4f
37 changed files with 272 additions and 32 deletions

View File

@@ -8,12 +8,12 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs@{ nixpkgs, home-manager, ... }:
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
let
systemSettings = {
system = "x86_64-linux";
hostname = "kenryu-nixos";
machine = "workstation";
host = "syushiki";
timezone = "Asia/Tokyo";
locale = "ja_JP.UTF-8";
bootConf = {
@@ -35,32 +35,37 @@
pkgs = import inputs.nixpkgs {
system = systemSettings.system;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true );
};
};
lib = inputs.nixpkgs.lib;
home-manager = inputs.home-manager;
in {
nixosConfigurations.system = lib.nixosSystem {
#nixosModules = {
# home-mngr = home-manager.nixosModules.home-manager {
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
# home-manager.users.${userSettings.username} = import (./. + "/hosts/${systemSettings.host}/home.nix");
# home-manager.extraSpecialArgs = {
# inherit userSettings;
# };
# };
#};
#nixosConfigurations = import ./hosts inputs { inherit systemSettings; inherit userSettings; };
nixosConfigurations.syushiki = lib.nixosSystem {
system = systemSettings.system;
modules = [
(./. + "/machines" + ("/" + systemSettings.machine) + "/configuration.nix")
./hosts/syushiki
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${userSettings.username} = import (./. + "/machines" + ("/" + systemSettings.machine) + "/home.nix");
home-manager.users.${userSettings.username} = import (./. + "/hosts/${systemSettings.host}/home.nix");
home-manager.extraSpecialArgs = {
inherit userSettings;
};
}
];
specialArgs = {
inherit systemSettings;
inherit userSettings;
inherit inputs;
inherit inputs systemSettings userSettings;
};
};
};

23
hosts/default.nix Normal file
View File

@@ -0,0 +1,23 @@
{ self, nixpkgs, ... }: { systemSettings, userSettings, ... }:
let
inherit (self) inputs;
inherit systemSettings userSettings;
mkHost = name:
nixpkgs.lib.nixosSystem {
modules = [
./${name}
{
nixpkgs.hostPlatform = systemSettings.system;
}
] ++ builtins.attrValues self.nixosModules;
specialArgs = {
inherit inputs;
inherit systemSettings;
inherit userSettings;
};
};
in
{
syushiki = mkHost "syushiki";
}

View File

@@ -0,0 +1,49 @@
{ config, lib, pkgs, modulesPath, ... }: {
imports = [
../../system
../../system/nvidia
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f4c95da6-3c6b-4414-a62a-c8c26c4a1c73";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/C83C-841F";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
fileSystems."/run/media/kenryus/hdd" = {
device = "/dev/disk/by-uuid/0d146628-12f4-4bb6-abde-bbf798a57c25";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/d933c349-8e70-41e1-8d13-605656dba18b"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
programs.appimage = {
enable = true;
binfmt = true;
};
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 3000 3001 22 ];
system.stateVersion = "24.05"; # Did you read the changelog?
}

48
hosts/syushiki/home.nix Normal file
View File

@@ -0,0 +1,48 @@
{ pkgs, userSettings, ... }:
{
imports = [
../../user/apps/browsers/firefox.nix
../../user/apps/browsers/chromium.nix
../../user/apps/thunderbird.nix
../../user/dev/tools/git.nix
../../user/dev/tools/gitui.nix
../../user/dev/tools/firefox-devedition.nix
../../user/dev/tools/dbeaver-bin.nix
../../user/dev/tools/tldr.nix
../../user/dev/tools/gh.nix
../../user/dev/editor/vscodium.nix
../../user/dev/editor/zed-editor.nix
../../user/dev/lang/cc.nix
../../user/dev/lang/python.nix
../../user/dev/lang/rust.nix
../../user/dev/lang/ecmascript.nix
../../user/dev/ide/qtcreator.nix
../../user/apps/utils/alacritty.nix
../../user/apps/utils/keepassxc.nix
#../../user/apps/utils/cava.nix
../../user/apps/utils/owncloud-client.nix
../../user/apps/utils/fzf.nix
../../user/apps/utils/zoxide.nix
../../user/apps/media/vlc.nix
../../user/apps/media/mpv.nix
../../user/apps/media/yt-dlp.nix
../../user/apps/media/kdenlive.nix
../../user/apps/media/obs-studio.nix
../../user/apps/graphics/gimp.nix
../../user/apps/graphics/inkscape.nix
../../user/apps/games/mangohud.nix
../../user/apps/office/texlive.nix
#../../user/apps/office/libreoffice-fresh.nix
../../user/shell/bash.nix
../../user/wm/xmonad/xmonad.nix
];
home.username = userSettings.username;
home.homeDirectory = "/home/" + userSettings.username;
programs.home-manager.enable = true;
home.stateVersion = "24.05";
home.packages = with pkgs; [];
}

18
system/default.nix Normal file
View File

@@ -0,0 +1,18 @@
{ ... }: {
imports = [
./audio
./bluetooth
./inputMethods
./kernel
./locale
./network
./nix
./opengl
./time
./users
./services
./wm
./env.nix
./utils.nix
];
}

View File

@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
environment.variables = {
EDITOR = "vim";

View File

@@ -1,4 +0,0 @@
{ ... }:
{
services.timesyncd.enable = true;
}

14
system/locale/default.nix Normal file
View File

@@ -0,0 +1,14 @@
{ systemSettings, ... }: {
i18n.defaultLocale = systemSettings.locale;
i18n.extraLocaleSettings = {
LC_ADDRESS = systemSettings.locale;
LC_IDENTIFICATION = systemSettings.locale;
LC_MEASUREMENT = systemSettings.locale;
LC_MONETARY = systemSettings.locale;
LC_NAME = systemSettings.locale;
LC_NUMERIC = systemSettings.locale;
LC_PAPER = systemSettings.locale;
LC_TELEPHONE = systemSettings.locale;
LC_TIME = systemSettings.locale;
};
}

View File

@@ -0,0 +1,9 @@
{ systemSettings, ... }:
{
networking = {
hostName = systemSettings.hostname;
networkmanager.enable = true;
firewall.enable = true;
};
systemd.network.wait-online.enable = false;
}

33
system/nix/default.nix Normal file
View File

@@ -0,0 +1,33 @@
{ ... }: {
nix = {
gc.automatic = false;
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
allowed-users = ["@wheel"];
trusted-users = ["@wheel"];
commit-lockfile-summary = "Update flake.lock";
accept-flake-config = true;
keep-derivations = true;
keep-outputs = true;
warn-dirty = false;
sandbox = true;
max-jobs = "auto";
log-lines = 30;
experimental-features = [ "nix-command" "flakes" ];
substituters = [
"https://cache.nixos.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
};
nixpkgs = {
config = {
allowUnfree = true;
};
};
}

View File

@@ -0,0 +1,12 @@
{ ... }: {
imports = [
./cups
./flatpak
./libvirtd
./podman
./polkit
./ssh
./steam
./tailscale
];
}

View File

@@ -1,5 +0,0 @@
{ ... }:
{
networking.networkmanager.enable = true;
systemd.network.wait-online.enable = false;
}

6
system/time/default.nix Normal file
View File

@@ -0,0 +1,6 @@
{ systemSettings, ... }:
{
time.timeZone = systemSettings.timezone;
services.timesyncd.enable = true;
}

21
system/users/default.nix Normal file
View File

@@ -0,0 +1,21 @@
{ pkgs, config, userSettings, ... }: {
users.users.${userSettings.username} = {
isNormalUser = true;
description = userSettings.name;
extraGroups = [
"networkmanager"
"wheel"
"docker"
"podman"
"input"
"flatpak"
"dialout"
"video"
"audio"
"libvirtd"
];
uid = 1000;
};
users.defaultUserShell = pkgs.bash;
}

11
system/wm/default.nix Normal file
View File

@@ -0,0 +1,11 @@
{ ... }: {
imports = [
./dbus
./fonts
./gnome-keyring
./plasma
./sddm
./sway
./xmonad
];
}

View File

@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
{
imports = [
./dbus.nix
../dbus
];
services.desktopManager.plasma6.enable = true;

View File

@@ -1,12 +1,12 @@
{ config, pkgs, lib, ... }:
{
imports = [
./fonts.nix
./dbus.nix
./gnome-keyring.nix
./xmonad.nix
./sway.nix
./plasma.nix
../fonts
../dbus
../gnome-keyring
../xmonad
../sway
../plasma
];
environment.systemPackages = with pkgs; [

View File

@@ -1,8 +1,8 @@
{ pkgs, lib, config, ... }:
{
imports = [
./gnome-keyring.nix
./dbus.nix
../gnome-keyring
../dbus
];
programs.sway = {