move user settings from nixosModules to userModules

This commit is contained in:
Aly Raffauf 2024-07-07 17:12:00 -04:00
parent ff1660f829
commit 62e400ddeb
11 changed files with 79 additions and 98 deletions

View file

@ -78,6 +78,9 @@
nixosModules.nixos = nixosModules.nixos =
import ./nixosModules inputs; import ./nixosModules inputs;
nixosModules.users =
import ./userModules inputs;
nixosConfigurations = nixosConfigurations =
inputs.nixpkgs.lib.genAttrs [ inputs.nixpkgs.lib.genAttrs [
"fallarbor" "fallarbor"
@ -100,6 +103,7 @@
inputs.nur.nixosModules.nur inputs.nur.nixosModules.nur
inputs.raffauflabs.nixosModules.raffauflabs inputs.raffauflabs.nixosModules.raffauflabs
self.nixosModules.nixos self.nixosModules.nixos
self.nixosModules.users
{ {
home-manager = { home-manager = {

View file

@ -4,7 +4,6 @@
inputs, inputs,
lib, lib,
pkgs, pkgs,
self,
... ...
}: { }: {
imports = [ imports = [

View file

@ -10,6 +10,5 @@ inputs: {
./desktop ./desktop
./options.nix ./options.nix
./services ./services
./users
]; ];
} }

View file

@ -108,67 +108,5 @@
}; };
}; };
}; };
users = {
defaultGroups = lib.mkOption {
description = "Default groups for desktop users.";
default = [
"dialout"
"docker"
"libvirtd"
"lp"
"networkmanager"
"scanner"
"transmission"
"video"
"wheel"
];
};
aly = {
enable = lib.mkEnableOption "Aly's user.";
manageHome = lib.mkOption {
description = "Whether to enable aly's home directory.";
type = lib.types.bool;
default = config.ar.users.aly.enable;
};
password = lib.mkOption {
description = "Hashed password for aly.";
type = lib.types.str;
};
};
dustin = {
enable = lib.mkEnableOption "Dustin's user.";
manageHome = lib.mkOption {
description = "Whether to manage dustin's home directory.";
type = lib.types.bool;
default = config.ar.users.dustin.enable;
};
password = lib.mkOption {
description = "Hashed password for dustin.";
type = lib.types.str;
};
};
morgan = {
enable = lib.mkEnableOption "Morgan's user.";
manageHome = lib.mkOption {
description = "Whether to manage morgan's home directory.";
type = lib.types.bool;
default = config.ar.users.morgan.enable;
};
password = lib.mkOption {
description = "Hashed password for morgan.";
type = lib.types.str;
};
};
};
}; };
} }

View file

@ -1,7 +1,7 @@
{ {
pkgs,
lib,
config, config,
lib,
pkgs,
... ...
}: { }: {
imports = [./syncMusic.nix]; imports = [./syncMusic.nix];

View file

@ -1,25 +0,0 @@
{
config,
inputs,
lib,
pkgs,
self,
...
}: {
imports = [
./aly
./dustin
./morgan
];
users = {
mutableUsers = false;
users.root.openssh.authorizedKeys.keyFiles = [
../../secrets/publicKeys/aly_lavaridge.pub
../../secrets/publicKeys/aly_mauville.pub
../../secrets/publicKeys/aly_petalburg.pub
../../secrets/publicKeys/aly_rustboro.pub
];
};
}

View file

@ -8,7 +8,7 @@
home-manager.users.aly = home-manager.users.aly =
lib.attrsets.optionalAttrs lib.attrsets.optionalAttrs
config.ar.users.aly.manageHome config.ar.users.aly.manageHome
(import ../../../homes/aly); (import ../../homes/aly);
users.users.aly = { users.users.aly = {
description = "Aly Raffauf"; description = "Aly Raffauf";
@ -24,10 +24,10 @@
]; ];
keyFiles = [ keyFiles = [
../../../secrets/publicKeys/aly_lavaridge.pub ../../secrets/publicKeys/aly_lavaridge.pub
../../../secrets/publicKeys/aly_mauville.pub ../../secrets/publicKeys/aly_mauville.pub
../../../secrets/publicKeys/aly_petalburg.pub ../../secrets/publicKeys/aly_petalburg.pub
../../../secrets/publicKeys/aly_rustboro.pub ../../secrets/publicKeys/aly_rustboro.pub
]; ];
}; };

24
userModules/default.nix Normal file
View file

@ -0,0 +1,24 @@
inputs: {
config,
pkgs,
lib,
...
}: {
imports = [
./aly
./dustin
./morgan
./options.nix
];
users = {
mutableUsers = false;
users.root.openssh.authorizedKeys.keyFiles = [
../secrets/publicKeys/aly_lavaridge.pub
../secrets/publicKeys/aly_mauville.pub
../secrets/publicKeys/aly_petalburg.pub
../secrets/publicKeys/aly_rustboro.pub
];
};
}

View file

@ -8,7 +8,7 @@
home-manager.users.dustin = home-manager.users.dustin =
lib.attrsets.optionalAttrs lib.attrsets.optionalAttrs
config.ar.users.dustin.manageHome config.ar.users.dustin.manageHome
(import ../../../homes/dustin); (import ../../homes/dustin);
users.users.dustin = { users.users.dustin = {
description = "Dustin Raffauf"; description = "Dustin Raffauf";

View file

@ -8,7 +8,7 @@
home-manager.users.morgan = home-manager.users.morgan =
lib.attrsets.optionalAttrs lib.attrsets.optionalAttrs
config.ar.users.morgan.manageHome config.ar.users.morgan.manageHome
(import ../../../homes/morgan); (import ../../homes/morgan);
users.users.morgan = { users.users.morgan = {
description = "Morgan Tamayo"; description = "Morgan Tamayo";

42
userModules/options.nix Normal file
View file

@ -0,0 +1,42 @@
{
config,
lib,
pkgs,
...
}: {
options.ar.users = let
mkUser = user: {
enable = lib.mkEnableOption "${user}.";
manageHome = lib.mkOption {
description = "Whether to manage ${user}'s home directory.";
type = lib.types.bool;
default = true;
};
password = lib.mkOption {
description = "Hashed password for ${user}.";
type = lib.types.str;
};
};
in {
defaultGroups = lib.mkOption {
description = "Default groups for desktop users.";
default = [
"dialout"
"docker"
"libvirtd"
"lp"
"networkmanager"
"scanner"
"transmission"
"video"
"wheel"
];
};
aly = mkUser "aly";
dustin = mkUser "dustin";
morgan = mkUser "morgan";
};
}