diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index b7a8691..29bbbe7 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -57,6 +57,7 @@ ./roles/chromecast ./roles/memtest86 ./roles/kodi + ./roles/ansible ]; nix.settings.experimental-features = [ diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 2ff3b72..5690f4d 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -33,4 +33,5 @@ me.graphicsCardType = "amd"; me.sway.enable = true; + me.ansible.enable = true; } diff --git a/nix/configuration/roles/ansible/default.nix b/nix/configuration/roles/ansible/default.nix new file mode 100644 index 0000000..58a3d06 --- /dev/null +++ b/nix/configuration/roles/ansible/default.nix @@ -0,0 +1,46 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + ansible.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install ansible."; + }; + }; + + config = lib.mkIf config.me.ansible.enable ( + lib.mkMerge [ + { + environment.systemPackages = with pkgs; [ + ansible + ]; + + nixpkgs.overlays = [ + (final: prev: { + ansible = pkgs.symlinkJoin { + name = "ansible"; + paths = [ + (prev.ansible.overridePythonAttrs { + propagatedBuildInputs = prev.ansible.propagatedBuildInputs ++ [ prev.python3Packages.jmespath ]; + }) + ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/ansible --prefix PATH : ${lib.makeBinPath [ ]} + ''; + }; + }) + ]; + } + ] + ); +}