From 65f71da77061339b4ed9b33508e95049a4e77cb4 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 4 Jun 2024 21:11:53 +0530 Subject: os/common/{environment,user}: init --- os/common/configuration.nix | 47 +++++++-------------------------------- os/common/modules/environment.nix | 19 ++++++++++++++++ os/common/modules/user.nix | 16 +++++++++++++ 3 files changed, 43 insertions(+), 39 deletions(-) create mode 100644 os/common/modules/environment.nix create mode 100644 os/common/modules/user.nix diff --git a/os/common/configuration.nix b/os/common/configuration.nix index e075ac3..8c89efb 100644 --- a/os/common/configuration.nix +++ b/os/common/configuration.nix @@ -1,11 +1,6 @@ -{ config, pkgs, lib, ... }: - -let +{ config, ... }: let host = config.networking.hostName; - user = config.global.userdata.name; - email = config.global.userdata.email; -in -{ +in { disabledModules = [ "services/networking/pppd.nix" "services/mail/stalwart-mail.nix" @@ -13,53 +8,27 @@ in imports = [ ./modules/tmux.nix ./modules/nix.nix + ./modules/user.nix + ./modules/environment.nix ./modules/pppd.nix ./modules/stalwart-mail.nix ]; system.stateVersion = "24.11"; + time.timeZone = "Asia/Kolkata"; + networking.useDHCP = false; + sops = { defaultSopsFile = ../${host}/secrets.yaml; age.keyFile = "/var/secrets/${host}.sops"; }; + boot = { tmp.useTmpfs = true; loader.timeout = 1; }; - users.users.${user} = { - uid = 1000; - isNormalUser = true; - description = email; - extraGroups = [ "wheel" ]; - - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAcCendbKbeoc7hYEEcBt9wwtSXrJUgJ2SuYARO0zPAX sinan@veu" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL8LnyOuPmtKRqAZeHueNN4kfYvpRQVwCivSTq+SZvDU sinan@cez" - ]; - }; - time.timeZone = "Asia/Kolkata"; - networking.useDHCP = false; - - environment = { - binsh = lib.getExe pkgs.dash; - systemPackages = with pkgs; [ - dash - neovim - ]; - - variables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - - shellAliases = { - ls = "ls --color=auto --group-directories-first"; - grep = "grep --color=auto"; - }; - }; - services.openssh = { enable = true; settings.PasswordAuthentication = false; diff --git a/os/common/modules/environment.nix b/os/common/modules/environment.nix new file mode 100644 index 0000000..38446f2 --- /dev/null +++ b/os/common/modules/environment.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: { + environment = { + binsh = lib.getExe pkgs.dash; + systemPackages = with pkgs; [ + dash + neovim + ]; + + variables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + }; + + shellAliases = { + grep = "grep --color=auto"; + ls = "ls --color=auto --group-directories-first"; + }; + }; +} diff --git a/os/common/modules/user.nix b/os/common/modules/user.nix new file mode 100644 index 0000000..d6c341b --- /dev/null +++ b/os/common/modules/user.nix @@ -0,0 +1,16 @@ +{ config, ... }: let + user = config.global.userdata.name; + email = config.global.userdata.email; +in { + users.users.${user} = { + uid = 1000; + isNormalUser = true; + description = email; + extraGroups = [ "wheel" ]; + + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAcCendbKbeoc7hYEEcBt9wwtSXrJUgJ2SuYARO0zPAX sinan@veu" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL8LnyOuPmtKRqAZeHueNN4kfYvpRQVwCivSTq+SZvDU sinan@cez" + ]; + }; +} -- cgit v1.2.3