From 91c56299ec946c5bf4ac8dec805bb29f2e570558 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Fri, 21 Jun 2024 12:33:38 -0500 Subject: [PATCH] Use full URL --- .envrc | 1 + .gitlab-ci-build.yml.in | 2 +- .gitlab-ci.yml | 2 +- flake.lock | 194 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 79 ++++++++++++++++ 5 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index c8c1910..60ffece 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -42,7 +42,7 @@ stages: before_script: - packer init sources - echo $COMMAND - - mc alias set storage "localhost:9000" root "$MINIO_SECRET" + - mc alias set storage "http://localhost:9000" root "$MINIO_SECRET" - mc ls storage/isos/cache - file=$(echo var.iso.url | packer console -var-file="${distro}" -config-type=hcl2 sources/) - mkdir cache diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3fcb28d..7255dd5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,7 +72,7 @@ downloads: script: - packer init sources - bash cache.sh - - mc alias set storage "localhost:9000" root "$MINIO_SECRET" + - mc alias set storage "http://localhost:9000" root "$MINIO_SECRET" - | for f in cache/*; do mc put "$f" "storage/isos/$f" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..45463b6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,194 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "owner": "numtide", + "repo": "devshell", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-root": { + "locked": { + "lastModified": 1713493429, + "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", + "owner": "srid", + "repo": "flake-root", + "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "flake-root", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718870667, + "narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1708475490, + "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e74ca98a74bc7270d28838369593635a5db3260", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "process-compose": { + "locked": { + "lastModified": 1718031437, + "narHash": "sha256-+RrlkAVZx0QhyeHAGFJnjST+/7Dc3zsDU3zAKXoDXaI=", + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "rev": "9344fac44edced4c686721686a6ad904d067c546", + "type": "github" + }, + "original": { + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts", + "flake-root": "flake-root", + "nixpkgs": "nixpkgs_2", + "process-compose": "process-compose", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1718522839, + "narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6a17f39 --- /dev/null +++ b/flake.nix @@ -0,0 +1,79 @@ +# 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 = [ + ]; + }; + + # This is not special, this is just flakes + packages = let + src = ./.; + in { + cache = pkgs.writeShellApplication { + name = "cache-isos"; + runtimeInputs = with pkgs; [ + minio-client + packer + ]; + text = let + #getIso = t: pkgs.runCommand "t.txt" { + #nativeInputs = [ pkgs.packer ]; + #} "echo var.iso.url | ${pkgs.packer}/bin/packer console -var-file=\"${t}\" -config-type=hcl2 ${src}/sources/"; + #isos = lib.attrsets.mapAttrsToList (t: builtins.readFile (getIso t)) templates; + #processIsos = builtins.concatStringsSep "\n" (builtins.map (i: "echo ${i}") isos); + in '' + packer init sources/ + rm -f cache/*latest* cache/*Rawhide* + ''; + }; + }; + + # https://numtide.github.io/treefmt/ + treefmt.config = { + inherit (config.flake-root) projectRootFile; + package = pkgs.treefmt; + + programs = { + deadnix.enable = true; + }; + + settings.formatter = { + }; + }; + }; + }; +}