From 0faa5884f244dd6524177ebaae615a0c2f6153ca Mon Sep 17 00:00:00 2001 From: Berwn Date: Sun, 14 Jun 2026 12:11:16 +0700 Subject: [PATCH] Initial commit --- .envrc | 2 + .gitignore | 2 + clan.nix | 58 ++++++++++++ flake.lock | 232 ++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 50 ++++++++++ modules/gnome.nix | 15 +++ 6 files changed, 359 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 clan.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 modules/gnome.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..0f94eed --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +# shellcheck shell=bash +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76570c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +.direnv/ \ No newline at end of file diff --git a/clan.nix b/clan.nix new file mode 100644 index 0000000..e3eb659 --- /dev/null +++ b/clan.nix @@ -0,0 +1,58 @@ +{ + # Ensure this is unique among all clans you want to use. + meta.name = "__CHANGE_ME__"; + meta.domain = "changeme"; + + inventory.machines = { + # Define machines here. + # jon = { }; + }; + + # Docs: See https://docs.clan.lol/services/definition/ + inventory.instances = { + + # Docs: https://docs.clan.lol/services/official/admin/ + # Admin service for managing machines + # This service adds a root password and SSH access. + admin = { + roles.default.tags.all = { }; + roles.default.settings.allowedKeys = { + # Insert the public key that you want to use for SSH access. + # All keys will have ssh access to all machines ("tags.all" means 'all machines'). + # Alternatively set 'users.users.root.openssh.authorizedKeys.keys' in each machine + "admin-machine-1" = "__YOUR_PUBLIC_KEY__"; + }; + }; + + # Docs: https://docs.clan.lol/services/official/zerotier/ + # The lines below will define a zerotier network and add all machines as 'peer' to it. + # !!! Manual steps required: + # - Define a controller machine for the zerotier network. + # - Deploy the controller machine first to initialize the network. + zerotier = { + # Replace with the name (string) of your machine that you will use as zerotier-controller + # See: https://docs.zerotier.com/controller/ + # Deploy this machine first to create the network secrets + roles.controller.machines."__YOUR_CONTROLLER__" = { }; + # Peers of the network + # tags.all means 'all machines' will joined + roles.peer.tags.all = { }; + }; + + # Docs: https://docs.clan.lol/services/official/tor/ + # Tor network provides secure, anonymous connections to your machines + # All machines will be accessible via Tor as a fallback connection method + tor = { + roles.server.tags.nixos = { }; + }; + }; + + # Additional NixOS configuration can be added here. + # machines/jon/configuration.nix will be automatically imported. + # See: https://docs.clan.lol/guides/inventory/autoincludes/ + machines = { + # jon = { config, ... }: { + # environment.systemPackages = [ pkgs.asciinema ]; + # }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e44a41f --- /dev/null +++ b/flake.lock @@ -0,0 +1,232 @@ +{ + "nodes": { + "clan-core": { + "inputs": { + "data-mesher": "data-mesher", + "disko": "disko", + "flake-parts": "flake-parts", + "nix-darwin": "nix-darwin", + "nix-select": "nix-select", + "nixos-facter-modules": "nixos-facter-modules", + "nixpkgs": "nixpkgs", + "sops-nix": "sops-nix", + "systems": "systems", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1779116933, + "narHash": "sha256-BoSQT4vbuWbGcDbXp4nqBd1I9X8r+dLSPtTbc5yJd28=", + "rev": "10d86d5d8291fe5162a5535f433a4d50efc4b2bc", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/clan-core/archive/10d86d5d8291fe5162a5535f433a4d50efc4b2bc.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.clan.lol/clan/clan-core/archive/25.11.tar.gz" + } + }, + "data-mesher": { + "inputs": { + "flake-parts": [ + "clan-core", + "flake-parts" + ], + "nixpkgs": [ + "clan-core", + "nixpkgs" + ], + "treefmt-nix": [ + "clan-core", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1767582502, + "narHash": "sha256-WVcYGWcAlWzVt38OaTC5i5Q3QkIKJKZsJ7LcQZVVxeE=", + "rev": "31f2e3ecf207fd2760e3cebf7c2cf3cb7170ea3d", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/data-mesher/archive/31f2e3ecf207fd2760e3cebf7c2cf3cb7170ea3d.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.clan.lol/clan/data-mesher/archive/main.tar.gz" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766150702, + "narHash": "sha256-P0kM+5o+DKnB6raXgFEk3azw8Wqg5FL6wyl9jD+G5a4=", + "owner": "nix-community", + "repo": "disko", + "rev": "916506443ecd0d0b4a0f4cf9d40a3c22ce39b378", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772129556, + "narHash": "sha256-Utk0zd8STPsUJPyjabhzPc5BpPodLTXrwkpXBHYnpeg=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "ebec37af18215214173c98cf6356d0aca24a2585", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "nix-darwin-25.11", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-select": { + "locked": { + "lastModified": 1763303120, + "narHash": "sha256-yxcNOha7Cfv2nhVpz9ZXSNKk0R7wt4AiBklJ8D24rVg=", + "rev": "3d1e3860bef36857a01a2ddecba7cdb0a14c35a9", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/nix-select/archive/3d1e3860bef36857a01a2ddecba7cdb0a14c35a9.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.clan.lol/clan/nix-select/archive/main.tar.gz" + } + }, + "nixos-facter-modules": { + "locked": { + "lastModified": 1773858690, + "narHash": "sha256-oW0/lC0oRG5H5LaK6Rmh9L1wmkn9TbenM4bXwnIEDKA=", + "owner": "nix-community", + "repo": "nixos-facter-modules", + "rev": "139dcef4dfc97009629c445806f197883351ab4a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-facter-modules", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1778003029, + "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "clan-core": "clan-core", + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777944972, + "narHash": "sha256-VfGRo1qTBKOe3s2gOv8LSoA6Fk19PvBlwQ1ECN0Evn8=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "c591bf665727040c6cc5cb409079acb22dcce33c", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768158989, + "narHash": "sha256-67vyT1+xClLldnumAzCTBvU0jLZ1YBcf4vANRWP3+Ak=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e96d59dff5c0d7fddb9d113ba108f03c3ef99eca", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6edbc22 --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + inputs.clan-core.url = "https://git.clan.lol/clan/clan-core/archive/25.11.tar.gz"; + inputs.nixpkgs.follows = "clan-core/nixpkgs"; + + outputs = + { + self, + clan-core, + nixpkgs, + ... + }@inputs: + let + # Usage see: https://docs.clan.lol + clan = clan-core.lib.clan { + inherit self; + imports = [ ./clan.nix ]; + specialArgs = { inherit inputs; }; + + # Customize nixpkgs + # pkgsForSystem = + # system: + # import nixpkgs { + # inherit system; + # config = { + # allowUnfree = true; + # }; + # overlays = []; + # }; + }; + in + { + inherit (clan.config) nixosConfigurations nixosModules clanInternals; + clan = clan.config; + # Add the Clan cli tool to the dev shell. + # Use "nix develop" to enter the dev shell. + devShells = + nixpkgs.lib.genAttrs + [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + "x86_64-darwin" + ] + (system: { + default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell { + packages = [ clan-core.packages.${system}.clan-cli ]; + }; + }); + }; +} diff --git a/modules/gnome.nix b/modules/gnome.nix new file mode 100644 index 0000000..d36b852 --- /dev/null +++ b/modules/gnome.nix @@ -0,0 +1,15 @@ +{ ... }: +{ + # Can be imported into machines to enable GNOME and GDM. + # + # Copy this into a machine's configuration: + # `machines//configuration.nix` + # ```nix + # imports = [ + # ../../modules/gnome.nix + # ]; + # ``` + + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; +}