move vars into a separate file

This commit is contained in:
Andreas Zweili 2022-02-21 11:36:12 +01:00
parent 075576d220
commit 85c73e44f0
19 changed files with 45 additions and 45 deletions

4
custom/default.nix Normal file
View File

@ -0,0 +1,4 @@
{
username = "andreas";
system = "x86_64-linux";
}

View File

@ -12,10 +12,6 @@
url = "github:nix-community/home-manager/release-21.11";
inputs.nixpkgs.follows = "nixpkgs";
};
custom = {
system = "x86_64-linux";
username = "andreas";
};
};
outputs =
@ -24,9 +20,9 @@
, nixpkgs-unstable
, nixos-hardware
, home-manager
, custom
}:
let
custom = import ./custom;
system = custom.system;
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
@ -46,7 +42,7 @@
};
mkComputer = configurationNix: homeManagerRole: extraModules: nixpkgs.lib.nixosSystem {
inherit system pkgs;
specialArgs = { inherit inputs; };
specialArgs = { inherit custom inputs; };
modules = (
[
# System configuration for this host
@ -60,7 +56,7 @@
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${custom.username}.imports = [
(import homeManagerRole { inherit pkgs inputs; })
(import homeManagerRole { inherit custom pkgs inputs; })
];
}
] ++ extraModules

View File

@ -1,8 +1,8 @@
{ inputs, ... }:
{ inputs, custom, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = inputs.custom.username;
home.homeDirectory = "/home/${inputs.custom.username}";
home.username = custom.username;
home.homeDirectory = "/home/${custom.username}";
programs.home-manager.enable = true;
}

View File

@ -1,7 +1,7 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
(import ./common { inherit inputs; })
(import ./common { inherit custom inputs; })
./software/work-desktop
./software/autorandr
./software/calibre

View File

@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
(import ./common { inherit inputs; })

View File

@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
./common
@ -14,7 +14,7 @@
enable = true;
bashrcExtra = ''
. ~/.nixos/home-manager/configs/bash/work_wsl_bashrc
. /home/${inputs.custom.username}/.nix-profile/etc/profile.d/nix.sh
. /home/${custom.username}/.nix-profile/etc/profile.d/nix.sh
'';
};
}

View File

@ -1,8 +1,8 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
services.code-server = {
enable = true;
user = inputs.custom.username;
user = custom.username;
host = "0.0.0.0";
auth = "none";
extraPackages = with pkgs;
@ -14,7 +14,7 @@
git
];
extraEnvironment = {
HOME = "/home/${inputs.custom.username}";
HOME = "/home/${custom.username}";
};
};
networking.firewall.allowedTCPPorts = [ 4444 ];

View File

@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/cli"
@ -49,7 +49,7 @@
# Disable the root user
users.users.root.hashedPassword = "!";
# Define a user account. Don't forget to set a password with passwd.
users.users.${inputs.custom.username} = {
users.users.${custom.username} = {
isNormalUser = true;
initialPassword = "password";
extraGroups = [

View File

@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
networking = {
networkmanager.enable = true;
@ -59,7 +59,7 @@
terminator
];
environment.shellAliases = {
management-server = "mosh ${inputs.custom.username}@10.7.89.150 tmux a";
management-server = "mosh ${custom.username}@10.7.89.150 tmux a";
};
}

View File

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

View File

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

View File

@ -1,10 +1,10 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
gnome.eog
];
home-manager.users.${inputs.custom.username} = {
home-manager.users.${custom.username} = {
xdg.mimeApps = {
enable = true;
associations.added = {

View File

@ -1,7 +1,7 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
services.espanso.enable = true;
home-manager.users.${inputs.custom.username} = {
home-manager.users.${custom.username} = {
xdg.configFile.espanso = {
target = "espanso/default.yml";
onChange = "systemctl --user restart espanso";

View File

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

View File

@ -1,11 +1,11 @@
{ inputs, time, ... }:
{ inputs, custom, time, ... }:
{
services.restic.backups.${inputs.custom.username} = {
services.restic.backups.${custom.username} = {
user = "root";
repository = "rest:http://10.7.89.30:8000";
timerConfig.OnCalendar = time;
passwordFile = "/home/${inputs.custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${inputs.custom.username}/" ];
passwordFile = "/home/${custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${custom.username}/" ];
extraBackupArgs = [
"--exclude-file=${inputs.self}/modules/restic/excludes.txt"
];

View File

@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
let
repository = "/mnt/restic-server";
in

View File

@ -1,18 +1,18 @@
{ inputs, pkgs, ... }:
{ inputs, custom, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
restic
];
services.restic.backups.${inputs.custom.username} = {
user = inputs.custom.username;
services.restic.backups.${custom.username} = {
user = custom.username;
repository = "rest:http://10.7.89.30:8000";
timerConfig = {
OnCalendar = "hourly";
RandomizedDelaySec = "15min";
};
passwordFile = "/home/${inputs.custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${inputs.custom.username}/" ];
passwordFile = "/home/${custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${custom.username}/" ];
extraBackupArgs = [
"--exclude-file=${inputs.self}/modules/restic/excludes.txt"
];

View File

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

View File

@ -1,4 +1,4 @@
{ inputs, hostname, ip, ... }:
{ inputs, custom, hostname, ip, ... }:
{
imports = [
(import "${inputs.self}/modules/mk-network" { inherit hostname ip; })