users: Add system.singleUser

This commit is contained in:
PapaTutuWawa 2021-08-04 19:07:42 +02:00
parent 3bf532866b
commit 97c6fece4c
14 changed files with 370 additions and 328 deletions

View File

@ -8,6 +8,7 @@ in {
./generic.nix
./modules/hardware/generic.nix ./modules/hardware/bluetooth.nix ./modules/hardware/wifi.nix ./modules/hardware/video.nix ./modules/hardware/mobile.nix
./modules/fonts.nix
./modules/users
./modules/users/alexander.nix
./modules/programs/zsh ./modules/programs/mpv ./modules/programs/git ./modules/programs/tmux ./modules/programs/firefox ./modules/programs/gnome-terminal ./modules/programs/gnome ./modules/programs/nonvm
./modules/programs/distributed-build/offload.nix

View File

@ -11,6 +11,7 @@ in
# Install home-manager
imports = [
"${home-manager}/nixos"
./modules/users # For system.singleUser
];
home-manager.useGlobalPkgs = true;
@ -68,8 +69,6 @@ in
avahi.enable = false;
};
documentation.nixos.enable = false;
security.sudo.extraConfig = ''
Defaults env_keep += "NIXOS_CONFIG"
'';

View File

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
home-manager.users.alexander.home.file = {
config.home-manager.users."${config.system.singleUser}".home.file = {
".emacs".source = ./dotemacs;
".emacs.d/early-init.el".source = ./early-init.el;
".emacs.d/mu4e.el".source = ./mu4e.el;

View File

@ -1,6 +1,7 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
config = {
environment = {
systemPackages = with pkgs; [ firefox-wayland tor-browser-bundle-bin ];
@ -16,7 +17,7 @@
};
};
home-manager.users.alexander.programs.firefox = {
home-manager.users."${config.system.singleUser}".programs.firefox = {
enable = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
https-everywhere
@ -132,4 +133,5 @@
};
};
};
};
}

View File

@ -1,8 +1,9 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
config = {
environment.systemPackages = [ pkgs.diff-so-fancy ];
home-manager.users.alexander.programs.git = {
home-manager.users."${config.system.singleUser}".programs.git = {
enable = true;
userEmail = "papatutuwawa@polynom.me";
userName = "Alexander \"PapaTutuWawa\"";
@ -22,4 +23,5 @@
};
};
};
};
}

View File

@ -1,8 +1,9 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
config = {
environment.systemPackages = [ pkgs.gnome.gnome-terminal ];
home-manager.users.alexander.programs.gnome-terminal = {
home-manager.users."${config.system.singleUser}".programs.gnome-terminal = {
enable = true;
profile.default = {
visibleName = "default";
@ -13,4 +14,5 @@
font = "Source Code Pro 12";
};
};
};
}

View File

