write the username into a separate file

This commit is contained in:
Andreas Zweili 2021-12-31 10:32:47 +01:00
parent 7163560725
commit be95c56aa7
11 changed files with 50 additions and 21 deletions

View File

@ -23,6 +23,7 @@
}:
let
system = "x86_64-linux";
username = import ./username.nix;
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
@ -50,7 +51,7 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.andreas = import ./home-manager/desktop.nix
home-manager.users.${username} = import ./home-manager/desktop.nix
{
inherit inputs system pkgs;
};
@ -67,7 +68,7 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.andreas = import ./home-manager/desktop.nix
home-manager.users.${username} = import ./home-manager/desktop.nix
{
inherit inputs system pkgs;
};
@ -82,7 +83,7 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.andreas = import ./home-manager/desktop.nix
home-manager.users.${username} = import ./home-manager/desktop.nix
{
inherit inputs system pkgs;
};

View File

@ -1,10 +1,12 @@
{ pkgs, ... }:
let
username = import ../username.nix;
in
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "andreas";
home.homeDirectory = "/home/andreas";
home.username = username;
home.homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage

View File

@ -1,7 +1,10 @@
{ ... }:
let
username = import ../../username.nix;
in
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "andreas";
home.homeDirectory = "/home/andreas";
home.username = username;
home.homeDirectory = "/home/${username}";
}

View File

@ -1,4 +1,7 @@
{ pkgs, ... }:
let
username = import ../username.nix;
in
{
imports = [
./common
@ -10,7 +13,7 @@
enable = true;
bashrcExtra = ''
. ~/git_repos/nixos/home-manager/work_config/bashrc
. /home/andreas/.nix-profile/etc/profile.d/nix.sh
. /home/${username}/.nix-profile/etc/profile.d/nix.sh
'';
};
}

View File

@ -1,5 +1,7 @@
{ pkgs, ... }:
let
username = import ../username.nix;
in
{
imports = [
./cli-packages.nix
@ -43,7 +45,7 @@
};
# Define a user account. Don't forget to set a password with passwd.
users.users.andreas = {
users.users.${username} = {
isNormalUser = true;
initialPassword = "password";
extraGroups = [

View File

@ -1,11 +1,14 @@
{ pkgs, ... }:
let
username = import ../username.nix;
in
{
virtualisation.docker =
{
enable = true;
autoPrune.enable = true;
};
users.users.andreas.extraGroups = [ "docker" ];
users.users.${username}.extraGroups = [ "docker" ];
environment.systemPackages = with pkgs; [
docker-compose
lazydocker

View File

@ -1,4 +1,7 @@
{ pkgs, ... }:
let
username = import ../../username.nix;
in
{
programs.droidcam.enable = true;
# required for USB connection
@ -6,7 +9,7 @@
environment.shellAliases = {
webcam = "droidcam-cli -size=1920x1080 ios 4747";
};
home-manager.users.andreas = {
home-manager.users.${username} = {
xdg.desktopEntries = {
droidcam = {
name = "Droidcam";

View File

@ -3,6 +3,7 @@ let
system-version = import ../version.nix;
home-manager-url = "https://github.com/nix-community/home-manager/archive/release-" + system-version + ".tar.gz";
home-manager = builtins.fetchTarball home-manager-url;
username = import ../username.nix;
in
{
imports = [
@ -10,7 +11,7 @@ in
];
home-manager.useGlobalPkgs = true;
home-manager.users.andreas = {
home-manager.users.${username} = {
imports = [
../home-manager/desktop.nix
];

View File

@ -1,13 +1,16 @@
{ ... }:
let
username = import ../../username.nix;
in
{
services.restic.backups."andreas" = {
user = "andreas";
services.restic.backups.${username} = {
user = username;
repository = "sftp:borg@10.7.89.117:restic";
timerConfig.OnCalendar = "hourly";
passwordFile = "/home/andreas/git_repos/nixos/secrets/passwords/restic.key";
paths = [ "/home/andreas/" ];
passwordFile = "/home/${username}/git_repos/nixos/secrets/passwords/restic.key";
paths = [ "/home/${username}/" ];
extraBackupArgs = [
"--exclude-file=/home/andreas/git_repos/nixos/modules/restic/excludes.txt"
"--exclude-file=/home/${username}/git_repos/nixos/modules/restic/excludes.txt"
];
};

View File

@ -1,16 +1,23 @@
{ pkgs, ... }:
let
username = import ../../username.nix;
in
{
programs.xonsh = {
enable = true;
config = ''
aliases['management-server'] = "mosh andreas@10.7.89.106 tmux a"
aliases['management-server'] = "mosh ${username}@10.7.89.106 tmux a"
aliases['nix-generations'] = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"
aliases['rebuild'] = "sudo nixos-rebuild -j auto switch"
aliases['find-garbage'] = "ls -l /nix/var/nix/gcroots/auto/ | sort"
'';
};
users.users.andreas = {
users.users.${username} = {
shell = pkgs.xonsh;
};
documentation.man.generateCaches = true;
home-manager.users.${username} = {
programs.man.generateCaches = true;
};
}

1
username.nix Normal file
View File

@ -0,0 +1 @@
"andreas"