feat: github updater

This commit is contained in:
Philipp Hochkamp 2022-03-28 18:33:43 +02:00
parent 2c860c57aa
commit dcb627c4a4
No known key found for this signature in database
GPG key ID: 3676AB4CB36E5641
3 changed files with 52 additions and 75 deletions

52
.github/workflows/update.yaml vendored Normal file
View file

@ -0,0 +1,52 @@
# https://github.com/sandhose/nixconf/blob/master/.github/workflows/update.yaml
name: "Update lock file"
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: tibdex/github-app-token@v1.5
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: cachix/install-nix-action@v16
with:
install_url: https://releases.nixos.org/nix/nix-2.4/install
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Git author
run: |
git config user.name 'GitHub Ations'
git config user.email 'noreply@github.com'
- name: Update lock file
run: nix flake update --no-registries --commit-lock-file
- name: Get commit message
id: commit
run: |
message="$(git log -1 --pretty=%B | tail +3 | awk -f ./misc/flake-to-markdown.awk)"
message="${message//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
echo "::set-output name=message::$message"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.14.0
with:
token: "${{ steps.generate-token.outputs.token }}"
title: "Automated Flake update"
body: "${{ steps.commit.outputs.message }}"
delete-branch: truec

View file

@ -124,15 +124,12 @@
};
my = self.packages."${prev.system}";
};
packages = [];
nixosModules = lib.my.mapModulesRec ./nixos-modules import;
darwinModules = [];
#darwinModules = lib.my.mapModulesRec ./darwin-modules import;
nixosConfigurations = processConfigurations {
picard = nixosSystem "x86_64-linux" [ ./hosts/picard/default.nix ]; # TODO
ds9 = nixosSystem "x86_64-linux" [ ./hosts/ds9/default.nix ]; # TODO
wohnzimmerpi = nixosSystem "aarch64-linux" [ ./hosts/musicpi/default.nix ]; # Livingroom pi
kuechenpi = nixosSystem "aarch64-linux" [ ./hosts/musicpi/default.nix ]; # Kitchen pi
};
darwinConfigurations = processConfigurations {
daedalus = darwinSystem "aarch64-darwin" [ ./hosts/daedalus/default.nix ]; # TODO

View file

@ -1,72 +0,0 @@
{ config, inputs, pkgs, lib, ... }:
{
imports = [
"${inputs.nixpkgs}/nixos/modules/profiles/minimal.nix"
# "${inputs.nixos-hardware}/raspberry-pi/4/default.nix"
];
# fix: https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
sound.enable = true;
boot = {
extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="DE"
'';
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi3;
initrd.availableKernelModules = lib.mkForce [ "md_mod" "ext2" "ext4" "sd_mod" "sr_mod" "mmc_block" "ehci_hcd" "ohci_hcd" "xhci_hcd" "usbhid" "hid_generic" ];
loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkForce false;
raspberryPi.enable = true;
raspberryPi.version = 3;
raspberryPi.uboot.enable = false;
raspberryPi.firmwareConfig = ''
dtparam=hifiberry-dac
'';
};
};
# Required for the Wireless firmware
hardware = {
firmware = [ pkgs.wireless-regdb pkgs.raspberrypiWirelessFirmware ];
enableRedistributableFirmware = lib.mkForce false;
};
nix = {
settings.auto-optimise-store = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
# Assuming this is installed on top of the disk image.
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
environment.systemPackages = [ pkgs.alsa-utils ];
ragon.services.ssh.enable = true;
ragon.agenix.enable = true;
networking.wireless.enable = true;
ragon.agenix.secrets.wpa_supplicant = { path = "/etc/wpa_supplicant.conf"; };
services.shairport-sync = {
enable = true;
arguments = "-o alsa -v";
openFirewall = true;
};
}