Skip to content

Commit

Permalink
feat(host): use unstable in host
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 14, 2024
1 parent 52a233b commit e0a18a9
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 12 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/media-lxc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Generate Media LXC Container
# Based on https://freddydumont.com/blog/nixos-github-actions

on:
workflow_call:
pull_request:
push:
branches:
- master
tags:
- "v*.*.*"

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

# The following permissions are required for softprops/action-gh-release@v1.
permissions:
contents: write

jobs:
generate:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Extract tag name
run: |
tag_name="nightly"
case "$GITHUB_REF_NAME" in
v*.*.*)
tag_name="$GITHUB_REF_NAME"
;;
esac
echo "TAG_NAME=$tag_name" >> $GITHUB_ENV
- name: Install nix
uses: cachix/install-nix-action@V27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate NixOS LXC configuration
run: |
nix run github:nix-community/nixos-generators -- -f proxmox-lxc --flake .#media | {
read path
echo "BUILD_PATH=$path" >> $GITHUB_ENV
}
- name: Modify file name
run: |
NEW_FILENAME="media-${{ env.TAG_NAME }}-$(basename ${{ env.BUILD_PATH }})"
RELEASE_PATH="${{ github.workspace }}/$NEW_FILENAME"
cp "${{ env.BUILD_PATH }}" "$RELEASE_PATH"
echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV
# Create a GitHub release and attach the generated container template.
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'push' }}
with:
name: ${{ env.TAG_NAME }}-media
files: ${{ env.RELEASE_PATH }}
prerelease: ${{ env.TAG_NAME == 'nightly' }}
tag_name: ${{ env.TAG_NAME }}
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
];

mkSystem = import ./lib/mksystem.nix {
inherit nixpkgs overlays inputs;
inherit nixpkgs nixpkgs-unstable overlays inputs;
};

# Generate a list of systems based on their hostname
Expand Down
10 changes: 9 additions & 1 deletion hosts/media/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, pkgs, user, hostname, ... }:
{ config, pkgs, pkgs-unstable, user, hostname, ... }:

{
imports = [
Expand Down Expand Up @@ -52,30 +52,35 @@
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.plex;
};
services.tautulli = {
enable = true;
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.tautulli;
};
services.sonarr = {
enable = true;
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.sonarr;
};
services.readarr = {
enable = true;
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.readarr;
};
services.radarr = {
enable = true;
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.radarr;
};
services.bazarr = {
enable = true;
Expand All @@ -86,16 +91,19 @@
services.prowlarr = {
enable = true;
openFirewall = true;
package = pkgs-unstable.prowlarr;
};
services.calibre-server = {
enable = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.calibre;
};
services.calibre-web = {
enable = true;
openFirewall = true;
group = "wheel";
user = "${user}";
package = pkgs-unstable.calibre-web;
};
}
10 changes: 1 addition & 9 deletions hosts/shared.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@

# Allow unfree packages
nixpkgs = {
config = {
allowUnfree = true;
# Allow NixOS system NUR packages
packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
};
};
config = import ../modules/nixpkgs-config.nix;
};

environment.pathsToLink = [ "/share/zsh" ];
Expand Down
6 changes: 5 additions & 1 deletion lib/mksystem.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ nixpkgs, overlays, inputs }:
{ nixpkgs, nixpkgs-unstable, overlays, inputs }:

{
system,
Expand All @@ -20,6 +20,10 @@ in systemFunc rec {

specialArgs = {
inherit inputs overlays hostname user isDarwin isLinux isHeadless;
pkgs-unstable = import nixpkgs-unstable {
inherit system;
config = import ../modules/nixpkgs-config.nix;
};
};
modules = [
{ nixpkgs.overlays = overlays; }
Expand Down

0 comments on commit e0a18a9

Please sign in to comment.