populated configuration

This commit is contained in:
2024-08-13 14:49:24 +09:00
parent f295d29525
commit 603379ca7b
17 changed files with 278 additions and 3 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@
# Ignore build outputs from performing a nix-build or `nix build` command # Ignore build outputs from performing a nix-build or `nix build` command
result result
result-* result-*
*.swp

View File

@@ -8,6 +8,8 @@
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./system/services/cups.nix
./system/services/ssh.nix
]; ];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
@@ -46,7 +48,7 @@
# services.xserver.xkb.options = "eurosign:e,caps:escape"; # services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; #services.printing.enable = true;
# Enable sound. # Enable sound.
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
@@ -76,8 +78,14 @@
wget wget
htop htop
mc mc
git
]; ];
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
@@ -89,7 +97,7 @@
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; #services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];

69
flake.nix Normal file
View File

@@ -0,0 +1,69 @@
{
description = "kenryuS nixos configurations/dotfiles";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs@{ nixpkgs, home-manager, ... }:
let
systemSettings = {
system = "x86_64-linux";
hostname = "kenryu-nixos";
machine = "workstation";
timezone = "Asia/Tokyo";
locale = "ja_JP.UTF-8";
bootConf = {
mode = "uefi";
mountPath = "/boot";
grubDev = "";
};
gpuType = "nvidia";
};
userSettings = {
username = "kenryus";
name = "Kenryu Shibata";
email-dev = "kenryudev5894@gmail.com";
dotfilesDir = "/etc/nixos";
editor = "nvim";
editor-pkg = pkgs.neovim;
};
pkgs = import inputs.nixpkgs {
system = systemSettings.system;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
};
lib = inputs.nixpkgs.lib;
home-manager = inputs.home-manager;
in {
nixOSConfiguration = {
system = lib.nixosSystem {
system = systemSettings.system;
modules = [
("./machines/" + systemSettings.machine + "/configuration.nix")
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.extraSpecialArgs = {
inherit userSettings;
};
}
];
specialArgs = {
inherit systemSettings;
inherit userSettings;
inherit inputs;
};
};
};
};
}

39
machines/base.nix Normal file
View File

@@ -0,0 +1,39 @@
{ pkgs, lib, config, systemSettings, userSettings, ... }:
{
imports = [
../system/hardware/audio.nix
../system/hardware/time.nix
../system/services/network-manager.nix
../system/utils.nix
];
time.timeZone = systemSettings.timezone;
networking.hostName = systemSettings.hostname;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
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;
};
users.users.${userSettings.username} = {
isNormalUser = true;
description = userSettings.name;
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
uid = 1000;
};
envirnment.shells = with pkgs; [ bash ];
users.defaultUserShell = pkgs.bash;
}

View File

@@ -0,0 +1,50 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../base.nix
../../system/services/cups.nix
../../system/services/ssh.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}

View File

@@ -0,0 +1,41 @@
# 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" "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" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/d933c349-8e70-41e1-8d13-605656dba18b"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,13 @@
{ pkgs, userSettings, ... }:
{
home.username = userSettings.username;
home.homeDirectory = "/home/" + userSettings.username;
programs.home-manager.enable = true;
imports = [];
home.stateVersion = "24.05";
home.packages = with pkgs; [];
}

View File

@@ -0,0 +1,4 @@
{ ... }:
{
hardware.pulseaudio.enable = true;
}

View File

@@ -0,0 +1,5 @@
{ ... }:
{
hardware.bluetooth.enable = true;
services.blueman.enable = true;
}

View File

@@ -0,0 +1,5 @@
{ config, pkgs, ... }:
{
boot.kernelPackages = pkgs.linuxPackages_xanmod_stable;
boot.consoleLogLevel = 3;
}

View File

@@ -0,0 +1,7 @@
{ pkgs, ... }:
{
hardware.opengl.enable = true;
hardware.opengl.extraPackages = with pkgs; [
mesa
];
}

4
system/hardware/time.nix Normal file
View File

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

4
system/services/cups.nix Normal file
View File

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

View File

@@ -0,0 +1,4 @@
{ ... }:
{
networking.networkmanager.enable = true;
}

9
system/services/ssh.nix Normal file
View File

@@ -0,0 +1,9 @@
{...}:
{
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
};
};
}

13
system/utils.nix Normal file
View File

@@ -0,0 +1,13 @@
{ lib, pkgs, ... }:
{
# minimal utilities for using linux
environment.systemPackages = with pkgs; [
vim
wget
htop
mc
git
parted
tree
];
}