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";
|
||||
|
||||
inputs = {
|
||||
# Latest stable nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
|
||||
|
||||
# Flake parts utils
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
};
|
||||
|
||||
# Default import-tree output
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;}
|
||||
(inputs.import-tree ./modules);
|
||||
# Pass all inputs to outputs
|
||||
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,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
# Define nixosConfiguration with hostname "host"
|
||||
flake.nixosConfigurations.host = inputs.nixpkgs.lib.nixosSystem {
|
||||
# Define modules to import
|
||||
modules = with self.nixosModules; [
|
||||
hostConfiguration
|
||||
system
|
||||
|
||||
@@ -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
|
||||
];
|
||||
|
||||
@@ -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
|
||||
];
|
||||
};
|
||||
|
||||
@@ -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
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
];
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user