From 8d9684cf50e7de74dec264827e30379791f46b31 Mon Sep 17 00:00:00 2001 From: gwg313 Date: Sun, 7 Jan 2024 16:34:16 -0500 Subject: [PATCH] fix: restore devShell for ci --- .envrc | 1 + flake.lock | 115 ++++++++++++++++++++++++++- flake.nix | 36 +++++++++ home-manager/machines/candlekeep.nix | 4 +- home-manager/modules/pass.nix | 2 +- 5 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 .envrc 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/flake.lock b/flake.lock index 5895ab1..97caf48 100644 --- a/flake.lock +++ b/flake.lock @@ -218,6 +218,22 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -290,6 +306,24 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -373,6 +407,27 @@ "type": "github" } }, + "gitignore_4": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -623,6 +678,22 @@ } }, "nixpkgs-stable_4": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_5": { "locked": { "lastModified": 1703351344, "narHash": "sha256-9FEelzftkE9UaJ5nqxidaJJPEhe9TPhbypLHmc2Mysc=", @@ -817,6 +888,30 @@ "type": "github" } }, + "pre-commit-hooks_4": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_5", + "gitignore": "gitignore_4", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_4" + }, + "locked": { + "lastModified": 1703939133, + "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "devenv": "devenv", @@ -826,6 +921,7 @@ "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_4", "nixpkgs-unstable": "nixpkgs-unstable", + "pre-commit-hooks": "pre-commit-hooks_4", "sops-nix": "sops-nix", "stylix": "stylix" } @@ -833,7 +929,7 @@ "sops-nix": { "inputs": { "nixpkgs": "nixpkgs_5", - "nixpkgs-stable": "nixpkgs-stable_4" + "nixpkgs-stable": "nixpkgs-stable_5" }, "locked": { "lastModified": 1703387502, @@ -859,7 +955,7 @@ "base16-kitty": "base16-kitty", "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "home-manager": "home-manager_2", "nixpkgs": [ "nixpkgs" @@ -954,6 +1050,21 @@ "type": "github" } }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "wlroots": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 972350c..d1456b8 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,9 @@ neovim-config.url = "github:gwg313/nvim-nix"; sops-nix.url = "github:Mic92/sops-nix"; + + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { @@ -76,6 +79,39 @@ # These are usually stuff you would upstream into home-manager homeManagerModules = import ./modules/home-manager; + devShells = forAllSystems ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + buildInputs = with pkgs; [ + alejandra + ]; + }; + + # Shell for bootstrapping flake-enabled nix and home-manager + bootstrap = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [nix home-manager git]; + }; + } + ); + + checks = forAllSystems ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + alejandra.enable = true; + }; + }; + } + ); + # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { diff --git a/home-manager/machines/candlekeep.nix b/home-manager/machines/candlekeep.nix index 9872fab..d0b0524 100644 --- a/home-manager/machines/candlekeep.nix +++ b/home-manager/machines/candlekeep.nix @@ -97,8 +97,8 @@ # Add stuff for your user as you see fit: # programs.neovim.enable = true; - home.packages = with pkgs; [ - openvpn + home.packages = with pkgs; [ + openvpn ]; # Enable home-manager and git diff --git a/home-manager/modules/pass.nix b/home-manager/modules/pass.nix index 6ccdfb0..11eccfb 100644 --- a/home-manager/modules/pass.nix +++ b/home-manager/modules/pass.nix @@ -2,7 +2,7 @@ {pkgs, ...}: { programs.password-store = { enable = true; - package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); + package = pkgs.pass.withExtensions (exts: [exts.pass-otp]); }; home.packages = with pkgs; [