chore: update flake inputs and add treefmt-nix

This commit is contained in:
technofab 2024-10-03 19:08:25 +00:00
parent 387b3081a6
commit 9d511995b6
2 changed files with 297 additions and 505 deletions

View file

@ -2,7 +2,6 @@
description = "Coder Templates";
outputs = {
self,
nixpkgs,
flake-parts,
systems,
@ -12,38 +11,42 @@
imports = [
inputs.devenv.flakeModule
inputs.nix-gitlab-ci.flakeModule
inputs.nix-devtools.flakeModule
inputs.treefmt-nix.flakeModule
];
systems = import systems;
flake = {
};
perSystem = {
config,
self',
inputs',
pkgs,
config,
system,
lib,
...
}: {
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
formatter = pkgs.alejandra;
devenv.shells.default = {
imports = [
inputs.nix-devtools.devenvModule
];
packages = [
pkgs.opentofu
pkgs.coder
pkgs.buildah
];
pre-commit.hooks = {
treefmt = {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
mdformat.enable = true;
};
};
devenv.shells.default = {
packages = with pkgs; [
opentofu
coder
buildah
];
pre-commit.hooks.treefmt = {
enable = true;
packageOverrides.treefmt = config.treefmt.build.wrapper;
};
task = {
enable = true;
alias = ",";
@ -95,7 +98,7 @@
parallel.matrix = [
{TEMPLATE = ["nix-kubernetes"];}
];
deps = [pkgs.gnutar];
nix.deps = [pkgs.gnutar];
script = [
"nix build .#\${TEMPLATE}"
"install -D result templates/\${TEMPLATE}.tf.json"
@ -118,7 +121,7 @@
};
"upload" = {
stage = "upload";
deps = [pkgs.buildah];
nix.deps = [pkgs.buildah];
needs = ["build:image"];
before_script = [
''export REGISTRY_AUTH_FILE=''${HOME}/auth.json''
@ -157,18 +160,9 @@
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
nix-gitlab-ci = {
url = "gitlab:TECHNOFAB/nix-gitlab-ci";
inputs.nixpkgs.follows = "nixpkgs";
inputs.devenv.follows = "devenv";
inputs.systems.follows = "systems";
};
nix-devtools = {
url = "gitlab:TECHNOFAB/nix-devtools";
inputs.nixpkgs.follows = "nixpkgs";
inputs.devenv.follows = "devenv";
inputs.systems.follows = "systems";
};
nix-gitlab-ci.url = "gitlab:TECHNOFAB/nix-gitlab-ci?dir=lib";
nix-devtools.url = "gitlab:TECHNOFAB/nix-devtools?dir=lib";
treefmt-nix.url = "github:numtide/treefmt-nix";
terranix.url = "github:terranix/terranix";
};