1
0
Fork 0
myserver-configuration/flake.nix

56 lines
1.5 KiB
Nix
Raw Normal View History

2024-07-14 14:57:41 +02:00
{
description = "Portfolio rust configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
2024-07-14 20:35:22 +02:00
2024-07-14 22:54:31 +02:00
import_pub_gpg = pkgs.writeScriptBin "import_pub_gpg" ''
#!${pkgs.runtimeShell}
echo "Importing public key"
gpg --import <(curl https://gitea.mrdev023.fr/florian.richer.gpg)
'';
2024-07-14 20:35:22 +02:00
init_sops = pkgs.writeScriptBin "init_sops" ''
#!${pkgs.runtimeShell}
echo "Decrypting vars file"
sops -d group_vars/all.enc.yml > group_vars/all.yml
echo "Decrypt inventory file"
sops -d work/inventory.enc.yml > work/inventory.yml
'';
clean_sops = pkgs.writeScriptBin "clean_sops" ''
#!${pkgs.runtimeShell}
echo "Decrypting vars file"
sops -d group_vars/all.enc.yml > group_vars/all.yml
echo "Decrypt inventory file"
sops -d work/inventory.enc.yml > work/inventory.yml
'';
2024-07-14 14:57:41 +02:00
in
{
devShells = {
default = pkgs.mkShell {
buildInputs = [
pkgs.ansible
pkgs.sops
2024-07-14 22:54:31 +02:00
import_pub_gpg
2024-07-14 20:35:22 +02:00
init_sops
clean_sops
2024-07-14 14:57:41 +02:00
];
};
};
});
}