Compare commits

...

3 Commits

Author SHA1 Message Date
ae59ef84f8 modified some files, removed backup files 2024-08-13 15:33:25 +09:00
712920a3df modified flake.nix 2024-08-13 15:00:50 +09:00
603379ca7b populated configuration 2024-08-13 14:49:24 +09:00
17 changed files with 293 additions and 126 deletions

2
.gitignore vendored
View File

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

View File

@@ -1,125 +0,0 @@
# 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
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Asia/Tokyo";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networking.networkmanager.enable = true;
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound.
hardware.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# firefox
# tree
# ];
# };
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
htop
mc
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# 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?
}

66
flake.lock generated Normal file
View File

@@ -0,0 +1,66 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1720042825,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.05",
"repo": "home-manager",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1723310128,
"narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1723282977,
"narHash": "sha256-oTK91aOlA/4IsjNAZGMEBz7Sq1zBS0Ltu4/nIQdYDOg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a781ff33ae258bbcfd4ed6e673860c3e923bf2cc",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

67
flake.nix Normal file
View File

@@ -0,0 +1,67 @@
{
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 {
nixosConfigurations.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;
};
environment.shells = with pkgs; [ bash ];
users.defaultUserShell = pkgs.bash;
}

View File

@@ -0,0 +1,51 @@
# 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
../../system/hardware/kernel.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,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";
};
};
}

14
system/utils.nix Normal file
View File

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