Compare commits
8 Commits
1a1a85aeda
...
b6500b97ff
| Author | SHA1 | Date | |
|---|---|---|---|
| b6500b97ff | |||
| 8f756554ad | |||
| 583b9ea5f3 | |||
| 6a30a431f8 | |||
| 38818e7508 | |||
| 94c64e9d33 | |||
| a9854ac144 | |||
| 8b109af08b |
@@ -8,19 +8,15 @@ let
|
||||
utils = import ../utils { inherit lib; };
|
||||
hostDirNames = utils.dirNames ../hosts;
|
||||
|
||||
mkNode = hostname: tags: {
|
||||
mkNode = hostname: meta: {
|
||||
imports = [ ../hosts/${hostname} ];
|
||||
deployment = {
|
||||
targetHost = self.nixosConfigurations.${hostname}.config.ssh.publicHostname;
|
||||
targetUser = self.nixosConfigurations.${hostname}.config.ssh.username;
|
||||
buildOnTarget = builtins.any (t: t != "local" && t != "arm") tags;
|
||||
inherit tags;
|
||||
inherit (meta.deployment) targetHost targetUser tags;
|
||||
buildOnTarget = builtins.any (t: t != "local" && t != "arm") meta.deployment.tags;
|
||||
};
|
||||
};
|
||||
|
||||
nodes = lib.genAttrs hostDirNames (
|
||||
hostname: mkNode hostname (utils.hostMeta ../hosts/${hostname}).deployment.tags
|
||||
);
|
||||
nodes = lib.genAttrs hostDirNames (hostname: mkNode hostname (utils.hostMeta ../hosts/${hostname}));
|
||||
in
|
||||
inputs.colmena.lib.makeHive (
|
||||
{
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import json
|
||||
|
||||
SLOTS_FILE = "/home/h/.local/share/task/add_slots"
|
||||
|
||||
def get_slots():
|
||||
try:
|
||||
with open(SLOTS_FILE, "r") as f:
|
||||
return int(f.read().strip())
|
||||
except:
|
||||
return 0
|
||||
|
||||
slots = get_slots()
|
||||
|
||||
if slots <= 0:
|
||||
print(f"Cannot add task: No slots available (0/{slots}).")
|
||||
print("Delete or complete a task first to earn an add slot.")
|
||||
sys.exit(1)
|
||||
|
||||
with open(SLOTS_FILE, "w") as f:
|
||||
f.write(str(slots - 1))
|
||||
|
||||
print(f"Task added. Slots remaining: {slots - 1}")
|
||||
|
||||
for line in sys.stdin:
|
||||
task = json.loads(line)
|
||||
print(json.dumps(task))
|
||||
sys.exit(0)
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import json
|
||||
|
||||
SLOTS_FILE = "/home/h/.local/share/task/add_slots"
|
||||
|
||||
def get_slots():
|
||||
try:
|
||||
with open(SLOTS_FILE, "r") as f:
|
||||
return int(f.read().strip())
|
||||
except:
|
||||
return 0
|
||||
|
||||
data = sys.stdin.read().strip().split("\n")
|
||||
if len(data) < 2:
|
||||
for line in data:
|
||||
if line:
|
||||
print(line)
|
||||
sys.exit(0)
|
||||
|
||||
old_task = json.loads(data[0])
|
||||
new_task = json.loads(data[1])
|
||||
|
||||
was_pending = old_task.get("status") == "pending"
|
||||
is_not_pending = new_task.get("status") in ("completed", "deleted")
|
||||
|
||||
if was_pending and is_not_pending:
|
||||
slots = get_slots() + 1
|
||||
with open(SLOTS_FILE, "w") as f:
|
||||
f.write(str(slots))
|
||||
print(f"Slot earned! Total slots: {slots}")
|
||||
|
||||
print(json.dumps(new_task))
|
||||
sys.exit(0)
|
||||
@@ -76,7 +76,7 @@
|
||||
nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./hosts/${host}
|
||||
{ nixpkgs.hostPlatform = import ./hosts/${host}/system.nix; }
|
||||
{ nixpkgs.hostPlatform = (myUtils.hostMeta ./hosts/${host}).system; }
|
||||
];
|
||||
specialArgs = {
|
||||
inherit
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
../../modules/cloud
|
||||
../../modules/comms
|
||||
../../modules/desktop/niri
|
||||
../../modules/devenv
|
||||
../../modules/direnv
|
||||
../../modules/git
|
||||
../../modules/k8s/k9s.nix
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
username = "hektor";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
@@ -21,6 +18,7 @@ in
|
||||
../../modules/database
|
||||
../../modules/dconf
|
||||
../../modules/desktop/niri
|
||||
../../modules/devenv
|
||||
../../modules/direnv
|
||||
../../modules/docker
|
||||
../../modules/git
|
||||
@@ -56,8 +54,8 @@ in
|
||||
|
||||
home = {
|
||||
stateVersion = "25.05";
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
username = "hektor";
|
||||
homeDirectory = "/home/${config.home.username}";
|
||||
};
|
||||
|
||||
targets.genericLinux.nixGL = {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
let
|
||||
terminal = "kitty";
|
||||
browser = config.browser.primary;
|
||||
font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.applications}";
|
||||
in
|
||||
{
|
||||
dconf.settings = {
|
||||
@@ -40,9 +41,9 @@ in
|
||||
clock-show-weekday = true;
|
||||
color-scheme = "prefer-dark";
|
||||
enable-hot-corners = false;
|
||||
font-name = "Iosevka Term SS08 12";
|
||||
font-name = font;
|
||||
locate-pointer = true;
|
||||
monospace-font-name = "Iosevka Term SS08 12";
|
||||
monospace-font-name = font;
|
||||
};
|
||||
|
||||
"org/gnome/desktop/wm/keybindings" = {
|
||||
|
||||
@@ -6,13 +6,19 @@
|
||||
}:
|
||||
|
||||
{
|
||||
options.nixgl.wrap = lib.mkOption {
|
||||
options = {
|
||||
host.username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.home.username;
|
||||
};
|
||||
|
||||
nixgl.wrap = lib.mkOption {
|
||||
type = lib.types.functionTo lib.types.package;
|
||||
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
options.wrapApp = lib.mkOption {
|
||||
wrapApp = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
default =
|
||||
pkg: flags:
|
||||
@@ -27,4 +33,5 @@
|
||||
pkg;
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
enableAlias = true;
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
k = "kubectl";
|
||||
};
|
||||
|
||||
imports = [
|
||||
./helm.nix
|
||||
./k9s.nix
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
{
|
||||
outputs,
|
||||
myUtils,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nixosConfigs = builtins.attrNames outputs.nixosConfigurations;
|
||||
homeConfigs = map (n: lib.last (lib.splitString "@" n)) (
|
||||
builtins.attrNames outputs.homeConfigurations
|
||||
);
|
||||
allHosts = lib.unique (homeConfigs ++ nixosConfigs);
|
||||
hostDir = ../../hosts;
|
||||
hostNames = myUtils.dirNames hostDir;
|
||||
hostsWithKeys = lib.filter (
|
||||
hostname: builtins.pathExists ../../hosts/${hostname}/ssh_host.pub
|
||||
) allHosts;
|
||||
hostname: builtins.pathExists (hostDir + "/${hostname}/ssh_host.pub")
|
||||
) hostNames;
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [ sshfs ];
|
||||
@@ -25,15 +22,14 @@ in
|
||||
lib.genAttrs hostsWithKeys (
|
||||
hostname:
|
||||
let
|
||||
hostConfig = outputs.nixosConfigurations.${hostname}.config;
|
||||
inherit (hostConfig.ssh) publicHostname username;
|
||||
meta = myUtils.hostMeta (hostDir + "/${hostname}");
|
||||
in
|
||||
{
|
||||
host = hostname;
|
||||
user = username;
|
||||
user = meta.deployment.targetUser;
|
||||
}
|
||||
// lib.optionalAttrs (publicHostname != "") {
|
||||
hostname = publicHostname;
|
||||
// lib.optionalAttrs (meta.deployment.targetHost != "") {
|
||||
hostname = meta.deployment.targetHost;
|
||||
}
|
||||
)
|
||||
// {
|
||||
|
||||
@@ -25,21 +25,6 @@ in
|
||||
sansSerif = config.stylix.fonts.monospace;
|
||||
emoji = config.stylix.fonts.monospace;
|
||||
};
|
||||
targets = {
|
||||
firefox = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
librewolf = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
gnome.enable = false;
|
||||
gtk.enable = false;
|
||||
kitty = {
|
||||
variant256Colors = true;
|
||||
};
|
||||
nixvim.enable = false;
|
||||
};
|
||||
targets = import ../../../modules/stylix/targets.nix;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -56,14 +56,6 @@ lib.optionalAttrs standalone {
|
||||
".local/share/task/hooks/on-exit.sync.py" = {
|
||||
source = dotsPath + "/.local/share/task/hooks/on-exit.sync.py";
|
||||
};
|
||||
".local/share/task/hooks/on-add.limit.py" = {
|
||||
source = dotsPath + "/.local/share/task/hooks/on-add.limit.py";
|
||||
executable = true;
|
||||
};
|
||||
".local/share/task/hooks/on-modify.limit.py" = {
|
||||
source = dotsPath + "/.local/share/task/hooks/on-modify.limit.py";
|
||||
executable = true;
|
||||
};
|
||||
".local/share/task/scripts/sync-and-notify.sh" = {
|
||||
source = dotsPath + "/.local/share/task/scripts/sync-and-notify.sh";
|
||||
executable = true;
|
||||
|
||||
@@ -51,31 +51,17 @@ in
|
||||
../../modules/yubikey
|
||||
];
|
||||
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/andromache {
|
||||
inherit
|
||||
inputs
|
||||
config
|
||||
pkgs
|
||||
lib
|
||||
;
|
||||
};
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/andromache;
|
||||
|
||||
ssh.username = config.host.username;
|
||||
ssh.authorizedHosts = [ "astyanax" ];
|
||||
|
||||
secrets = {
|
||||
inherit (config.host) username;
|
||||
nixSigningKey.enable = true;
|
||||
};
|
||||
secrets.nixSigningKey.enable = true;
|
||||
|
||||
tailscale.enable = true;
|
||||
|
||||
docker.user = config.host.username;
|
||||
docker.enable = true;
|
||||
|
||||
hcloud = {
|
||||
enable = true;
|
||||
inherit (config.host) username;
|
||||
};
|
||||
hcloud.enable = true;
|
||||
|
||||
disko.devices = {
|
||||
disk.data = {
|
||||
@@ -107,7 +93,6 @@ in
|
||||
|
||||
my.yubikey = {
|
||||
enable = false;
|
||||
inherit (config.host) username;
|
||||
keys = [
|
||||
{
|
||||
handle = "<KeyHandle1>";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
system = "x86_64-linux";
|
||||
deployment = {
|
||||
tags = [ "local" ];
|
||||
targetHost = "";
|
||||
targetUser = "h";
|
||||
};
|
||||
role = "desktop";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"x86_64-linux"
|
||||
@@ -47,26 +47,15 @@ in
|
||||
../../modules/yubikey
|
||||
];
|
||||
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/astyanax {
|
||||
inherit
|
||||
inputs
|
||||
config
|
||||
pkgs
|
||||
lib
|
||||
;
|
||||
};
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/astyanax;
|
||||
|
||||
ssh.username = config.host.username;
|
||||
ssh.authorizedHosts = [ "andromache" ];
|
||||
|
||||
secrets = {
|
||||
inherit (config.host) username;
|
||||
nixSigningKey.enable = true;
|
||||
};
|
||||
secrets.nixSigningKey.enable = true;
|
||||
|
||||
tailscale.enable = true;
|
||||
docker.user = config.host.username;
|
||||
nfc.user = config.host.username;
|
||||
docker.enable = true;
|
||||
nfc.enable = true;
|
||||
desktop.ly.enable = true;
|
||||
audio.automation.enable = true;
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
system = "x86_64-linux";
|
||||
deployment = {
|
||||
tags = [ "local" ];
|
||||
targetHost = "";
|
||||
targetUser = "h";
|
||||
};
|
||||
role = "laptop";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"x86_64-linux"
|
||||
@@ -12,8 +12,6 @@
|
||||
];
|
||||
|
||||
ssh = {
|
||||
inherit (config.host) username;
|
||||
publicHostname = config.host.name;
|
||||
authorizedHosts = [
|
||||
"andromache"
|
||||
"astyanax"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "arm" ];
|
||||
system = "aarch64-linux";
|
||||
deployment = {
|
||||
tags = [ "arm" ];
|
||||
targetHost = "eetion-02";
|
||||
targetUser = "h";
|
||||
};
|
||||
role = "embedded";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"aarch64-linux"
|
||||
@@ -13,8 +13,6 @@
|
||||
];
|
||||
|
||||
ssh = {
|
||||
inherit (config.host) username;
|
||||
publicHostname = config.host.name;
|
||||
authorizedHosts = [
|
||||
"andromache"
|
||||
"astyanax"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "arm" ];
|
||||
system = "aarch64-linux";
|
||||
deployment = {
|
||||
tags = [ "arm" ];
|
||||
targetHost = "eetion";
|
||||
targetUser = "h";
|
||||
};
|
||||
role = "embedded";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"aarch64-linux"
|
||||
@@ -19,15 +19,13 @@
|
||||
|
||||
networking.hostName = config.host.name;
|
||||
ssh = {
|
||||
inherit (config.host) username;
|
||||
publicHostname = "server.hektormisplon.xyz";
|
||||
authorizedHosts = [
|
||||
"andromache"
|
||||
"astyanax"
|
||||
];
|
||||
};
|
||||
|
||||
docker.user = config.host.username;
|
||||
docker.enable = true;
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "cloud" ];
|
||||
system = "x86_64-linux";
|
||||
deployment = {
|
||||
tags = [ "cloud" ];
|
||||
targetHost = "server.hektormisplon.xyz";
|
||||
targetUser = "username";
|
||||
};
|
||||
role = "server";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"x86_64-linux"
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
@@ -29,13 +28,7 @@
|
||||
../../modules/x
|
||||
];
|
||||
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/vm {
|
||||
inherit inputs config pkgs;
|
||||
};
|
||||
|
||||
ssh.username = config.host.username;
|
||||
|
||||
secrets.username = config.host.username;
|
||||
home-manager.users.${config.host.username} = import ../../home/hosts/vm;
|
||||
|
||||
disko = {
|
||||
devices.disk.main = {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
system = "x86_64-linux";
|
||||
deployment = {
|
||||
tags = [ "local" ];
|
||||
targetHost = "";
|
||||
targetUser = "h";
|
||||
};
|
||||
role = "vm";
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"x86_64-linux"
|
||||
@@ -12,10 +12,15 @@ let
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../modules/common/host.nix
|
||||
../modules/ssh
|
||||
];
|
||||
|
||||
ssh.username = username;
|
||||
host = {
|
||||
inherit username;
|
||||
name = "orange-pi";
|
||||
};
|
||||
|
||||
ssh.authorizedHosts = [
|
||||
"andromache"
|
||||
"astyanax"
|
||||
|
||||
@@ -12,10 +12,15 @@ let
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../modules/common/host.nix
|
||||
../modules/ssh
|
||||
];
|
||||
|
||||
ssh.username = username;
|
||||
host = {
|
||||
inherit username;
|
||||
name = "raspberry-pi";
|
||||
};
|
||||
|
||||
ssh.authorizedHosts = [
|
||||
"andromache"
|
||||
"astyanax"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ config, myUtils, ... }:
|
||||
|
||||
let
|
||||
inherit (config.secrets) sopsDir username;
|
||||
inherit (config.secrets) sopsDir;
|
||||
inherit (config.host) username;
|
||||
owner = config.users.users.${username}.name;
|
||||
in
|
||||
{
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ config, myUtils, ... }:
|
||||
|
||||
let
|
||||
inherit (config.secrets) sopsDir username;
|
||||
inherit (config.secrets) sopsDir;
|
||||
inherit (config.host) username;
|
||||
owner = config.users.users.${username}.name;
|
||||
in
|
||||
{
|
||||
|
||||
@@ -73,6 +73,11 @@ in
|
||||
myUtils
|
||||
;
|
||||
};
|
||||
sharedModules = [
|
||||
{
|
||||
host.username = lib.mkDefault config.host.username;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,29 +2,17 @@
|
||||
|
||||
let
|
||||
cfg = config.docker;
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.docker = {
|
||||
enable = lib.mkEnableOption "docker";
|
||||
rootless = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
warnings = lib.flatten [
|
||||
(lib.optional (
|
||||
cfg.rootless && cfg.user != null
|
||||
) "'virtualisation.docker.user' is ignored when rootless mode is enabled")
|
||||
(lib.optional (
|
||||
!cfg.rootless && cfg.user == null
|
||||
) "'virtualisation.docker.user' is not set (no user is added to the docker group)")
|
||||
];
|
||||
}
|
||||
(lib.mkIf cfg.rootless {
|
||||
virtualisation.docker = {
|
||||
enable = false;
|
||||
@@ -34,11 +22,9 @@ in
|
||||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf (!cfg.rootless && cfg.user != null) {
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
};
|
||||
users.users.${cfg.user}.extraGroups = [ "docker" ];
|
||||
(lib.mkIf (cfg.enable && !cfg.rootless) {
|
||||
virtualisation.docker.enable = true;
|
||||
users.users.${username}.extraGroups = [ "docker" ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.secrets) username;
|
||||
inherit (config.host) username;
|
||||
owner = config.users.users.${username}.name;
|
||||
in
|
||||
{
|
||||
|
||||
@@ -7,25 +7,22 @@
|
||||
|
||||
let
|
||||
cfg = config.hcloud;
|
||||
inherit (config.host) username;
|
||||
inherit (config.secrets) sopsDir;
|
||||
in
|
||||
{
|
||||
options.hcloud = {
|
||||
enable = lib.mkEnableOption "hcloud CLI configuration";
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Username for hcloud CLI configuration";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops.secrets = myUtils.mkSopsSecrets sopsDir "hcloud" [ "api-token" ] {
|
||||
owner = config.users.users.${cfg.username}.name;
|
||||
owner = config.users.users.${username}.name;
|
||||
};
|
||||
|
||||
sops.templates."hcloud/cli.toml" = {
|
||||
owner = config.users.users.${cfg.username}.name;
|
||||
path = "/home/${cfg.username}/.config/hcloud/cli.toml";
|
||||
owner = config.users.users.${username}.name;
|
||||
path = "/home/${username}/.config/hcloud/cli.toml";
|
||||
content = ''
|
||||
active_context = "server"
|
||||
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
|
||||
let
|
||||
cfg = config.nfc;
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.nfc = {
|
||||
user = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
enable = lib.mkEnableOption "NFC device access";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (cfg.user != null) {
|
||||
users.users.${cfg.user}.extraGroups = [ "dialout" ];
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.${username}.extraGroups = [ "dialout" ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
let
|
||||
cfg = config.secrets;
|
||||
inherit (config.host) username;
|
||||
inherit (cfg) sopsDir;
|
||||
owner = config.users.users.${cfg.username}.name;
|
||||
owner = config.users.users.${username}.name;
|
||||
mkSopsSecrets = myUtils.mkSopsSecrets sopsDir;
|
||||
in
|
||||
{
|
||||
@@ -18,10 +19,6 @@ in
|
||||
|
||||
options = {
|
||||
secrets = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
sopsDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${toString inputs.nix-secrets}/secrets";
|
||||
@@ -43,7 +40,7 @@ in
|
||||
# ```
|
||||
# age-plugin-yubikey --identity > <keyfile-path>
|
||||
# ```
|
||||
age.keyFile = "/home/${cfg.username}/.config/sops/age/keys.txt";
|
||||
age.keyFile = "/home/${username}/.config/sops/age/keys.txt";
|
||||
|
||||
secrets = lib.mkMerge [
|
||||
(mkSopsSecrets "email" [ "personal" "work" ] { inherit owner; })
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.ssh = {
|
||||
authorizedHosts = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "h";
|
||||
};
|
||||
publicHostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
# auto generate authorized_keys from `authorizedHosts`
|
||||
config.users.users.${config.ssh.username}.openssh.authorizedKeys.keys = lib.flatten (
|
||||
config.users.users.${username}.openssh.authorizedKeys.keys = lib.flatten (
|
||||
map (
|
||||
hostname:
|
||||
let
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (config.ssh) username;
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
# auto extract SSH keys
|
||||
|
||||
@@ -30,20 +30,7 @@ in
|
||||
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
stylix.targets = {
|
||||
firefox = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
librewolf = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
kitty.variant256Colors = true;
|
||||
gnome.enable = false;
|
||||
gtk.enable = false;
|
||||
nixvim.enable = false;
|
||||
};
|
||||
stylix.targets = import ./targets.nix;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
14
modules/stylix/targets.nix
Normal file
14
modules/stylix/targets.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
firefox = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
librewolf = {
|
||||
profileNames = [ "default" ];
|
||||
colorTheme.enable = true;
|
||||
};
|
||||
kitty.variant256Colors = true;
|
||||
gnome.enable = false;
|
||||
gtk.enable = false;
|
||||
nixvim.enable = false;
|
||||
}
|
||||
@@ -7,23 +7,18 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.my.syncthing;
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.my.syncthing.username = mkOption {
|
||||
type = types.str;
|
||||
default = "h";
|
||||
};
|
||||
|
||||
config = {
|
||||
users.groups.${cfg.username} = { };
|
||||
users.users.${cfg.username}.extraGroups = [ cfg.username ];
|
||||
users.groups.${username} = { };
|
||||
users.users.${username}.extraGroups = [ username ];
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = cfg.username;
|
||||
group = cfg.username;
|
||||
configDir = "/home/${cfg.username}/.local/state/syncthing";
|
||||
user = username;
|
||||
group = username;
|
||||
configDir = "/home/${username}/.local/state/syncthing";
|
||||
openDefaultPorts = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ config, myUtils, ... }:
|
||||
|
||||
let
|
||||
inherit (config.secrets) sopsDir username;
|
||||
inherit (config.secrets) sopsDir;
|
||||
inherit (config.host) username;
|
||||
owner = config.users.users.${username}.name;
|
||||
in
|
||||
{
|
||||
|
||||
@@ -9,18 +9,14 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.my.yubikey;
|
||||
inherit (config.host) username;
|
||||
formatKey = key: ":${key.handle},${key.userKey},${key.coseType},${key.options}";
|
||||
authfileContent = username: keys: username + lib.concatMapStrings formatKey keys;
|
||||
authfileContent = u: keys: u + lib.concatMapStrings formatKey keys;
|
||||
in
|
||||
{
|
||||
options.my.yubikey = {
|
||||
enable = mkEnableOption "yubiKey U2F authentication";
|
||||
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
default = "h";
|
||||
};
|
||||
|
||||
origin = mkOption {
|
||||
type = types.str;
|
||||
default = "pam://yubi";
|
||||
@@ -61,7 +57,7 @@ in
|
||||
interactive = true;
|
||||
cue = true;
|
||||
inherit (cfg) origin;
|
||||
authfile = pkgs.writeText "u2f-mappings" (authfileContent cfg.username cfg.keys);
|
||||
authfile = pkgs.writeText "u2f-mappings" (authfileContent username cfg.keys);
|
||||
};
|
||||
};
|
||||
services = {
|
||||
|
||||
Reference in New Issue
Block a user