Build and push to cachix

This commit is contained in:
Charlotte Van Petegem 2022-01-11 21:32:18 +01:00
parent 26a8a56225
commit ada5ab5685
No known key found for this signature in database
GPG key ID: 019E764B7184435A
6 changed files with 62 additions and 8 deletions

27
.github/workflows/cachix.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Cachix
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v15
- name: Cachix
uses: cachix/cachix-action@v10
with:
name: chvp
extraPullNames: "nix-community,accentor"
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
skipPush: true
- run: nix build -L --no-link .#nixosConfigurations.urithiru.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.lasting-integrity.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.kholinar.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.kharbranth.config.system.build.toplevel
- run: nix eval --json ".#nixosConfigurations.urithiru.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.lasting-integrity.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.kholinar.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.kharbranth.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp

32
.github/workflows/update.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Update
on:
schedule:
- cron: '42 * * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v15
- name: Cachix
uses: cachix/cachix-action@v10
with:
name: accentor
extraPullNames: "nix-community,accentor"
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
skipPush: true
- run: nix flake update
- run: nix build -L --no-link .#nixosConfigurations.urithiru.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.lasting-integrity.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.kholinar.config.system.build.toplevel
- run: nix build -L --no-link .#nixosConfigurations.kharbranth.config.system.build.toplevel
- run: nix eval --json ".#nixosConfigurations.urithiru.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.lasting-integrity.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.kholinar.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- run: nix eval --json ".#nixosConfigurations.kharbranth.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp
- uses: stefanzweifel/git-auto-commit-action@v4.6.0
with:
commit_message: "Update dependencies"

View file

@ -62,7 +62,6 @@
inputs;
nix.nixPath = [ "/etc/channels" ];
})
({ config._module.args = { nixosConfigurations = self.nixosConfigurations; }; })
accentor.nixosModule
agenix.nixosModules.age
home-manager.nixosModules.home-manager

View file

@ -7,10 +7,6 @@
networking.hostId = "079e60ba";
environment.etc = lib.mapAttrs' (n: v: { name = "pinned-hosts/${n}"; value = { source = v.config.system.build.toplevel.outPath; }; })
(lib.filterAttrs (n: _: n != "urithiru") nixosConfigurations);
# Machine-specific module settings
chvp = {
stateVersion = "20.09";
base = {

View file

@ -5,4 +5,4 @@ set -x
hostname=$1
shift 1
nixos-rebuild --flake .#$hostname --target-host root@$hostname --build-host root@urithiru "$@"
nixos-rebuild --flake .#$hostname --target-host root@$hostname -s "$@"

View file

@ -6,7 +6,7 @@ nix flake update
if [ -z "${OVERRIDE:-}" ]
then
su -c "nixos-rebuild --flake . --build-host root@urithiru switch"
su -c "nixos-rebuild --flake . switch"
else
su -c "nixos-rebuild --flake . --build-host root@urithiru --override-input nixpkgs ../nixpkgs --no-write-lock-file switch"
su -c "nixos-rebuild --flake . --override-input nixpkgs ../nixpkgs --no-write-lock-file switch"
fi