@ -3,6 +3,7 @@
let
unstable = (import ../../unstable.nix config);
in {
config = {
environment = {
systemPackages = with pkgs; [
arc-theme
@ -63,4 +64,54 @@ in {
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
gtkUsePortal = true;
};
home-manager.users."${config.system.singleUser}" = {
dconf.settings = {
# The packages come in from modules/programs/gnome
# Theme
"org/gnome/desktop/interface" = {
gtk-theme = "Arc-Dark";
};
# Nightlight (TODO: ?)
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = true;
};
# Extensions
"org/gnome/shell" = {
enabled-extensions = [
"caffeine@patapon.info"
"notification-timeout@chlumskyvaclav.gmail.com"
"gnome-ui-tune@itstime.tech"
"volume-mixer@evermiss.net"
];
};
"org/gnome/shell/extensions/caffeine" = {
show-notifications = false;
inhibit-apps = [ "mpv.desktop" ];
};
"org/gnome/shell/extensions/notification-timeout" = {
timeout = 3000;
};
"org/gnome/shell/extensions/gnome-ui-tune" = {
hide-search = true;
};
# Shortcuts
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Alt>Return";
command = "gnome-terminal";
name = "Terminal";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>s";
command = "systemctl suspend";
name = "Suspend";
};
};
};
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
let
makeMpvProfile = { shader, additional ? {} }: {
@ -14,9 +14,10 @@ let
tscale = "oversample";
} // additional;
in {
config = {
environment.systemPackages = [ pkgs.mpv ];
home-manager.users.alexander = {
home-manager.users."${config.system.singleUser}" = {
xdg.configFile = {
"mpv/shaders/Anime4K_Upscale_CNN_UL_x2_Deblur.glsl".source = ./shaders/Anime4K_Upscale_CNN_UL_x2_Deblur.glsl;
"mpv/shaders/Anime4K_Upscale_CNN_UL_x2_Denoise.glsl".source = ./shaders/Anime4K_Upscale_CNN_UL_x2_Denoise.glsl;
@ -41,4 +42,5 @@ in {
};
};
};
};
}

View File

@ -1,8 +1,9 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
config = {
environment.systemPackages = [ pkgs.tmux ];
home-manager.users.alexander.programs.tmux = {
home-manager.users."${config.system.singleUser}".programs.tmux = {
enable = true;
extraConfig = ''
set -g mouse on
@ -53,4 +54,5 @@
# }
'';
};
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
environment = {
@ -11,7 +11,7 @@
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
home-manager.users.alexander.programs.zsh = {
home-manager.users."${config.system.singleUser}".programs.zsh = {
enable = true;
history.ignoreSpace = true;
shellAliases = {

View File

@ -12,10 +12,14 @@
isSystemUser = false;
};
system.singleUser = "alexander";
# Activate gpg
programs.gnupg.agent.enable = true;
# No need to use users."${system.singleUser}" as we already know it
home-manager.users.alexander = {
# TODO: Move into a generic
pam.sessionVariables = {
NIXOS_CONFIG = "\${HOME}/Development/Personal/nixos-config/${config.networking.hostName}.nix";
};
@ -37,53 +41,6 @@
enable = true;
pinentryFlavor = "gnome3";
};
dconf.settings = {
# The packages come in from modules/programs/gnome
# Theme
"org/gnome/desktop/interface" = {
gtk-theme = "Arc-Dark";
};
# Nightlight (TODO: ?)
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = true;
};
# Extensions
"org/gnome/shell" = {
enabled-extensions = [
"caffeine@patapon.info"
"notification-timeout@chlumskyvaclav.gmail.com"
"gnome-ui-tune@itstime.tech"
"volume-mixer@evermiss.net"
];
};
"org/gnome/shell/extensions/caffeine" = {
show-notifications = false;
inhibit-apps = [ "mpv.desktop" ];
};
"org/gnome/shell/extensions/notification-timeout" = {
timeout = 3000;
};
"org/gnome/shell/extensions/gnome-ui-tune" = {
hide-search = true;
};
# Shortcuts
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Alt>Return";
command = "gnome-terminal";
name = "Terminal";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>s";
command = "systemctl suspend";
name = "Suspend";
};
};
};
};
}

11
modules/users/default.nix Normal file
View File

@ -0,0 +1,11 @@
{ lib, ... }:
{
options.system = {
singleUser = lib.options.mkOption {
example = "PapaTutuWawa";
readOnly = true;
description = "The username of this single-user system";
};
};
}

View File

@ -1,5 +1,18 @@
{ pkgs, ... }:
{ pkgs, lib, config, ... }:
{
# TODO
config = {
users.users.fuck-xi = {
isNormalUser = true;
extraGroups = [ "wheel" "audio" "video" "kvm" "input" ];
# -> abc123
hashedPassword = "$5$etg0.qVfujgh8JZu$HxGwG.aTZIT1vVo/E2wNdgVLr6dtg.XEPxvAro.iJ29";
shell = pkgs.zsh;
useDefaultShell = false;
uid = 1000;
isSystemUser = false;
};
system.singleUser = "fuck-xi";
};
}