make it a real flake template

This commit is contained in:
jhonas 2022-02-01 02:30:23 +01:00
parent 92fff1b0b4
commit 56ebe90450
Signed by: teutat3s
GPG key ID: 924889A86D0B0FEB
10 changed files with 56 additions and 50 deletions

View file

@ -11,9 +11,9 @@
2. Otherwise, proceed to enable flakes (still an experimental feature in `nix`):
https://nixos.wiki/wiki/Flakes#Installing_flakes
2. Get this nix flake template:
2. Get this nix flake template, it will be setup in a new directory `./tritonshell` (feel free to adjust this):
```
nix flake new 'git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell'
nix flake new --template "git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell?ref=main" ./tritonshell
```
3. Ready to go:

View file

@ -1,51 +1,10 @@
{
description = "devs & ops environment for nix'ing with triton";
description = "nix flake template for devs & ops environment with triton";
inputs.devshell.url = "github:numtide/devshell";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
inputs.nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nixpkgs20-09.url = "github:nixos/nixpkgs/release-20.09";
outputs = { self, flake-utils, devshell, nixpkgs, nixpkgsUnstable, nixpkgs20-09 }:
flake-utils.lib.eachDefaultSystem (system: {
# Internal utility package with shell function and env vars helper.
# These get source'd in devshell.bash.extra when starting tritonshell
packages.triton-utils = import ./pkgs/triton-utils.nix { inherit nixpkgs; inherit system; };
devShell =
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay ];
};
pkgsUnstable = import nixpkgsUnstable {
inherit system;
overlays = [ devshell.overlay ];
};
pkgs20-09 = import nixpkgs20-09 {
inherit system;
overlays = [ devshell.overlay ];
};
# HINT: add your extra pkgs here,
# they'll get appended to devshell.packages in ./tritonshell.nix
extraDevshellPkgs = [
pkgsUnstable.consul
pkgsUnstable.nomad
pkgsUnstable.terraform
pkgsUnstable.vault
];
in
import ./tritonshell.nix { inherit extraDevshellPkgs devshell pkgs pkgsUnstable pkgs20-09 self system; };
}) // {
# merge this into the attr set above
defaultTemplate.description = "nix flake new -t 'git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell' tritonshell";
defaultTemplate.path = "./";
};
outputs = { self }: {
defaultTemplate = {
description = "nix flake new --template 'git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell?ref=main' ./tritonshell";
path = ./template;
};
};
}

47
template/flake.nix Normal file
View file

@ -0,0 +1,47 @@
{
description = "devs & ops environment for nix'ing with triton";
inputs.devshell.url = "github:numtide/devshell";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
inputs.nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nixpkgs20-09.url = "github:nixos/nixpkgs/release-20.09";
outputs = { self, flake-utils, devshell, nixpkgs, nixpkgsUnstable, nixpkgs20-09 }:
flake-utils.lib.eachDefaultSystem (system: {
# Internal utility package with shell function and env vars helper.
# These get source'd in devshell.bash.extra when starting tritonshell
packages.triton-utils = import ./pkgs/triton-utils.nix { inherit nixpkgs; inherit system; };
devShell =
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay ];
};
pkgsUnstable = import nixpkgsUnstable {
inherit system;
overlays = [ devshell.overlay ];
};
pkgs20-09 = import nixpkgs20-09 {
inherit system;
overlays = [ devshell.overlay ];
};
# HINT: add your extra pkgs here,
# they'll get appended to devshell.packages in ./tritonshell.nix
extraDevshellPkgs = [
pkgsUnstable.consul
pkgsUnstable.nomad
pkgsUnstable.terraform
pkgsUnstable.vault
];
in
import ./tritonshell.nix { inherit extraDevshellPkgs devshell pkgs pkgsUnstable pkgs20-09 self system; };
});
}