From 9be3527af1283bc5318be6a23460436c5c1eb2c8 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Sun, 31 Jul 2022 23:06:16 -0700 Subject: [PATCH] share user configuration between systems --- nix/system/common/users.nix | 15 +++++++++++++++ nix/system/framework/configuration.nix | 20 ++++++-------------- nix/system/xps11/configuration.nix | 17 +---------------- 3 files changed, 22 insertions(+), 30 deletions(-) create mode 100644 nix/system/common/users.nix diff --git a/nix/system/common/users.nix b/nix/system/common/users.nix new file mode 100644 index 0000000..7c21ab6 --- /dev/null +++ b/nix/system/common/users.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + users.users.haak = { + isNormalUser = true; + extraGroups = [ + "wheel" # Enable ‘sudo’ for the user. + "networkmanager" # Allow the user to manage networks + ]; + }; + + users.extraUsers.haak = { + shell = pkgs.zsh; + }; +} diff --git a/nix/system/framework/configuration.nix b/nix/system/framework/configuration.nix index 7be99c8..867786f 100644 --- a/nix/system/framework/configuration.nix +++ b/nix/system/framework/configuration.nix @@ -9,6 +9,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../common/users.nix ]; # Use the systemd-boot EFI boot loader. @@ -158,20 +159,11 @@ location.provider = "geoclue2"; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.haak = { - isNormalUser = true; - extraGroups = [ - "wheel" # Enable ‘sudo’ for the user. - "networkmanager" # Allow the user to manage networks - "adbusers" # allow ADB use - ]; - }; - - users.extraUsers.haak = { - shell = pkgs.zsh; - }; - - nix.settings.trusted-users = [ "root" "haak" ]; + users.users.haak.extraGroups = [ + "wheel" # Enable ‘sudo’ for the user. + "networkmanager" # Allow the user to manage networks + "adbusers" # allow ADB use + ]; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database diff --git a/nix/system/xps11/configuration.nix b/nix/system/xps11/configuration.nix index 28f0732..ee23e3f 100644 --- a/nix/system/xps11/configuration.nix +++ b/nix/system/xps11/configuration.nix @@ -10,6 +10,7 @@ # Include the results of the hardware scan. ./hardware-configuration.nix ./glibc-locale-paths.nix + ../common/users.nix ]; # Use the systemd-boot EFI boot loader. @@ -183,22 +184,6 @@ location.provider = "geoclue2"; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.haak = { - isNormalUser = true; - extraGroups = [ - "wheel" # Enable ‘sudo’ for the user. - "networkmanager" # Allow the user to manage networks - ]; - }; - security.sudo.wheelNeedsPassword = false; - - users.extraUsers.haak = { - shell = pkgs.zsh; - }; - - nix.settings.trusted-users = [ "root" "haak" ]; - # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you