summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-04-21 19:49:14 +0000
committerGitHub <[email protected]>2024-04-21 19:49:14 +0000
commitf6e1aa350d6b23a4ffb63fc859c89b79ec6ce8d0 (patch)
treea1c8940feba0f2922cc18a958594c12b622e5efd /flake.nix
parentae1dc52060791990f994df6ecfd4960e6ff3fe5c (diff)
nix: remove subflake (#174)
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix101
1 files changed, 95 insertions, 6 deletions
diff --git a/flake.nix b/flake.nix
index 4e4ece1..d2def00 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,13 +1,19 @@
{
description = "teawie moment";
- inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ fenix = {
+ url = "github:nix-community/fenix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
outputs = {
self,
nixpkgs,
...
- }: let
+ } @ inputs: let
systems = [
"x86_64-linux"
"aarch64-linux"
@@ -17,17 +23,100 @@
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in {
- nixosModules.default = import ./nix/module.nix self;
+ checks = forAllSystems ({
+ lib,
+ pkgs,
+ ...
+ }: {
+ actionlint = pkgs.runCommand "check-actionlint" {} ''
+ ${lib.getExe pkgs.actionlint} ${./.github/workflows}/*
+ touch $out
+ '';
- packages = forAllSystems ({
+ deadnix = pkgs.runCommand "check-deadnix" {} ''
+ ${lib.getExe pkgs.deadnix} --fail ${./.}
+ touch $out
+ '';
+
+ editorconfig = pkgs.runCommand "check-editorconfig" {} ''
+ cd ${./.}
+ ${lib.getExe pkgs.editorconfig-checker} \
+ -exclude '.git' .
+
+ touch $out
+ '';
+
+ rustfmt = pkgs.runCommand "check-rustfmt" {nativeBuildInputs = [pkgs.cargo pkgs.rustfmt];} ''
+ cd ${./.}
+ cargo fmt -- --check
+ touch $out
+ '';
+
+ statix = pkgs.runCommand "check-statix" {} ''
+ ${lib.getExe pkgs.statix} check ${./.}
+ touch $out
+ '';
+ });
+
+ devShells = forAllSystems ({
pkgs,
system,
...
}: {
- teawiebot = pkgs.callPackage ./nix/derivation.nix {inherit self;};
- default = self.packages.${system}.teawiebot;
+ default = pkgs.mkShell {
+ packages = [
+ # rust tools
+ pkgs.clippy
+ pkgs.rustfmt
+ pkgs.rust-analyzer
+
+ # nix tools
+ pkgs.deadnix
+ pkgs.nil
+ pkgs.statix
+
+ # misc formatter/linters
+ pkgs.actionlint
+ self.formatter.${system}
+
+ pkgs.redis
+ ];
+
+ inputsFrom = [self.packages.${system}.teawiebot];
+ RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
+ };
+
+ ci = pkgs.mkShell {
+ packages = [
+ pkgs.clippy
+ pkgs.rustfmt
+
+ self.formatter.${system}
+ ];
+
+ inputsFrom = [self.packages.${system}.teawiebot];
+ };
});
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
+
+ nixosModules.default = import ./nix/module.nix self;
+
+ packages = forAllSystems ({
+ pkgs,
+ system,
+ ...
+ }: let
+ crossBuildsFor = arch: import ./nix/docker.nix {inherit pkgs arch inputs;};
+ in
+ {
+ teawiebot = pkgs.callPackage ./nix/derivation.nix {inherit self;};
+
+ default = self.packages.${system}.teawiebot;
+ }
+ // crossBuildsFor "x86_64"
+ // crossBuildsFor "aarch64");
+
overlays.default = _: prev: {
teawiebot = prev.callPackage ./nix/derivation.nix {inherit self;};
};