summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike.vink@stater.nl>2023-04-22 00:45:27 +0200
committerMike Vink <mike.vink@stater.nl>2023-04-22 00:45:27 +0200
commit5f160e0c69958b70ef84663734a658d3165a523a (patch)
treec20e32334894607ee953186f1b915aced41a3fa7
parent918357587182a16fe7dde77cb5bfc3db0598565b (diff)
add ansible flake template
-rw-r--r--flake.nix12
-rw-r--r--home.nix1
-rw-r--r--templates/ansible/.envrc4
-rw-r--r--templates/ansible/flake.nix38
4 files changed, 52 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index d1bfcb0..810d56a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -57,9 +57,15 @@
};
};
- templates.default = {
- path = ./templates/flake;
- description = "nix flake new -t ~/flake";
+ templates = {
+ default = {
+ path = ./templates/flake;
+ description = "Flake with python and go stuff";
+ };
+ ansible = {
+ path = ./templates/ansible;
+ description = "Flake with ansible and shellhook to login to awx";
+ }
};
};
}
diff --git a/home.nix b/home.nix
index 853b0e7..72bcbfb 100644
--- a/home.nix
+++ b/home.nix
@@ -48,6 +48,7 @@
m = "xrandr --output eDP1 --auto --output HDMI1 --off";
mM = "xrandr --output eDP1 --auto --output HDMI1 --off";
newflake = "nix flake new -t ~/flake ";
+ ansible-flake = "nix flake new -t ~/flake#ansible ";
};
};
diff --git a/templates/ansible/.envrc b/templates/ansible/.envrc
new file mode 100644
index 0000000..1305de8
--- /dev/null
+++ b/templates/ansible/.envrc
@@ -0,0 +1,4 @@
+if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
+ source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
+fi
+use flake
diff --git a/templates/ansible/flake.nix b/templates/ansible/flake.nix
new file mode 100644
index 0000000..b2fa49b
--- /dev/null
+++ b/templates/ansible/flake.nix
@@ -0,0 +1,38 @@
+{
+ inputs = {
+ nixpkgs.url = "nixpkgs";
+ nix-filter.url = "github:numtide/nix-filter";
+ flake-utils.url = "github:numtide/flake-utils";
+ nixpkgs-terraform-providers-bin.url = "github:nix-community/nixpkgs-terraform-providers-bin";
+ nixpkgs-terraform-providers-bin.inputs.nixpkgs.follows = "nixpkgs";
+ poetry2nix = {
+ url = "github:nix-community/poetry2nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+ outputs = {
+ self,
+ flake-utils,
+ ...
+ } @ inputs:
+ flake-utils.lib.eachDefaultSystem (system: let
+ pkgs =
+ import inputs.nixpkgs
+ {
+ inherit system;
+ };
+ poetry = inputs.poetry2nix.packages.${system}.poetry;
+ inherit (inputs.poetry2nix.legacyPackages.${system}) mkPoetryEnv defaultPoetryOverrides;
+ in {
+ devShells.default = pkgs.mkShell {
+ name = "dev";
+ buildInputs = [
+ poetry
+ ];
+ shellHook = ''
+ source ~/awx-login.sh
+ [[ -f ./.venv/bin/activate ]] && source ./.venv/bin/activate
+ '';
+ };
+ });
+}