mirror of
https://github.com/TheWanderingCrow/CrOS.git
synced 2026-01-11 17:54:08 -05:00
do password stuff for virtual machines
This commit is contained in:
parent
b7f0fed007
commit
f7e969fdf3
3 changed files with 66 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
# Decrypt password to /run/secrets-for-users/ so it can be used to create the user
|
# Decrypt password to /run/secrets-for-users/ so it can be used to create the user
|
||||||
sopsHashedPasswordFile = lib.optionalString (!config.hostSpec.isMinimal) config.sops.secrets."passwords/${hostSpec.username}".path;
|
sopsHashedPasswordFile = lib.optionalString (!config.hostSpec.isMinimal) config.sops.secrets."passwords/${hostSpec.username}".path;
|
||||||
|
virtPass = pkgs.writeText "password" "$y$j9T$ZbQbNHUSFsePoP0X.TdwR/$.EKJWDSY7ZO/nqf4FxgUYA3a47CYAKLzaV7ZAy745R/";
|
||||||
in {
|
in {
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false; # Only allow declarative credentials; Required for password to be set via sops during system activation!
|
mutableUsers = false; # Only allow declarative credentials; Required for password to be set via sops during system activation!
|
||||||
|
|
@ -19,7 +20,10 @@ in {
|
||||||
${hostSpec.username} = {
|
${hostSpec.username} = {
|
||||||
home = "/home/${hostSpec.username}";
|
home = "/home/${hostSpec.username}";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
hashedPasswordFile = sopsHashedPasswordFile; # Blank if sops is not working.
|
hashedPasswordFile =
|
||||||
|
if config.hostSpec.isVirtual
|
||||||
|
then virtPass
|
||||||
|
else sopsHashedPasswordFile;
|
||||||
linger = true;
|
linger = true;
|
||||||
|
|
||||||
extraGroups = lib.flatten [
|
extraGroups = lib.flatten [
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,59 @@
|
||||||
# Dragneel - Desktop #
|
# Dragneel - Desktop #
|
||||||
# #
|
# #
|
||||||
######################
|
######################
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = lib.flatten [
|
||||||
|
# Disks
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
(lib.custom.relativeToRoot "hosts/common/disks/btrfs-disk.nix")
|
||||||
|
{
|
||||||
|
_module.args = {
|
||||||
|
disk = "/dev/nvme0n1";
|
||||||
|
withSwap = true;
|
||||||
|
swapSize = "8";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
|
||||||
|
(map lib.custom.relativeToRoot [
|
||||||
|
# Required configs
|
||||||
|
"hosts/common/core"
|
||||||
|
|
||||||
|
# Optional configs
|
||||||
|
"hosts/common/optional/audio.nix"
|
||||||
|
"hosts/common/optional/bluetooth.nix"
|
||||||
|
"hosts/common/optional/pentesting.nix"
|
||||||
|
"hosts/common/optional/gaming.nix"
|
||||||
|
"hosts/common/optional/printing.nix"
|
||||||
|
])
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
|
hostSpec = {
|
||||||
|
hostName = "Dragneel";
|
||||||
|
isVirtual = true;
|
||||||
|
persistFolder = "/persist";
|
||||||
|
};
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
networkmanager.enable = true;
|
||||||
|
enableIPv6 = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.loader = {
|
||||||
|
limine = {
|
||||||
|
enable = true;
|
||||||
|
efiSupport = true;
|
||||||
|
};
|
||||||
|
efi = {
|
||||||
|
canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,11 @@
|
||||||
default = false;
|
default = false;
|
||||||
description = "Used to indicate a host that is darwin";
|
description = "Used to indicate a host that is darwin";
|
||||||
};
|
};
|
||||||
|
isVirtual = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Used to indicate a virtual host";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue