refactor: use 'import-as-enable' pattern
This commit is contained in:
@@ -47,12 +47,7 @@ in
|
||||
cloud.hetzner.enable = true;
|
||||
comms.signal.enable = true;
|
||||
github.enable = true;
|
||||
pandoc.enable = true;
|
||||
|
||||
shell.bash = {
|
||||
enable = true;
|
||||
aliases.lang-js = true;
|
||||
};
|
||||
shell.bash.aliases.lang-js = true;
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
|
||||
@@ -45,13 +45,7 @@ in
|
||||
cloud.hetzner.enable = true;
|
||||
comms.signal.enable = true;
|
||||
github.enable = true;
|
||||
nfc.proxmark3.enable = true;
|
||||
pandoc.enable = true;
|
||||
|
||||
shell.bash = {
|
||||
enable = true;
|
||||
aliases.lang-js = true;
|
||||
};
|
||||
shell.bash.aliases.lang-js = true;
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
|
||||
@@ -106,14 +106,7 @@ in
|
||||
database.postgresql.enable = true;
|
||||
github.enable = true;
|
||||
gitlab.enable = true;
|
||||
pandoc.enable = true;
|
||||
secrets = {
|
||||
enable = true;
|
||||
vault.enable = true;
|
||||
};
|
||||
|
||||
shell.bash.enable = true;
|
||||
starship.enable = true;
|
||||
secrets.vault.enable = true;
|
||||
|
||||
programs = {
|
||||
gh.enable = true;
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.go = {
|
||||
enable = lib.mkEnableOption "go language";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.go.enable {
|
||||
home.packages = with pkgs; [
|
||||
go
|
||||
gopls
|
||||
];
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
go
|
||||
gopls
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nfc.proxmark3;
|
||||
in
|
||||
{
|
||||
options.nfc.proxmark3 = {
|
||||
enable = lib.mkEnableOption "proxmark3 (iceman fork)";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.proxmark3.override { withGeneric = true; })
|
||||
];
|
||||
};
|
||||
home.packages = [
|
||||
(pkgs.proxmark3.override { withGeneric = true; })
|
||||
];
|
||||
}
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
}:
|
||||
|
||||
{
|
||||
options.nodejs = {
|
||||
enable = lib.mkEnableOption "nodejs (and related packages)";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.nodejs_24;
|
||||
};
|
||||
options.nodejs.package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.nodejs_24;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.nodejs.enable {
|
||||
config = {
|
||||
home.packages = with pkgs; [
|
||||
config.nodejs.package
|
||||
pnpm
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.pandoc = {
|
||||
enable = lib.mkEnableOption "pandoc";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.pandoc.enable {
|
||||
home.packages = with pkgs; [
|
||||
haskellPackages.pandoc-crossref
|
||||
pandoc
|
||||
texliveSmall
|
||||
];
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
haskellPackages.pandoc-crossref
|
||||
pandoc
|
||||
texliveSmall
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.secrets = {
|
||||
enable = lib.mkEnableOption "secrets";
|
||||
};
|
||||
|
||||
imports = [ ./vault.nix ];
|
||||
|
||||
config = lib.mkIf config.secrets.enable {
|
||||
home.packages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
];
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
];
|
||||
}
|
||||
|
||||
@@ -9,38 +9,32 @@ let
|
||||
inherit (config.home) username;
|
||||
in
|
||||
{
|
||||
options.shell.bash = {
|
||||
enable = lib.mkEnableOption "bash configuration";
|
||||
imports = [ ./utils.nix ];
|
||||
|
||||
options.shell.bash = {
|
||||
aliases = {
|
||||
all = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable common aliases";
|
||||
};
|
||||
lang-js = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable JavaScript/Node.js aliases";
|
||||
};
|
||||
};
|
||||
|
||||
addBinToPath = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Add dots .bin directory to PATH";
|
||||
};
|
||||
|
||||
extraInit = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = "Additional bash initialization";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
shell-utils.enable = lib.mkDefault true;
|
||||
|
||||
config = {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.starship = {
|
||||
enable = lib.mkEnableOption "starship prompt";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.starship.enable {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
programs.starship.enable = true;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.shell-utils = {
|
||||
enable = lib.mkEnableOption "shell utilities";
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = lib.mkDefault true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.shell-utils.enable {
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = lib.mkDefault true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
ripgrep
|
||||
bat
|
||||
jq
|
||||
entr
|
||||
parallel
|
||||
];
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
ripgrep
|
||||
bat
|
||||
jq
|
||||
entr
|
||||
parallel
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ in
|
||||
imports = [
|
||||
./hard.nix
|
||||
../../modules/ssh
|
||||
# ../../modules/uptime-kuma
|
||||
];
|
||||
|
||||
ssh = {
|
||||
|
||||
@@ -17,7 +17,6 @@ in
|
||||
./hard.nix
|
||||
../../modules/ssh
|
||||
../../modules/docker
|
||||
../../modules/uptime-kuma
|
||||
];
|
||||
|
||||
networking.hostName = hostName;
|
||||
@@ -32,8 +31,6 @@ in
|
||||
|
||||
docker.user = username;
|
||||
|
||||
my.uptime-kuma.enable = false;
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
|
||||
@@ -10,15 +10,12 @@ let
|
||||
cfg = config.my.syncthing;
|
||||
in
|
||||
{
|
||||
options.my.syncthing = {
|
||||
enable = mkEnableOption "Syncthing file synchronization";
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
default = "h";
|
||||
};
|
||||
options.my.syncthing.username = mkOption {
|
||||
type = types.str;
|
||||
default = "h";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = {
|
||||
users.groups.${cfg.username} = { };
|
||||
users.users.${cfg.username}.extraGroups = [ cfg.username ];
|
||||
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.my.uptime-kuma;
|
||||
in
|
||||
{
|
||||
options.my.uptime-kuma.enable = lib.mkEnableOption "Uptime Kuma monitoring service (Docker container)";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.oci-containers = {
|
||||
backend = "docker";
|
||||
containers.uptime-kuma = {
|
||||
image = "louislam/uptime-kuma:latest";
|
||||
ports = [ "127.0.0.1:3001:3001" ];
|
||||
volumes = [ "/var/lib/uptime-kuma:/app/data" ];
|
||||
environment = {
|
||||
TZ = "UTC";
|
||||
UMASK = "0022";
|
||||
};
|
||||
extraOptions = [
|
||||
"--network=proxiable"
|
||||
];
|
||||
virtualisation.oci-containers = {
|
||||
backend = "docker";
|
||||
containers.uptime-kuma = {
|
||||
image = "louislam/uptime-kuma:latest";
|
||||
ports = [ "127.0.0.1:3001:3001" ];
|
||||
volumes = [ "/var/lib/uptime-kuma:/app/data" ];
|
||||
environment = {
|
||||
TZ = "UTC";
|
||||
UMASK = "0022";
|
||||
};
|
||||
extraOptions = [
|
||||
"--network=proxiable"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings."uptime-kuma" = {
|
||||
"/var/lib/uptime-kuma".d = {
|
||||
mode = "0755";
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ docker-compose ];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings."uptime-kuma" = {
|
||||
"/var/lib/uptime-kuma".d = {
|
||||
mode = "0755";
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ docker-compose ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user