added more config

This commit is contained in:
Jakub Kropáček 2024-12-18 23:14:56 +01:00
parent ce0fcb23a4
commit 15771a522d
7 changed files with 114 additions and 7 deletions

View file

@ -22,16 +22,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1734119587,
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
"lastModified": 1734536697,
"narHash": "sha256-G/HnRTtU+ob8x967kjzMRqjNFbAdllrcjYc+IcaR15Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
"rev": "9c40bef08a5bdc0ccc3207f4282a1ded83e77a7a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -13,7 +13,10 @@
outputs =
inputs@{ self, nixpkgs, ... }:
let
kclib = (import ./lib.nix);
kclib = import ./lib.nix {
nixpkgs = inputs.nixpkgs;
inputs = inputs;
};
in
{
nixosConfigurations = {

19
hosts/base.nix Normal file
View file

@ -0,0 +1,19 @@
{
...
}:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
kropcloud = {
admin = {
user = "krop";
sshKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJl0Rdo2kHliBeIiPuiO4kYO5M0VZFNXw4siepV1p6Pj krop@wenar-nix"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOUnlAjPnMwJYgZb7YuholdTxifOEFnAyXVqI+xFlHw6 krop@lenar"
];
};
};
system.stateVersion = "24.11";
}

View file

@ -1,6 +1,5 @@
{
nixpkgs,
lib,
inputs,
}:
{
@ -8,6 +7,7 @@
nixpkgs.lib.nixosSystem = {
system = arch;
modules = [
./hosts/base.nix
./hosts/${name}.nix
./nixosModules
];

View file

@ -1 +1,7 @@
{ }: { }
{ }:
{
imports = [
./users
./locale
];
}

View file

@ -0,0 +1,52 @@
{ config, lib, ... }:
let
cfg = config.kropcloud.locale;
in
{
options.kropcloud.locale = {
timeZone = lib.mkOption {
type = lib.types.str;
default = "Europe/Prague";
description = "The timezone for the system.";
};
keyMap = lib.mkOption {
type = lib.types.str;
default = "cz-lat2";
description = "The keymap to use for console input.";
};
defaultLocale = lib.mkOption {
type = lib.types.str;
default = "en_GB.UTF-8";
description = "The default locale for the system.";
};
extraLocale = lib.mkOption {
type = lib.types.str;
default = "cs_CZ.UTF-8";
description = "The locale to apply uniformly to all LC_* categories.";
};
};
config = {
# Set the system timezone.
time.timeZone = cfg.timeZone;
# Set the default locale.
i18n.defaultLocale = cfg.defaultLocale;
# Apply the same locale to all LC_* categories.
i18n.extraLocaleSettings = lib.genAttrs [
"LC_ADDRESS"
"LC_IDENTIFICATION"
"LC_MEASUREMENT"
"LC_MONETARY"
"LC_NAME"
"LC_NUMERIC"
"LC_PAPER"
"LC_TELEPHONE"
"LC_TIME"
] (_: cfg.extraLocale);
# Set the console keymap.
console.keyMap = cfg.keyMap;
};
}

View file

@ -0,0 +1,27 @@
{ config, lib, ... }:
let
cfg = config.kropcloud.admin;
in
{
options.kropcloud.admin = {
user = lib.mkOption {
type = lib.types.str;
default = "krop";
description = "Name of the admin user to be created.";
};
sshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "List of SSH public keys to authorize for the admin user.";
};
};
config = {
# Define the admin user
users.users.${cfg.user} = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = cfg.sshKeys;
};
};
}