diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..1f94de3 --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,14 @@ +name: "Nix" +on: + pull_request: + push: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: DeterminateSystems/magic-nix-cache-action@v2 + - run: nix flake check diff --git a/flake.nix b/flake.nix index 3b07227..97d18f9 100644 --- a/flake.nix +++ b/flake.nix @@ -7,13 +7,13 @@ forAllSystems = nixpkgs.lib.genAttrs systems; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; - overlays = [ self.overlay ]; + overlays = [ self.overlays.default ]; }); optionsDocFor = forAllSystems (system: import ./nix/module-options-doc.nix (nixpkgsFor."${system}") ); in { - overlay = final: prev: { + overlays.default = final: prev: { comin = final.buildGoModule rec { pname = "comin"; version = "0.2.0"; @@ -41,16 +41,17 @@ }; packages = forAllSystems (system: { - inherit (nixpkgsFor."${system}") comin; + default = nixpkgsFor."${system}".comin; generate-module-options = optionsDocFor."${system}".optionsDocCommonMarkGenerator; }); - defaultPackage = forAllSystems (system: self.packages."${system}".comin); checks = forAllSystems (system: { - options-doc = optionsDocFor."${system}".checkOptionsDocCommonMark; + module-options-doc = optionsDocFor."${system}".checkOptionsDocCommonMark; + # I don't understand why nix flake check does't build packages.default + package = nixpkgsFor."${system}".comin; }); - nixosModules.comin = import ./nix/module.nix self.overlay; - devShell.x86_64-linux = let + nixosModules.comin = import ./nix/module.nix self.packages.default; + devShells.x86_64-linux.default = let pkgs = nixpkgs.legacyPackages.x86_64-linux; in pkgs.mkShell { buildInputs = [