lotsa reorganization

This commit is contained in:
CherryKitten 2024-03-24 19:03:41 +01:00
parent 48bbfe3b4b
commit 9f5a9af650
Signed by: sammy
GPG key ID: 98D8F75FB0658276
28 changed files with 15 additions and 6 deletions

View file

@ -42,7 +42,7 @@
}; };
defaults = { lib, config, name, ... }: { defaults = { lib, config, name, ... }: {
imports = [ ./hosts/${name}/configuration.nix ./modules/nixos/common.nix (import "${home-manager}/nixos") ]; imports = [ ./hosts/${name} ./hosts/common (import "${home-manager}/nixos") ];
deployment = { deployment = {
targetUser = "sammy"; targetUser = "sammy";
@ -53,6 +53,8 @@
inherit inputs outputs; inherit inputs outputs;
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
}; };
cherrykitten.hostname = name;
}; };
bengal = { }; bengal = { };
@ -63,7 +65,7 @@
test = nixpkgs.lib.nixosSystem { test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit inputs outputs; };
modules = [ ./modules/nixos/common.nix ./hosts/test-vm/configuration.nix (import "${home-manager}/nixos") ]; modules = [ ./hosts/test-vm ./hosts/common (import "${home-manager}/nixos") ];
}; };
} // colmenaHive.nodes; } // colmenaHive.nodes;
@ -73,7 +75,7 @@
mkHome = { user ? "sammy", hostname ? null }: mkHome = { user ? "sammy", hostname ? null }:
lib.homeManagerConfiguration { lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ ./modules/home/users/${user}.nix ] ++ lib.optional (!isNull hostname) ./modules/home/hosts/${hostname}.nix; modules = [ ./users/${user}.nix ] ++ lib.optional (!isNull hostname) (./. + "/users/${user}@${hostname}.nix");
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };

View file

@ -1,5 +1,10 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }: {
options.cherrykitten.common = { options.cherrykitten = {
hostname = lib.mkOption {
type = lib.types.str;
default = "";
description = "the hostname, this is already set for every host by the flake config";
};
test = lib.mkOption { test = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "nya"; default = "nya";

View file

@ -1,6 +1,7 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let let
cfg = config.cherrykitten.users; cfg = config.cherrykitten.users;
hostname = config.cherrykitten.hostname;
in in
{ {
options.cherrykitten.users = { options.cherrykitten.users = {
@ -16,6 +17,7 @@ in
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ]; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ];
}; };
home-manager.users.sammy = lib.mkIf cfg.sammy.enable (import ../home/users/sammy.nix); home-manager.users.sammy = lib.mkIf cfg.sammy.enable (import ../../users/sammy.nix)
// lib.mkIf (lib.pathExists (../../users + "/sammy@${hostname}.nix")) (import ../../users + "sammy@${hostname}.nix");
}; };
} }

View file

@ -1,5 +1,5 @@
{ ... }: { { ... }: {
imports = [ ../default.nix ]; imports = [ ./common ];
programs.git = { programs.git = {
userName = "CherryKitten"; userName = "CherryKitten";