Compare commits

...

3 commits

7 changed files with 77 additions and 57 deletions

View file

@ -158,7 +158,6 @@ let
in in
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
citron-emu
ryubing ryubing
borgbackup borgbackup
borgtui borgtui
@ -196,34 +195,35 @@ in
}; };
}; };
citron-emu = { # FIXME: change to edenemu
name = "Citron w/ Borg Backups"; # citron-emu = {
comment = "Citron Emulator with Borg Backups"; # name = "Citron w/ Borg Backups";
exec = mkLaunchCommand { # comment = "Citron Emulator with Borg Backups";
savePath = "${homeDir}/.local/share/citron/nand/user/save"; # exec = mkLaunchCommand {
backupPath = "/pool/Backups/Switch/CitronSaves"; # savePath = "${homeDir}/.local/share/citron/nand/user/save";
maxBackups = 30; # backupPath = "/pool/Backups/Switch/CitronSaves";
command = "citron-emu"; # maxBackups = 30;
}; # command = "citron-emu";
icon = "applications-games"; # };
type = "Application"; # icon = "applications-games";
terminal = false; # type = "Application";
categories = [ # terminal = false;
"Game" # categories = [
"Emulator" # "Game"
]; # "Emulator"
mimeType = [ # ];
"application/x-nx-nca" # mimeType = [
"application/x-nx-nro" # "application/x-nx-nca"
"application/x-nx-nso" # "application/x-nx-nro"
"application/x-nx-nsp" # "application/x-nx-nso"
"application/x-nx-xci" # "application/x-nx-nsp"
]; # "application/x-nx-xci"
prefersNonDefaultGPU = true; # ];
settings = { # prefersNonDefaultGPU = true;
StartupWMClass = "Citron"; # settings = {
GenericName = "Nintendo Switch Emulator"; # StartupWMClass = "Citron";
}; # GenericName = "Nintendo Switch Emulator";
}; # };
# };
}; };
} }

View file

@ -0,0 +1,13 @@
[?25l ▄▄▄ ▄▄▄ ▄▄▄ 
▄▄▄▄ ▄▄▄▄▄▄▄ 
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄ 
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄░▄ 
▄▄▄▄▄ ▄▄▄▄▄▄ 
▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄░
▄▄▄▄▄▄ ▄▄▄ 
░▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 
▄ ▄▄▄▄▄▄▄▄▄░░▄▄▄▄ 
▄▄▄▄▄▄▄ ▄░▄ 
▄▄▄ ▄▄▄▄ ▄▄▄ 
[?25h

View file

@ -0,0 +1,13 @@
[?25l ▄▄▄ ▄▄▄ ▄▄▄ 
▄▄▄▄ ▄▄▄▄▄▄▄ 
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄ 
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄░▄ 
▄▄▄▄▄ ▄▄▄▄▄▄ 
▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄░
▄▄▄▄▄▄ ▄▄▄ 
░▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 
▄ ▄▄▄▄▄▄▄▄▄░░▄▄▄▄ 
▄▄▄▄▄▄▄ ▄░▄ 
▄▄▄ ▄▄▄▄ ▄▄▄ 
[?25h

View file

@ -8,7 +8,7 @@
}: }:
let let
## Get the current user's SSH config ## ## Get the current user's SSH config ##
userSsh = secretsSpec.users.${hostSpec.user}.ssh; userSsh = secretsSpec.users.${hostSpec.username}.ssh;
## Generate local key paths for the config ## ## Generate local key paths for the config ##
sshKeysMap = lib.mapAttrs (name: _: "${hostSpec.home}/.ssh/${name}") userSsh.privateKeys; sshKeysMap = lib.mapAttrs (name: _: "${hostSpec.home}/.ssh/${name}") userSsh.privateKeys;

View file

@ -46,7 +46,7 @@ in
"video" "video"
]) ])
]; ];
openssh.authorizedKeys.keys = builtins.attrValues config.secretsSpec.ssh.publicKeys or [ ]; openssh.authorizedKeys.keys = user.ssh.publicKeys or [ ];
}; };
# Special sudo config for user # Special sudo config for user
@ -69,7 +69,7 @@ in
users.users.root = { users.users.root = {
shell = pkgs.bash; shell = pkgs.bash;
hashedPassword = lib.mkForce hostSpec.hashedPassword; hashedPassword = lib.mkForce hostSpec.hashedPassword;
openssh.authorizedKeys.keys = builtins.attrValues config.secretsSpec.ssh.publicKeys or [ ]; openssh.authorizedKeys.keys = user.ssh.publicKeys or [ ];
}; };
} }
// lib.optionalAttrs (inputs ? "home-manager") { // lib.optionalAttrs (inputs ? "home-manager") {

View file

@ -70,7 +70,15 @@ in
privateKeys = lib.mkOption { privateKeys = lib.mkOption {
type = lib.types.attrsOf lib.types.path; type = lib.types.attrsOf lib.types.path;
description = "SSH private key file paths keyed by name"; description = "SSH private key file paths keyed by name";
readOnly = true; default = { };
apply =
_:
let
userName = config.hostSpec.username;
userConfig = config.secretsSpec.users.${userName} or { };
privateKeyContents = userConfig.ssh.privateKeyContents or { };
in
lib.mapAttrs (name: content: mkSshKeyFile "${userName}-${name}" content) privateKeyContents;
}; };
config = lib.mkOption { config = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@ -104,7 +112,15 @@ in
privateKey = lib.mkOption { privateKey = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "GPG private key file path"; description = "GPG private key file path";
readOnly = true; default = null;
apply =
_:
let
userName = config.hostSpec.username;
userConfig = config.secretsSpec.users.${userName} or { };
privateKeyContent = userConfig.gpg.privateKeyContents or "";
in
if privateKeyContent != "" then mkGpgKeyFile userName privateKeyContent else null;
}; };
trust = lib.mkOption { trust = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -247,26 +263,4 @@ in
default = { }; default = { };
}; };
}; };
config.secretsSpec.users = lib.mapAttrs (
userName: userConfig:
userConfig
// {
## Auto-generate SSH private key files ##
ssh = userConfig.ssh // {
privateKeys = lib.mapAttrs (
name: content: mkSshKeyFile "${userName}-${name}" content
) userConfig.ssh.privateKeyContents;
};
## Auto-generate GPG private key file ##
gpg = userConfig.gpg // {
privateKey =
if userConfig.gpg.privateKeyContents != "" then
mkGpgKeyFile "${userName}-gpg" userConfig.gpg.privateKeyContents
else
null;
};
}
) config.secretsSpec.users;
} }

Binary file not shown.