DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

02ce64158f185dab5806859d9279ae87bae5bfd4 — Jonni Liljamo 3 months ago a90f1d8
feat: pre commit hooks
3 files changed, 90 insertions(+), 8 deletions(-)

A .gitignore
M flake.lock
M flake.nix
A .gitignore => .gitignore +1 -0
@@ 0,0 1,1 @@
.pre-commit-config.yaml

M flake.lock => flake.lock +66 -3
@@ 24,6 24,22 @@
      }
    },
    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1696426674,
        "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "flake-compat_2": {
      "locked": {
        "lastModified": 1696426674,
        "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",


@@ 117,12 133,37 @@
    },
    "git-hooks": {
      "inputs": {
        "flake-compat": "flake-compat",
        "gitignore": "gitignore",
        "nixpkgs": [
          "nixpkgs-unstable"
        ],
        "nixpkgs-stable": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1721042469,
        "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
        "owner": "cachix",
        "repo": "git-hooks.nix",
        "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
        "type": "github"
      },
      "original": {
        "owner": "cachix",
        "repo": "git-hooks.nix",
        "type": "github"
      }
    },
    "git-hooks_2": {
      "inputs": {
        "flake-compat": [
          "nvim-flake",
          "nixvim",
          "flake-compat"
        ],
        "gitignore": "gitignore",
        "gitignore": "gitignore_2",
        "nixpkgs": [
          "nvim-flake",
          "nixvim",


@@ 151,6 192,27 @@
    "gitignore": {
      "inputs": {
        "nixpkgs": [
          "git-hooks",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1709087332,
        "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
        "owner": "hercules-ci",
        "repo": "gitignore.nix",
        "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
        "type": "github"
      },
      "original": {
        "owner": "hercules-ci",
        "repo": "gitignore.nix",
        "type": "github"
      }
    },
    "gitignore_2": {
      "inputs": {
        "nixpkgs": [
          "nvim-flake",
          "nixvim",
          "git-hooks",


@@ 313,9 375,9 @@
    "nixvim": {
      "inputs": {
        "devshell": "devshell",
        "flake-compat": "flake-compat",
        "flake-compat": "flake-compat_2",
        "flake-parts": "flake-parts_3",
        "git-hooks": "git-hooks",
        "git-hooks": "git-hooks_2",
        "home-manager": "home-manager_2",
        "nix-darwin": "nix-darwin",
        "nixpkgs": [


@@ 363,6 425,7 @@
    "root": {
      "inputs": {
        "flake-parts": "flake-parts",
        "git-hooks": "git-hooks",
        "home-manager": "home-manager",
        "impermanence": "impermanence",
        "nixos-hardware": "nixos-hardware",

M flake.nix => flake.nix +23 -5
@@ 9,6 9,11 @@
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };
    git-hooks = {
      url = "github:cachix/git-hooks.nix";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
      inputs.nixpkgs-stable.follows = "nixpkgs";
    };

    # Core
    impermanence.url = "github:nix-community/impermanence";


@@ 31,7 36,7 @@
    };
  };

  outputs = inputs:
  outputs = inputs @ {self, ...}:
    inputs.flake-parts.lib.mkFlake {inherit inputs;} {
      imports = [
        ./systems


@@ 43,11 48,24 @@
        system,
        ...
      }: {
        checks.pre-commit-check = inputs.git-hooks.lib.${system}.run {
          src = ./.;
          hooks = {
            alejandra = {
              enable = true;
              always_run = true;
            };
          };
        };

        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            alejandra
            sops
          ];
          inherit (self.checks.${system}.pre-commit-check) shellHook;
          buildInputs = with pkgs;
            [
              alejandra
              sops
            ]
            ++ self.checks.${system}.pre-commit-check.enabledPackages;
        };
      };
    };