rename tree to modules

This commit is contained in:
Callum Leslie 2026-04-22 18:54:27 +01:00
parent cc0d8d78d3
commit 7404996570
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
13 changed files with 72 additions and 51 deletions

View file

@ -39,7 +39,7 @@
inputs.flake-parts.flakeModules.easyOverlay inputs.flake-parts.flakeModules.easyOverlay
inputs.pre-commit-hooks.flakeModule inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
(inputs.import-tree ./tree) (inputs.import-tree ./modules)
]; ];
systems = import inputs.systems; systems = import inputs.systems;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
flake.nixosModules.boot = { flake.nixosModules.boot = {
boot = { boot = {
loader = { loader = {

View file

@ -1,13 +1,17 @@
{...}: { { ... }:
flake.nixosModules.deploy = { {
config, flake.nixosModules.deploy =
pkgs, {
lib, config,
... pkgs,
}: lib,
with lib; let ...
}:
with lib;
let
cfg = config.c.services.remote-deploy; cfg = config.c.services.remote-deploy;
in { in
{
options.c.services.remote-deploy = { options.c.services.remote-deploy = {
enable = mkEnableOption "Enable remote deployment with nixinate."; enable = mkEnableOption "Enable remote deployment with nixinate.";
host = mkOption { host = mkOption {
@ -50,8 +54,7 @@
config = mkIf cfg.enable { config = mkIf cfg.enable {
_module.args = { _module.args = {
nixinate = { nixinate = {
inherit inherit (cfg)
(cfg)
host host
buildOn buildOn
port port
@ -60,21 +63,21 @@
sshUser = cfg.user; sshUser = cfg.user;
}; };
}; };
users.groups."${cfg.group}" = {}; users.groups."${cfg.group}" = { };
users.users."${cfg.user}" = { users.users."${cfg.user}" = {
isSystemUser = true; isSystemUser = true;
shell = pkgs.bash; shell = pkgs.bash;
inherit (cfg) group; inherit (cfg) group;
openssh.authorizedKeys.keys = cfg.keys; openssh.authorizedKeys.keys = cfg.keys;
}; };
nix.settings.trusted-users = [cfg.user]; nix.settings.trusted-users = [ cfg.user ];
security.sudo.extraRules = [ security.sudo.extraRules = [
{ {
groups = [cfg.group]; groups = [ cfg.group ];
commands = [ commands = [
{ {
command = "ALL"; command = "ALL";
options = ["NOPASSWD"]; options = [ "NOPASSWD" ];
} }
]; ];
} }

View file

@ -0,0 +1,8 @@
{ ... }:
{
flake.nixosModules.gpg-pinentry-wayland =
{ pkgs, ... }:
{
services.dbus.packages = [ pkgs.gcr ];
};
}

9
modules/hm.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
flake.nixosModules.hm =
{ ... }:
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
}

10
modules/keys.nix Normal file
View file

@ -0,0 +1,10 @@
{ ... }:
{
flake.nixosModules.keys =
{ lib, ... }:
{
options.keys = lib.mkOption {
default = import ../lib/keys.nix;
};
};
}

View file

@ -1,4 +1,5 @@
{inputs, ...}: { { inputs, ... }:
{
flake.nixosModules.nix-config = { flake.nixosModules.nix-config = {
nix = { nix = {
registry.nixpkgs.flake = inputs.nixpkgs; registry.nixpkgs.flake = inputs.nixpkgs;

8
modules/secrets.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
flake.nixosModules.secrets =
{ ... }:
{
imports = [ ../secrets/secrets-configuration.nix ];
};
}

View file

@ -1,12 +1,16 @@
{...}: { { ... }:
flake.nixosModules.tailscale = { {
config, flake.nixosModules.tailscale =
lib, {
... config,
}: lib,
with lib; let ...
}:
with lib;
let
cfg = config.c.services.mesh; cfg = config.c.services.mesh;
in { in
{
options.c.services.mesh = { options.c.services.mesh = {
enable = mkEnableOption "Enable tailscale daemon."; enable = mkEnableOption "Enable tailscale daemon.";
exitNode = mkOption { exitNode = mkOption {
@ -28,10 +32,10 @@
"--login-server" "--login-server"
"https://mesh.cleslie.uk" "https://mesh.cleslie.uk"
]; ];
extraSetFlags = [(mkIf cfg.exitNode "--advertise-exit-node")]; extraSetFlags = [ (mkIf cfg.exitNode "--advertise-exit-node") ];
}; };
networking.firewall = { networking.firewall = {
trustedInterfaces = [config.services.tailscale.interfaceName]; trustedInterfaces = [ config.services.tailscale.interfaceName ];
}; };
}; };
}; };

View file

@ -1,5 +0,0 @@
{...}: {
flake.nixosModules.gpg-pinentry-wayland = {pkgs, ...}: {
services.dbus.packages = [pkgs.gcr];
};
}

View file

@ -1,6 +0,0 @@
{...}: {
flake.nixosModules.hm = {...}: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
}

View file

@ -1,7 +0,0 @@
{...}: {
flake.nixosModules.keys = {lib, ...}: {
options.keys = lib.mkOption {
default = import ../lib/keys.nix;
};
};
}

View file

@ -1,5 +0,0 @@
{...}: {
flake.nixosModules.secrets = {...}: {
imports = [../secrets/secrets-configuration.nix];
};
}