Fix flake.nix and use its hooks

Fixes #24
This commit is contained in:
Greg Hellings
2024-11-18 22:02:07 -06:00
parent e7d1b0f7bd
commit ee831b6c48
3 changed files with 101 additions and 110 deletions
+1
View File
@@ -1,3 +1,4 @@
.pre-commit-config.yaml
output_*
output/*
*.box
Generated
+62 -40
View File
@@ -1,21 +1,18 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1717408969,
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
"owner": "numtide",
"repo": "devshell",
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
@@ -37,31 +34,55 @@
"type": "github"
}
},
"flake-utils": {
"gitignore": {
"inputs": {
"systems": "systems"
"nixpkgs": [
"hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1731363552,
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704161960,
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
"lastModified": 1730768919,
"narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
"rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc",
"type": "github"
},
"original": {
@@ -83,6 +104,22 @@
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1730741070,
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1720750130,
@@ -116,26 +153,11 @@
},
"root": {
"inputs": {
"devshell": "devshell",
"flake-parts": "flake-parts",
"hooks": "hooks",
"nixpkgs": "nixpkgs_2",
"process-compose": "process-compose"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
+22 -54
View File
@@ -3,9 +3,9 @@
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";
process-compose.url = "github:Platonic-Systems/process-compose-flake";
hooks.url = "github:cachix/git-hooks.nix";
};
outputs =
@@ -41,11 +41,6 @@
packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}'';
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
];
flake = {
# Universal things
};
@@ -65,56 +60,29 @@
inherit system;
config.allowUnfree = true;
};
# https://numtide.github.io/devshell/intro.html
devshells.default = {
devShells.default = pkgs.mkShell {
buildInputs = self'.checks.pre-commit.enabledPackages;
shellHook = self'.checks.pre-commit.shellHook;
packages =
(with pkgs; [
vagrant
])
++ (with self'.packages; [
cache
generate
shellcheck
validate
])
++ (builtins.map (d: self'.packages."build${name d}") withProviders);
# 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.generate;
category = "utils";
help = "Generate dynamic HCL files";
}
{
package = self'.packages.shellcheck;
category = "utils";
help = "Run shellchecks";
}
{
package = self'.packages.validate;
category = "utils";
help = "Validate all the files";
}
{
package = pkgs.vagrant;
category = "utils";
help = "Vagrant to help with testing";
}
]
++ (builtins.map (d: {
package = self'.packages."build${name d}";
category = "builds";
}) withProviders);
env = [
{
name = "EFI_DIR";
value = "${pkgs.OVMF.fd}/FV/";
}
{
name = "PACKER_CONFIG_DIR";
value = "./packer_config";
}
{
name = "STORAGE_URL";
value = "http://s3.thehellings.lan:9000";
}
];
env = {
EFI_DIR = "${pkgs.OVMF.fd}/FV/";
PACKER_CONFIG_DIR = "./packer_config";
STORAGE_URL = "http://s3.thehellings.lan:9000";
};
};
# This is not special, this is just flakes