Unverified Commit 985c6a5f authored by 0x4A6F's avatar 0x4A6F
Browse files

nixify & flakeify & direnvify

parent 0f621f30
use flake
use_flake() {
watch_file flake.nix
watch_file flake.lock
eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"
}
.direnv/
.history
......@@ -11,6 +11,18 @@ pip:
1. Enter virtualenv: `source my-venv-directory/bin/activate`
1. Install ansible: `pip install ansible`
#### Using nix
Use `nix-shell` or `nix develop` to use ansible.
Update to newer nixpkgs version (check functionality and add a commit afterwards):
`nix flake update --recreate-lock-file --update-input nixpkgs`
#### Using direnv
Run `mkdir .direnv && direnv allow .` to enable direnv integration with nix flakes.
### SSH Aliases
Some hosts are only reachable through a jumphost, e.g. Containers or VMs on a
......
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1609246779,
"narHash": "sha256-eq6ZXE/VWo3EMC65jmIT6H/rrUc9UWOWVujkzav025k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "08c7ad4a0844adc4a7f9f5bb3beae482e789afa4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1609187327,
"narHash": "sha256-6lCwWpGpZxbSYclryv4ixsxxbISe7HuLyyQnGWCC8ZQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e065200fc90175a8f6e50e76ef10a48786126e1c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-20.09",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "Freifunk Stuttgart - ansible";
# To update all inputs:
# $ nix flake update --recreate-lock-file
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShell = import ./shell.nix { inherit pkgs; };
}
);
}
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
{
pkgs ? import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
}) { }
}:
with pkgs;
mkShell {
name = "ansible-shell";
buildInputs = [
ansible_2_10
ansible-lint
git-crypt
sshpass
];
HISTFILE = "${toString ./.}/.history";
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment