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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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