66 lines
1.8 KiB
Nix
66 lines
1.8 KiB
Nix
{
|
|
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; };
|
|
|
|
import_pub_gpg = pkgs.writeScriptBin "import_pub_gpg" ''
|
|
#!${pkgs.runtimeShell}
|
|
|
|
echo "Importing public key"
|
|
gpg --import <(curl https://gitea.mrdev023.fr/florian.richer.gpg)
|
|
'';
|
|
|
|
|
|
decrypt_sops = pkgs.writeScriptBin "decrypt_sops" ''
|
|
#!${pkgs.runtimeShell}
|
|
|
|
echo "Decrypting vars file"
|
|
sops -d group_vars/all.enc.yml > group_vars/all.yml
|
|
|
|
echo "Decrypting inventory file"
|
|
sops -d work/inventory.enc.yml > work/inventory.yml
|
|
'';
|
|
|
|
clean_sops = pkgs.writeScriptBin "clean_sops" ''
|
|
#!${pkgs.runtimeShell}
|
|
|
|
echo "Deleting vars file"
|
|
rm group_vars/all.yml
|
|
|
|
echo "Deleting inventory file"
|
|
rm work/inventory.yml
|
|
'';
|
|
|
|
encrypt_sops = pkgs.writeScriptBin "encrypt_sops" ''
|
|
#!${pkgs.runtimeShell}
|
|
|
|
echo "Crypting vars file"
|
|
sops -e group_vars/all.yml > group_vars/all.enc.yml
|
|
|
|
echo "Crypting inventory file"
|
|
sops -e work/inventory.yml > work/inventory.enc.yml
|
|
'';
|
|
in
|
|
{
|
|
devShells = {
|
|
default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.ansible
|
|
pkgs.sops
|
|
import_pub_gpg
|
|
decrypt_sops
|
|
clean_sops
|
|
encrypt_sops
|
|
];
|
|
};
|
|
};
|
|
});
|
|
}
|