Files
vms/flake.nix
T

117 lines
2.8 KiB
Nix
Raw Normal View History

2024-06-21 12:33:38 -05:00
# github.com/brianmcgee has lots of great ideas for going above and beyond for this
{
description = "Greg's homepage";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
process-compose.url = "github:Platonic-Systems/process-compose-flake";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = { devshell, flake-parts, flake-root, process-compose, treefmt-nix, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
];
flake = {
# Universal things
};
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem = { config, pkgs, self', system, ... }: let
lib = pkgs.lib;
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
# https://numtide.github.io/devshell/intro.html
devshells.default = {
# These commands will be shown in the motd that users read
# upon entering the shell
2024-06-21 13:00:22 -05:00
commands = [ {
package = self'.packages.cache;
category = "utils";
help = "Downloads ISO files and adds them to the S3 bucket";
2024-06-24 23:04:16 -05:00
} {
package = self'.packages.shellcheck;
category = "utils";
help = "Run shellchecks";
2024-06-24 23:13:53 -05:00
} {
package = self'.packages.validate;
category = "utils";
help = "Validate all the files";
2024-06-21 13:00:22 -05:00
} ];
2024-06-21 12:33:38 -05:00
};
# This is not special, this is just flakes
2024-06-21 13:00:22 -05:00
packages = {
2024-06-21 12:33:38 -05:00
cache = pkgs.writeShellApplication {
name = "cache-isos";
runtimeInputs = with pkgs; [
2024-06-21 13:00:22 -05:00
curl
2024-06-21 12:33:38 -05:00
minio-client
packer
];
2024-06-21 13:00:22 -05:00
text = builtins.readFile ./cache.sh;
2024-06-21 12:33:38 -05:00
};
2024-06-21 16:23:24 -05:00
cache-restore = pkgs.writeShellApplication {
name = "cache-restore";
runtimeInputs = with pkgs; [
jq
minio-client
packer
];
text = builtins.readFile ./cache-restore.sh;
};
2024-06-24 23:04:16 -05:00
shellcheck = pkgs.writeShellApplication {
name = "shellcheck";
runtimeInputs = with pkgs; [
shellcheck
];
text = ''
scripts=()
shopt -s globstar
for f in **/*.sh; do
scripts+=("$f")
done
shellcheck -e SC2239 "''${scripts[@]}"
'';
};
2024-06-24 23:13:53 -05:00
validate = pkgs.writeShellApplication {
name = "validate";
runtimeInputs = with pkgs; [
packer
];
text = ''
shopt -s globstar
packer init sources
for vars in distros/**/*.pkrvars.hcl; do
packer validate -except=upload "-var-file=''${vars}" sources/
done
'';
};
2024-06-21 12:33:38 -05:00
};
# https://numtide.github.io/treefmt/
treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt;
programs = {
deadnix.enable = true;
};
settings.formatter = {
};
};
};
};
}