reorganisation
This commit is contained in:
55
modules/system/core/_hardware-configuration.nix
Normal file
55
modules/system/core/_hardware-configuration.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
# 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 = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/7e9a351d-22a4-44dc-a29e-317a8bf5d346";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/home/user01/Tank" = {
|
||||
device = "/dev/disk/by-uuid/26739c9c-da0a-4fc3-9958-cb2d4a4eff13";
|
||||
fsType = "ext4";
|
||||
options = [
|
||||
"defaults"
|
||||
"user"
|
||||
"rw"
|
||||
"exec"
|
||||
];
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/7A34-CD26";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
25
modules/system/core/bootloader.nix
Normal file
25
modules/system/core/bootloader.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{...}: {
|
||||
# Define flake part nixosModule "bootloader" and pass in pkgs
|
||||
flake.nixosModules.bootloader = {pkgs, ...}: {
|
||||
# Normal nix code
|
||||
boot = {
|
||||
loader = {
|
||||
# Set bootloader timeout
|
||||
timeout = 2;
|
||||
efi = {
|
||||
# Enable efi var mutation
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
# Enable grub
|
||||
grub = {
|
||||
efiSupport = true;
|
||||
# Fix resolution issues
|
||||
device = "nodev";
|
||||
};
|
||||
};
|
||||
|
||||
# Set kernel to latest available version
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
};
|
||||
};
|
||||
}
|
||||
25
modules/system/core/default.nix
Normal file
25
modules/system/core/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{self, ...}: {
|
||||
# This module acts as a collection of other modules, for ease
|
||||
# of use. Adding another module to this list will import it
|
||||
# for all other modules that import this one.
|
||||
|
||||
# Keep in mind that you cannot import this module alongside
|
||||
# any of its children. For example, importing this module and
|
||||
# the user module in the same block is the same as importing
|
||||
# the user module twice, leading to an error due to trying
|
||||
# to define the same user twice.
|
||||
|
||||
# Collections should be used for static lists of modules, like
|
||||
# those that would make up a basic system, as seen here.
|
||||
|
||||
# Define flake part nixosModule "core"
|
||||
flake.nixosModules.core = {...}: let
|
||||
modules = with self.nixosModules; [
|
||||
user
|
||||
bootloader
|
||||
imports
|
||||
];
|
||||
in {
|
||||
imports = modules;
|
||||
};
|
||||
}
|
||||
12
modules/system/core/imports.nix
Normal file
12
modules/system/core/imports.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{...}: {
|
||||
# Define flake part nixosModule "imports"
|
||||
flake.nixosModules.imports = {...}: {
|
||||
# Import sibling file
|
||||
imports = [
|
||||
# Prefacing file names with underscores means that
|
||||
# import-tree will ignore them. You do not need to
|
||||
# preface files that don't have a ".nix" ending
|
||||
./_hardware-configuration.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
23
modules/system/core/nix-settings.nix
Normal file
23
modules/system/core/nix-settings.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{inputs, ...}: {
|
||||
# PerSystem, allows for universal module access
|
||||
perSystem = {system, ...}: {
|
||||
# Pre-defined object
|
||||
_module.args = {
|
||||
# Custom object, creating a new nixpkgs from a different input
|
||||
unstablePkgs = import inputs.nixpkgs-unstable {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
# Another example not in the video, creating an unfree instance of nixpkgs
|
||||
# Setting nixpkgs.config.free = true isn't possible through a normal nixosModule,
|
||||
# because of how inheritance works with nixos exclusive objects
|
||||
unfreePkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
# You can also set universal variables here, if you need to access the same info across files
|
||||
someVariable = "import this as you would import pkgs, in a perSystem block";
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/system/core/user.nix
Normal file
18
modules/system/core/user.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{...}: {
|
||||
# Define flake part nixosModule "user"
|
||||
flake.nixosModules.user = {...}: {
|
||||
# Normal nix code
|
||||
# Define user called user01
|
||||
users.users.user01 = {
|
||||
# Make not root explicitly (prevents permission issues)
|
||||
isNormalUser = true;
|
||||
# Password for vm
|
||||
initialPassword = "password";
|
||||
# Allow use of sudo with password
|
||||
extraGroups = [
|
||||
"root"
|
||||
"wheel"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user