added readme and comments for part 1

This commit is contained in:
2026-10-17 18:41:53 +01:00
parent 468eedf901
commit 0e3718ab22
12 changed files with 85 additions and 5 deletions

View File

@@ -1,9 +1,12 @@
{
# Import self and universal inputs (different to inputs')
self,
inputs,
...
}: {
# Define nixosConfiguration with hostname "host"
flake.nixosConfigurations.host = inputs.nixpkgs.lib.nixosSystem {
# Define modules to import
modules = with self.nixosModules; [
hostConfiguration
system

View File

@@ -1,5 +1,7 @@
{...}: {
# Define flake part nixosModule "hostConfiguration" and pass in arch specific pkgs
flake.nixosModules.hostConfiguration = {pkgs, ...}: {
# Normal nix code within module, add git to systemPackages
environment.systemPackages = with pkgs; [
git
];

View File

@@ -1,11 +1,14 @@
{
# Import self and universal inputs (different to inputs')
self,
inputs,
...
}: {
# Define nixosConfiguration with hostname "newHost"
flake.nixosConfigurations.newHost = inputs.nixpkgs.lib.nixosSystem {
# Define modules to import
modules = with self.nixosModules; [
newHostConfiguration
newHostConfiguration
system
];
};

View File

@@ -1,8 +1,9 @@
{...}: {
# Define flake part nixosModule "newHostConfiguration" and pass in arch specific pkgs
flake.nixosModules.newHostConfiguration = {pkgs, ...}: {
# Normal nix code within module, add git to systemPackages
environment.systemPackages = with pkgs; [
fastfetch
];
};
}

View File

@@ -1,4 +1,7 @@
{
# Define what systems the modules are runnable on.
# Some pacakges may not have an aarch64 version, consult
# nixpkgs to check.
config = {
systems = [
"x86_64-linux"

View File

@@ -1,16 +1,24 @@
{...}: {
# 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;
};
};

View File

@@ -1,10 +1,24 @@
{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 "system"
flake.nixosModules.system = {...}: let
modules = with self.nixosModules; [
user
networking
bootloader
imports
imports
];
in {
imports = modules;

View File

@@ -1,6 +1,11 @@
{...}: {
# 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
];
};

View File

@@ -1,17 +1,25 @@
{...}: {
# Define flake part nixosModule "networking"
flake.nixosModules.networking = {...}: {
# Normal nix code
networking = {
# Enable networkManager
networkmanager = {
enable = true;
# Disable router dns
dns = "none";
};
# cloudflare nameservers
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
# disable firewall
firewall.enable = false;
};
# Disable "wait-online" target, makes connecting to network
# async on boot
systemd.services.NetworkManager-wait-online.enable = false;
};
}

View File

@@ -1,8 +1,14 @@
{...}: {
# 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"