🚧 Implement basic easy-hosts configuration and flake structure

📝 Add credits and structure
This commit is contained in:
Jo 2025-01-13 23:35:54 +01:00
parent 4a6199eacb
commit 9dc26a0db6
10 changed files with 250 additions and 0 deletions

View file

@ -33,3 +33,24 @@ The main goals of this rewritten flake are:
- improved secrets management
- keeping external assets closer to their related nix file, e.g. wallpapers in
the desktop modules folder
## 🏗️ Structure
The structure this flake aims to build on is relatively simple to grasp.
```
flake.nix --> The flake.
/systems --> NixOS configurations for various types of systems, using easy-hosts.
/modules --> Modules that are mapped to their corresponding easy-hosts class (and home modules).
/nixos --> (example) Modules specific to the nixos class configured in easy-hosts.
/homes --> Directory for home-manager configurations, not specific to the system type.
/lib --> A place for custom lib attributes exposed on the flake namespace (lib.puzzlevision.mkOpt).
(more...) --> Additional directories have been considered (e.g. shells), but as of right now, they serve no use to me.
```
## 🎨 Credits
Parts of this flake were inspired by the likes of:
- [isabelroses](https://github.com/isabelroses)
- [uncenter](https://github.com/uncenter)
Many thanks to their hard work!

85
flake.lock Normal file
View file

@ -0,0 +1,85 @@
{
"nodes": {
"easy-hosts": {
"locked": {
"lastModified": 1736680851,
"narHash": "sha256-KUkO4H0W+1u5piwAzIzCuVhamQ0L3io8vR61NrODtHs=",
"owner": "isabelroses",
"repo": "easy-hosts",
"rev": "450d2ae463bb8fb55194f33073ebdd83b8b7ddaa",
"type": "github"
},
"original": {
"owner": "isabelroses",
"repo": "easy-hosts",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736785676,
"narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1736701207,
"narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"easy-hosts": "easy-hosts",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
{
description = "Jo's dotfiles";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Flake parts, a library that provides utilites for creating flakes
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
# Provides an easy interface for loading systems from a directory
easy-hosts.url = "github:isabelroses/easy-hosts";
#
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
./systems
];
systems = [ "x86_64-linux" ];
};
}

1
homes/default.nix Normal file
View file

@ -0,0 +1 @@
{}

1
homes/jo/default.nix Normal file
View file

@ -0,0 +1 @@
{}

1
modules/home/default.nix Normal file
View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

30
systems/default.nix Normal file
View file

@ -0,0 +1,30 @@
{
lib,
self,
inputs,
...
}:
{
imports = [ inputs.easy-hosts.flakeModule ];
easyHosts = {
autoConstruct = true;
path = ../systems;
shared.modules = [
../homes
];
perClass =
class:
{
modules = [
"${self}/modules/${class}"
(lib.optionals (class == "nixos") [
inputs.home-manager.nixosModules.home-manager
])
];
};
};
}

View file

@ -0,0 +1,27 @@
{
pkgs,
...
}:
{
imports = [
./hardware.nix
];
# Enable Plasma6
services.xserver.enable = true;
services.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
# Todo: pass a set of users to enable from within easy-hosts and automatically map the corresponding home-manager configurations
# Register "jo" as a user
users.users.jo.isNormalUser = true;
users.users.jo.extraGroups = [ "dialout" "docker" ];
users.users.jo.initialPassword = "balls";
users.users.jo.createHome = true;
environment.systemPackages = with pkgs; [
ghostty
];
system.stateVersion = "25.05";
}

View file

@ -0,0 +1,52 @@
# 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 = [ "xhci_pci" "vmd" "nvme" "usbhid" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/864b1287-89fd-4cc0-98a5-40a3caf804c6";
fsType = "btrfs";
options = [ "subvol=@" ];
};
boot.initrd.luks.devices."luks-5fd4fc76-d5c5-46c3-b952-1a7a7ff3a1fc".device = "/dev/disk/by-uuid/5fd4fc76-d5c5-46c3-b952-1a7a7ff3a1fc";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/2429-4141";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.br-01571e4eda2f.useDHCP = lib.mkDefault true;
# networking.interfaces.br-20785fae249b.useDHCP = lib.mkDefault true;
# networking.interfaces.br-64a49a5722c1.useDHCP = lib.mkDefault true;
# networking.interfaces.br-71e5fc5962fc.useDHCP = lib.mkDefault true;
# networking.interfaces.br-7df9905783da.useDHCP = lib.mkDefault true;
# networking.interfaces.br-9b746f4e7e2f.useDHCP = lib.mkDefault true;
# networking.interfaces.br-e2f470a56dfe.useDHCP = lib.mkDefault true;
# networking.interfaces.docker0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s13f0u4u4.useDHCP = lib.mkDefault true;
# networking.interfaces.veth4e96b46.useDHCP = lib.mkDefault true;
# networking.interfaces.veth96a5ccd.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}