Add a option az-username

This commit is contained in:
Andreas Zweili 2023-05-29 12:26:02 +02:00
parent a511a1e113
commit 3114f334fe
26 changed files with 64 additions and 51 deletions

View File

@ -1,4 +1,4 @@
{ custom }: { lib, pkgs, ... }:
{ custom }: { config, lib, pkgs, ... }:
{
# The rough location
location = {
@ -65,7 +65,7 @@
# Disable the root user
users.users.root.hashedPassword = "!";
# Define a user account. Don't forget to set a password with passwd.
users.users.${custom.username} = {
users.users.${config.az-username} = {
isNormalUser = true;
initialPassword = "password";
extraGroups = [
@ -123,6 +123,8 @@
}
];
};
az-username = "andreas";
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions

View File

@ -5,5 +5,6 @@
./lockscreen
./makemkv
./rdp
./username
];
}

View File

@ -1,12 +1,12 @@
{ custom }: { pkgs, ... }:
{
imports = [
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
(import "${custom.inputs.self}/modules/email" { inherit custom; })
"${custom.inputs.self}/modules/hunspell"
(import "${custom.inputs.self}/modules/libimobiledevice" { inherit custom; })
(import "${custom.inputs.self}/modules/nix-direnv" { inherit custom; })
(import "${custom.inputs.self}/modules/pipewire" { inherit custom; })
"${custom.inputs.self}/modules/libimobiledevice"
"${custom.inputs.self}/modules/nix-direnv"
"${custom.inputs.self}/modules/pipewire"
"${custom.inputs.self}/modules/scripts"
"${custom.inputs.self}/modules/tmux"
];

View File

@ -1,11 +1,11 @@
{ custom }: { pkgs, ... }:
{ config, pkgs, ... }:
{
virtualisation.docker =
{
enable = true;
autoPrune.enable = true;
};
users.users.${custom.username}.extraGroups = [ "docker" ];
users.users.${config.az-username}.extraGroups = [ "docker" ];
environment.systemPackages = with pkgs; [
docker-compose
lazydocker

View File

@ -4,11 +4,11 @@
{
file = "${custom.inputs.self}/scrts/personal_email.key.age";
mode = "600";
owner = custom.username;
owner = config.az-username;
group = "users";
};
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
accounts.email.accounts."personal" = {
address = "andreas@zweili.ch";
realName = "Andreas Zweili";

View File

@ -1,4 +1,4 @@
{ config, custom, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.programs.az-eog;
in
@ -11,7 +11,7 @@ in
environment.systemPackages = with pkgs; [
gnome.eog
];
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
xdg.mimeApps = {
enable = true;
associations.added = {

View File

@ -1,4 +1,4 @@
{ custom }: { pkgs, ... }:
{ config, pkgs, ... }:
{
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs;
@ -6,7 +6,7 @@
libimobiledevice
];
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
home.shellAliases = {
iphone-backup = ''
backup_dir=~/Downloads/$(date -I)_iphone &&

View File

@ -1,4 +1,4 @@
{ config, custom, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.programs.az-makemkv;
in
@ -8,7 +8,7 @@ in
};
config = lib.mkIf cfg.enable {
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
home.packages = with pkgs; [
makemkv
];

View File

@ -1,11 +1,11 @@
{ custom, }: { ... }:
{ config, ... }:
{
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
};

View File

@ -1,4 +1,4 @@
{ custom }: { lib, ... }:
{ config, lib, ... }:
{
hardware.pulseaudio.enable = lib.mkForce false;
security.rtkit.enable = true;
@ -14,7 +14,7 @@
}];
};
};
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
services.easyeffects.enable = true;
};
}

View File

@ -1,6 +1,6 @@
{ custom }: { pkgs, ... }:
{ custom }: { config, pkgs, ... }:
let
pathToMonitor = "/home/${custom.username}/10_documents/";
pathToMonitor = "/home/${config.az-username}/10_documents/";
syncNotes = pkgs.writeShellScriptBin "monitor-notes" ''
${pkgs.rclone}/bin/rclone bisync -P --remove-empty-dirs --max-delete=10 --exclude=/99_archive/** nextcloud:10_documents ${pathToMonitor}
'';
@ -14,9 +14,9 @@ in
];
age.secrets.webdavSecrets = {
file = "${custom.inputs.self}/scrts/webdav_andreas.age";
path = "/home/${custom.username}/.config/rclone/rclone.conf";
path = "/home/${config.az-username}/.config/rclone/rclone.conf";
mode = "600";
owner = "${custom.username}";
owner = "${config.az-username}";
group = "users";
};
@ -32,7 +32,7 @@ in
systemd.services."rclone-webdav-sync" = {
after = [ "network-online.target" ];
serviceConfig = {
User = custom.username;
User = config.az-username;
Type = "oneshot";
};
onFailure = [ "unit-status-telegram@%n.service" ];
@ -43,7 +43,7 @@ in
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
User = custom.username;
User = config.az-username;
};
onFailure = [ "unit-status-telegram@%n.service" ];
wantedBy = [ "multi-user.target" ];

View File

@ -51,29 +51,29 @@ in
age.secrets.infomaniakEnv = {
file = "${custom.inputs.self}/scrts/infomaniak_env.age";
mode = "600";
owner = custom.username;
owner = config.az-username;
group = "users";
};
age.secrets.resticKey = {
file = "${custom.inputs.self}/scrts/restic.key.age";
mode = "600";
owner = custom.username;
owner = config.az-username;
group = "users";
};
systemd.timers."restic-backups-${custom.username}" = {
systemd.timers."restic-backups-${config.az-username}" = {
wantedBy = [ "timers.target" ];
partOf = [ "restic-backups-${custom.username}.service" ];
partOf = [ "restic-backups-${config.az-username}.service" ];
timerConfig = {
OnCalendar = "hourly";
RandomizedDelaySec = "15min";
};
};
systemd.services."restic-backups-${custom.username}" = {
systemd.services."restic-backups-${config.az-username}" = {
unitConfig.ConditionACPower = true;
serviceConfig = {
User = custom.username;
User = config.az-username;
Type = "oneshot";
};
environment = {
@ -85,7 +85,7 @@ in
${pkgs.restic}/bin/restic \
--exclude-file=${custom.inputs.self}/modules/restic-client/excludes.txt \
--tag home-dir \
backup /home/${custom.username}
backup /home/${config.az-username}
${pkgs.restic}/bin/restic \
forget \

View File

@ -1,4 +1,4 @@
{ custom }: { ... }:
{ config, ... }:
{
programs.steam.enable = true;
hardware.steam-hardware.enable = true;
@ -6,7 +6,7 @@
allowedTCPPorts = [ 27036 ];
allowedUDPPorts = [ 27031 ];
};
home-manager.users.${custom.username} = {
home-manager.users.${config.az-username} = {
home.file.".local/share/applications/steam.desktop".source = ./steam.desktop;
};
}

View File

@ -0,0 +1,10 @@
{ lib, ... }:
{
options = {
az-username = lib.mkOption {
type = lib.types.str;
description = "The main user of a system";
};
};
config = { };
}

View File

@ -1,4 +1,4 @@
{ custom, hostname }: { ... }:
{ custom, hostname }: { config, ... }:
{
imports = [
(import "${custom.inputs.self}/modules/desktop" { inherit custom; })
@ -38,7 +38,7 @@
virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.guest.x11 = true;
users.users.${custom.username} = {
users.users.${config.az-username} = {
extraGroups = [
"vboxsf"
];

View File

@ -18,7 +18,7 @@ in
(import "${custom.inputs.self}/modules/gitea" {
inherit custom domain;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/mariadb"
];
}

View File

@ -5,7 +5,7 @@
ip = "10.7.89.10";
inherit hostname custom;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/tmux"
];
}

View File

@ -13,7 +13,7 @@
(import "${custom.inputs.self}/modules/nginx-proxy" {
domain = "mail.zweili.org"; inherit custom;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
(import "${custom.inputs.self}/modules/docker-mailserver" { inherit custom; })
];
}

View File

@ -5,10 +5,10 @@
ip = "10.7.89.150";
inherit custom hostname;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/data-share"
"${custom.inputs.self}/modules/logs-share"
(import "${custom.inputs.self}/modules/nix-direnv" { inherit custom; })
"${custom.inputs.self}/modules/nix-direnv"
(import "${custom.inputs.self}/modules/rclone-webdav" { inherit custom; })
(import "${custom.inputs.self}/modules/restic-client-server" {
path = "/home/andreas";

View File

@ -6,8 +6,8 @@ in
imports = [
custom.inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${custom.inputs.self}/modules/log-to-ram"
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
(import "${custom.inputs.self}/modules/nix-direnv" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/nix-direnv"
"${custom.inputs.self}/modules/tmux"
];

View File

@ -8,7 +8,7 @@ in
ip = "10.7.89.103";
inherit custom hostname;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/mariadb"
(import "${custom.inputs.self}/modules/nextcloud" {
inherit custom domain;

View File

@ -11,7 +11,7 @@
time = "02:30";
inherit custom;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/media-share"
(import "${custom.inputs.self}/modules/plex" { inherit custom; })
];

View File

@ -11,7 +11,7 @@
inherit custom;
})
"${custom.inputs.self}/modules/nginx-acme-base"
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/grav"
"${custom.inputs.self}/modules/haproxy"
"${custom.inputs.self}/modules/heimdall"

View File

@ -5,7 +5,7 @@
custom.inputs.nixos-hardware.nixosModules.common-pc-laptop
custom.inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
(import "${custom.inputs.self}/modules/desktop" { inherit custom; })
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
(import "${custom.inputs.self}/modules/restic-client-desktop" { inherit custom; })
"${custom.inputs.self}/modules/tlp"
"${custom.inputs.self}/modules/tmux"

View File

@ -5,8 +5,8 @@
ip = "10.7.89.40";
inherit hostname custom;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
(import "${custom.inputs.self}/modules/nix-direnv" { inherit custom; })
"${custom.inputs.self}/modules/docker"
"${custom.inputs.self}/modules/nix-direnv"
"${custom.inputs.self}/modules/tmux"
];
}

View File

@ -8,7 +8,7 @@ in
ip = "10.7.89.115";
inherit custom hostname;
})
(import "${custom.inputs.self}/modules/docker" { inherit custom; })
"${custom.inputs.self}/modules/docker"
(import "${custom.inputs.self}/modules/nginx-proxy" {
domain = "rss-bridge.2li.ch";
port = "8082";