diff options
| author | Mike Vink <mike.vink@stater.nl> | 2023-04-22 00:45:27 +0200 |
|---|---|---|
| committer | Mike Vink <mike.vink@stater.nl> | 2023-04-22 00:45:27 +0200 |
| commit | 5f160e0c69958b70ef84663734a658d3165a523a (patch) | |
| tree | c20e32334894607ee953186f1b915aced41a3fa7 | |
| parent | 918357587182a16fe7dde77cb5bfc3db0598565b (diff) | |
add ansible flake template
| -rw-r--r-- | flake.nix | 12 | ||||
| -rw-r--r-- | home.nix | 1 | ||||
| -rw-r--r-- | templates/ansible/.envrc | 4 | ||||
| -rw-r--r-- | templates/ansible/flake.nix | 38 |
4 files changed, 52 insertions, 3 deletions
@@ -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"; + } }; }; } @@ -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 + ''; + }; + }); +} |
