# 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 commands = [ { package = self'.packages.cache; category = "utils"; help = "Downloads ISO files and adds them to the S3 bucket"; } { package = self'.packages.shellcheck; category = "utils"; help = "Run shellchecks"; } ]; }; # This is not special, this is just flakes packages = { cache = pkgs.writeShellApplication { name = "cache-isos"; runtimeInputs = with pkgs; [ curl minio-client packer ]; text = builtins.readFile ./cache.sh; }; cache-restore = pkgs.writeShellApplication { name = "cache-restore"; runtimeInputs = with pkgs; [ jq minio-client packer ]; text = builtins.readFile ./cache-restore.sh; }; 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[@]}" ''; }; }; # https://numtide.github.io/treefmt/ treefmt.config = { inherit (config.flake-root) projectRootFile; package = pkgs.treefmt; programs = { deadnix.enable = true; }; settings.formatter = { }; }; }; }; }