Skip to content

Commit

Permalink
Merge pull request #108 from wimpysworld/fixes
Browse files Browse the repository at this point in the history
refactor: assorted fixes and refactor to separate live media from base system
  • Loading branch information
flexiondotorg authored Feb 7, 2024
2 parents 733fd2f + 7ef8b76 commit d5d8c5e
Show file tree
Hide file tree
Showing 23 changed files with 218 additions and 219 deletions.
26 changes: 1 addition & 25 deletions .github/workflows/build-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,9 @@ jobs:
gh release upload "${{ github.ref }}" "${artefact}" --clobber
done
build-desktop-iso:
needs: [create-release]
name: Desktop ISO
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v9
- uses: DeterminateSystems/magic-nix-cache-action@v3
- name: Build Desktop ISO
run: |
nix build .#nixosConfigurations.iso-desktop.config.system.build.isoImage
mkdir iso || true
ISO=$(head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6)
sudo mv "result/iso/${ISO}" iso/desktop-${ISO}
sha256sum "iso/desktop-${ISO}" > "iso/desktop-${ISO}.sha256"
sed -i -r "s/ .*\/(.+)/ \1/g" "iso/desktop-${ISO}.sha256"
- name: Upload Desktop ISO
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for artefact in "iso/"*; do
gh release upload "${{ github.ref }}" "${artefact}" --clobber
done
publish-release:
name: Publish Release
needs: [build-console-iso, build-desktop-iso]
needs: [build-console-iso]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository contains a [Nix Flake](https://zero-to-nix.com/concepts/flakes) for configuring my computers and/or home environment.
It is not intended to be a drop in configuration for your computer, but you are welcome to use it as a reference or starting point for your own configuration.
**If you are looking for a more generic NixOS configuration, I recommend [nix-starter-configs].** 👍️
**If you are looking for a more generic NixOS configuration, I recommend [nix-starter-configs](https://github.com/Misterio77/nix-starter-configs).** 👍️
These computers are managed by this Nix flake ❄️

| Hostname | Board | CPU | RAM | Primary GPU | Secondary GPU | Role | OS | State |
Expand Down Expand Up @@ -81,10 +81,13 @@ gh repo clone wimpysworld/nix-config ~/Zero/nix-config

### ISO 📀

`build-iso-desktop` (*desktop*) and `build-iso-console` (*console only*) aliases are provided that create .iso images from this flake. They do the following:
The `build-iso` script is included that creates .iso images from this flake. The following modes are available:

A live image will be left in `~/$HOME/Zero/nix-config/result/iso/` and are injected into `~/Quickemu/nixos-console` or `~/Quickemu/nixos-desktop`.
These .iso images are also periodically built and published via [GitHub [Actions](./.github/workflows) and are available in [this](https://github.com/wimpysworld/nix-config/releases) project's Releases](https://github.com/wimpysworld/nix-config/releases).
- `build-iso console` (*terminal environment*): Includes `install-system` for automated installation.
- `build-iso desktop` (*desktop environment*): Includes `install-system` and [Calamares](https://calamares.io/) installation.

Live images will be left in `~/$HOME/Zero/nix-config/result/iso/` and are also injected into `~/Quickemu/nixos-console` and `~/Quickemu/nixos-desktop` respectively.
The console .iso image is also periodically built and published via [GitHub [Actions](./.github/workflows) and are available in [this](https://github.com/wimpysworld/nix-config/releases) project's Releases](https://github.com/wimpysworld/nix-config/releases).

## What's in the box? 🎁

Expand Down
18 changes: 9 additions & 9 deletions flake.lock

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

53 changes: 34 additions & 19 deletions home-manager/_mixins/users/martin/hosts/phasma.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
{ config, lib, ... }:
{ config, desktop, lib, pkgs, ... }:
with lib.hm.gvariant;
{
imports = [
../../../desktop/deckmaster-xl.nix
];

# Disable unused audio devices
# - alsa_card.pci-0000_0a_00.1: NVIDIA (HDA NVidia)
home = {
#file.".config/wireplumber/main.lua.d/51-disable-cards.lua".text = ''
# rule = {
# matches = {
# {
# { "device.name", "equals", "alsa_card.pci-0000_0a_00.1" },
# { "device.name", "equals", "alsa_card.usb-AVerMedia_Technologies__Inc._Live_Streamer_CAM_513_5203711200146-00" },
# { "device.name", "equals", "alsa_card.usb-Elgato_Cam_Link_4K_000592F643000-03" },
# },
# },
# apply_properties = {
# ["device.disabled"] = true,
# },
# }
# table.insert(alsa_monitor.rules,rule)
#'';
file = {
"${config.xdg.configHome}/autostart/screenlayout.desktop".text = lib.mkIf (desktop == "pantheon") ''
[Desktop Entry]
Name=xrandr screenlayout
Comment=xrandr screenlayout
Type=Application
Exec=${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 --primary --mode 3440x1440 --pos 0x1280 --rotate normal --output DisplayPort-1 --mode 1920x1080 --pos 760x2720 --rotate normal --output DisplayPort-2 --off --output HDMI-A-0 --mode 1920x1280 --pos 1520x0 --rotate normal --output DP-1-0 --off --output DP-1-1 --off --output DP-1-2 --off --output DP-1-3 --off --output DP-1-4 --off --output DP-1-5 --off --output DP-1-6 --off --output DP-1-7 --off
Categories=
Terminal=false
NoDisplay=true
StartupNotify=false'';
};
# Disable unused audio devices
# pactl list
# - alsa_card.pci-0000_34_00.1: NVIDIA (HDA NVidia) T600
# - alsa_card.pci-0000_26_00.0: Magewell (00-00 Pro Capture Quad HDMI)
# - sa_card.usb-AVerMedia_Technologies__Inc._Live_Streamer_CAM_513_5203711200146-00
file.".config/wireplumber/main.lua.d/51-disable-cards.lua".text = ''
rule = {
matches = {
{
{ "device.name", "equals", "alsa_card.pci-0000_34_00.1" },
{ "device.name", "equals", "alsa_card.pci-0000_26_00.0" },
{ "device.name", "equals", "alsa_card.usb-AVerMedia_Technologies__Inc._Live_Streamer_CAM_513_5203711200146-00" },
},
},
apply_properties = {
["device.disabled"] = true,
},
}
table.insert(alsa_monitor.rules,rule)
'';
};

dconf.settings = {
dconf.settings = lib.mkIf (desktop != null) {
"org/gnome/desktop/background" = {
picture-options = "zoom";
picture-uri = "file://${config.home.homeDirectory}/Pictures/Determinate/DeterminateColorway-3440x1440.png";
Expand Down
67 changes: 41 additions & 26 deletions home-manager/_mixins/users/martin/hosts/vader.nix
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
{ config, lib, ... }:
{ config, desktop, lib, pkgs, ... }:
with lib.hm.gvariant;
{
imports = [
../../../desktop/deckmaster-xl.nix
];

# Disable unused audio devices
# pactl list
# - alsa_card.pci-0000_30_00.1: HDA NVidia T1000
# - alsa_card.pci-0000_33_00.1: Navi 21/23 HDMI/DP Audio Controller
# - alsa_card.pci-0000_26_00.0: Magewell (00-00 Pro Capture Quad HDMI)
# - alsa_card.pci-0000_27_00.0: Magewell (00-01 Pro Capture Quad HDMI)
# - alsa_card.pci-0000_28_00.0: Magewell (00-02 Pro Capture Quad HDMI) (keep, device capture is used by OBS Studio)
# - alsa_card.pci-0000_29_00.0: Magewell (00-03 Pro Capture Quad HDMI)
home.file.".config/wireplumber/main.lua.d/51-disable-cards.lua".text = ''
rule = {
matches = {
{
{ "device.name", "equals", "alsa_card.pci-0000_30_00.1" },
{ "device.name", "equals", "alsa_card.pci-0000_33_00.1" },
{ "device.name", "equals", "alsa_card.pci-0000_26_00.0" },
{ "device.name", "equals", "alsa_card.pci-0000_27_00.0" },
{ "device.name", "equals", "alsa_card.pci-0000_29_00.0" },
home = {
file = {
"${config.xdg.configHome}/autostart/screenlayout.desktop".text = lib.mkIf (desktop == "pantheon") "
[Desktop Entry]
Name=xrandr screenlayout
Comment=xrandr screenlayout
Type=Application
Exec=${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 --primary --mode 2560x1440 --pos 0x1080 --rotate normal --output DisplayPort-1 --mode 2560x1440 --pos 2560x1080 --rotate normal --output DisplayPort-2 --mode 1920x1080 --pos 640x2520 --rotate normal --output HDMI-A-0 --mode 1920x1080 --pos 2560x0 --rotate normal --output DP-1-0 --off --output DP-1-1 --off --output DP-1-2 --off --output DP-1-3 --off --output DP-1-4 --off --output DP-1-5 --off --output DP-1-6 --off --output DP-1-7 --off
Categories=
Terminal=false
NoDisplay=true
StartupNotify=false";
};

# Disable unused audio devices
# pactl list
# - alsa_card.pci-0000_30_00.1: NVIDIA (HDA NVidia) T1000
# - alsa_card.pci-0000_33_00.1: Navi 21/23 HDMI/DP Audio Controller
# - alsa_card.pci-0000_26_00.0: Magewell (00-00 Pro Capture Quad HDMI)
# - alsa_card.pci-0000_27_00.0: Magewell (00-01 Pro Capture Quad HDMI)
# - alsa_card.pci-0000_28_00.0: Magewell (00-02 Pro Capture Quad HDMI) (keep, device capture is used by OBS Studio)
# - alsa_card.pci-0000_29_00.0: Magewell (00-03 Pro Capture Quad HDMI)
file.".config/wireplumber/main.lua.d/51-disable-cards.lua".text = ''
rule = {
matches = {
{
{ "device.name", "equals", "alsa_card.pci-0000_30_00.1" },
{ "device.name", "equals", "alsa_card.pci-0000_33_00.1" },
{ "device.name", "equals", "alsa_card.pci-0000_26_00.0" },
{ "device.name", "equals", "alsa_card.pci-0000_27_00.0" },
{ "device.name", "equals", "alsa_card.pci-0000_29_00.0" },
},
},
},
apply_properties = {
["device.disabled"] = true,
},
}
table.insert(alsa_monitor.rules,rule)
'';
apply_properties = {
["device.disabled"] = true,
},
}
table.insert(alsa_monitor.rules,rule)
'';
};

dconf.settings = {
dconf.settings = lib.mkIf (desktop != null) {
"org/gnome/desktop/background" = {
picture-options = "zoom";
picture-uri = "file://${config.home.homeDirectory}/Pictures/Determinate/DeterminateColorway-2560x1440.png";
Expand Down
45 changes: 45 additions & 0 deletions nixos/_mixins/base/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ desktop, hostname, inputs, lib, pkgs, ... }:
let
# Do not enable the base system on .iso live images
isInstall = builtins.substring 0 4 hostname != "iso-";
in
lib.mkIf (isInstall) {
environment.systemPackages = with pkgs; [
nvme-cli
smartmontools
] ++ lib.optionals (desktop != null) [
gsmartcontrol
];

programs = {
nix-index-database.comma.enable = true;
nix-ld.enable = true;
};

services = {
fwupd.enable = true;
kmscon = {
enable = true;
hwRender = true;
fonts = [{
name = "FiraCode Nerd Font Mono";
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
}];
extraConfig = ''
font-size=14
xkb-layout=gb
'';
};
smartd.enable = true;
};

system = {
activationScripts.diff = {
supportsDryActivation = true;
text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.unstable.nix}/bin diff /run/current-system "$systemConfig"
'';
};
nixos.label = "-";
};
}
40 changes: 40 additions & 0 deletions nixos/_mixins/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,46 @@
};
};

fonts = {
# Enable a basic set of fonts providing several font styles and families and reasonable coverage of Unicode.
enableDefaultPackages = false;
fontDir.enable = true;
packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" "SourceCodePro" "UbuntuMono" ]; })
fira
fira-go
joypixels
liberation_ttf
noto-fonts-emoji
source-serif
ubuntu_font_family
work-sans
];

fontconfig = {
antialias = true;
defaultFonts = {
serif = [ "Source Serif" ];
sansSerif = [ "Work Sans" "Fira Sans" "FiraGO" ];
monospace = [ "FiraCode Nerd Font Mono" "SauceCodePro Nerd Font Mono" ];
emoji = [ "Joypixels" "Noto Color Emoji" ];
};
enable = true;
hinting = {
autohint = false;
enable = true;
style = "slight";
};
subpixel = {
rgba = "rgb";
lcdfilter = "light";
};
};
};

# Accept the joypixels license
nixpkgs.config.joypixels.acceptLicense = true;

hardware = {
opengl = {
enable = true;
Expand Down
2 changes: 1 addition & 1 deletion nixos/_mixins/desktop/firefox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
programs.firefox = {
enable = true;
languagePacks = [ "en-GB" ];
package = pkgs.unstable.firefox;
package = pkgs.firefox;
};
}
File renamed without changes.
17 changes: 0 additions & 17 deletions nixos/_mixins/scripts/build-iso-console.nix

This file was deleted.

17 changes: 0 additions & 17 deletions nixos/_mixins/scripts/build-iso-desktop.nix

This file was deleted.

Loading

0 comments on commit d5d8c5e

Please sign in to comment.