refac: pass paths as extra args instead

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-10 02:37:26 +03:00
parent bac5f2747a
commit 374d00c941
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
9 changed files with 28 additions and 24 deletions

View file

@ -115,6 +115,9 @@
specialArgs = {
inherit inputs;
globalData = import ./data.nix;
usersPath = ./users;
hostsPath = ./hosts;
packagesPath = ./packages;
} // specialArgs;
modules =
@ -138,6 +141,9 @@
({ ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
packagesPath = ./packages;
};
home-manager.sharedModules = [
{
imports = [

View file

@ -1,7 +1,7 @@
{ config, ... }:
{ config, hostsPath, ... }:
let
serverData = import ../../../tatos/data.secret.nix;
serverData = import (hostsPath + "/tatos/data.secret.nix");
in
{
age.secrets.wireguard-asus-gl553vd-private = {

View file

@ -1,11 +1,11 @@
{ ... }:
{ hostsPath, usersPath, ... }:
let
asusData = import ../data.secret.nix;
homeData = import ../../home/data.secret.nix;
asusData = import (hostsPath + "/asus-gl553vd/data.secret.nix");
homeData = import (hostsPath + "/home/data.secret.nix");
in
{
imports = [ ../../../users/jan ];
imports = [ (usersPath + "/jan") ];
home-manager.users.jan = {
local.window-manager = {

View file

@ -1,7 +1,7 @@
{ config, ... }:
{ config, hostsPath, ... }:
let
serverData = import ../../../tatos/data.secret.nix;
serverData = import (hostsPath + "/tatos/data.secret.nix");
in
{
age.secrets.wireguard-home-private = {

View file

@ -1,9 +1,9 @@
{ ... }:
{ usersPath, ... }:
{
imports = [
./jan.nix
../../../users/nas
(usersPath + "/nas")
];
home-manager.sharedModules = [

View file

@ -1,11 +1,11 @@
{ pkgs, ... }:
{ pkgs, hostsPath, usersPath, ... }:
let
homeData = import ../data.secret.nix;
asusData = import ../../asus-gl553vd/data.secret.nix;
homeData = import (hostsPath + "/home/data.secret.nix");
asusData = import (hostsPath + "/asus-gl553vd/data.secret.nix");
in
{
imports = [ ../../../users/jan ];
imports = [ (usersPath + "/jan") ];
home-manager.users.jan = {
local.window-manager = {

View file

@ -1,9 +1,8 @@
{ config, pkgs, ... }:
{ config, pkgs, hostsPath, ... }:
let
tatosData = import ../../../tatos/data.secret.nix;
istalData = import ../../data.secret.nix;
tatosData = import (hostsPath + "/tatos/data.secret.nix");
istalData = import (hostsPath + "/istal/data.secret.nix");
inherit (istalData.wireguard) port;
in
{

View file

@ -1,11 +1,10 @@
{ config, pkgs, ... }:
{ config, pkgs, hostsPath, ... }:
# Source: https://habr.com/ru/companies/xakep/articles/699000/
let
istalData = import ../../../istal/data.secret.nix;
tatosData = import ../../data.secret.nix;
istalData = import (hostsPath + "/istal/data.secret.nix");
tatosData = import (hostsPath + "/tatos/data.secret.nix");
port = tatosData.wireguard.port;
in
{

View file

@ -1,9 +1,9 @@
{ pkgs, ... }:
{ pkgs, packagesPath, ... }:
{
home.packages = [
pkgs.git-crypt
(pkgs.callPackage ../../../packages/git-crypt-rm-gpg-user { })
(pkgs.callPackage (packagesPath + /git-crypt-rm-gpg-user) { })
];
programs.git = {