From 3d8f1d3912be52e7e8346a3822c8a4faa5056de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 4 Mar 2024 14:53:50 +0200 Subject: [PATCH] vm updates --- hosts/vm/configuration.nix | 20 ++++---------------- modules/base/default.nix | 15 +++++++++++---- modules/profiles/desktop/default.nix | 16 ++++------------ 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix index 93a9546..9c6990b 100644 --- a/hosts/vm/configuration.nix +++ b/hosts/vm/configuration.nix @@ -28,7 +28,7 @@ mj = { stateVersion = "23.11"; timeZone = "UTC"; - desktop.username = "nixos"; + username = "nixos"; }; isoImage = { @@ -49,14 +49,6 @@ xserver.enable = true; }; - programs = { - ssh.startAgent = false; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - users.users = { nixos = { isNormalUser = true; @@ -66,6 +58,9 @@ root.initialHashedPassword = ""; }; + # do not autostart lightdm, leave at tty + systemd.services.display-manager.wantedBy = lib.mkForce []; + security = { pam.services.lightdm.text = '' auth sufficient pam_succeed_if.so user ingroup wheel @@ -81,11 +76,4 @@ domain = "jakstys.lt"; firewall.allowedTCPPorts = [22]; }; - - nix = { - extraOptions = '' - experimental-features = nix-command flakes - trusted-users = nixos - ''; - }; } diff --git a/modules/base/default.nix b/modules/base/default.nix index e599871..aa591d9 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -4,7 +4,9 @@ pkgs, myData, ... -}: { +}: let + cfg = config.mj; +in { imports = [ ./boot ./fileSystems @@ -28,6 +30,11 @@ example = "Europe/Vilnius"; description = "Time zone for this system"; }; + + username = lib.mkOption { + type = str; + default = "motiejus"; + }; }; config = { @@ -37,7 +44,7 @@ hardware.enableRedistributableFirmware = true; - time.timeZone = config.mj.timeZone; + time.timeZone = cfg.timeZone; mj.services.friendlyport.ports = [ { @@ -60,11 +67,11 @@ }; settings = { experimental-features = ["nix-command" "flakes"]; - trusted-users = ["motiejus"]; + trusted-users = [cfg.username]; }; }; - system.stateVersion = config.mj.stateVersion; + system.stateVersion = cfg.stateVersion; security = { sudo = { diff --git a/modules/profiles/desktop/default.nix b/modules/profiles/desktop/default.nix index e9571ca..b07c859 100644 --- a/modules/profiles/desktop/default.nix +++ b/modules/profiles/desktop/default.nix @@ -1,18 +1,10 @@ { - lib, pkgs, config, ... }: let - cfg = config.mj.desktop; + username = config.mj.username; in { - options.mj.desktop = with lib.types; { - username = lib.mkOption { - type = str; - default = "motiejus"; - }; - }; - config = { hardware.bluetooth = { enable = true; @@ -27,7 +19,7 @@ in { wireshark.enable = true; }; - mj.base.users.passwd.${cfg.username}.extraGroups = ["adbusers" "networkmanager" "wireshark"]; + mj.base.users.passwd.${username}.extraGroups = ["adbusers" "networkmanager" "wireshark"]; services = { fwupd.enable = true; @@ -68,7 +60,7 @@ in { defaultSession = "none+awesome"; autoLogin = { enable = true; - user = cfg.username; + user = username; }; }; }; @@ -239,7 +231,7 @@ in { # https://discourse.nixos.org/t/nixos-rebuild-switch-upgrade-networkmanager-wait-online-service-failure/30746 systemd.services.NetworkManager-wait-online.enable = false; - home-manager.users.${cfg.username} = { + home-manager.users.${username} = { pkgs, config, ...