Skip to content

Commit

Permalink
added test config
Browse files Browse the repository at this point in the history
changed workflow

added test config

Create main.yml
  • Loading branch information
Sly-Harvey committed Apr 17, 2024
1 parent 478500b commit 096ecd6
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 18 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: NixOS
concurrency: nixos

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- testing
paths-ignore:
- "README.md"
- ".gitignore"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Create Dir for Mounting Disk Space"
run: |
sudo mkdir /nix
- name: "Remove unneeded components"
run: |
sudo rm -rf $AGENT_TOOLSDIRECTORY
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/lib/heroku
sudo rm -rf /var/lib/docker/overlay2
sudo rm -rf /home/linuxbrew
sudo rm -rf /home/runner/.rustup
- name: "Maximize Disk Space"
uses: easimon/maximize-build-space@v10
with:
#root-reserve-mb: 8192
swap-size-mb: 1024
build-mount-path: /nix
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"

- uses: actions/checkout@v3

- name: "Install Nix ❄️"
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: "Install Cachix ❄️"
uses: cachix/cachix-action@v14
with:
name: workflow-nixos-config
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: "Build NixOS config ❄️"
run: |
nix build .#nixosConfigurations.Test.config.system.build.toplevel
32 changes: 19 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,12 @@
lib = nixpkgs.lib;
in {
nixosConfigurations = {
iso = lib.nixosSystem {
inherit system;
specialArgs =
{
username = "harvey";
inherit inputs;
}
// inputs;
modules = [
./hosts/ISO/configuration.nix
];
};
# This is the only config you will have to change (Desktop and Laptop are for my personal use and may not work for you)
nixos = lib.nixosSystem {
inherit system;
specialArgs = {inherit username locale timezone inputs;} // inputs;
modules = [
./hosts/Default/configuration.nix
#./home/programs/firefox/firefox-system.nix
];
};
Desktop = lib.nixosSystem {
Expand All @@ -75,6 +62,25 @@
./hosts/Laptop/configuration.nix
];
};
iso = lib.nixosSystem {
inherit system;
specialArgs =
{
username = "harvey";
inherit inputs;
}
// inputs;
modules = [
./hosts/ISO/configuration.nix
];
};
Test = lib.nixosSystem {
inherit system;
specialArgs = {inherit username locale timezone inputs;} // inputs;
modules = [
./hosts/Test/configuration.nix
];
};
};

# Standalone home-manager configuration entrypoint
Expand Down
104 changes: 104 additions & 0 deletions hosts/Test/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Please Don't use this test config since it disables drivers.
# And has a different hardware config.
# It's not meant to be used for Personal use.
# This is for automatic testing with github actions.

{
pkgs,
username,
locale,
timezone,
...
}: {
imports = [
../common.nix
../../modules/desktop/hyprland # Enable Hyprland window manager
./hardware-configuration.nix
];

# Home-manager config
home-manager.users.${username} = {
home.username = username;
home.homeDirectory = "/home/${username}";

home.stateVersion = "23.11"; # Please read the comment before changing.

home.packages = with pkgs; [
#vim
#krita
#steam
(pkgs.writeShellScriptBin "hello" ''
echo "Hello ''${username}!"
'')
];

home.sessionVariables = {
# EDITOR = "emacs";
};

# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
};

networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

# Enable networking
networking.networkmanager.enable = true;

# Timezone and locale
time.timeZone = timezone;
i18n.defaultLocale = locale;
i18n.extraLocaleSettings = {
LC_ADDRESS = locale;
LC_IDENTIFICATION = locale;
LC_MEASUREMENT = locale;
LC_MONETARY = locale;
LC_NAME = locale;
LC_NUMERIC = locale;
LC_PAPER = locale;
LC_TELEPHONE = locale;
LC_TIME = locale;
};

# Enable the X11 windowing system.
services.xserver.enable = true;

# Configure keymap in X11
services.xserver.xkb = {
layout = "gb";
variant = "";
};

# Configure console keymap
console.keyMap = "uk";

# Enable CUPS to print documents.
services.printing.enable = true;

# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.${username} = {
isNormalUser = true;
extraGroups = [
"networkmanager"
"wheel"
"video"
"audio"
];
};

environment.systemPackages = with pkgs; [
];

# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}
40 changes: 40 additions & 0 deletions hosts/Test/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];

boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/20549c3e-0dab-4acb-839d-3eac29f4e8a8";
fsType = "btrfs";
options = [ "subvol=@" ];
};

boot.initrd.luks.devices."luks-d3d509db-85bf-4a7b-ad47-1f67952cc6c1".device = "/dev/disk/by-uuid/d3d509db-85bf-4a7b-ad47-1f67952cc6c1";

fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/2556-369F";
fsType = "vfat";
};

swapDevices = [ ];

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
5 changes: 0 additions & 5 deletions rebuild.sh

This file was deleted.

0 comments on commit 096ecd6

Please sign in to comment.