From 85c73e44f01710158d0999cdf6136d8fdf2449cf Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 21 Feb 2022 11:36:12 +0100 Subject: [PATCH] move vars into a separate file --- custom/default.nix | 4 ++++ flake.nix | 10 +++------- home-manager/common/default.nix | 6 +++--- home-manager/desktop.nix | 4 ++-- home-manager/headless.nix | 2 +- home-manager/work-wsl.nix | 4 ++-- modules/code-server/default.nix | 6 +++--- modules/common/default.nix | 4 ++-- modules/desktop/default.nix | 4 ++-- modules/docker/default.nix | 4 ++-- modules/droidcam/default.nix | 4 ++-- modules/eog/default.nix | 4 ++-- modules/espanso/default.nix | 4 ++-- modules/nix-direnv/default.nix | 4 ++-- modules/restic-server-client/default.nix | 8 ++++---- modules/restic-server/default.nix | 2 +- modules/restic/default.nix | 10 +++++----- modules/steam/default.nix | 4 ++-- systems/proxmox-vm/default.nix | 2 +- 19 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 custom/default.nix diff --git a/custom/default.nix b/custom/default.nix new file mode 100644 index 0000000..a80cc74 --- /dev/null +++ b/custom/default.nix @@ -0,0 +1,4 @@ +{ + username = "andreas"; + system = "x86_64-linux"; +} diff --git a/flake.nix b/flake.nix index 54e27b2..955aa74 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/home-manager/common/default.nix b/home-manager/common/default.nix index 18b65a2..ab1f470 100644 --- a/home-manager/common/default.nix +++ b/home-manager/common/default.nix @@ -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; } diff --git a/home-manager/desktop.nix b/home-manager/desktop.nix index 4f19037..a79ece6 100644 --- a/home-manager/desktop.nix +++ b/home-manager/desktop.nix @@ -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 diff --git a/home-manager/headless.nix b/home-manager/headless.nix index c88dcb6..f1d13fb 100644 --- a/home-manager/headless.nix +++ b/home-manager/headless.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ inputs, custom, pkgs, ... }: { imports = [ (import ./common { inherit inputs; }) diff --git a/home-manager/work-wsl.nix b/home-manager/work-wsl.nix index 8f0ab32..560885a 100644 --- a/home-manager/work-wsl.nix +++ b/home-manager/work-wsl.nix @@ -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 ''; }; } diff --git a/modules/code-server/default.nix b/modules/code-server/default.nix index d5c5c42..f672c85 100644 --- a/modules/code-server/default.nix +++ b/modules/code-server/default.nix @@ -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 ]; diff --git a/modules/common/default.nix b/modules/common/default.nix index f32f1ea..4c32ca0 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -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 = [ diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 62b04f3..adb5244 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -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"; }; } diff --git a/modules/docker/default.nix b/modules/docker/default.nix index df69b46..e7644b8 100644 --- a/modules/docker/default.nix +++ b/modules/docker/default.nix @@ -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 diff --git a/modules/droidcam/default.nix b/modules/droidcam/default.nix index 45537f3..1c42172 100644 --- a/modules/droidcam/default.nix +++ b/modules/droidcam/default.nix @@ -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"; diff --git a/modules/eog/default.nix b/modules/eog/default.nix index fbab623..2769659 100644 --- a/modules/eog/default.nix +++ b/modules/eog/default.nix @@ -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 = { diff --git a/modules/espanso/default.nix b/modules/espanso/default.nix index 32a50d8..6837bd4 100644 --- a/modules/espanso/default.nix +++ b/modules/espanso/default.nix @@ -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"; diff --git a/modules/nix-direnv/default.nix b/modules/nix-direnv/default.nix index 4ef584c..33cf464 100644 --- a/modules/nix-direnv/default.nix +++ b/modules/nix-direnv/default.nix @@ -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; diff --git a/modules/restic-server-client/default.nix b/modules/restic-server-client/default.nix index ecc6bb6..a204685 100644 --- a/modules/restic-server-client/default.nix +++ b/modules/restic-server-client/default.nix @@ -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" ]; diff --git a/modules/restic-server/default.nix b/modules/restic-server/default.nix index ff7b11d..e420521 100644 --- a/modules/restic-server/default.nix +++ b/modules/restic-server/default.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ inputs, custom, pkgs, ... }: let repository = "/mnt/restic-server"; in diff --git a/modules/restic/default.nix b/modules/restic/default.nix index 88e9ee6..350891a 100644 --- a/modules/restic/default.nix +++ b/modules/restic/default.nix @@ -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" ]; diff --git a/modules/steam/default.nix b/modules/steam/default.nix index 9cfe731..6cbd700 100644 --- a/modules/steam/default.nix +++ b/modules/steam/default.nix @@ -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; }; } diff --git a/systems/proxmox-vm/default.nix b/systems/proxmox-vm/default.nix index 41b25bf..890a518 100644 --- a/systems/proxmox-vm/default.nix +++ b/systems/proxmox-vm/default.nix @@ -1,4 +1,4 @@ -{ inputs, hostname, ip, ... }: +{ inputs, custom, hostname, ip, ... }: { imports = [ (import "${inputs.self}/modules/mk-network" { inherit hostname ip; })