summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorseth <[email protected]>2024-07-05 07:01:21 -0400
committerseth <[email protected]>2024-07-09 15:38:51 -0400
commitbe286a453d1902af09431f28a5a02a8c00a954ea (patch)
treee0b774db2066c08a095ca827c14ccc96d6654b18 /dev
parent1f7efe32e4dd69db644568a0a1d36cd01cfd6233 (diff)
tree-wide: move dev outputs to dev/
Diffstat (limited to 'dev')
-rw-r--r--dev/checks.nix42
-rw-r--r--dev/default.nix13
-rw-r--r--dev/devShells.nix38
-rw-r--r--dev/hydraJobs.nix26
4 files changed, 119 insertions, 0 deletions
diff --git a/dev/checks.nix b/dev/checks.nix
new file mode 100644
index 0000000..56c5038
--- /dev/null
+++ b/dev/checks.nix
@@ -0,0 +1,42 @@
+{
+ perSystem =
+ { pkgs, ... }:
+ {
+ checks = {
+ check-formatting =
+ pkgs.runCommand "check-formatting" { nativeBuildInputs = [ pkgs.nixfmt-rfc-style ]; }
+ ''
+ cd ${./.}
+
+ echo "running nixfmt..."
+ nixfmt --check .
+
+ touch $out
+ '';
+
+ check-lint =
+ pkgs.runCommand "check-lint"
+ {
+ nativeBuildInputs = [
+ pkgs.actionlint
+ pkgs.deadnix
+ pkgs.statix
+ ];
+ }
+ ''
+ cd ${./.}
+
+ echo "running actionlint..."
+ actionlint ./.github/workflows/*
+
+ echo "running deadnix..."
+ deadnix --fail
+
+ echo "running statix..."
+ statix check .
+
+ touch $out
+ '';
+ };
+ };
+}
diff --git a/dev/default.nix b/dev/default.nix
new file mode 100644
index 0000000..105273c
--- /dev/null
+++ b/dev/default.nix
@@ -0,0 +1,13 @@
+{
+ imports = [
+ ./checks.nix
+ ./devShells.nix
+ ./hydraJobs.nix
+ ];
+
+ perSystem =
+ { pkgs, ... }:
+ {
+ formatter = pkgs.nixfmt-rfc-style;
+ };
+}
diff --git a/dev/devShells.nix b/dev/devShells.nix
new file mode 100644
index 0000000..9bed89b
--- /dev/null
+++ b/dev/devShells.nix
@@ -0,0 +1,38 @@
+{
+ perSystem =
+ {
+ lib,
+ pkgs,
+ inputs',
+ self',
+ ...
+ }:
+ {
+ devShells = {
+ default = pkgs.mkShellNoCC {
+ packages =
+ [
+ pkgs.lix
+
+ # format + lint
+ pkgs.actionlint
+ self'.formatter
+ pkgs.deadnix
+ pkgs.nil
+ pkgs.statix
+
+ # utils
+ pkgs.deploy-rs
+ pkgs.fzf
+ pkgs.just
+ self'.packages.opentofu
+ ]
+ ++ lib.optional pkgs.stdenv.isDarwin [ inputs'.nix-darwin.packages.darwin-rebuild ]
+ ++ lib.optionals pkgs.stdenv.isLinux [
+ pkgs.nixos-rebuild
+ inputs'.agenix.packages.agenix
+ ];
+ };
+ };
+ };
+}
diff --git a/dev/hydraJobs.nix b/dev/hydraJobs.nix
new file mode 100644
index 0000000..9cc4617
--- /dev/null
+++ b/dev/hydraJobs.nix
@@ -0,0 +1,26 @@
+{
+ lib,
+ self,
+ withSystem,
+ ...
+}:
+let
+ ciSystem = "x86_64-linux";
+ derivFromCfg = deriv: deriv.config.system.build.toplevel or deriv.activationPackage;
+ mapCfgsToDerivs = lib.mapAttrs (lib.const derivFromCfg);
+in
+{
+ flake.hydraJobs = withSystem ciSystem (
+ { pkgs, self', ... }:
+ {
+ inherit (self') checks;
+ inherit (self') devShells;
+ darwinConfigurations = mapCfgsToDerivs self.darwinConfigurations;
+ homeConfigurations = mapCfgsToDerivs self.homeConfigurations;
+ nixosConfigurations = mapCfgsToDerivs self.nixosConfigurations // {
+ # please add aarch64 runners github...please...
+ atlas = lib.deepSeq (derivFromCfg self.nixosConfigurations.atlas).drvPath pkgs.emptyFile;
+ };
+ }
+ );
+}