sops: concentrate shell and config generation in one file

This commit is contained in:
SebastianStork 2025-07-28 16:03:43 +02:00
parent d84e13d45e
commit 9facf82a70
4 changed files with 30 additions and 28 deletions

View file

@ -70,11 +70,11 @@
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
imports = [ imports = [
./flake/dev-shells.nix ./flake/dev-shell.nix
./flake/formatter.nix ./flake/formatter.nix
./flake/hosts.nix ./flake/hosts.nix
./flake/modules.nix ./flake/modules.nix
./flake/packages.nix ./flake/sops.nix
]; ];
}; };
} }

13
flake/dev-shell.nix Normal file
View file

@ -0,0 +1,13 @@
_: {
perSystem =
{ inputs', pkgs, ... }:
{
devShells.default = pkgs.mkShellNoCC {
packages = [
pkgs.just
pkgs.nh
inputs'.deploy-rs.packages.default
];
};
};
}

View file

@ -1,25 +0,0 @@
{ inputs, self, ... }:
{
perSystem =
{ pkgs, system, ... }:
{
devShells = {
default = pkgs.mkShell {
packages = [
pkgs.just
pkgs.nh
inputs.deploy-rs.packages.${system}.default
];
};
sops = pkgs.mkShell {
SOPS_CONFIG = self.packages.${system}.sops-config;
packages = [
pkgs.sops
pkgs.age
pkgs.ssh-to-age
];
};
};
};
}

View file

@ -1,7 +1,12 @@
{ self, ... }: { self, ... }:
{ {
perSystem = perSystem =
{ pkgs, lib, ... }: {
self',
pkgs,
lib,
...
}:
{ {
packages.sops-config = packages.sops-config =
let let
@ -32,5 +37,14 @@
pkgs.runCommand "sops.yaml" { buildInputs = [ pkgs.yj ]; } '' pkgs.runCommand "sops.yaml" { buildInputs = [ pkgs.yj ]; } ''
echo '${jsonConfig}' | yj -jy > $out echo '${jsonConfig}' | yj -jy > $out
''; '';
devShells.sops = pkgs.mkShellNoCC {
SOPS_CONFIG = self'.packages.sops-config;
packages = [
pkgs.sops
pkgs.age
pkgs.ssh-to-age
];
};
}; };
} }