Skip to content

Commit

Permalink
Initial code
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Salvador <[email protected]>
  • Loading branch information
otavio committed Jun 20, 2023
0 parents commit f5d6c7c
Show file tree
Hide file tree
Showing 40 changed files with 1,142 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "master"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"
44 changes: 44 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "CI"

on:
pull_request:
paths:
- '**.nix'
- 'flake.lock'
push:
branches: [ master ]
paths:
- '**.nix'
- 'flake.lock'

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v22
with:
nix_conf: experimental-features = nix-command flakes repl-flake
- uses: cachix/cachix-action@v12
with:
name: otavio-nix-config
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: nix flake check

nixos:
runs-on: ubuntu-latest
strategy:
matrix:
nixosConfiguration:
- centrium
- hyper
- pikachu
steps:
- run: sudo apt-get clean
- uses: actions/checkout@v3
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v22
with:
nix_conf: experimental-features = nix-command flakes repl-flake
- run: nix -Lv build ".#nixosConfigurations.${{ matrix.nixosConfiguration }}.config.system.build.toplevel"
23 changes: 23 additions & 0 deletions .github/workflows/update-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: update-flake-lock
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v22
with:
nix_conf: experimental-features = nix-command flakes repl-flake
- name: Update flake.lock
id: update
uses: DeterminateSystems/update-flake-lock@v19
with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
- name: Print PR number
run: echo Pull request number is ${{ steps.update.outputs.pull-request-number }}.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*~
199 changes: 199 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
description = "Otavio Salvador's NixOS/Home Manager config";

inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};

vscode-server.url = "github:nix-community/nixos-vscode-server";
nixos-hardware.url = "nixos-hardware";
disko.url = "github:nix-community/disko";
};

outputs = { self, ... }@inputs:
let
inherit (self) outputs;
lib = import ./lib { inherit inputs outputs; };
in
{
overlays = import ./overlays { inherit inputs outputs; };

nixosConfigurations = {
centrium = lib.mkSystem {
hostname = "centrium";
system = "x86_64-linux";
};

hyper = lib.mkSystem {
hostname = "hyper";
system = "x86_64-linux";
};

pikachu = lib.mkSystem {
hostname = "pikachu";
system = "x86_64-linux";
};
};

packages = builtins.foldl'
(packages: hostname:
let
inherit (self.nixosConfigurations.${hostname}.config.nixpkgs) system;
targetConfiguration = self.nixosConfigurations.${hostname};
in
packages // {
${system} = (packages.${system} or { }) // {
"${hostname}-install-iso" = lib.mkInstallerForSystem { inherit hostname targetConfiguration system; };
};
})
{ }
(builtins.attrNames self.nixosConfigurations);
} // inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
inherit (self) outputs;
pkgs = import inputs.nixpkgs { inherit system outputs; };
in
{
formatter = pkgs.writeShellApplication {
name = "normalise_nix";
runtimeInputs = with pkgs; [ nixpkgs-fmt statix ];
text = ''
set -o xtrace
nixpkgs-fmt "$@"
statix fix "$@"
'';
};

checks = {
lint = pkgs.runCommand "lint-code" { nativeBuildInputs = with pkgs; [ nixpkgs-fmt deadnix statix ]; } ''
deadnix --fail ${./.}
#statix check ${./.} # https://github.com/nerdypepper/statix/issues/75
nixpkgs-fmt --check ${./.}
touch $out
'';
};
});
}
22 changes: 22 additions & 0 deletions hosts/centrium/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ inputs, ... }:

{
imports = with inputs.nixos-hardware.nixosModules; [
common-cpu-intel
common-pc-ssd
] ++ [
../features/required

./partitioning.nix
];

boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;

initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" ];
initrd.kernelModules = [ ];

kernelModules = [ "kvm-intel" ];
};
}
Loading

0 comments on commit f5d6c7c

Please sign in to comment.