From 74049965707b2a117e6760cd7ac8131685396ed4 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Wed, 22 Apr 2026 18:54:27 +0100 Subject: [PATCH] rename tree to modules --- flake.nix | 2 +- {tree => modules}/boot.nix | 3 ++- {tree => modules}/deploy.nix | 33 +++++++++++++++++--------------- modules/gpg-pinentry-wayland.nix | 8 ++++++++ modules/hm.nix | 9 +++++++++ modules/keys.nix | 10 ++++++++++ {tree => modules}/nix.nix | 3 ++- modules/secrets.nix | 8 ++++++++ {tree => modules}/tailscale.nix | 24 +++++++++++++---------- tree/gpg-pinentry-wayland.nix | 5 ----- tree/hm.nix | 6 ------ tree/keys.nix | 7 ------- tree/secrets.nix | 5 ----- 13 files changed, 72 insertions(+), 51 deletions(-) rename {tree => modules}/boot.nix (97%) rename {tree => modules}/deploy.nix (84%) create mode 100644 modules/gpg-pinentry-wayland.nix create mode 100644 modules/hm.nix create mode 100644 modules/keys.nix rename {tree => modules}/nix.nix (97%) create mode 100644 modules/secrets.nix rename {tree => modules}/tailscale.nix (73%) delete mode 100644 tree/gpg-pinentry-wayland.nix delete mode 100644 tree/hm.nix delete mode 100644 tree/keys.nix delete mode 100644 tree/secrets.nix diff --git a/flake.nix b/flake.nix index 1acf793..42e6015 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ inputs.flake-parts.flakeModules.easyOverlay inputs.pre-commit-hooks.flakeModule inputs.treefmt-nix.flakeModule - (inputs.import-tree ./tree) + (inputs.import-tree ./modules) ]; systems = import inputs.systems; diff --git a/tree/boot.nix b/modules/boot.nix similarity index 97% rename from tree/boot.nix rename to modules/boot.nix index 6895f62..c607e0b 100644 --- a/tree/boot.nix +++ b/modules/boot.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ flake.nixosModules.boot = { boot = { loader = { diff --git a/tree/deploy.nix b/modules/deploy.nix similarity index 84% rename from tree/deploy.nix rename to modules/deploy.nix index a436425..4ca4c5a 100644 --- a/tree/deploy.nix +++ b/modules/deploy.nix @@ -1,13 +1,17 @@ -{...}: { - flake.nixosModules.deploy = { - config, - pkgs, - lib, - ... - }: - with lib; let +{ ... }: +{ + flake.nixosModules.deploy = + { + config, + pkgs, + lib, + ... + }: + with lib; + let cfg = config.c.services.remote-deploy; - in { + in + { options.c.services.remote-deploy = { enable = mkEnableOption "Enable remote deployment with nixinate."; host = mkOption { @@ -50,8 +54,7 @@ config = mkIf cfg.enable { _module.args = { nixinate = { - inherit - (cfg) + inherit (cfg) host buildOn port @@ -60,21 +63,21 @@ sshUser = cfg.user; }; }; - users.groups."${cfg.group}" = {}; + users.groups."${cfg.group}" = { }; users.users."${cfg.user}" = { isSystemUser = true; shell = pkgs.bash; inherit (cfg) group; openssh.authorizedKeys.keys = cfg.keys; }; - nix.settings.trusted-users = [cfg.user]; + nix.settings.trusted-users = [ cfg.user ]; security.sudo.extraRules = [ { - groups = [cfg.group]; + groups = [ cfg.group ]; commands = [ { command = "ALL"; - options = ["NOPASSWD"]; + options = [ "NOPASSWD" ]; } ]; } diff --git a/modules/gpg-pinentry-wayland.nix b/modules/gpg-pinentry-wayland.nix new file mode 100644 index 0000000..00f9940 --- /dev/null +++ b/modules/gpg-pinentry-wayland.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + flake.nixosModules.gpg-pinentry-wayland = + { pkgs, ... }: + { + services.dbus.packages = [ pkgs.gcr ]; + }; +} diff --git a/modules/hm.nix b/modules/hm.nix new file mode 100644 index 0000000..88e61a4 --- /dev/null +++ b/modules/hm.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + flake.nixosModules.hm = + { ... }: + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + }; +} diff --git a/modules/keys.nix b/modules/keys.nix new file mode 100644 index 0000000..6015159 --- /dev/null +++ b/modules/keys.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + flake.nixosModules.keys = + { lib, ... }: + { + options.keys = lib.mkOption { + default = import ../lib/keys.nix; + }; + }; +} diff --git a/tree/nix.nix b/modules/nix.nix similarity index 97% rename from tree/nix.nix rename to modules/nix.nix index 4a44378..c5c3b05 100644 --- a/tree/nix.nix +++ b/modules/nix.nix @@ -1,4 +1,5 @@ -{inputs, ...}: { +{ inputs, ... }: +{ flake.nixosModules.nix-config = { nix = { registry.nixpkgs.flake = inputs.nixpkgs; diff --git a/modules/secrets.nix b/modules/secrets.nix new file mode 100644 index 0000000..a5f4eb4 --- /dev/null +++ b/modules/secrets.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + flake.nixosModules.secrets = + { ... }: + { + imports = [ ../secrets/secrets-configuration.nix ]; + }; +} diff --git a/tree/tailscale.nix b/modules/tailscale.nix similarity index 73% rename from tree/tailscale.nix rename to modules/tailscale.nix index 9b682a9..c56b682 100644 --- a/tree/tailscale.nix +++ b/modules/tailscale.nix @@ -1,12 +1,16 @@ -{...}: { - flake.nixosModules.tailscale = { - config, - lib, - ... - }: - with lib; let +{ ... }: +{ + flake.nixosModules.tailscale = + { + config, + lib, + ... + }: + with lib; + let cfg = config.c.services.mesh; - in { + in + { options.c.services.mesh = { enable = mkEnableOption "Enable tailscale daemon."; exitNode = mkOption { @@ -28,10 +32,10 @@ "--login-server" "https://mesh.cleslie.uk" ]; - extraSetFlags = [(mkIf cfg.exitNode "--advertise-exit-node")]; + extraSetFlags = [ (mkIf cfg.exitNode "--advertise-exit-node") ]; }; networking.firewall = { - trustedInterfaces = [config.services.tailscale.interfaceName]; + trustedInterfaces = [ config.services.tailscale.interfaceName ]; }; }; }; diff --git a/tree/gpg-pinentry-wayland.nix b/tree/gpg-pinentry-wayland.nix deleted file mode 100644 index 72c2b18..0000000 --- a/tree/gpg-pinentry-wayland.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - flake.nixosModules.gpg-pinentry-wayland = {pkgs, ...}: { - services.dbus.packages = [pkgs.gcr]; - }; -} diff --git a/tree/hm.nix b/tree/hm.nix deleted file mode 100644 index 9540cb1..0000000 --- a/tree/hm.nix +++ /dev/null @@ -1,6 +0,0 @@ -{...}: { - flake.nixosModules.hm = {...}: { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - }; -} diff --git a/tree/keys.nix b/tree/keys.nix deleted file mode 100644 index e7f0d7d..0000000 --- a/tree/keys.nix +++ /dev/null @@ -1,7 +0,0 @@ -{...}: { - flake.nixosModules.keys = {lib, ...}: { - options.keys = lib.mkOption { - default = import ../lib/keys.nix; - }; - }; -} diff --git a/tree/secrets.nix b/tree/secrets.nix deleted file mode 100644 index 4354f9e..0000000 --- a/tree/secrets.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - flake.nixosModules.secrets = {...}: { - imports = [../secrets/secrets-configuration.nix]; - }; -}