added readme and comments for part 1
This commit is contained in:
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Dendritic Example Repo
|
||||||
|
|
||||||
|
Videos can be found [on my channel](https://www.youtube.com/@Adumh00man).
|
||||||
|
|
||||||
|
This is supposed to be a minimal dendritic nix configuration, some things may be
|
||||||
|
deliberately missing or broken for demonstrative purposes in some commits.
|
||||||
|
|
||||||
|
This repo will most likely not work on bare metal, using a vm is reccomended for
|
||||||
|
tinkering and getting your head around things. This can be done with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nixos-rebuild build-vm --flake .#host
|
||||||
|
```
|
||||||
|
|
||||||
|
Some commits will require impure evaluation, although I will keep this to a minimum.
|
||||||
|
|
||||||
|
Comments have been placed outside of filming to explain what parts of the code do,
|
||||||
|
as this is a mostly "for reference" repo.
|
||||||
|
|
||||||
|
Any issues or typos or whatever can be reported via [email](mailto://admin@voidarc.co.uk)
|
||||||
|
or [matrix](https://matrix.to/#/@admin:voidarc.co.uk). Lots of love <3
|
||||||
10
flake.nix
10
flake.nix
@@ -2,13 +2,19 @@
|
|||||||
description = "some config";
|
description = "some config";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
# Latest stable nixpkgs
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
|
||||||
|
|
||||||
|
# Flake parts utils
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
import-tree.url = "github:vic/import-tree";
|
import-tree.url = "github:vic/import-tree";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Default import-tree output
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
inputs.flake-parts.lib.mkFlake {inherit inputs;}
|
# Pass all inputs to outputs
|
||||||
(inputs.import-tree ./modules);
|
inputs.flake-parts.lib.mkFlake {
|
||||||
|
# Call mkFlake from flake-parts module
|
||||||
|
inherit inputs; # Inherit inputs (required to get correct arch for self')
|
||||||
|
} (inputs.import-tree ./modules); # Pass in all modules using import-tree
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
# Import self and universal inputs (different to inputs')
|
||||||
self,
|
self,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
# Define nixosConfiguration with hostname "host"
|
||||||
flake.nixosConfigurations.host = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations.host = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
# Define modules to import
|
||||||
modules = with self.nixosModules; [
|
modules = with self.nixosModules; [
|
||||||
hostConfiguration
|
hostConfiguration
|
||||||
system
|
system
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "hostConfiguration" and pass in arch specific pkgs
|
||||||
flake.nixosModules.hostConfiguration = {pkgs, ...}: {
|
flake.nixosModules.hostConfiguration = {pkgs, ...}: {
|
||||||
|
# Normal nix code within module, add git to systemPackages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
# Import self and universal inputs (different to inputs')
|
||||||
self,
|
self,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
# Define nixosConfiguration with hostname "newHost"
|
||||||
flake.nixosConfigurations.newHost = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations.newHost = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
# Define modules to import
|
||||||
modules = with self.nixosModules; [
|
modules = with self.nixosModules; [
|
||||||
newHostConfiguration
|
newHostConfiguration
|
||||||
system
|
system
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "newHostConfiguration" and pass in arch specific pkgs
|
||||||
flake.nixosModules.newHostConfiguration = {pkgs, ...}: {
|
flake.nixosModules.newHostConfiguration = {pkgs, ...}: {
|
||||||
|
# Normal nix code within module, add git to systemPackages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
fastfetch
|
fastfetch
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = {
|
config = {
|
||||||
systems = [
|
systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "bootloader" and pass in pkgs
|
||||||
flake.nixosModules.bootloader = {pkgs, ...}: {
|
flake.nixosModules.bootloader = {pkgs, ...}: {
|
||||||
|
# Normal nix code
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
|
# Set bootloader timeout
|
||||||
timeout = 2;
|
timeout = 2;
|
||||||
efi = {
|
efi = {
|
||||||
|
# Enable efi var mutation
|
||||||
canTouchEfiVariables = true;
|
canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
|
# Enable grub
|
||||||
grub = {
|
grub = {
|
||||||
efiSupport = true;
|
efiSupport = true;
|
||||||
|
# Fix resolution issues
|
||||||
device = "nodev";
|
device = "nodev";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Set kernel to latest available version
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,18 @@
|
|||||||
{self, ...}: {
|
{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
|
flake.nixosModules.system = {...}: let
|
||||||
modules = with self.nixosModules; [
|
modules = with self.nixosModules; [
|
||||||
user
|
user
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "imports"
|
||||||
flake.nixosModules.imports = {...}: {
|
flake.nixosModules.imports = {...}: {
|
||||||
|
# Import sibling file
|
||||||
imports = [
|
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
|
./_hardware-configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "networking"
|
||||||
flake.nixosModules.networking = {...}: {
|
flake.nixosModules.networking = {...}: {
|
||||||
|
# Normal nix code
|
||||||
networking = {
|
networking = {
|
||||||
|
# Enable networkManager
|
||||||
networkmanager = {
|
networkmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# Disable router dns
|
||||||
dns = "none";
|
dns = "none";
|
||||||
};
|
};
|
||||||
|
# cloudflare nameservers
|
||||||
nameservers = [
|
nameservers = [
|
||||||
"1.1.1.1"
|
"1.1.1.1"
|
||||||
"8.8.8.8"
|
"8.8.8.8"
|
||||||
];
|
];
|
||||||
|
# disable firewall
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Disable "wait-online" target, makes connecting to network
|
||||||
|
# async on boot
|
||||||
systemd.services.NetworkManager-wait-online.enable = false;
|
systemd.services.NetworkManager-wait-online.enable = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
# Define flake part nixosModule "user"
|
||||||
flake.nixosModules.user = {...}: {
|
flake.nixosModules.user = {...}: {
|
||||||
|
# Normal nix code
|
||||||
|
# Define user called user01
|
||||||
users.users.user01 = {
|
users.users.user01 = {
|
||||||
|
# Make not root explicitly (prevents permission issues)
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
# Password for vm
|
||||||
initialPassword = "password";
|
initialPassword = "password";
|
||||||
|
# Allow use of sudo with password
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"root"
|
"root"
|
||||||
"wheel"
|
"wheel"
|
||||||
|
|||||||
Reference in New Issue
Block a user