From 821ef8122d2094608dc88b2fc4ee32aeaa83243b Mon Sep 17 00:00:00 2001 From: Pedro Rey Anca Date: Wed, 6 Aug 2025 21:42:27 +0200 Subject: [PATCH] Initial commit --- .envrc | 2 + .gitignore | 2 + clan.nix | 50 ++++++++++ flake.lock | 228 ++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 38 ++++++++ modules/gnome.nix | 15 +++ 6 files changed, 335 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..9ac930a --- /dev/null +++ b/clan.nix @@ -0,0 +1,50 @@ +{ + # Ensure this is unique among all clans you want to use. + meta.name = "__CHANGE_ME__"; + + inventory.machines = { + # Define machines here. + # jon = { }; + }; + + # Docs: See https://docs.clan.lol/reference/clanServices + inventory.instances = { + + # Docs: https://docs.clan.lol/reference/clanServices/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/reference/clanServices/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 initilize 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 = { }; + }; + }; + + # Additional NixOS configuration can be added here. + # machines/jon/configuration.nix will be automatically imported. + # See: https://docs.clan.lol/guides/more-machines/#automatic-registration + machines = { + # jon = { config, ... }: { + # environment.systemPackages = [ pkgs.asciinema ]; + # }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ac03082 --- /dev/null +++ b/flake.lock @@ -0,0 +1,228 @@ +{ + "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": 1754493613, + "narHash": "sha256-dI4LG8519Q8xWtUR/RrjkSNYEx8fgw7VLqC8mZ7ZxnI=", + "rev": "9cad07473252d3272c359f4b12b766c6bd7534aa", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/clan-core/archive/9cad07473252d3272c359f4b12b766c6bd7534aa.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.clan.lol/clan/clan-core/archive/main.tar.gz" + } + }, + "data-mesher": { + "inputs": { + "flake-parts": [ + "clan-core", + "flake-parts" + ], + "nixpkgs": [ + "clan-core", + "nixpkgs" + ], + "treefmt-nix": [ + "clan-core", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1753067306, + "narHash": "sha256-jyoEbaXa8/MwVQ+PajUdT63y3gYhgD9o7snO/SLaikw=", + "rev": "18dfd42bdb2cfff510b8c74206005f733e38d8b9", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/data-mesher/archive/18dfd42bdb2cfff510b8c74206005f733e38d8b9.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": 1753140376, + "narHash": "sha256-7lrVrE0jSvZHrxEzvnfHFE/Wkk9DDqb+mYCodI5uuB8=", + "owner": "nix-community", + "repo": "disko", + "rev": "545aba02960caa78a31bd9a8709a0ad4b6320a5c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754420989, + "narHash": "sha256-3e4wHzNwTMg7GaeLH9A091DMaO9AfFxUjpfqbddCUeo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f38f25a44023a21a504bd3fd9d4f41c4a39f55c", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751313918, + "narHash": "sha256-HsJM3XLa43WpG+665aGEh8iS8AfEwOIQWk3Mke3e7nk=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "e04a388232d9a6ba56967ce5b53a8a6f713cdfcf", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-select": { + "locked": { + "lastModified": 1745005516, + "narHash": "sha256-IVaoOGDIvAa/8I0sdiiZuKptDldrkDWUNf/+ezIRhyc=", + "rev": "69d8bf596194c5c35a4e90dd02c52aa530caddf8", + "type": "tarball", + "url": "https://git.clan.lol/api/v1/repos/clan/nix-select/archive/69d8bf596194c5c35a4e90dd02c52aa530caddf8.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.clan.lol/clan/nix-select/archive/main.tar.gz" + } + }, + "nixos-facter-modules": { + "locked": { + "lastModified": 1750412875, + "narHash": "sha256-uP9Xxw5XcFwjX9lNoYRpybOnIIe1BHfZu5vJnnPg3Jc=", + "owner": "nix-community", + "repo": "nixos-facter-modules", + "rev": "14df13c84552a7d1f33c1cd18336128fbc43f920", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-facter-modules", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 315532800, + "narHash": "sha256-lUi+sPH7Kuh9uP3PyfgbENcJGReUM8Ffk9GxGBFbSN8=", + "rev": "be9e214982e20b8310878ac2baa063a961c1bdf6", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre827262.be9e214982e2/nixexprs.tar.xz" + }, + "original": { + "type": "tarball", + "url": "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz" + } + }, + "root": { + "inputs": { + "clan-core": "clan-core", + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754328224, + "narHash": "sha256-glPK8DF329/dXtosV7YSzRlF4n35WDjaVwdOMEoEXHA=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "49021900e69812ba7ddb9e40f9170218a7eca9f4", + "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": 1754492133, + "narHash": "sha256-B+3g9+76KlGe34Yk9za8AF3RL+lnbHXkLiVHLjYVOAc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1298185c05a56bff66383a20be0b41a307f52228", + "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..17582db --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + inputs.clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.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; }; + }; + in + { + inherit (clan.config) nixosConfigurations nixosModules clanInternals; + # 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; +}