Commit 4b48301
2026-08-02 16:31:34
Changed files (23)
.helix
modules
hosts
cyrene
hyacine
kevin
mobius
tribios
users
.helix/languages.toml
@@ -0,0 +1,13 @@
+[[language]]
+name = "nix"
+auto-format = true
+language-servers = ["nixd"]
+
+[language-server.nixd.config.nixd]
+formatting.command = ["alejandra"]
+nixpkgs = { expr = "(builtins.import ./default.nix).outputs.currentSystem._module.args.pkgs" }
+
+[language-server.nixd.config.nixd.options]
+flake-parts = { expr = "(builtins.import ./default.nix).outputs.debug.options" }
+nixos = { expr = "(builtins.import ./default.nix).outputs.nixosConfigurations.kevin.options" }
+hjem = { expr = "(builtins.import ./default.nix).outputs.nixosConfigurations.kevin.options.hjem.users.type.getSubOptions []" }
modules/hosts/cyrene/default.nix
@@ -0,0 +1,14 @@
+{
+ den.hosts.cyrene = {
+ system = "x86_64-linux";
+ description = ''
+ Cyrene - x86_64 Linux VPS as my center remote server.
+ Based on a KVM virtual host,
+ with 2 virtual core CPU, 2GB RAM and 60GB SSD storage.
+ '';
+
+ users.hpcesia = {
+ classes = ["user" "hjem"];
+ };
+ };
+}
modules/hosts/hyacine/default.nix
@@ -0,0 +1,14 @@
+{
+ den.hosts.hyacine = {
+ system = "x86_64-linux";
+ description = ''
+ Hyacine - x86_64 Linux VPS for lightweight tasks.
+ Based on a KVM virtual host,
+ with AMD EPYC 7K62 2 core @ 2.6GHz, 2GB RAM and 30GB SSD storage.
+ '';
+
+ users.hpcesia = {
+ classes = ["user" "hjem"];
+ };
+ };
+}
modules/hosts/kevin/default.nix
@@ -0,0 +1,14 @@
+{
+ den.hosts.kevin = {
+ system = "x86_64-linux";
+ description = ''
+ Kevin - x86_64 Linux laptop for work and gaming.
+ Based on a Lenovo ThinkBook 16P G5 IRX,
+ with Intel Core i7-14650HX, 32GB RAM and 2TB NVMe storage.
+ '';
+
+ users.hpcesia = {
+ classes = ["user" "hjem"];
+ };
+ };
+}
modules/hosts/mobius/default.nix
@@ -0,0 +1,14 @@
+{
+ den.hosts.mobius = {
+ system = "x86_64-linux";
+ description = ''
+ Mobius - x86_64 Linux server as my homelab.
+ Based on a Topfell DeskOne T2 mini PC,
+ with AMD Ryzen 7 H255, 16GB RAM and 1TB NVMe storage.
+ '';
+
+ users.hpcesia = {
+ classes = ["user" "hjem"];
+ };
+ };
+}
modules/hosts/tribios/default.nix
@@ -0,0 +1,14 @@
+{
+ den.hosts.tribios = {
+ system = "aarch64-linux";
+ description = ''
+ Tribios - Aarch64 Linux router for home network.
+ Based on a Friendly Nano Pi R6S board,
+ with Rockchip RK3588S, 4GB RAM and 64GB eMMC storage.
+ '';
+
+ users.hpcesia = {
+ classes = ["user" "hjem"];
+ };
+ };
+}
modules/hosts/default.nix
@@ -0,0 +1,5 @@
+{den, ...}: {
+ den.default.includes = [
+ den.batteries.hostname
+ ];
+}
modules/hosts/schema.nix
@@ -0,0 +1,6 @@
+{
+ den.schema.host = {
+ options = {
+ };
+ };
+}
modules/users/hpcesia/default.nix
@@ -0,0 +1,4 @@
+{
+ den.aspects.hpcesia = {
+ };
+}
modules/users/default.nix
@@ -0,0 +1,16 @@
+{
+ den.default.includes = [
+ ({
+ host,
+ user,
+ ...
+ }: {
+ name = "user-define/${user.userName}@${host.name}";
+ nixos.users.users.${user.userName} = {
+ name = user.userName;
+ home = "/home/${user.userName}";
+ isNormalUser = true;
+ };
+ })
+ ];
+}
modules/users/schema.nix
@@ -0,0 +1,2 @@
+{
+}
modules/den.nix
@@ -0,0 +1,9 @@
+{
+ inputs,
+ den,
+ ...
+}: {
+ imports = [inputs.den.flakeModule];
+
+ flake.den = den; # For debug
+}
modules/flake-file.nix
@@ -0,0 +1,34 @@
+{inputs, ...}: {
+ imports = [inputs.flake-file.flakeModules.dendritic];
+
+ flake-file = {
+ description = "IX - HPCesia's NixOS configuration all my machines.";
+
+ formatter = pkgs: pkgs.alejandra;
+
+ inputs = {
+ # Basic
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ flake-file.url = "github:denful/flake-file";
+
+ flake-parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+
+ flake-compat.url = "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz";
+
+ # $HOME manage
+ hjem = {
+ url = "github:feel-co/hjem";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ # Dendritic
+ den.url = "github:denful/den";
+
+ import-tree.url = "github:denful/import-tree";
+ };
+ };
+}
modules/flake-parts.nix
@@ -0,0 +1,13 @@
+{den, ...}: {
+ debug = true;
+
+ # Read flake-parts classes from hosts and their includes
+ den.policies.flake-parts-to-host = _:
+ map (host: den.lib.policy.resolve.to "host" {inherit host;}) (
+ builtins.concatMap builtins.attrValues (builtins.attrValues den.hosts)
+ );
+ den.schema.flake-parts.includes = [den.policies.flake-parts-to-host];
+
+ # Enter flake-parts scope from flake-system.
+ den.schema.flake-system.includes = [den.policies.system-to-flake-parts];
+}
.envrc
@@ -0,0 +1,3 @@
+use nix
+export NH_FILE=./default.nix
+export NH_ATTRP=nixosConfigurations.$(hostname)
.gitignore
@@ -0,0 +1,11 @@
+# Nix
+.direnv
+result
+result-*
+
+# VM
+*.qcow2
+
+# General
+.DS_Store
+
AGENTS.md
@@ -0,0 +1,24 @@
+# IX
+
+IX is a Nix configuration built with [Dendritic Pattern](https://github.com/mightyiam/dendritic)
+and [den](https://github.com/denful/den).
+
+## Code Style
+
+- DO NOT ADD ANY COMMENTS unless asked. Comments should describe why not what,
+ code should be self documenting as to what.
+- After 3+ workarounds in the same area, redesign the component instead of
+ patching further.
+
+## Development commands
+
+```sh
+# Build a nixosConfiguration for specific host
+just build <hostname> --no-nom --diff=never
+
+# Regenerate flake.nix & flake.lock after add modify flake inputs by flake-file
+just write-flake
+
+# Get path of a nix flake input
+nix eval --impure --expr '(builtins.import ./default.nix).inputs.<input>.outPath'
+```
default.nix
@@ -0,0 +1,16 @@
+let
+ lockFile = builtins.fromJSON (builtins.readFile ./flake.lock);
+ flake-compat-node = lockFile.nodes.${lockFile.nodes.root.inputs.flake-compat};
+ flake-compat = fetchTarball {
+ inherit (flake-compat-node.locked) url;
+ sha256 = flake-compat-node.locked.narHash;
+ };
+
+ flake = (
+ import flake-compat {
+ src = ./.;
+ copySourceTreeToStore = false; # No more copying to the store
+ }
+ );
+in
+ flake.defaultNix
flake.lock
@@ -0,0 +1,131 @@
+{
+ "nodes": {
+ "den": {
+ "locked": {
+ "lastModified": 1786475005,
+ "narHash": "sha256-gp7Q7rMEjsqAyW4Uwz+sms8j+XegD5P/lzRCuMW2fNI=",
+ "owner": "denful",
+ "repo": "den",
+ "rev": "e8e8de1e32646456cfc613f152175a7a548508ec",
+ "type": "github"
+ },
+ "original": {
+ "owner": "denful",
+ "repo": "den",
+ "type": "github"
+ }
+ },
+ "flake-compat": {
+ "locked": {
+ "lastModified": 1777699697,
+ "narHash": "sha256-Eg9b/rq/ECYwNwEXs5i9wHyhxNI0JrYx2srdI2uZMaQ=",
+ "rev": "382052b74656a369c5408822af3f2501e9b1af81",
+ "type": "tarball",
+ "url": "https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/382052b74656a369c5408822af3f2501e9b1af81.tar.gz?rev=382052b74656a369c5408822af3f2501e9b1af81"
+ },
+ "original": {
+ "type": "tarball",
+ "url": "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz"
+ }
+ },
+ "flake-file": {
+ "locked": {
+ "lastModified": 1781217157,
+ "narHash": "sha256-N3q/SP2Ropk336e9KSgLh7kpROY6P70dprYdbPIfd5c=",
+ "owner": "denful",
+ "repo": "flake-file",
+ "rev": "ce63eaf7ebfe04a176653f66385a7f0a36380cee",
+ "type": "github"
+ },
+ "original": {
+ "owner": "denful",
+ "repo": "flake-file",
+ "type": "github"
+ }
+ },
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1782949081,
+ "narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "hjem": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1785525782,
+ "narHash": "sha256-M9v4zyKLYSVv2RYB4iYTg2THKvW3mDlj+fR1KvW9G3w=",
+ "owner": "feel-co",
+ "repo": "hjem",
+ "rev": "d628ecda714785fddf86cad28ee4f506dc5b7eb9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "feel-co",
+ "repo": "hjem",
+ "type": "github"
+ }
+ },
+ "import-tree": {
+ "locked": {
+ "lastModified": 1778781969,
+ "narHash": "sha256-Jjuz5CmSkur8KvLDoGa+vylEp+RkQtv4mt/qcMznpH0=",
+ "owner": "denful",
+ "repo": "import-tree",
+ "rev": "d321337efd0f23a9eb14a42adb7b2c29313ab274",
+ "type": "github"
+ },
+ "original": {
+ "owner": "denful",
+ "repo": "import-tree",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1785571196,
+ "narHash": "sha256-KoTsyMQqnXQZq8deCEnu4QkyldkwH/bpMMhUcfMdGIw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "148bab9c1c3c53136ecb44a6ea356a0ed5b39b06",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "den": "den",
+ "flake-compat": "flake-compat",
+ "flake-file": "flake-file",
+ "flake-parts": "flake-parts",
+ "hjem": "hjem",
+ "import-tree": "import-tree",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
flake.nix
@@ -0,0 +1,23 @@
+# DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file.
+# Use `nix run .#write-flake` to regenerate it.
+{
+ description = "IX - HPCesia's NixOS configuration all my machines.";
+
+ outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} (inputs.import-tree ./modules);
+
+ inputs = {
+ den.url = "github:denful/den";
+ flake-compat.url = "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz";
+ flake-file.url = "github:denful/flake-file";
+ flake-parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+ hjem = {
+ url = "github:feel-co/hjem";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ import-tree.url = "github:denful/import-tree";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ };
+}
justfile
@@ -0,0 +1,29 @@
+#!/usr/bin/env just --justfile
+
+set shell := ["bash", "-cu"]
+
+current_hostname:= `hostname`
+
+[private]
+run-nh mode hostname=current_hostname *flags:
+ nh os {{mode}} -f ./default.nix nixosConfigurations.{{hostname}} --hostname={{hostname}} \
+ {{if hostname != current_hostname {"--target-host=hpcesia@" + hostname} else {""}}} \
+ {{flags}}
+# Build system profile of specific host
+@build *args:
+ just run-nh build {{args}}
+# Build system profile of specific host, make it boot default
+@boot *args:
+ just run-nh boot {{args}}
+# Build and activate system profile of specific host, make it boot default
+@switch *args:
+ just run-nh switch {{args}}
+
+# REPL current configuration
+repl:
+ nix repl -f ./default.nix -v --show-trace
+
+# Write flake-files config into "flake.nix"
+write-flake:
+ nix run .#write-flake
+ nix flake lock
README.md
@@ -0,0 +1,12 @@
+# IX
+
+HPCesia's [Dendritic Pattern](https://github.com/mightyiam/dendritic) NixOS
+configuration for all my machines, powered by [den](https://github.com/denful/den).
+
+## Acknowledgements
+
+- [chlorine/shosai](https://src.chlo.is/chlorine/shosai)
+- [drupol/infra](https://github.com/drupol/infra)
+- [ryan4yin/nix-config](https://github.com/ryan4yin/nix-config)
+- [sini/nix-config](https://github.com/sini/nix-config)
+- [xddxdd/nixos-config](https://github.com/xddxdd/nixos-config)
shell.nix
@@ -0,0 +1,15 @@
+let
+ lockFile = builtins.fromJSON (builtins.readFile ./flake.lock);
+ flake-compat-node = lockFile.nodes.${lockFile.nodes.root.inputs.flake-compat};
+ flake-compat = fetchTarball {
+ inherit (flake-compat-node.locked) url;
+ sha256 = flake-compat-node.locked.narHash;
+ };
+
+ flake = (
+ import flake-compat {
+ src = ./.;
+ }
+ );
+in
+ flake.shellNix