mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 19:27:17 +00:00
Adds new github actions workflow with cachix
This commit is contained in:
parent
3ee52ab988
commit
1bf44d8648
3 changed files with 75 additions and 5 deletions
36
.github/workflows/nix-github-actions.yml
vendored
Normal file
36
.github/workflows/nix-github-actions.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
name: Nix Flake actions
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
nix-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v23
|
||||
- id: set-matrix
|
||||
name: Generate Nix Matrix
|
||||
run: |
|
||||
set -Eeu
|
||||
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
nix-build:
|
||||
needs: nix-matrix
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v23
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: willemml
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- run: nix build -L ".#${{ matrix.attr }}"
|
21
flake.lock
generated
21
flake.lock
generated
|
@ -234,6 +234,26 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1698974481,
|
||||
"narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "4bb5e752616262457bc7ca5882192a564c0472d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -406,6 +426,7 @@
|
|||
"flake-parts": "flake-parts",
|
||||
"home-manager": "home-manager",
|
||||
"hyprland": "hyprland",
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixos-apple-silicon": "nixos-apple-silicon",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
|
|
23
flake.nix
23
flake.nix
|
@ -27,20 +27,24 @@
|
|||
|
||||
nix-index-database.url = "github:Mic92/nix-index-database";
|
||||
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nix-github-actions.url = "github:nix-community/nix-github-actions";
|
||||
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
darwin,
|
||||
flake-parts,
|
||||
home-manager,
|
||||
nix-github-actions,
|
||||
nixpkgs,
|
||||
pre-commit-hooks,
|
||||
darwin,
|
||||
self,
|
||||
...
|
||||
} @ inputs: let
|
||||
globals = import ./common/globals.nix;
|
||||
in
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} rec {
|
||||
imports = [
|
||||
./flake/home-manager.nix
|
||||
./flake/overlays.nix
|
||||
|
@ -77,6 +81,7 @@
|
|||
config
|
||||
];
|
||||
});
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
in {
|
||||
nixosConfigurations.x86_64-live = mkNixos "x86_64" ./nixos/hosts/x86_64-live.nix;
|
||||
nixosConfigurations.aarch64-live = mkNixos "aarch64" ./nixos/hosts/aarch64-live.nix;
|
||||
|
@ -88,15 +93,19 @@
|
|||
|
||||
darwinConfigurations.zeus = mkDarwin "aarch64" ./nixos/hosts/zeus.nix;
|
||||
|
||||
homeConfigurations.willem-aarch64-darwin = mkHome "aarch64-darwin" ./home/darwin/default.nix;
|
||||
|
||||
packages.aarch64-darwin.home = self.homeConfigurations.willem-aarch64-darwin.activationPackage;
|
||||
homeConfigurations = forAllSystems (system: {willem = mkHome system ./home/${builtins.replaceStrings ["aarch64-" "x86_64-"] ["" ""] system}/default.nix;});
|
||||
|
||||
packages.aarch64-darwin.minimal-vm = self.nixosConfigurations.darwin-arm-minimal-vm.config.system.build.vm;
|
||||
packages.aarch64-darwin.homeconsole-vm = self.nixosConfigurations.darwin-arm-homeconsole-vm.config.system.build.vm;
|
||||
|
||||
packages.x86_64-linux.live-image = self.nixosConfigurations.x86_64-live.config.system.build.isoImage;
|
||||
packages.aarch64-linux.live-image = self.nixosConfigurations.x86_64-live.config.system.build.isoImage;
|
||||
|
||||
checks.x86_64-linux.nixbox = self.nixosConfigurations.nixbox.config.system.build.topLevel;
|
||||
|
||||
githubActions = nix-github-actions.lib.mkGithubMatrix {
|
||||
checks = nixpkgs.lib.getAttrs ["x86_64-linux" "x86_64-darwin"] self.checks;
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = {
|
||||
|
@ -113,6 +122,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
checks.home = self'.packages.home;
|
||||
|
||||
packages.home = self.homeConfigurations.${system}.willem.activationPackage;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
inherit (self'.checks.pre-commit-check) shellHook;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue