refactor(flake-parts): initial flake-parts configuration

This commit is contained in:
ooks-io 2024-05-13 22:50:56 +12:00
parent 8f67be9e68
commit 5603001d65
230 changed files with 380 additions and 717 deletions

24
outputs/nixos/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ inputs, nixpkgs, self, ... }:
let
inherit (nixpkgs.lib) nixosSystem;
hm = inputs.home-manager.nixosModules.home-manager;
systemInputs = "${self}/inputs/system";
base = "${systemInputs}/modules/base";
specialArgs = {inherit inputs self;};
in
{
ooksdesk = nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
./ooksdesk
hm
base
];
};
}

View file

@ -0,0 +1,128 @@
{ config, inputs, pkgs, ... }:
# Imports
# -------------------------------------------------------------------------------------------------
{
imports = [
inputs.hardware.nixosModules.common-pc-ssd
inputs.hardware.nixosModules.common-cpu-intel
inputs.hardware.nixosModules.common-gpu-intel
./hardware-configuration.nix
../common/user/ooks
../common/base
../common/features/bluetooth.nix
../common/features/greetd.nix
];
# Hostname and networking
# -------------------------------------------------------------------------------------------------
networking = {
hostName = "ooksx1";
networkmanager.enable = true;
};
# Printing
# -------------------------------------------------------------------------------------------------
services.printing.enable = true;
# Kernel
# ------------------------------------------------------------------------------------------------
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
};
# Laptop Programs
# -------------------------------------------------------------------------------------------------
powerManagement.powertop.enable = true;
programs = {
light.enable = true;
dconf.enable = true;
kdeconnect.enable = true;
};
hardware = {
opengl = {
enable = true;
};
};
# gnupg
# -------------------------------------------------------------------------------------------------
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Services
# -------------------------------------------------------------------------------------------------
services = {
logind = {
lidSwitch = "suspend";
};
dbus = {
enable = true;
packages = [ pkgs.gcr ];
};
auto-cpufreq = {
enable = true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};
systemd = {
user.services.polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
# Firewall
# -------------------------------------------------------------------------------------------------
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# System Version
# -------------------------------------------------------------------------------------------------
system = {
stateVersion = "22.05";
};
}

View file

@ -0,0 +1,62 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/3ea21f10-f705-457c-8366-a8268f658ba6";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/db84a41f-6094-46b1-b98a-26e03afc18e1";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/45D8-8DC3";
fsType = "vfat";
};
swapDevices = [{
device = "/swap/swapfile";
size = 8196;
}];
# 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;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wwp0s20f0u2c2.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,40 @@
{ lib, config, inputs, pkgs, ... }:
let
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
in
{
imports = [
./hardware-configuration.nix
];
systemModules.host = {
name = "ooksdesk";
type = "desktop";
function = [ "workstation" "gaming" ];
admin = {
name = "ooks";
shell = "fish";
sshKey = key;
homeManager = true;
};
hardware = {
cpu.type = "amd";
cpu.amd.pstate.enable = true;
gpu.type = "amd";
features = [ "ssd" ];
};
};
systemModules.networking.tailscale = {
enable = true;
client = true;
};
boot = {
kernelPackages = pkgs.linuxPackages_xanmod_latest;
};
system.stateVersion = lib.mkDefault "23.11";
}

View file

@ -0,0 +1,58 @@
# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/629a7421-24a0-45e6-87af-031574d9d46d";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/b5d09a8b-54a9-4f72-828c-5cceea2ec287";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/629a7421-24a0-45e6-87af-031574d9d46d";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/629a7421-24a0-45e6-87af-031574d9d46d";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/629a7421-24a0-45e6-87af-031574d9d46d";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1D01-7040";
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.enp8s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,34 @@
{ config, inputs, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
../../profiles
./nixarr.nix
];
activeProfiles = ["base" "gaming"];
systemModules.user = {
ooks.enable = true;
shell = "fish";
};
systemModules.hardware = {
cpu.type = "intel";
gpu.type = "nvidia";
};
systemModules.networking.tailscale = {
enable = true;
server = true;
};
networking = {
hostName = "ooksmedia";
# useDHCP = true;
};
boot = {
kernelPackages = pkgs.linuxPackages_xanmod_latest;
};
}

View file

@ -0,0 +1,56 @@
# 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" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/50617edf-e788-49cc-9e0c-85a2f90a5550";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/B511-09E2";
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.enp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,22 @@
{ inputs, ... }:
{
imports = [ inputs.nixarr.nixosModules.default ];
nixarr = {
enable = true;
mediaDir = "/jellyfin";
stateDir = "/var/lib/nixarr";
mediaUsers = ["ooks"];
jellyfin.enable = true;
sonarr.enable = true;
radarr.enable = true;
prowlarr.enable = true;
transmission.enable = true;
};
fileSystems."/jellyfin" = {
device = "/dev/disk/by-label/jellyfin";
fsType = "btrfs";
};
}

View file

@ -0,0 +1,38 @@
{ pkgs, ... }:
{
imports = [
./hardware-configuration.nix
../../profiles
];
activeProfiles = ["base" "laptop"];
systemModules.user = {
ooks.enable = true;
shell.fish.enable = true;
};
systemModules.laptop.power = {
powersave = {
minFreq = 800;
maxFreq = 1600;
};
performance = {
minFreq = 1100;
maxFreq = 2600;
};
};
networking = {
hostName = "ooksmicro";
};
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
# need this due to
kernelParams = [ "fbcon=rotate:1" ];
# required for keyboard to work during boot
initrd.availableKernelModules = [ "battery" ];
};
}

View file

@ -0,0 +1,53 @@
# 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 = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/fe7ea7fd-b531-4c00-8123-99f7ea855800";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/57C5-11E7";
fsType = "vfat";
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/385526ad-e263-495d-91eb-1f484985bd0f";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
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.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,43 @@
{ pkgs, inputs, outputs, ... }:
{
imports = [ ./modules ];
environment.packages = with pkgs; [
killall
hostname
man
coreutils
];
environment.etcBackupExtension = ".bak";
system.stateVersion = "23.11";
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
substituters = [
"https://cache.nixos.org?priority=10"
"https://helix.cachix.org"
"https://nix-community.cachix.org"
];
trustedPublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
time.timeZone = "Pacific/Auckland";
user = {
shell = "${pkgs.fish}/bin/fish";
};
home-manager = {
extraSpecialArgs = { inherit inputs outputs; };
config = import ../../../home/user/ooks/ooksphone;
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./theme.nix
# ./openssh.nix
];
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
programs.ssh = {
enable = true;
startAgent = true;
};
}

View file

@ -0,0 +1,43 @@
{ pkgs, ... }:
let
fontPackage = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
fontPath = "/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFontMono-Regular.ttf";
in
{
terminal = {
font = fontPackage + fontPath;
# Gruvbox Material Dark Soft
colors = {
background = "#32302F";
foreground = "#DDC7A1";
cursor = "#DDC7A1";
color0 = "#32302F"; # Black
color8 = "#7C6F64"; # Bright Black
color1 = "#EA6962"; # Red
color9 = "#EA6962"; # Bright Red
color2 = "#A9B665"; # Green
color10 = "#A9B665"; # Bright Green
color3 = "#D8A657"; # Yellow
color11 = "#D8A657"; # Bright Yellow
color4 = "#7DAEA3"; # Blue
color12 = "#7DAEA3"; # Bright Blue
color5 = "#D3869B"; # Magenta
color13 = "#D3869B"; # Bright Magenta
color6 = "#89B482"; # Cyan
color14 = "#89B482"; # Bright Cyan
color7 = "#DDC7A1"; # White
color15 = "#FBF1C7"; # Bright White
};
};
}

View file

@ -0,0 +1,40 @@
{ config, inputs, pkgs, ... }:
{
imports = [
inputs.hardware.nixosModules.lenovo-thinkpad-t480s
./hardware-configuration.nix
../../profiles
];
activeProfiles = ["base"];
systemModules = {
user = {
ooks.enable = true;
shell = "fish";
};
hardware = {
cpu.type = "intel";
gpu.type = "intel";
features = [ "bluetooth" "backlight" "battery" ];
battery = {
powersave = {
minFreq = 800;
maxFreq = 1800;
};
performance = {
minFreq = 1800;
maxFreq = 3600;
};
};
};
};
networking = {
hostName = "ookst480s";
};
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
};
}

View file

@ -0,0 +1,61 @@
# 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" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."cryptnix".device = "/dev/disk/by-uuid/014d725c-bf13-40a2-a9ab-0dd6185a95f6";
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/19e4cf0f-b5ac-4544-a44b-c017b23fd283";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/F356-6F9C";
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;
# networking.interfaces.wlp61s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wwan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,26 @@
{ outputs, inputs, ... }:
{
# For every flake input, aliases 'pkgs.inputs.${flake}' to
# 'inputs.${flake}.packages.${pkgs.system}' or
# 'inputs.${flake}.legacyPackages.${pkgs.system}'
flake-inputs = final: _: {
inputs = builtins.mapAttrs
(_: flake: let
legacyPackages = ((flake.legacyPackages or {}).${final.system} or {});
packages = ((flake.packages or {}).${final.system} or {});
in
if legacyPackages != {} then legacyPackages else packages
)
inputs;
};
zjstatus = final: prev: {
zjstatus = inputs.zjstatus.packages.${prev.system}.default;
};
waybar = final: prev: {
waybar = inputs.nixpkgs-wayland.packages.${prev.system}.waybar;
};
additions = final: prev: import ../pkgs { pkgs = final; };
}

7
outputs/pkgs/default.nix Normal file
View file

@ -0,0 +1,7 @@
{
perSystem = { system, pkgs, inputs, ... }: {
packages = {
live-buds-cli = pkgs.callPackage ./live-buds-cli {};
};
};
}

View file

@ -0,0 +1,26 @@
{ lib, rustPlatform, fetchFromGitHub, stdenv, pkg-config, dbus, libpulseaudio, bluez }:
rustPlatform.buildRustPackage rec {
pname = "live-buds-cli";
version = "0.1.9";
src = fetchFromGitHub {
owner = "JojiiOfficial";
repo = "LiveBudsCli";
rev = "v${version}";
sha256 = "A4XQiJrk4ehb6+935L2JFOeAhUJ7bdukV5mL0Jxn0sQ=";
};
cargoSha256 = "w/dt7Q9TACw5N/+QNAKMUEngf8sAhWyGslnw3B16crQ="; # you will need to determine this hash
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libpulseaudio bluez dbus ];
meta = with lib; {
description = "A free cli tool to control your Galaxy buds live, Galaxy Buds+, Galaxy Buds Pro, Galaxy Buds 2 and Galaxy Buds 2 Pro";
license = licenses.gpl3;
#maintainers = [ maintainers.ooks-io ]; # replace with your maintainer info
platforms = platforms.unix;
};
}

7
outputs/shell.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs ? (import ./nixpkgs.nix) { } }: {
default = pkgs.mkShell {
# Enable experimental features without having to specify the argument
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [ nix home-manager git neovim ];
};
}