Commit 57bf622
2026-06-10 04:53:42
Changed files (42)
.helix
.zed
modules
core
flake
hosts
hyacine
installer
kevin
mobius
tribios
users
.helix/languages.toml
@@ -0,0 +1,9 @@
+[language-server.nixd.config.nixd]
+nixpkgs = { expr = "(builtins.import (builtins.toString ./default.nix)).currentSystem._module.args.pkgs" }
+formatting.command = ["alejandra"]
+
+[language-server.nixd.config.nixd.options]
+flake-parts = { expr = "(builtins.import (builtins.toString ./default.nix)).debug.options" }
+nixos = { expr = "(builtins.import (builtins.toString ./default.nix)).nixosConfigurations.kevin.options" }
+homeManager = { expr = "(builtins.import (builtins.toString ./default.nix)).homeConfigurations.\"hpcesia@kevin\".options" }
+
.zed/settings.json
@@ -0,0 +1,22 @@
+{
+ "lsp": {
+ "nixd": {
+ "settings": {
+ "nixpkgs": {
+ "expr": "(builtins.import (builtins.toString ./default.nix)).currentSystem._module.args.pkgs",
+ },
+ "options": {
+ "flake-parts": {
+ "expr": "(builtins.import (builtins.toString ./default.nix)).debug.options",
+ },
+ "nixos": {
+ "expr": "(builtins.import (builtins.toString ./default.nix)).nixosConfigurations.kevin.options",
+ },
+ "homeManager": {
+ "expr": "(builtins.import (builtins.toString ./default.nix)).homeConfigurations.\"hpcesia@kevin\".options",
+ },
+ },
+ },
+ },
+ },
+}
modules/core/nix/lix.nix
@@ -0,0 +1,19 @@
+{
+ den.aspects.core.nix.lix = {
+ nixos = {pkgs, ...}: {
+ nixpkgs.overlays = [
+ (final: prev: {
+ inherit
+ (prev.lixPackageSets.stable)
+ nixpkgs-review
+ nix-eval-jobs
+ nix-fast-build
+ colmena
+ ;
+ })
+ ];
+
+ nix.package = pkgs.lixPackageSets.stable.lix;
+ };
+ };
+}
modules/core/nix/nh.nix
@@ -0,0 +1,21 @@
+{
+ den.aspects.core.nix.nh = {
+ nixos = {
+ programs.nh = {
+ enable = true;
+ clean.enable = true;
+ clean.extraArgs = "--keep-since 4d --keep 3";
+ };
+
+ system.tools = {
+ # disable useless tools
+ nixos-build-vms.enable = false;
+ nixos-enter.enable = false;
+ nixos-generate-config.enable = false;
+ nixos-install.enable = false;
+ nixos-option.enable = false;
+ nixos-rebuild.enable = false; # No needed, use `nh os` instead.
+ };
+ };
+ };
+}
modules/core/nix/nix.nix
@@ -0,0 +1,51 @@
+{
+ den.aspects.core.nix = {
+ nixos = {
+ nix.settings = {
+ experimental-features = [
+ "nix-command"
+ "flakes"
+ "auto-allocate-uids"
+ "cgroups"
+ ];
+ # Select UIDs for builds automatically, EXPERIMENTAL
+ auto-allocate-uids = true;
+ # Required by auto-allocate-uids
+ use-cgroups = true;
+ # Automatically hard link identical files in the Nix store
+ auto-optimise-store = true;
+ # Remote servers preferred substituters instead of local builders
+ builders-use-substitutes = true;
+ # Unlimited HTTP connections
+ http-connections = 0;
+ # Use `$XDG_STATE_HOME/nix/...` instead of `$HOME/.nix-...`
+ use-xdg-base-directories = true;
+
+ trusted-users = ["@wheel"];
+
+ flake-registry = "";
+
+ substituters = [
+ # Official cache's mirrors located in China
+ "https://mirrors.ustc.edu.cn/nix-channels/store?priority=10"
+ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store?priority=10"
+ # Official cache
+ "https://nix-community.cachix.org?priority=11"
+
+ # Nixpkgs with CUDA enabled cache
+ "https://cache.flox.dev?priority=20"
+ ];
+ trusted-public-keys = [
+ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+
+ "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
+ ];
+ };
+ nix.channel.enable = false;
+
+ nixpkgs.flake.setFlakeRegistry = true;
+
+ system.copySystemConfiguration = false;
+ };
+ };
+}
modules/core/nix/nixpkgs.nix
@@ -0,0 +1,6 @@
+{
+ den.aspects.core.nix.nixpkgs = {
+ nixos.nixpkgs.config.allowUnfree = true;
+ darwin.nixpkgs.config.allowUnfree = true;
+ };
+}
modules/core/nix/state-versions.nix
@@ -0,0 +1,7 @@
+{
+ den.aspects.core.nix.state-versions = {
+ nixos.system.stateVersion = "26.05";
+ darwin.system.stateVersion = "26.05";
+ homeManager.home.stateVersion = "26.05";
+ };
+}
modules/core/editor.nix
@@ -0,0 +1,26 @@
+{lib, ...}: {
+ den.aspects.core.editor = {
+ settings = {
+ name = lib.mkOption {
+ type = lib.types.str;
+ default = "hx";
+ };
+ package = lib.mkOption {
+ type = lib.types.functionTo lib.types.package;
+ default = pkgs: pkgs.helix;
+ example = lib.literalExpression "pkgs: pkgs.vim";
+ };
+ };
+
+ nixos = {
+ host,
+ pkgs,
+ ...
+ }: {
+ environment.variables.EDITOR = host.settings.core.editor.name;
+ environment.systemPackages = [
+ (host.settings.core.editor.package pkgs)
+ ];
+ };
+ };
+}
modules/core/installer.nix
@@ -0,0 +1,7 @@
+{inputs, ...}: {
+ den.aspects.core.installer = {
+ nixos = {
+ imports = ["${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"];
+ };
+ };
+}
modules/core/localization.nix
@@ -0,0 +1,14 @@
+{
+ den.aspects.core.localization = {
+ nixos = {
+ time.timeZone = "Asia/Shanghai";
+
+ i18n = {
+ defaultLocale = "en_US.UTF-8";
+ extraLocaleSettings = {
+ LC_COLLATE = "C.UTF-8";
+ };
+ };
+ };
+ };
+}
modules/core/nameservers.nix
@@ -0,0 +1,12 @@
+{
+ den.aspects.core.nameservers = {
+ nixos.networking.nameservers = [
+ # IPv4
+ "119.29.29.29" # DNSPod
+ "223.5.5.5" # AliDNS
+ # IPv6
+ "2400:3200::1" # AliDNS
+ "2606:4700:4700::1111" # Cloudflare
+ ];
+ };
+}
modules/core/nftables.nix
@@ -0,0 +1,7 @@
+{
+ den.aspects.core.nftables = {
+ nixos = {
+ networking.nftables.enable = true;
+ };
+ };
+}
modules/core/openssh.nix
@@ -0,0 +1,42 @@
+{lib, ...}: {
+ den.aspects.core.openssh = {
+ nixos = {
+ services.openssh = {
+ generateHostKeys = true;
+ hostKeys = [
+ {
+ path = "/etc/ssh/ssh_host_ed25519_key";
+ type = "ed25519";
+ }
+ {
+ path = "/etc/ssh/ssh_host_rsa_key";
+ type = "rsa";
+ bit = 4096;
+ }
+ ];
+ };
+ };
+ };
+
+ den.aspects.core.openssh.access = {
+ includes = [
+ ({user, ...}: {
+ name = "core.openssh.access.user";
+ user.openssh.authorizedKeys.keys = user.authorizedKeys;
+ })
+ ];
+
+ nixos = {host, ...}: {
+ services.openssh = {
+ enable = true;
+ settings = {
+ PermitRootLogin = "prohibit-password";
+ PasswordAuthentication = false;
+ };
+ openFirewall = true;
+ };
+
+ environment.enableAllTerminfo = true;
+ };
+ };
+}
modules/core/systemd.nix
@@ -0,0 +1,14 @@
+{
+ den.aspects.core.systemd = {
+ nixos = {
+ systemd.tmpfiles.rules = [
+ "d /var/lib/systemd/coredump 0755 root root 7d"
+ ];
+
+ services.journald.extraConfig = ''
+ MaxRetentionSec=3month
+ SystemMaxUse=2G
+ '';
+ };
+ };
+}
modules/core/time-sync.nix
@@ -0,0 +1,11 @@
+{
+ den.aspects.core.time-sync = {
+ nixos = {
+ networking.timeServers = [
+ "ntp.aliyun.com" # Aliyun NTP server
+ "ntp.tencent.com" # Tencent NTP server
+ "time.cloudflare.com" # Cloudflare NTP server
+ ];
+ };
+ };
+}
modules/core/utils.nix
@@ -0,0 +1,34 @@
+{
+ den.aspects.core.utils = {
+ nixos = {pkgs, ...}: {
+ environment.systemPackages = with pkgs; [
+ # Basic tools
+ coreutils
+ findutils
+
+ # Archives process
+ gnutar
+ p7zip
+ unzipNLS
+ xz
+ zip
+ zstd
+
+ # Networking
+ curl
+ netcat
+ tcpdump
+ wget
+
+ # Misc
+ fastfetch.minimal
+ fd
+ file
+ git
+ which
+
+ rsync
+ ];
+ };
+ };
+}
modules/flake/flake-parts/default.nix
@@ -0,0 +1,15 @@
+{den, ...}: {
+ flake-file.inputs.flake-parts.url = "github:hercules-ci/flake-parts";
+
+ # 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];
+
+ debug = true;
+}
modules/flake/flake-parts/devshell.nix
@@ -0,0 +1,27 @@
+{
+ den,
+ inputs,
+ ...
+}: {
+ flake-file.inputs.devshell = {
+ url = "github:numtide/devshell";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ imports = [inputs.devshell.flakeModule];
+
+ den.classes.devshell = {};
+ den.policies.devshell-to-flake-parts = _: [
+ (den.lib.policy.route {
+ fromClass = "devshell";
+ intoClass = "flake-parts";
+ path = [
+ "devshells"
+ "default"
+ ];
+ adaptArgs = {config, ...}: config.allModuleArgs;
+ })
+ ];
+
+ den.schema.flake-parts.includes = [den.policies.devshell-to-flake-parts];
+}
modules/flake/den.nix
@@ -0,0 +1,9 @@
+{
+ inputs,
+ den,
+ ...
+}: {
+ imports = [inputs.den.flakeModule];
+
+ flake.den = den; # For debug
+}
modules/flake/gen-flake.nix
@@ -0,0 +1,34 @@
+{inputs, ...}: {
+ imports = [inputs.flake-file.flakeModules.dendritic];
+
+ flake-file = {
+ description = "IX - HPCesia's NixOS configuration for laptop, homelab and VPS.";
+
+ formatter = pkgs: pkgs.alejandra;
+
+ inputs = {
+ # Basic
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ home-manager = {
+ url = "github:nix-community/home-manager";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ flake-file.url = "github:denful/flake-file";
+
+ flake-parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+
+ # Dendritic
+ den.url = "github:denful/den";
+
+ import-tree.url = "github:denful/import-tree";
+
+ # Other
+ flake-compat.url = "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz";
+ };
+ };
+}
modules/hosts/hyacine/default.nix
@@ -0,0 +1,24 @@
+{den, ...}: {
+ 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 = {
+ authorizedKeys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMKaGC2I3an4AJDeWzVx5vhm63+kxi6zJNdh7yEp6CK hpcesia@kevin"
+ ];
+ };
+
+ pubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINy57YGTUNEbBVs1YHD6m/zhJnJKnicNEaLB5fEcJln6 root@hyacine";
+ };
+
+ den.aspects.hyacine = {
+ includes = [
+ den.aspects.roles.default
+ den.aspects.roles.server
+ ];
+ };
+}
modules/hosts/installer/aarch64.nix
@@ -0,0 +1,29 @@
+{den, ...}: {
+ den.hosts.nixos-live-aarch64 = {
+ system = "aarch64-linux";
+ description = ''
+ Custom nixos installer for aarch64-linux
+ '';
+
+ pubKey = "";
+ };
+
+ den.aspects.nixos-live-aarch64 = {
+ includes = [
+ (den.batteries.tty-autologin "root")
+ den.aspects.core.installer
+ den.aspects.core.nix
+ den.aspects.core.nix.nixpkgs
+ den.aspects.core.nix.state-versions
+ den.aspects.core.editor
+ den.aspects.core.openssh
+ den.aspects.core.openssh.access
+ ];
+
+ nixos = {
+ users.users.root.openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMKaGC2I3an4AJDeWzVx5vhm63+kxi6zJNdh7yEp6CK hpcesia@kevin"
+ ];
+ };
+ };
+}
modules/hosts/installer/x86_64.nix
@@ -0,0 +1,29 @@
+{den, ...}: {
+ den.hosts.nixos-live-x86_64 = {
+ system = "x86_64-linux";
+ description = ''
+ Custom nixos installer for x86_64-linux
+ '';
+
+ pubKey = "";
+ };
+
+ den.aspects.nixos-live-x86_64 = {
+ includes = [
+ (den.batteries.tty-autologin "root")
+ den.aspects.core.installer
+ den.aspects.core.nix
+ den.aspects.core.nix.nixpkgs
+ den.aspects.core.nix.state-versions
+ den.aspects.core.editor
+ den.aspects.core.openssh
+ den.aspects.core.openssh.access
+ ];
+
+ nixos = {
+ users.users.root.openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMKaGC2I3an4AJDeWzVx5vhm63+kxi6zJNdh7yEp6CK hpcesia@kevin"
+ ];
+ };
+ };
+}
modules/hosts/kevin/default.nix
@@ -0,0 +1,25 @@
+{den, ...}: {
+ 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"
+ "homeManager"
+ ];
+ };
+
+ pubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOO9CyAqGo/WbJkncrt1a9jxS1E+hd550SC4A08I/l0/ root@kevin";
+ };
+
+ den.aspects.kevin = {
+ includes = [
+ den.aspects.roles.default
+ den.aspects.roles.develop
+ ];
+ };
+}
modules/hosts/mobius/default.nix
@@ -0,0 +1,28 @@
+{den, ...}: {
+ 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"
+ ];
+ authorizedKeys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMKaGC2I3an4AJDeWzVx5vhm63+kxi6zJNdh7yEp6CK hpcesia@kevin"
+ ];
+ };
+
+ pubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKSHlIARpQYDi744NML9QmFMxOEZwShfyj/ovQh6lCt7 root@mobius";
+ };
+
+ den.aspects.mobius = {
+ includes = [
+ den.aspects.roles.default
+ den.aspects.roles.develop
+ den.aspects.roles.server
+ ];
+ };
+}
modules/hosts/tribios/default.nix
@@ -0,0 +1,24 @@
+{den, ...}: {
+ 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 = {
+ authorizedKeys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMKaGC2I3an4AJDeWzVx5vhm63+kxi6zJNdh7yEp6CK hpcesia@kevin"
+ ];
+ };
+
+ pubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMQTx9RhZJa4WOAJyAUzlQLaFExcDv921sVsfM02vB9h root@tribios";
+ };
+
+ den.aspects.tribios = {
+ includes = [
+ den.aspects.roles.default
+ den.aspects.roles.server
+ ];
+ };
+}
modules/hosts/default.nix
@@ -0,0 +1,5 @@
+{den, ...}: {
+ den.schema.host.includes = [
+ den.batteries.hostname
+ ];
+}
modules/hosts/schema.nix
@@ -0,0 +1,22 @@
+{
+ lib,
+ den,
+ ...
+}: {
+ den.schema.host = {
+ options = let
+ in {
+ description = lib.mkOption {
+ description = "Description of the host.";
+ type = lib.types.str;
+ default = "";
+ };
+
+ pubKey = lib.mkOption {
+ description = "Public SSH key for the host.";
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ };
+ };
+ };
+}
modules/roles/default.nix
@@ -0,0 +1,20 @@
+{den, ...}: {
+ den.aspects.roles.default = {
+ includes = with den.aspects; [
+ core.nix
+ core.nix.lix
+ core.nix.nh
+ core.nix.nixpkgs
+ core.nix.state-versions
+
+ core.editor
+ core.localization
+ core.nameservers
+ core.nftables
+ core.openssh
+ core.systemd
+ core.time-sync
+ core.utils
+ ];
+ };
+}
modules/roles/develop.nix
@@ -0,0 +1,6 @@
+{den, ...}: {
+ den.aspects.roles.develop = {
+ includes = with den.aspects; [
+ ];
+ };
+}
modules/roles/server.nix
@@ -0,0 +1,7 @@
+{den, ...}: {
+ den.aspects.roles.server = {
+ includes = with den.aspects; [
+ core.openssh.access
+ ];
+ };
+}
modules/users/hpcesia/default.nix
@@ -0,0 +1,8 @@
+{den, ...}: {
+ den.aspects.hpcesia = {
+ includes = [
+ den.batteries.host-aspects
+ den.batteries.primary-user
+ ];
+ };
+}
modules/users/default.nix
@@ -0,0 +1,9 @@
+{den, ...}: {
+ den.default.includes = [
+ den.batteries.define-user
+ ({user, ...}: {
+ name = "users/description";
+ user.description = user.description;
+ })
+ ];
+}
modules/users/schema.nix
@@ -0,0 +1,16 @@
+{lib, ...}: {
+ den.schema.user = {config, ...}: {
+ options = {
+ description = lib.mkOption {
+ description = "Description of the user.";
+ type = lib.types.str;
+ default = config.userName;
+ };
+ authorizedKeys = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ description = "List of authorized keys for the user.";
+ default = [];
+ };
+ };
+ };
+}
.envrc
@@ -0,0 +1,1 @@
+use nix
.gitignore
@@ -0,0 +1,11 @@
+# Nix
+.direnv
+result
+result-*
+
+# VM
+*.qcow2
+
+# General
+.DS_Store
+
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,152 @@
+{
+ "nodes": {
+ "den": {
+ "locked": {
+ "lastModified": 1781621963,
+ "narHash": "sha256-8Mntz200pNVIF2l8twpdc4wvEFqzrlkICz2tvkfwz0s=",
+ "owner": "denful",
+ "repo": "den",
+ "rev": "5df0987658d6e44268abba953406480e9f066928",
+ "type": "github"
+ },
+ "original": {
+ "owner": "denful",
+ "repo": "den",
+ "type": "github"
+ }
+ },
+ "devshell": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1768818222,
+ "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=",
+ "owner": "numtide",
+ "repo": "devshell",
+ "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "devshell",
+ "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": 1779051720,
+ "narHash": "sha256-+jbXnODsR19pFKB0x/6kHhFgW6yV6N+CGClFr45eDU8=",
+ "owner": "denful",
+ "repo": "flake-file",
+ "rev": "c58eb27d9434e5be0c8693f1eb18d47035bc21ba",
+ "type": "github"
+ },
+ "original": {
+ "owner": "denful",
+ "repo": "flake-file",
+ "type": "github"
+ }
+ },
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1778716662,
+ "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "home-manager": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1780679734,
+ "narHash": "sha256-KmRNvpNOb7QEORa06bVgjW9kITcx0VhsI7w0vhmZyD8=",
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "rev": "b2b7db486e06e098711dc291bb25db82850e1d16",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "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": 1780243769,
+ "narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "331800de5053fcebacf6813adb5db9c9dca22a0c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "den": "den",
+ "devshell": "devshell",
+ "flake-compat": "flake-compat",
+ "flake-file": "flake-file",
+ "flake-parts": "flake-parts",
+ "home-manager": "home-manager",
+ "import-tree": "import-tree",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
flake.nix
@@ -0,0 +1,27 @@
+# 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 for laptop, homelab and VPS.";
+
+ outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} (inputs.import-tree ./modules);
+
+ inputs = {
+ den.url = "github:denful/den";
+ devshell = {
+ url = "github:numtide/devshell";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ 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";
+ };
+ home-manager = {
+ url = "github:nix-community/home-manager";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ import-tree.url = "github:denful/import-tree";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ };
+}
justfile
@@ -0,0 +1,40 @@
+#!/usr/bin/env just --justfile
+
+set shell := ["bash", "-cu"]
+
+default_hostname := `hostname`
+current_username := `whoami`
+
+# Build a system profile
+build hostname=default_hostname *flags:
+ nh os build -f ./default.nix nixosConfigurations.{{hostname}} \
+ --hostname={{hostname}} {{flags}}
+
+# Build a system profile, make it boot default
+build-boot hostname=default_hostname *flags:
+ nh os boot -f ./default.nix nixosConfigurations.{{hostname}} \
+ --hostname={{hostname}} {{flags}}
+
+# Build and activate a system profile, make it boot default
+build-switch hostname=default_hostname *flags:
+ nh os switch -f ./default.nix nixosConfigurations.{{hostname}} \
+ --hostname={{hostname}} {{flags}}
+
+# Build and activate standlaone home manager profile for current user
+build-home *flags:
+ nh home switch -f ./default.nix 'homeConfigurations.{{current_username}}@{{default_hostname}}' \
+ {{flags}}
+
+# Build a system profile to a vm
+build-vm hostname=default_hostname *flags:
+ nh os build-vm -f ./default.nix nixosConfigurations.{{hostname}} \
+ --hostname={{hostname}} {{flags}}
+
+# Build custom nixos installer for specific arch
+build-installer arch="x86_64":
+ nix build .#nixosConfigurations.nixos-live-{{arch}}.config.system.build.isoImage
+
+# Write flake-files config into "flake.nix"
+write-flake:
+ nix run .#write-flake
+ nix flake lock
README.md
@@ -0,0 +1,3 @@
+# IX
+
+HPCesia's NixOS configuration for laptop, homelab and VPS.
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