Add function to make paths from flake root

No more ../../../../../../
This commit is contained in:
Daniel Olsen 2024-11-17 00:08:02 +01:00
parent 8285d91401
commit 3bdfb4c297
20 changed files with 75 additions and 74 deletions

View File

@ -1,9 +1,9 @@
{ pkgs, lib, ... }:
{ pkgs, lib, fp, ... }:
{
imports = [
../users
../modules/snakeoil-certs.nix
(fp /users)
(fp /modules/snakeoil-certs.nix)
./networking.nix
./nix.nix

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1729281548,
"narHash": "sha256-MuojlSnwAJAwfhgmW8ZtZrwm2Sko4fqubCvReqbUzYw=",
"lastModified": 1731746438,
"narHash": "sha256-f3SSp1axoOk0NAI7oFdRzbxG2XPBSIXC+/DaAXnvS1A=",
"owner": "nix-community",
"repo": "disko",
"rev": "a6a3179ddf396dfc28a078e2f169354d0c137125",
"rev": "cb64993826fa7a477490be6ccb38ba1fa1e18fa8",
"type": "github"
},
"original": {
@ -119,11 +119,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1729307008,
"narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=",
"lastModified": 1731663789,
"narHash": "sha256-x07g4NcqGP6mQn6AISXJaks9sQYDjZmTMBlKIvajvyc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3",
"rev": "035d434d48f4375ac5d3a620954cf5fda7dd7c36",
"type": "github"
},
"original": {
@ -135,11 +135,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1728156290,
"narHash": "sha256-uogSvuAp+1BYtdu6UWuObjHqSbBohpyARXDWqgI12Ss=",
"lastModified": 1730602179,
"narHash": "sha256-efgLzQAWSzJuCLiCaQUCDu4NudNlHdg2NzGLX5GYaEY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "17ae88b569bb15590549ff478bab6494dde4a907",
"rev": "3c2f1c4ca372622cb2f9de8016c9a0b1cbd0f37c",
"type": "github"
},
"original": {
@ -151,11 +151,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1729308112,
"narHash": "sha256-Ap+cPeiluam2KFZO+OWuFTl/IkIJfyGYGMgkT2pVCRY=",
"lastModified": 1731745710,
"narHash": "sha256-SVeiClbgqL071JpAspOu0gCkPSAL51kSIRwo4C/pghA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "61253596816c4cd65e2a0f474cbc0ac0c6e0f7cf",
"rev": "dfaa4cb76c2d450d8f396bb6b9f43cede3ade129",
"type": "github"
},
"original": {
@ -249,11 +249,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1728345710,
"narHash": "sha256-lpunY1+bf90ts+sA2/FgxVNIegPDKCpEoWwOPu4ITTQ=",
"lastModified": 1731748189,
"narHash": "sha256-Zd/Uukvpcu26M6YGhpbsgqm6LUSLz+Q8mDZ5LOEGdiE=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "06535d0e3d0201e6a8080dd32dbfde339b94f01b",
"rev": "d2bd7f433b28db6bc7ae03d5eca43564da0af054",
"type": "github"
},
"original": {

View File

@ -59,6 +59,7 @@
specialArgs = {
inherit unstablePkgs inputs;
values = import ./values.nix;
fp = path: ./${path};
};
modules = [

View File

@ -1,10 +1,10 @@
{ pkgs, values, ... }:
{ fp, pkgs, values, ... }:
{
imports = [
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
./services/bluemap/default.nix
./services/gitea/default.nix
@ -19,7 +19,7 @@
./services/well-known
];
sops.defaultSopsFile = ../../secrets/bekkalokk/bekkalokk.yaml;
sops.defaultSopsFile = fp /secrets/bekkalokk/bekkalokk.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;

View File

@ -1,4 +1,4 @@
{ config, values, pkgs, lib, ... }:
{ config, values, fp, pkgs, lib, ... }:
let
cfg = config.services.gitea;
domain = "git.pvv.ntnu.no";
@ -173,8 +173,8 @@ in {
};
script = let
logo-svg = ../../../../assets/logo_blue_regular.svg;
logo-png = ../../../../assets/logo_blue_regular.png;
logo-svg = fp /assets/logo_blue_regular.svg;
logo-png = fp /assets/logo_blue_regular.png;
extraLinks = pkgs.writeText "gitea-extra-links.tmpl" ''
<a class="item" href="https://www.pvv.ntnu.no/">PVV</a>
<a class="item" href="https://wiki.pvv.ntnu.no/">Wiki</a>

View File

@ -1,4 +1,4 @@
{ pkgs, lib, config, values, pkgs-unstable, ... }: let
{ pkgs, lib, fp, config, values, pkgs-unstable, ... }: let
cfg = config.services.mediawiki;
# "mediawiki"
@ -210,8 +210,8 @@ in {
'';
};
"= /PNG/PVV-logo.svg".alias = ../../../../assets/logo_blue_regular.svg;
"= /PNG/PVV-logo.png".alias = ../../../../assets/logo_blue_regular.png;
"= /PNG/PVV-logo.svg".alias = fp /assets/logo_blue_regular.svg;
"= /PNG/PVV-logo.png".alias = fp /assets/logo_blue_regular.png;
"= /favicon.ico".alias = pkgs.runCommandLocal "mediawiki-favicon.ico" {
buildInputs = with pkgs; [ imagemagick ];
} ''
@ -219,7 +219,7 @@ in {
-resize x64 \
-gravity center \
-crop 64x64+0+0 \
${../../../../assets/logo_blue_regular.png} \
${fp /assets/logo_blue_regular.png} \
-flatten \
-colors 256 \
-background transparent \

View File

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
{ config, lib, fp, pkgs, ... }:
let
cfg = config.services.snappymail;
in {
imports = [ ../../../../modules/snappymail.nix ];
imports = [ (fp /modules/snappymail.nix) ];
services.snappymail = {
enable = true;

View File

@ -1,10 +1,10 @@
{ pkgs, values, ... }:
{ fp, pkgs, values, ... }:
{
imports = [
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
./services/nginx
./services/mysql.nix
@ -15,7 +15,7 @@
./services/matrix
];
sops.defaultSopsFile = ../../secrets/bicep/bicep.yaml;
sops.defaultSopsFile = fp /secrets/bicep/bicep.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;

View File

@ -1,16 +1,16 @@
{ config, lib, pkgs, ... }:
{ config, fp, lib, pkgs, ... }:
let
cfg = config.services.pvv-calendar-bot;
in {
sops.secrets = {
"calendar-bot/matrix_token" = {
sopsFile = ../../../secrets/bicep/bicep.yaml;
sopsFile = fp /secrets/bicep/bicep.yaml;
key = "calendar-bot/matrix_token";
owner = cfg.user;
group = cfg.group;
};
"calendar-bot/mysql_password" = {
sopsFile = ../../../secrets/bicep/bicep.yaml;
sopsFile = fp /secrets/bicep/bicep.yaml;
key = "calendar-bot/mysql_password";
owner = cfg.user;
group = cfg.group;

View File

@ -1,14 +1,14 @@
{ config, lib, pkgs, secrets, values, ... }:
{ config, lib, fp, pkgs, secrets, values, ... }:
{
sops.secrets."matrix/synapse/turnconfig" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "synapse/turnconfig";
owner = config.users.users.matrix-synapse.name;
group = config.users.users.matrix-synapse.group;
};
sops.secrets."matrix/coturn/static-auth-secret" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "coturn/static-auth-secret";
owner = config.users.users.turnserver.name;
group = config.users.users.turnserver.group;

View File

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, fp, ... }:
let
cfg = config.services.mx-puppet-discord;
@ -7,11 +7,11 @@ in
users.groups.keys-matrix-registrations = { };
sops.secrets."matrix/discord/as_token" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "discord/as_token";
};
sops.secrets."matrix/discord/hs_token" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "discord/hs_token";
};

View File

@ -1,4 +1,4 @@
{ config, lib, unstablePkgs, inputs, ... }:
{ config, lib, fp, unstablePkgs, inputs, ... }:
let
cfg = config.services.matrix-hookshot;
@ -11,11 +11,11 @@ in
];
sops.secrets."matrix/hookshot/as_token" = {
sopsFile = ../../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "hookshot/as_token";
};
sops.secrets."matrix/hookshot/hs_token" = {
sopsFile = ../../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "hookshot/hs_token";
};

View File

@ -1,8 +1,8 @@
{ config, lib, ... }:
{ config, lib, fp, ... }:
{
sops.secrets."matrix/mjolnir/access_token" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "mjolnir/access_token";
owner = config.users.users.mjolnir.name;
group = config.users.users.mjolnir.group;

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, values, inputs, ... }:
{ config, lib, fp, pkgs, values, inputs, ... }:
let
cfg = config.services.matrix-synapse-next;
@ -10,13 +10,13 @@ let
in {
sops.secrets."matrix/synapse/signing_key" = {
key = "synapse/signing_key";
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
owner = config.users.users.matrix-synapse.name;
group = config.users.users.matrix-synapse.group;
};
sops.secrets."matrix/synapse/user_registration" = {
sopsFile = ../../../../secrets/bicep/matrix.yaml;
sopsFile = fp /secrets/bicep/matrix.yaml;
key = "synapse/signing_key";
owner = config.users.users.matrix-synapse.name;
group = config.users.users.matrix-synapse.group;

View File

@ -1,16 +1,16 @@
{ config, pkgs, values, ... }:
{ config, fp, pkgs, values, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
./disks.nix
../../misc/builder.nix
(fp /misc/builder.nix)
];
sops.defaultSopsFile = ../../secrets/bob/bob.yaml;
sops.defaultSopsFile = fp /secrets/bob/bob.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;

View File

@ -1,10 +1,10 @@
{ config, pkgs, values, ... }:
{ config, fp, pkgs, values, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
./services/grzegorz.nix
];

View File

@ -1,6 +1,6 @@
{ config, ... }:
{ config, fp, ... }:
{
imports = [ ../../../modules/grzegorz.nix ];
imports = [ (fp /modules/grzegorz.nix) ];
services.nginx.virtualHosts."${config.networking.fqdn}" = {
serverAliases = [

View File

@ -1,12 +1,12 @@
{ config, pkgs, values, ... }:
{ config, fp, pkgs, values, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
../../modules/grzegorz.nix
(fp /modules/grzegorz.nix)
];
boot.loader.systemd-boot.enable = true;

View File

@ -1,16 +1,16 @@
{ config, pkgs, lib, values, ... }:
{ config, fp, pkgs, lib, values, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
./services/monitoring
./services/nginx
];
sops.defaultSopsFile = ../../secrets/ildkule/ildkule.yaml;
sops.defaultSopsFile = fp /secrets/ildkule/ildkule.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;

View File

@ -1,13 +1,13 @@
{ config, pkgs, values, ... }:
{ config, fp, pkgs, values, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../base
../../misc/metrics-exporters.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
];
sops.defaultSopsFile = ../../secrets/shark/shark.yaml;
sops.defaultSopsFile = fp /secrets/shark/shark.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;