formatting

This commit is contained in:
mjallen18
2024-05-31 16:11:42 -05:00
parent 4aead74c7f
commit 29ec754b2f
82 changed files with 1521 additions and 974 deletions

View File

@@ -5,9 +5,9 @@ let
folder = ../cachix; folder = ../cachix;
toImport = name: value: folder + ("/" + name); toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
(lib.filterAttrs filterCaches (builtins.readDir folder)); in
in { {
inherit imports; inherit imports;
nix.settings.substituters = [ "https://cache.nixos.org/" ]; nix.settings.substituters = [ "https://cache.nixos.org/" ];
} }

View File

@@ -2,9 +2,7 @@
nix = { nix = {
settings = { settings = {
substituters = [ "https://nix-community.cachix.org" ]; substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [ trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
}; };
}; };
} }

194
flake.nix
View File

@@ -17,7 +17,7 @@
url = "github:nix-community/lanzaboote/v0.3.0"; url = "github:nix-community/lanzaboote/v0.3.0";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager-stable.url = "github:nix-community/home-manager/release-24.05"; home-manager-stable.url = "github:nix-community/home-manager/release-24.05";
@@ -31,98 +31,118 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
}; };
outputs = { self, nixpkgs, nixpkgs-stable, chaotic, lanzaboote, impermanence, nix-flatpak, home-manager outputs =
, nixos-hardware, nix-darwin, nixos-apple-silicon, home-manager-stable, nix-inspect, nixpkgs-unstable }@inputs: {
let self,
inherit (self) outputs; nixpkgs,
in { nixpkgs-stable,
overlays = import ./overlays {inherit inputs;}; chaotic,
lanzaboote,
impermanence,
nix-flatpak,
home-manager,
nixos-hardware,
nix-darwin,
nixos-apple-silicon,
home-manager-stable,
nix-inspect,
nixpkgs-unstable,
}@inputs:
let
inherit (self) outputs;
in
{
overlays = import ./overlays { inherit inputs; };
nixosConfigurations = { nixosConfigurations = {
# Desktop # Desktop
"matt-nixos" = nixpkgs.lib.nixosSystem { "matt-nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = {inherit inputs outputs;}; specialArgs = {
modules = [ inherit inputs outputs;
impermanence.nixosModules.impermanence };
lanzaboote.nixosModules.lanzaboote modules = [
nix-flatpak.nixosModules.nix-flatpak impermanence.nixosModules.impermanence
./hosts/desktop/configuration.nix lanzaboote.nixosModules.lanzaboote
./share/impermanence nix-flatpak.nixosModules.nix-flatpak
chaotic.nixosModules.default ./hosts/desktop/configuration.nix
home-manager.nixosModules.home-manager ./share/impermanence
{ chaotic.nixosModules.default
home-manager.useGlobalPkgs = true; home-manager.nixosModules.home-manager
home-manager.useUserPackages = true; {
home-manager.users.matt = import ./hosts/desktop/home.nix; home-manager.useGlobalPkgs = true;
} home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/desktop/home.nix;
}
nixos-hardware.nixosModules.common-cpu-amd nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-gpu-amd nixos-hardware.nixosModules.common-gpu-amd
nixos-hardware.nixosModules.common-hidpi nixos-hardware.nixosModules.common-hidpi
nixos-hardware.nixosModules.common-pc nixos-hardware.nixosModules.common-pc
]; ];
};
# NAS
"jallen-nas" = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs outputs;
};
modules = [
./hosts/nas/configuration.nix
home-manager-stable.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.admin = import ./hosts/nas/home.nix;
}
];
};
# mac nix
"mac-nixos" = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixos-apple-silicon.nixosModules.apple-silicon-support
./hosts/mac-nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/mac-nixos/home.nix;
}
];
};
# Pi4
"nixos-pi4" = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./hosts/pi4/configuration.nix
];
};
}; };
# NAS darwinConfigurations = {
"jallen-nas" = nixpkgs-stable.lib.nixosSystem { "MacBook-Pro" = nix-darwin.lib.darwinSystem {
system = "x86_64-linux"; system = "aarch64-darwin";
specialArgs = {inherit inputs outputs;}; modules = [
modules = [ ./hosts/mac/configuration.nix
./hosts/nas/configuration.nix home-manager.darwinModules.home-manager
home-manager-stable.nixosModules.home-manager {
{ home-manager.useGlobalPkgs = true;
home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true;
home-manager.useUserPackages = true; home-manager.users.mattjallen = import ./hosts/mac/home.nix;
home-manager.users.admin = import ./hosts/nas/home.nix; }
} ];
]; };
}; };
# mac nix # Expose the package set, including overlays, for convenience.
"mac-nixos" = nixpkgs.lib.nixosSystem { darwinPackages = self.darwinConfigurations."MacBook-Pro".pkgs;
system = "aarch64-linux";
modules = [
nixos-apple-silicon.nixosModules.apple-silicon-support
./hosts/mac-nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/mac-nixos/home.nix;
}
];
};
# Pi4 # Set Git commit hash for darwin-version.
"nixos-pi4" = nixpkgs.lib.nixosSystem { system.configurationRevision = self.rev or self.dirtyRev or null;
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./hosts/pi4/configuration.nix
];
};
}; };
darwinConfigurations = {
"MacBook-Pro" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
./hosts/mac/configuration.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mattjallen = import ./hosts/mac/home.nix;
}
];
};
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."MacBook-Pro".pkgs;
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
};
} }

View File

@@ -1,11 +1,24 @@
{ config, lib, pkgs, ... }: {
let timezone = "America/Chicago"; config,
in { lib,
imports = [ ../modules ../share ]; pkgs,
...
}:
let
timezone = "America/Chicago";
in
{
imports = [
../modules
../share
];
# Enable nix flakes and nix-command tools # Enable nix flakes and nix-command tools
nix = { nix = {
settings.experimental-features = [ "nix-command" "flakes" ]; settings.experimental-features = [
"nix-command"
"flakes"
];
# Garbage collect automatically every week # Garbage collect automatically every week
gc.automatic = lib.mkDefault true; gc.automatic = lib.mkDefault true;
@@ -81,10 +94,8 @@ in {
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ pinentry-curses ];
pinentry-curses
];
# Security config # Security config
security = { security = {
rtkit.enable = lib.mkDefault true; rtkit.enable = lib.mkDefault true;
@@ -92,24 +103,25 @@ in {
# configure sudo # configure sudo
sudo = { sudo = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
extraRules = [{ extraRules = [
commands = [ {
{ commands = [
command = "${pkgs.systemd}/bin/systemctl suspend"; {
options = [ "NOPASSWD" ]; command = "${pkgs.systemd}/bin/systemctl suspend";
} options = [ "NOPASSWD" ];
{ }
command = "${pkgs.systemd}/bin/reboot"; {
options = [ "NOPASSWD" ]; command = "${pkgs.systemd}/bin/reboot";
} options = [ "NOPASSWD" ];
{ }
command = "${pkgs.systemd}/bin/poweroff"; {
options = [ "NOPASSWD" ]; command = "${pkgs.systemd}/bin/poweroff";
} options = [ "NOPASSWD" ];
]; }
groups = [ "wheel" ]; ];
}]; groups = [ "wheel" ];
}
];
}; };
}; };
} }

View File

@@ -2,16 +2,23 @@
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, outputs, lib, pkgs, ... }: {
config,
outputs,
lib,
pkgs,
...
}:
let let
user = "matt"; user = "matt";
password = password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "matt-nixos"; hostname = "matt-nixos";
gnome = false; gnome = false;
plasma = true; plasma = true;
in { in
imports = [ # Include the results of the hardware scan. {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
# ../../cachix/cachix.nix # ../../cachix/cachix.nix
../default.nix ../default.nix
@@ -142,7 +149,9 @@ in {
}; };
# Time config # Time config
time = { hardwareClockInLocalTime = true; }; time = {
hardwareClockInLocalTime = true;
};
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ]; # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
# xdg.portal.extraPortals = mkIf plasma [ pkgs.xdg-desktop-portal-gtk ]; # xdg.portal.extraPortals = mkIf plasma [ pkgs.xdg-desktop-portal-gtk ];
@@ -190,7 +199,11 @@ in {
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users."${user}" = { users.users."${user}" = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "ratbagd" ]; # Enable sudo for the user. extraGroups = [
"wheel"
"networkmanager"
"ratbagd"
]; # Enable sudo for the user.
shell = pkgs.fish; shell = pkgs.fish;
}; };
@@ -213,19 +226,46 @@ in {
fileSystems."/media/nas/backup" = { fileSystems."/media/nas/backup" = {
device = "//10.0.1.18/Backup"; device = "//10.0.1.18/Backup";
fsType = "cifs"; fsType = "cifs";
options = [ "sec=none" "x-systemd.automount" "auto" "rw" "file_mode=0775" "dir_mode=0775" "uid=matt" "gid=wheel" ]; options = [
"sec=none"
"x-systemd.automount"
"auto"
"rw"
"file_mode=0775"
"dir_mode=0775"
"uid=matt"
"gid=wheel"
];
}; };
fileSystems."/media/nas/isos" = { fileSystems."/media/nas/isos" = {
device = "//10.0.1.18/isos"; device = "//10.0.1.18/isos";
fsType = "cifs"; fsType = "cifs";
options = [ "sec=none" "x-systemd.automount" "auto" "rw" "file_mode=0775" "dir_mode=0775" "uid=matt" "gid=wheel" ]; options = [
"sec=none"
"x-systemd.automount"
"auto"
"rw"
"file_mode=0775"
"dir_mode=0775"
"uid=matt"
"gid=wheel"
];
}; };
fileSystems."/media/nas/3d_printer" = { fileSystems."/media/nas/3d_printer" = {
device = "//10.0.1.18/3d_printer"; device = "//10.0.1.18/3d_printer";
fsType = "cifs"; fsType = "cifs";
options = [ "sec=none" "x-systemd.automount" "auto" "rw" "file_mode=0775" "dir_mode=0775" "uid=matt" "gid=wheel" ]; options = [
"sec=none"
"x-systemd.automount"
"auto"
"rw"
"file_mode=0775"
"dir_mode=0775"
"uid=matt"
"gid=wheel"
];
}; };
# This option defines the first version of NixOS you have installed on this particular machine, # This option defines the first version of NixOS you have installed on this particular machine,
@@ -245,6 +285,4 @@ in {
# #
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View File

@@ -1,13 +1,26 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules = [
[ "xhci_pci" "nvme" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ]; "xhci_pci"
"nvme"
"ahci"
"usbhid"
"uas"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@@ -15,37 +28,60 @@
fileSystems."/" = { fileSystems."/" = {
device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
options = [ "defaults" "size=256G" "mode=755" ]; options = [
"defaults"
"size=256G"
"mode=755"
];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ]; options = [
"subvol=nix"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/etc" = { fileSystems."/etc" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=etc" "compress=zstd" "noatime" ]; options = [
"subvol=etc"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/root" = { fileSystems."/root" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ]; options = [
"subvol=root"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/var/log" = { fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ]; options = [
"subvol=log"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" ]; options = [
"subvol=home"
"compress=zstd"
];
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
@@ -53,8 +89,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/a94819f6-d4e1-4471-b972-703c80de1a5f"; } ];
[{ device = "/dev/disk/by-uuid/a94819f6-d4e1-4471-b972-703c80de1a5f"; }];
fileSystems."/home/matt/Games" = { fileSystems."/home/matt/Games" = {
device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3"; device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3";
@@ -74,6 +109,5 @@
# networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@@ -61,7 +61,7 @@
vmware-horizon-client vmware-horizon-client
vorta vorta
]; ];
# dconf = { # dconf = {
# enable = true; # enable = true;
# settings = { # settings = {

View File

@@ -1,7 +1,5 @@
{ ... }: { ... }:
{ {
imports = [ imports = [ ./modules/default.nix ];
./modules/default.nix
];
} }

View File

@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
pkgs' = config.hardware.asahi.pkgs; pkgs' = config.hardware.asahi.pkgs;
@@ -8,12 +13,10 @@ let
customLogo = config.boot.m1n1CustomLogo; customLogo = config.boot.m1n1CustomLogo;
}; };
bootUBoot = pkgs'.uboot-asahi.override { bootUBoot = pkgs'.uboot-asahi.override { m1n1 = bootM1n1; };
m1n1 = bootM1n1;
};
bootFiles = { bootFiles = {
"m1n1/boot.bin" = pkgs.runCommand "boot.bin" {} '' "m1n1/boot.bin" = pkgs.runCommand "boot.bin" { } ''
cat ${bootM1n1}/build/m1n1.bin > $out cat ${bootM1n1}/build/m1n1.bin > $out
cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out
cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out
@@ -22,14 +25,18 @@ let
fi fi
''; '';
}; };
in { in
{
config = lib.mkIf config.hardware.asahi.enable { config = lib.mkIf config.hardware.asahi.enable {
# install m1n1 with the boot loader # install m1n1 with the boot loader
boot.loader.grub.extraFiles = bootFiles; boot.loader.grub.extraFiles = bootFiles;
boot.loader.systemd-boot.extraFiles = bootFiles; boot.loader.systemd-boot.extraFiles = bootFiles;
# ensure the installer has m1n1 in the image # ensure the installer has m1n1 in the image
system.extraDependencies = lib.mkForce [ bootM1n1 bootUBoot ]; system.extraDependencies = lib.mkForce [
bootM1n1
bootUBoot
];
system.build.m1n1 = bootFiles."m1n1/boot.bin"; system.build.m1n1 = bootFiles."m1n1/boot.bin";
}; };

View File

@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
imports = [ imports = [
./kernel ./kernel
@@ -8,20 +13,22 @@
./sound ./sound
]; ];
config = let config =
let
cfg = config.hardware.asahi; cfg = config.hardware.asahi;
in lib.mkIf cfg.enable { in
lib.mkIf cfg.enable {
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ]; nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
hardware.asahi.pkgs = hardware.asahi.pkgs =
if cfg.pkgsSystem != "aarch64-linux" if cfg.pkgsSystem != "aarch64-linux" then
then
import (pkgs.path) { import (pkgs.path) {
crossSystem.system = "aarch64-linux"; crossSystem.system = "aarch64-linux";
localSystem.system = cfg.pkgsSystem; localSystem.system = cfg.pkgsSystem;
overlays = [ cfg.overlay ]; overlays = [ cfg.overlay ];
} }
else pkgs; else
pkgs;
}; };
options.hardware.asahi = { options.hardware.asahi = {

View File

@@ -1,11 +1,17 @@
# the Asahi Linux kernel and options that must go along with it # the Asahi Linux kernel and options that must go along with it
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
config = lib.mkIf config.hardware.asahi.enable { config = lib.mkIf config.hardware.asahi.enable {
boot.kernelPackages = let boot.kernelPackages =
pkgs' = config.hardware.asahi.pkgs; let
in pkgs' = config.hardware.asahi.pkgs;
in
pkgs'.linux-asahi.override { pkgs'.linux-asahi.override {
_kernelPatches = config.boot.kernelPatches; _kernelPatches = config.boot.kernelPatches;
withRust = config.hardware.asahi.withRust; withRust = config.hardware.asahi.withRust;
@@ -93,8 +99,11 @@
}; };
imports = [ imports = [
(lib.mkRemovedOptionModule [ "hardware" "asahi" "addEdgeKernelConfig" ] (lib.mkRemovedOptionModule [
"All edge kernel config options are now the default.") "hardware"
"asahi"
"addEdgeKernelConfig"
] "All edge kernel config options are now the default.")
]; ];
options.hardware.asahi.withRust = lib.mkOption { options.hardware.asahi.withRust = lib.mkOption {

View File

@@ -1,47 +1,57 @@
{ config, pkgs, lib, ... }:
{ {
config = let config,
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver pkgs,
&& config.hardware.asahi.experimentalGPUInstallMode == mode); lib,
in lib.mkIf config.hardware.asahi.enable (lib.mkMerge [ ...
{ }:
# required for proper DRM setup even without GPU driver {
services.xserver.config = '' config =
Section "OutputClass" let
Identifier "appledrm" isMode =
MatchDriver "apple" mode:
Driver "modesetting" (
Option "PrimaryGPU" "true" config.hardware.asahi.useExperimentalGPUDriver
EndSection && config.hardware.asahi.experimentalGPUInstallMode == mode
''; );
} in
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver { lib.mkIf config.hardware.asahi.enable (
# install the drivers lib.mkMerge [
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers; {
# required for proper DRM setup even without GPU driver
# required for in-kernel GPU driver services.xserver.config = ''
hardware.asahi.withRust = true; Section "OutputClass"
}) Identifier "appledrm"
(lib.mkIf (isMode "replace") { MatchDriver "apple"
# replace the Mesa linked into system packages with the Asahi version Driver "modesetting"
# without rebuilding them to avoid rebuilding the world. Option "PrimaryGPU" "true"
system.replaceRuntimeDependencies = [ EndSection
{ original = pkgs.mesa; '';
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
} }
]; (lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
}) # install the drivers
(lib.mkIf (isMode "overlay") { hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
# which requires rebuilding the world but ensures it is done faithfully # required for in-kernel GPU driver
# (and in a way compatible with pure evaluation) hardware.asahi.withRust = true;
nixpkgs.overlays = [
(final: prev: {
mesa = final.mesa-asahi-edge;
}) })
]; (lib.mkIf (isMode "replace") {
}) # replace the Mesa linked into system packages with the Asahi version
]); # without rebuilding them to avoid rebuilding the world.
system.replaceRuntimeDependencies = [
{
original = pkgs.mesa;
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
}
];
})
(lib.mkIf (isMode "overlay") {
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
# which requires rebuilding the world but ensures it is done faithfully
# (and in a way compatible with pure evaluation)
nixpkgs.overlays = [ (final: prev: { mesa = final.mesa-asahi-edge; }) ];
})
]
);
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption { options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@@ -54,7 +64,11 @@
}; };
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption { options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
type = lib.types.enum [ "driver" "replace" "overlay" ]; type = lib.types.enum [
"driver"
"replace"
"overlay"
];
default = "replace"; default = "replace";
description = '' description = ''
Mode to use to install the experimental GPU driver into the system. Mode to use to install the experimental GPU driver into the system.

View File

@@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
config = lib.mkIf config.hardware.asahi.enable { config = lib.mkIf config.hardware.asahi.enable {
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [ assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null; {
assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
message = '' message = ''
Asahi peripheral firmware extraction is enabled but the firmware Asahi peripheral firmware extraction is enabled but the firmware
location appears incorrect. location appears incorrect.
@@ -10,26 +16,34 @@
} }
]; ];
hardware.firmware = let hardware.firmware =
pkgs' = config.hardware.asahi.pkgs; let
in pkgs' = config.hardware.asahi.pkgs;
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null) in
&& config.hardware.asahi.extractPeripheralFirmware) [ lib.mkIf
(pkgs.stdenv.mkDerivation { (
name = "asahi-peripheral-firmware"; (config.hardware.asahi.peripheralFirmwareDirectory != null)
&& config.hardware.asahi.extractPeripheralFirmware
)
[
(pkgs.stdenv.mkDerivation {
name = "asahi-peripheral-firmware";
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ]; nativeBuildInputs = [
pkgs'.asahi-fwextract
pkgs.cpio
];
buildCommand = '' buildCommand = ''
mkdir extracted mkdir extracted
asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted
mkdir -p $out/lib/firmware mkdir -p $out/lib/firmware
cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames
mv vendorfw/* $out/lib/firmware mv vendorfw/* $out/lib/firmware
''; '';
}) })
]; ];
}; };
options.hardware.asahi = { options.hardware.asahi = {
@@ -45,13 +59,12 @@
peripheralFirmwareDirectory = lib.mkOption { peripheralFirmwareDirectory = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null [
[ # path when the system is operating normally
# path when the system is operating normally /boot/asahi
/boot/asahi # path when the system is mounted in the installer
# path when the system is mounted in the installer /mnt/boot/asahi
/mnt/boot/asahi ];
];
description = '' description = ''
Path to the directory containing the non-free non-redistributable Path to the directory containing the non-free non-redistributable

View File

@@ -1,4 +1,10 @@
{ config, options, pkgs, lib, ... }: {
config,
options,
pkgs,
lib,
...
}:
{ {
imports = [ imports = [
@@ -19,72 +25,96 @@
}; };
}; };
config = let config =
cfg = config.hardware.asahi; let
cfg = config.hardware.asahi;
asahi-audio = pkgs.asahi-audio; # the asahi-audio we use asahi-audio = pkgs.asahi-audio; # the asahi-audio we use
lsp-plugins = pkgs.lsp-plugins; # the lsp-plugins we use lsp-plugins = pkgs.lsp-plugins; # the lsp-plugins we use
lsp-plugins-is-patched = (lsp-plugins.overrideAttrs (old: { lsp-plugins-is-patched =
passthru = (old.passthru or {}) // { (lsp-plugins.overrideAttrs (old: {
lsp-plugins-is-patched = builtins.elem "58c3f985f009c84347fa91236f164a9e47aafa93.patch" passthru = (old.passthru or { }) // {
(builtins.map (p: p.name) (old.patches or [])); lsp-plugins-is-patched = builtins.elem "58c3f985f009c84347fa91236f164a9e47aafa93.patch" (
}; builtins.map (p: p.name) (old.patches or [ ])
})).lsp-plugins-is-patched; );
};
})).lsp-plugins-is-patched;
lsp-plugins-is-safe = (pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14") || lsp-plugins-is-patched; lsp-plugins-is-safe =
(pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14") || lsp-plugins-is-patched;
# https://github.com/NixOS/nixpkgs/pull/282377 # https://github.com/NixOS/nixpkgs/pull/282377
# options is the set of all module option declarations, rather than their # options is the set of all module option declarations, rather than their
# values, to prevent infinite recursion # values, to prevent infinite recursion
newHotness = builtins.hasAttr "configPackages" options.services.pipewire; newHotness = builtins.hasAttr "configPackages" options.services.pipewire;
lv2Path = lib.makeSearchPath "lib/lv2" [ lsp-plugins pkgs.bankstown-lv2 ]; lv2Path = lib.makeSearchPath "lib/lv2" [
in lib.mkIf (cfg.setupAsahiSound && cfg.enable) (lib.mkMerge [ lsp-plugins
{ pkgs.bankstown-lv2
# enable pipewire to run real-time and avoid audible glitches ];
security.rtkit.enable = true; in
# set up pipewire with the supported capabilities (instead of pulseaudio) lib.mkIf (cfg.setupAsahiSound && cfg.enable) (
# and asahi-audio configs and plugins lib.mkMerge [
services.pipewire = { {
enable = true; # enable pipewire to run real-time and avoid audible glitches
security.rtkit.enable = true;
# set up pipewire with the supported capabilities (instead of pulseaudio)
# and asahi-audio configs and plugins
services.pipewire = {
enable = true;
alsa.enable = true; alsa.enable = true;
pulse.enable = true; pulse.enable = true;
wireplumber.enable = true; wireplumber.enable = true;
}; };
# set up enivronment so that UCM configs are used as well # set up enivronment so that UCM configs are used as well
environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2"; environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2";
systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 =
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; config.environment.variables.ALSA_CONFIG_UCM2;
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 =
config.environment.variables.ALSA_CONFIG_UCM2;
# enable speakersafetyd to protect speakers # enable speakersafetyd to protect speakers
systemd.packages = lib.mkAssert lsp-plugins-is-safe systemd.packages =
"lsp-plugins is unpatched/outdated and speakers cannot be safely enabled" lib.mkAssert lsp-plugins-is-safe
[ pkgs.speakersafetyd ]; "lsp-plugins is unpatched/outdated and speakers cannot be safely enabled"
services.udev.packages = [ pkgs.speakersafetyd ]; [ pkgs.speakersafetyd ];
} services.udev.packages = [ pkgs.speakersafetyd ];
(lib.optionalAttrs newHotness { }
# use configPackages and friends to install asahi-audio and plugins (lib.optionalAttrs newHotness {
services.pipewire = { # use configPackages and friends to install asahi-audio and plugins
configPackages = [ asahi-audio ]; services.pipewire = {
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ]; configPackages = [ asahi-audio ];
wireplumber = { extraLv2Packages = [
configPackages = [ asahi-audio ]; lsp-plugins
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ]; pkgs.bankstown-lv2
}; ];
}; wireplumber = {
}) configPackages = [ asahi-audio ];
(lib.optionalAttrs (!newHotness) { extraLv2Packages = [
# use environment.etc and environment variables to install asahi-audio and plugins lsp-plugins
environment.etc = builtins.listToAttrs (builtins.map pkgs.bankstown-lv2
(f: { name = f; value = { source = "${asahi-audio}/share/${f}"; }; }) ];
asahi-audio.providedConfigFiles); };
};
})
(lib.optionalAttrs (!newHotness) {
# use environment.etc and environment variables to install asahi-audio and plugins
environment.etc = builtins.listToAttrs (
builtins.map (f: {
name = f;
value = {
source = "${asahi-audio}/share/${f}";
};
}) asahi-audio.providedConfigFiles
);
systemd.user.services.pipewire.environment.LV2_PATH = lv2Path; systemd.user.services.pipewire.environment.LV2_PATH = lv2Path;
systemd.user.services.wireplumber.environment.LV2_PATH = lv2Path; systemd.user.services.wireplumber.environment.LV2_PATH = lv2Path;
}) })
]); ]
);
} }

View File

@@ -1,6 +1,8 @@
{ lib {
, fetchFromGitHub lib,
, alsa-ucm-conf }: fetchFromGitHub,
alsa-ucm-conf,
}:
(alsa-ucm-conf.overrideAttrs (oldAttrs: rec { (alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
version = "5"; version = "5";
@@ -12,8 +14,10 @@
rev = "v${version}"; rev = "v${version}";
hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw="; hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw=";
}; };
postInstall = oldAttrs.postInstall or "" + '' postInstall =
cp -r ${src_asahi}/ucm2 $out/share/alsa oldAttrs.postInstall or ""
''; + ''
cp -r ${src_asahi}/ucm2 $out/share/alsa
'';
})) }))

View File

@@ -1,6 +1,7 @@
{ stdenv {
, lib stdenv,
, fetchFromGitHub lib,
fetchFromGitHub,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {

View File

@@ -1,9 +1,10 @@
{ lib {
, python3 lib,
, fetchFromGitHub python3,
, gzip fetchFromGitHub,
, gnutar gzip,
, lzfse gnutar,
lzfse,
}: }:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {

View File

@@ -1,9 +1,10 @@
{ lib {
, lv2 lib,
, pkg-config lv2,
, rustPlatform pkg-config,
, fetchFromGitHub rustPlatform,
, fetchpatch fetchFromGitHub,
fetchpatch,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
@@ -28,11 +29,7 @@ rustPlatform.buildRustPackage rec {
make install make install
''; '';
nativeBuildInputs = [ nativeBuildInputs = [ pkg-config ];
pkg-config
];
buildInputs = [ buildInputs = [ lv2 ];
lv2
];
} }

View File

@@ -1,12 +1,13 @@
{ lib {
, pkgs lib,
, callPackage pkgs,
, writeShellScriptBin callPackage,
, writeText writeShellScriptBin,
, removeReferencesTo writeText,
, linuxPackagesFor removeReferencesTo,
, withRust ? false linuxPackagesFor,
, _kernelPatches ? [ ] withRust ? false,
_kernelPatches ? [ ],
}: }:
let let
@@ -14,67 +15,107 @@ let
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig # parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
# into a list of k, v tuples # into a list of k, v tuples
parseExtraConfig = config: parseExtraConfig =
config:
let let
lines = lines = builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
builtins.filter (s: s != "") (lib.strings.splitString "\n" config); parseLine =
parseLine = line: let line:
t = lib.strings.splitString " " line; let
join = l: builtins.foldl' (a: b: "${a} ${b}") t = lib.strings.splitString " " line;
(builtins.head l) (builtins.tail l); join = l: builtins.foldl' (a: b: "${a} ${b}") (builtins.head l) (builtins.tail l);
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1); v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
in [ "CONFIG_${i t 0}" v ]; in
in map parseLine lines; [
"CONFIG_${i t 0}"
v
];
in
map parseLine lines;
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo" # parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
# style configuration as found in a patch's extraStructuredConfig into # style configuration as found in a patch's extraStructuredConfig into
# a list of k, v tuples # a list of k, v tuples
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList parseExtraStructuredConfig =
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config; config:
lib.attrsets.mapAttrsToList (k: v: [
"CONFIG_${k}"
(v.tristate or v.freeform)
]) config;
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }: parsePatchConfig =
(parseExtraConfig extraConfig) ++ {
(parseExtraStructuredConfig extraStructuredConfig); extraConfig ? "",
extraStructuredConfig ? { },
...
}:
(parseExtraConfig extraConfig) ++ (parseExtraStructuredConfig extraStructuredConfig);
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file # parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
# into a list of k, v tuples # into a list of k, v tuples
parseConfig = config: parseConfig =
config:
let let
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")''; parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
# get either the [ymn] option or the "foo" option; whichever matched # get either the [ymn] option or the "foo" option; whichever matched
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ]; t =
l:
let
v = (i l 2);
in
[
(i l 0)
(if v != null then v else (i l 3))
];
lines = lib.strings.splitString "\n" config; lines = lib.strings.splitString "\n" config;
in map t (builtins.filter (l: l != null) (map parseLine lines)); in
map t (builtins.filter (l: l != null) (map parseLine lines));
origConfigfile = ./config; origConfigfile = ./config;
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel, linux-asahi-pkg =
rustPlatform, rustc, rustfmt, rust-bindgen, ... } @ args: {
stdenv,
lib,
fetchFromGitHub,
fetchpatch,
linuxKernel,
rustPlatform,
rustc,
rustfmt,
rust-bindgen,
...
}@args:
let let
origConfigText = builtins.readFile origConfigfile; origConfigText = builtins.readFile origConfigfile;
# extraConfig from all patches in order # extraConfig from all patches in order
extraConfig = extraConfig = lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [ ] _kernelPatches;
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches;
# config file text for above # config file text for above
extraConfigText = let extraConfigText =
text = k: v: if (v == "y") || (v == "m") || (v == "n") let
then "${k}=${v}" else ''${k}="${v}"''; text = k: v: if (v == "y") || (v == "m") || (v == "n") then "${k}=${v}" else ''${k}="${v}"'';
in (map (t: text (i t 0) (i t 1)) extraConfig); in
(map (t: text (i t 0) (i t 1)) extraConfig);
# final config as a text file path # final config as a text file path
configfile = if extraConfig == [] then origConfigfile else configfile =
writeText "config" '' if extraConfig == [ ] then
${origConfigText} origConfigfile
else
writeText "config" ''
${origConfigText}
# Patches # Patches
${lib.strings.concatStringsSep "\n" extraConfigText} ${lib.strings.concatStringsSep "\n" extraConfigText}
''; '';
# final config as an attrset # final config as an attrset
configAttrs = let configAttrs =
makePair = t: lib.nameValuePair (i t 0) (i t 1); let
configList = (parseConfig origConfigText) ++ extraConfig; makePair = t: lib.nameValuePair (i t 0) (i t 1);
in builtins.listToAttrs (map makePair (lib.lists.reverseList configList)); configList = (parseConfig origConfigText) ++ extraConfig;
in
builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
# used to (ostensibly) keep compatibility for those running stable versions of nixos # used to (ostensibly) keep compatibility for those running stable versions of nixos
rustOlder = version: withRust && (lib.versionOlder rustc.version version); rustOlder = version: withRust && (lib.versionOlder rustc.version version);
@@ -84,71 +125,94 @@ let
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version); rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version); bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
in in
(linuxKernel.manualConfig rec { (
inherit stdenv lib; linuxKernel.manualConfig rec {
inherit stdenv lib;
version = "6.6.0-asahi"; version = "6.6.0-asahi";
modDirVersion = version; modDirVersion = version;
extraMeta.branch = "6.6"; extraMeta.branch = "6.6";
src = fetchFromGitHub { src = fetchFromGitHub {
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification) # tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
owner = "AsahiLinux"; owner = "AsahiLinux";
repo = "linux"; repo = "linux";
rev = "asahi-6.6-15"; rev = "asahi-6.6-15";
hash = "sha256-Jm7wTKWuwd/6ZN0g5F4CNNETiOyGQL31hfSyTDYH85k="; hash = "sha256-Jm7wTKWuwd/6ZN0g5F4CNNETiOyGQL31hfSyTDYH85k=";
}; };
kernelPatches = [ kernelPatches =
{ name = "coreutils-fix"; [
patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch; {
} name = "coreutils-fix";
# speaker enablement; we assert on the relevant lsp-plugins patch patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch;
# before installing speakersafetyd to let the speakers work }
{ name = "speakers-1"; # speaker enablement; we assert on the relevant lsp-plugins patch
patch = fetchpatch { # before installing speakersafetyd to let the speakers work
url = "https://github.com/AsahiLinux/linux/commit/385ea7b5023486aba7919cec8b6b3f6a843a1013.patch"; {
hash = "sha256-u7IzhJbUgBPfhJXAcpHw1I6OPzPHc1UKYjH91Ep3QHQ="; name = "speakers-1";
}; patch = fetchpatch {
} url = "https://github.com/AsahiLinux/linux/commit/385ea7b5023486aba7919cec8b6b3f6a843a1013.patch";
{ name = "speakers-2"; hash = "sha256-u7IzhJbUgBPfhJXAcpHw1I6OPzPHc1UKYjH91Ep3QHQ=";
patch = fetchpatch { };
url = "https://github.com/AsahiLinux/linux/commit/6a24102c06c95951ab992e2d41336cc6d4bfdf23.patch"; }
hash = "sha256-wn5x2hN42/kCp/XHBvLWeNLfwlOBB+T6UeeMt2tSg3o="; {
}; name = "speakers-2";
} patch = fetchpatch {
] ++ lib.optionals (rustAtLeast "1.75.0") [ url = "https://github.com/AsahiLinux/linux/commit/6a24102c06c95951ab992e2d41336cc6d4bfdf23.patch";
{ name = "rustc-1.75.0"; hash = "sha256-wn5x2hN42/kCp/XHBvLWeNLfwlOBB+T6UeeMt2tSg3o=";
patch = ./0001-check-in-new-alloc-for-1.75.0.patch; };
} }
] ++ lib.optionals (rustAtLeast "1.76.0") [ ]
{ name = "rustc-1.76.0"; ++ lib.optionals (rustAtLeast "1.75.0") [
patch = ./rust_1_76_0.patch; {
} name = "rustc-1.75.0";
] ++ _kernelPatches; patch = ./0001-check-in-new-alloc-for-1.75.0.patch;
}
]
++ lib.optionals (rustAtLeast "1.76.0") [
{
name = "rustc-1.76.0";
patch = ./rust_1_76_0.patch;
}
]
++ _kernelPatches;
inherit configfile; inherit configfile;
# hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages. # hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages.
# we can't use it until it's in stable and until we've evaluated the cross-compilation impact. # we can't use it until it's in stable and until we've evaluated the cross-compilation impact.
config = configAttrs // { "CONFIG_RUST" = "n"; }; config = configAttrs // {
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then { "CONFIG_RUST" = "n";
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ };
rust-bindgen }
rustfmt // (args.argsOverride or { })
rustc ).overrideAttrs
removeReferencesTo (
]; old:
# HACK: references shouldn't have been there in the first place if withRust then
# TODO: remove once 23.05 is obsolete {
postFixup = (old.postFixup or "") + '' nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then rust-bindgen
remove-references-to -t $out $dev/lib/modules/${old.version}/build/vmlinux rustfmt
fi rustc
remove-references-to -t $dev $out/Image removeReferencesTo
''; ];
RUST_LIB_SRC = rustPlatform.rustLibSrc; # HACK: references shouldn't have been there in the first place
} else {}); # TODO: remove once 23.05 is obsolete
postFixup =
(old.postFixup or "")
+ ''
if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then
remove-references-to -t $out $dev/lib/modules/${old.version}/build/vmlinux
fi
remove-references-to -t $dev $out/Image
'';
RUST_LIB_SRC = rustPlatform.rustLibSrc;
}
else
{ }
);
linux-asahi = (callPackage linux-asahi-pkg { }); linux-asahi = (callPackage linux-asahi-pkg { });
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi) in
lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)

View File

@@ -1,29 +1,33 @@
{ stdenv {
, buildPackages stdenv,
, lib buildPackages,
, fetchFromGitHub lib,
, python3 fetchFromGitHub,
, dtc python3,
, imagemagick dtc,
, isRelease ? false imagemagick,
, withTools ? true isRelease ? false,
, withChainloading ? false withTools ? true,
, rust-bin ? null withChainloading ? false,
, customLogo ? null rust-bin ? null,
customLogo ? null,
}: }:
assert withChainloading -> rust-bin != null; assert withChainloading -> rust-bin != null;
let let
pyenv = python3.withPackages (p: with p; [ pyenv = python3.withPackages (
construct p: with p; [
pyserial construct
]); pyserial
]
);
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override { rustenv = rust-bin.selectLatestNightlyWith (
targets = [ "aarch64-unknown-none-softfloat" ]; toolchain: toolchain.minimal.override { targets = [ "aarch64-unknown-none-softfloat" ]; }
}); );
in stdenv.mkDerivation rec { in
stdenv.mkDerivation rec {
pname = "m1n1"; pname = "m1n1";
version = "1.4.11"; version = "1.4.11";
@@ -36,15 +40,14 @@ in stdenv.mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ] makeFlags = [
++ lib.optional isRelease "RELEASE=1" "ARCH=${stdenv.cc.targetPrefix}"
++ lib.optional withChainloading "CHAINLOADING=1"; ] ++ lib.optional isRelease "RELEASE=1" ++ lib.optional withChainloading "CHAINLOADING=1";
nativeBuildInputs = [ nativeBuildInputs = [
dtc dtc
buildPackages.gcc buildPackages.gcc
] ++ lib.optional withChainloading rustenv ] ++ lib.optional withChainloading rustenv ++ lib.optional (customLogo != null) imagemagick;
++ lib.optional (customLogo != null) imagemagick;
postPatch = '' postPatch = ''
substituteInPlace proxyclient/m1n1/asm.py \ substituteInPlace proxyclient/m1n1/asm.py \
@@ -67,35 +70,38 @@ in stdenv.mkDerivation rec {
popd &>/dev/null popd &>/dev/null
''; '';
installPhase = '' installPhase =
runHook preInstall ''
runHook preInstall
mkdir -p $out/build mkdir -p $out/build
cp build/m1n1.bin $out/build cp build/m1n1.bin $out/build
'' + (lib.optionalString withTools '' ''
mkdir -p $out/{bin,script,toolchain-bin} + (lib.optionalString withTools ''
cp -r proxyclient $out/script mkdir -p $out/{bin,script,toolchain-bin}
cp -r tools $out/script cp -r proxyclient $out/script
cp -r tools $out/script
for toolpath in $out/script/proxyclient/tools/*.py; do for toolpath in $out/script/proxyclient/tools/*.py; do
tool=$(basename $toolpath .py) tool=$(basename $toolpath .py)
script=$out/bin/m1n1-$tool script=$out/bin/m1n1-$tool
cat > $script <<EOF cat > $script <<EOF
#!/bin/sh #!/bin/sh
${pyenv}/bin/python $toolpath "\$@" ${pyenv}/bin/python $toolpath "\$@"
EOF EOF
chmod +x $script chmod +x $script
done done
GCC=${buildPackages.gcc} GCC=${buildPackages.gcc}
BINUTILS=${buildPackages.binutils-unwrapped} BINUTILS=${buildPackages.binutils-unwrapped}
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/ ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/ ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/ ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/ ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/ ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
'') + '' '')
runHook postInstall + ''
''; runHook postInstall
'';
} }

View File

@@ -1,49 +1,56 @@
{ lib {
, fetchFromGitLab lib,
, mesa fetchFromGitLab,
, meson mesa,
, llvmPackages meson,
llvmPackages,
}: }:
(mesa.override { (mesa.override {
galliumDrivers = [ "swrast" "asahi" ]; galliumDrivers = [
"swrast"
"asahi"
];
vulkanDrivers = [ "swrast" ]; vulkanDrivers = [ "swrast" ];
enableGalliumNine = false; enableGalliumNine = false;
# libclc and other OpenCL components are needed for geometry shader support on Apple Silicon # libclc and other OpenCL components are needed for geometry shader support on Apple Silicon
enableOpenCL = true; enableOpenCL = true;
}).overrideAttrs (oldAttrs: { }).overrideAttrs
# version must be the same length (i.e. no unstable or date) (oldAttrs: {
# so that system.replaceRuntimeDependencies can work # version must be the same length (i.e. no unstable or date)
version = "24.1.0"; # so that system.replaceRuntimeDependencies can work
src = fetchFromGitLab { version = "24.1.0";
# tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi src = fetchFromGitLab {
domain = "gitlab.freedesktop.org"; # tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi
owner = "asahi"; domain = "gitlab.freedesktop.org";
repo = "mesa"; owner = "asahi";
rev = "asahi-20240228"; repo = "mesa";
hash = "sha256-wOFJyYfoN6yxE9HaHXLP/0MhjyRvmlb+jPPUke0sbbE="; rev = "asahi-20240228";
}; hash = "sha256-wOFJyYfoN6yxE9HaHXLP/0MhjyRvmlb+jPPUke0sbbE=";
};
mesonFlags = mesonFlags =
# remove flag to configure xvmc functionality as having it # remove flag to configure xvmc functionality as having it
# breaks the build because that no longer exists in Mesa 23 # breaks the build because that no longer exists in Mesa 23
(lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags) ++ [ (lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags)
# we do not build any graphics drivers these features can be enabled for ++ [
"-Dgallium-va=disabled" # we do not build any graphics drivers these features can be enabled for
"-Dgallium-vdpau=disabled" "-Dgallium-va=disabled"
"-Dgallium-xa=disabled" "-Dgallium-vdpau=disabled"
# does not make any sense "-Dgallium-xa=disabled"
"-Dandroid-libbacktrace=disabled" # does not make any sense
# do not want to add the dependencies "-Dandroid-libbacktrace=disabled"
"-Dlibunwind=disabled" # do not want to add the dependencies
"-Dlmsensors=disabled" "-Dlibunwind=disabled"
] ++ ( # does not compile on nixpkgs stable, doesn't seem mandatory "-Dlmsensors=disabled"
lib.optional (lib.versionOlder meson.version "1.3.1") ]
"-Dgallium-rusticl=false"); ++
# does not compile on nixpkgs stable, doesn't seem mandatory
(lib.optional (lib.versionOlder meson.version "1.3.1") "-Dgallium-rusticl=false");
# replace patches with ones tweaked slightly to apply to this version # replace patches with ones tweaked slightly to apply to this version
patches = [ patches = [
./disk_cache-include-dri-driver-path-in-cache-key.patch ./disk_cache-include-dri-driver-path-in-cache-key.patch
./opencl.patch ./opencl.patch
]; ];
}) })

View File

@@ -1,9 +1,10 @@
{ rustPlatform {
, stdenv rustPlatform,
, rust stdenv,
, fetchCrate rust,
, pkg-config fetchCrate,
, alsa-lib pkg-config,
alsa-lib,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {

View File

@@ -1,7 +1,8 @@
{ lib {
, fetchFromGitHub lib,
, buildUBoot fetchFromGitHub,
, m1n1 buildUBoot,
m1n1,
}: }:
(buildUBoot rec { (buildUBoot rec {
@@ -27,17 +28,17 @@
CONFIG_VIDEO_FONT_SUN12X22=n CONFIG_VIDEO_FONT_SUN12X22=n
CONFIG_VIDEO_FONT_16X32=y CONFIG_VIDEO_FONT_16X32=y
''; '';
}).overrideAttrs (o: { }).overrideAttrs
# nixos's downstream patches are not applicable (o: {
patches = [ # nixos's downstream patches are not applicable
]; patches = [ ];
# DTC= flag somehow breaks DTC compilation so we remove it # DTC= flag somehow breaks DTC compilation so we remove it
makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags; makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags;
preInstall = '' preInstall = ''
# compress so that m1n1 knows U-Boot's size and can find things after it # compress so that m1n1 knows U-Boot's size and can find things after it
gzip -n u-boot-nodtb.bin gzip -n u-boot-nodtb.bin
cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
''; '';
}) })

View File

@@ -2,14 +2,19 @@
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = imports = [
[ # Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
../default.nix ../default.nix
]; ];
hardware.asahi.enable = true; hardware.asahi.enable = true;
hardware.asahi.useExperimentalGPUDriver = true; hardware.asahi.useExperimentalGPUDriver = true;
@@ -26,7 +31,7 @@
''; '';
networking.hostName = "mac-nixos"; # Define your hostname. networking.hostName = "mac-nixos"; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
services = { services = {
# Enable the X11 windowing system. # Enable the X11 windowing system.
@@ -105,6 +110,4 @@
# #
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
} }

View File

@@ -1,62 +1,66 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "sdhci_pci" ]; boot.initrd.availableKernelModules = [ "sdhci_pci" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
}; };
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5"; device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=etc" ]; options = [ "subvol=etc" ];
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5"; device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" ]; options = [ "subvol=nix" ];
}; };
fileSystems."/var/log" = fileSystems."/var/log" = {
{ device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5"; device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" ]; options = [ "subvol=log" ];
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5"; device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" ]; options = [ "subvol=home" ];
}; };
fileSystems."/root" = fileSystems."/root" = {
{ device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5"; device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" ]; options = [ "subvol=root" ];
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/F4A1-C77F"; device = "/dev/disk/by-uuid/F4A1-C77F";
fsType = "vfat"; fsType = "vfat";
}; };
# fileSystems."/boot" = # fileSystems."/boot" =
# { device = "/dev/disk/by-uuid/3aaa1d0e-057d-4b7d-b2fe-ef02db373e9f"; # { device = "/dev/disk/by-uuid/3aaa1d0e-057d-4b7d-b2fe-ef02db373e9f";
# fsType = "ext4"; # fsType = "ext4";
# }; # };
swapDevices = [ ]; swapDevices = [ ];

View File

@@ -38,7 +38,7 @@
gnome.gnome-tweaks gnome.gnome-tweaks
papirus-icon-theme papirus-icon-theme
]; ];
dconf = { dconf = {
enable = true; enable = true;
settings = { settings = {
@@ -50,7 +50,7 @@
"org/gnome/desktop/interface".icon-theme = "Papirus-Dark"; "org/gnome/desktop/interface".icon-theme = "Papirus-Dark";
"org/gnome/desktop/peripherals/touchpad".two-finger-scrolling-enabled = true; "org/gnome/desktop/peripherals/touchpad".two-finger-scrolling-enabled = true;
"org/gnome/desktop/peripherals/touchpad".tap-to-click = true; "org/gnome/desktop/peripherals/touchpad".tap-to-click = true;
"org/gnome/mutter".experimental-features = ["scale-monitor-framebuffer"]; "org/gnome/mutter".experimental-features = [ "scale-monitor-framebuffer" ];
"org/gnome/tweaks".show-extensions-notice = false; "org/gnome/tweaks".show-extensions-notice = false;
"org/gnome/shell".enabled-extensions = [ "org/gnome/shell".enabled-extensions = [
"appindicatorsupport@rgcjonas.gmail.com" "appindicatorsupport@rgcjonas.gmail.com"

View File

@@ -4,34 +4,32 @@
# List packages installed in system profile. To search by name, run: # List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget # $ nix-env -qaP | grep wget
environment.systemPackages = environment.systemPackages = [
[ pkgs.vim
pkgs.vim pkgs.asitop
pkgs.asitop ];
];
# Homebrew # Homebrew
homebrew.enable = true; homebrew.enable = true;
homebrew.casks = homebrew.casks = [
[ "spotify"
"spotify" "protonvpn"
"protonvpn" "firefox"
"firefox" "discord"
"discord" "vmware-horizon-client"
"vmware-horizon-client" "tg-pro"
"tg-pro" "steam"
"steam" "orcaslicer"
"orcaslicer" "vscodium"
"vscodium" "epic-games"
"epic-games" "wine-stable"
"wine-stable"
]; ];
homebrew.masApps = { homebrew.masApps = {
# Tailscale = 1475387142; # Tailscale = 1475387142;
# Infuse = 1136220934; # Infuse = 1136220934;
Amphetamine = 937984704; Amphetamine = 937984704;
# LunaTask = 1583719331; # LunaTask = 1583719331;
}; };
homebrew.global.autoUpdate = true; homebrew.global.autoUpdate = true;
@@ -42,7 +40,6 @@
system.defaults.NSGlobalDomain."com.apple.keyboard.fnState" = false; system.defaults.NSGlobalDomain."com.apple.keyboard.fnState" = false;
security.pam.enableSudoTouchIdAuth = true; security.pam.enableSudoTouchIdAuth = true;
# Auto upgrade nix package and the daemon service. # Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
# nix.package = pkgs.nix; # nix.package = pkgs.nix;
@@ -65,7 +62,7 @@
nixpkgs.hostPlatform = "aarch64-darwin"; nixpkgs.hostPlatform = "aarch64-darwin";
users.users.mattjallen = { users.users.mattjallen = {
name = "mattjallen"; name = "mattjallen";
home = "/Users/mattjallen"; home = "/Users/mattjallen";
}; };
} }

View File

@@ -1,4 +1,9 @@
{ config, pkgs, inputs, ... }: {
config,
pkgs,
inputs,
...
}:
{ {
imports = [ ./trampoline-apps ]; imports = [ ./trampoline-apps ];
@@ -17,8 +22,8 @@
# changes in each release. # changes in each release.
home.stateVersion = "23.11"; home.stateVersion = "23.11";
programs= { programs = {
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
home-manager = { home-manager = {
enable = true; enable = true;
}; };
@@ -47,5 +52,5 @@
}; };
# Manage bug in compilations - who uses manpages in 2024 anyways? :P # Manage bug in compilations - who uses manpages in 2024 anyways? :P
manual.manpages.enable = false; manual.manpages.enable = false;
} }

View File

@@ -6,7 +6,8 @@
pkgs, pkgs,
... ...
}: }:
with lib; { with lib;
{
config = mkIf pkgs.stdenv.hostPlatform.isDarwin { config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
# Install MacOS applications to the user Applications folder. Also update Docked applications # Install MacOS applications to the user Applications folder. Also update Docked applications
home.extraActivationPath = with pkgs; [ home.extraActivationPath = with pkgs; [
@@ -14,11 +15,11 @@ with lib; {
dockutil dockutil
gawk gawk
]; ];
home.activation.trampolineApps = hm.dag.entryAfter ["writeBoundary"] '' home.activation.trampolineApps = hm.dag.entryAfter [ "writeBoundary" ] ''
${builtins.readFile ./lib-bash/trampoline-apps.sh} ${builtins.readFile ./lib-bash/trampoline-apps.sh}
fromDir="$HOME/Applications/Home Manager Apps" fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines" toDir="$HOME/Applications/Home Manager Trampolines"
sync_trampolines "$fromDir" "$toDir" sync_trampolines "$fromDir" "$toDir"
''; '';
}; };
} }

View File

@@ -2,18 +2,31 @@
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ inputs, outputs, config, lib, pkgs, ... }: {
inputs,
outputs,
config,
lib,
pkgs,
...
}:
let let
user = "admin"; user = "admin";
password = password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "jallen-nas"; hostname = "jallen-nas";
allowedPorts = [ 2342 3493 61208 9090 ]; allowedPorts = [
2342
3493
61208
9090
];
enableDisplayManager = false; enableDisplayManager = false;
# adding a flag cause nixos cant figure itself out and broke shit that cant be fixed # adding a flag cause nixos cant figure itself out and broke shit that cant be fixed
enableUps = true; enableUps = true;
in { in
imports = [ # Include the results of the hardware scan. {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
../default.nix ../default.nix
]; ];
@@ -60,10 +73,10 @@ in {
httpsPort = "9443"; httpsPort = "9443";
}; };
# ollama.enable = true; # ollama.enable = true;
open-webui.enable = true; open-webui.enable = true;
# open-webui.port = "3000"; # open-webui.port = "3000";
orca-slicer.enable = true; orca-slicer.enable = true;
@@ -138,7 +151,10 @@ in {
# Override kernel to latest # Override kernel to latest
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [ "nohibernate" "amd_pstate=active" ]; kernelParams = [
"nohibernate"
"amd_pstate=active"
];
consoleLogLevel = 3; consoleLogLevel = 3;
bootspec.enable = true; bootspec.enable = true;
@@ -186,7 +202,8 @@ in {
userServices = true; userServices = true;
workstation = true; workstation = true;
}; };
extraServiceFiles = { # TODO is this needed? extraServiceFiles = {
# TODO is this needed?
smb = '' smb = ''
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
@@ -204,7 +221,7 @@ in {
apcupsd = { apcupsd = {
enable = true; enable = true;
}; };
grafana = { grafana = {
enable = true; enable = true;
settings.server = { settings.server = {
@@ -222,7 +239,10 @@ in {
exporters = { exporters = {
node = { node = {
enable = true; enable = true;
enabledCollectors = [ "diskstats" "systemd" ]; enabledCollectors = [
"diskstats"
"systemd"
];
port = 9002; port = 9002;
}; };
smartctl = { smartctl = {
@@ -244,23 +264,28 @@ in {
}; };
}; };
scrapeConfigs = [{ scrapeConfigs = [
job_name = hostname; {
static_configs = [{ job_name = hostname;
targets = [ static_configs = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" {
"127.0.0.1:${ targets = [
toString config.services.prometheus.exporters.smartctl.port "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
}" "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"
];
}
]; ];
}]; }
}]; ];
}; };
}; };
systemd.services = { systemd.services = {
nas-mounts = { nas-mounts = {
path = [ pkgs.zfs pkgs.bash ]; path = [
pkgs.zfs
pkgs.bash
];
script = '' script = ''
if test -d /mnt/ssd/ssd_app_data; then if test -d /mnt/ssd/ssd_app_data; then
echo "NAS ZFS Pools Mounted." echo "NAS ZFS Pools Mounted."
@@ -277,7 +302,10 @@ in {
}; };
glances-server = { glances-server = {
path = [ pkgs.bash pkgs.glances ]; path = [
pkgs.bash
pkgs.glances
];
script = '' script = ''
#!/user/bin/env bash #!/user/bin/env bash
glances -w glances -w
@@ -298,8 +326,7 @@ in {
firewall = { firewall = {
enable = true; enable = true;
allowPing = true; allowPing = true;
extraCommands = extraCommands = "iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed?
"iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed?
allowedTCPPorts = allowedPorts; allowedTCPPorts = allowedPorts;
allowedUDPPorts = allowedPorts; allowedUDPPorts = allowedPorts;
}; };
@@ -307,9 +334,9 @@ in {
# Configure environment # Configure environment
environment = { environment = {
# etc."nut/upsd.conf".source = ./upsd.conf; # etc."nut/upsd.conf".source = ./upsd.conf;
# etc."nut/upsd.users".source = ./upsd.users; # etc."nut/upsd.users".source = ./upsd.users;
# etc."nut/upsmon.conf".source = ./upsmon.conf; # etc."nut/upsmon.conf".source = ./upsmon.conf;
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
@@ -355,7 +382,7 @@ in {
virt-manager.enable = true; virt-manager.enable = true;
nix-ld.enable = true; nix-ld.enable = true;
}; };
power.ups.ups = { power.ups.ups = {
enable = enableUps; enable = enableUps;
mode = "netserver"; mode = "netserver";
@@ -370,7 +397,7 @@ in {
upsd = { upsd = {
enable = true; enable = true;
listen = { listen = {
address = 0.0.0.0; address = 0.0 0.0 0.0;
port = 3493; port = 3493;
}; };
}; };
@@ -383,27 +410,25 @@ in {
}; };
# Add UPS monitoring service # Add UPS monitoring service
# power.upsmon = { # power.upsmon = {
# enable = true; # enable = true;
# # Configure UPS device # # Configure UPS device
# device = "/dev/usb/hiddev1"; # Change this to your UPS device # device = "/dev/usb/hiddev1"; # Change this to your UPS device
# driver = "usbhid-ups"; # Change this if your UPS uses a different driver # driver = "usbhid-ups"; # Change this if your UPS uses a different driver
# # Set UPS monitoring options # # Set UPS monitoring options
# options = { # options = {
# # NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script # # NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
# POLLFREQ = 5; # POLLFREQ = 5;
# POLLFREQALERT = 5; # POLLFREQALERT = 5;
# HOSTSYNC = "on"; # HOSTSYNC = "on";
# DEADTIME = 15; # DEADTIME = 15;
# FINALDELAY = 5; # FINALDELAY = 5;
# }; # };
# }; # };
# Configure nixpkgs # Configure nixpkgs
nixpkgs = { nixpkgs = {
overlays = [ overlays = [ outputs.overlays.nixpkgs-unstable ];
outputs.overlays.nixpkgs-unstable
];
config = { config = {
# Enable non free # Enable non free
@@ -462,11 +487,11 @@ in {
isSystemUser = true; isSystemUser = true;
uid = 911; uid = 911;
group = "jallen-nas"; group = "jallen-nas";
extraGroups = [ extraGroups = [
"jallen-nas" "jallen-nas"
"docker" "docker"
"podman" "podman"
]; # Enable sudo for the user. ]; # Enable sudo for the user.
hashedPassword = password; hashedPassword = password;
}; };
@@ -508,5 +533,4 @@ in {
# #
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View File

@@ -1,13 +1,25 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules = [
[ "nvme" "mpt3sas" "xhci_pci" "ahci" "uas" "sd_mod" ]; "nvme"
"mpt3sas"
"xhci_pci"
"ahci"
"uas"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@@ -15,7 +27,11 @@
fileSystems."/" = { fileSystems."/" = {
device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
options = [ "defaults" "size=32G" "mode=755" ]; options = [
"defaults"
"size=32G"
"mode=755"
];
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
@@ -26,35 +42,53 @@
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; options = [
"subvol=nix"
"compress-force=zstd"
"noatime"
];
}; };
fileSystems."/etc" = { fileSystems."/etc" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=etc" "compress-force=zstd" "noatime" ]; options = [
"subvol=etc"
"compress-force=zstd"
"noatime"
];
}; };
fileSystems."/root" = { fileSystems."/root" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" "compress-force=zstd" "noatime" ]; options = [
"subvol=root"
"compress-force=zstd"
"noatime"
];
}; };
fileSystems."/var/log" = { fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" "compress-force=zstd" "noatime" ]; options = [
"subvol=log"
"compress-force=zstd"
"noatime"
];
}; };
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" "compress-force=zstd" ]; options = [
"subvol=home"
"compress-force=zstd"
];
}; };
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; } ];
[{ device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; }];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's
@@ -76,6 +110,5 @@
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@@ -2,29 +2,42 @@
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
user = "matt"; user = "matt";
password = password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
SSID = "Joeys Jungle"; SSID = "Joeys Jungle";
SSIDpassword = "kR8v&3Qd"; SSIDpassword = "kR8v&3Qd";
interface = "wlan0"; interface = "wlan0";
timezone = "America/Chicago"; timezone = "America/Chicago";
hostname = "nixos-pi4"; hostname = "nixos-pi4";
in { in
imports = [ # Include the results of the hardware scan. {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./docker-pi4.nix ./docker-pi4.nix
]; ];
# Enable nix flakes and nix-command tools # Enable nix flakes and nix-command tools
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
boot = { boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4; kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ]; initrd.availableKernelModules = [
"xhci_pci"
"usbhid"
"usb_storage"
];
loader = { loader = {
grub.enable = false; grub.enable = false;
generic-extlinux-compatible.enable = true; generic-extlinux-compatible.enable = true;
@@ -43,7 +56,12 @@ in {
}; };
}; };
environment.systemPackages = with pkgs; [ vim raspberrypi-eeprom htop git ]; environment.systemPackages = with pkgs; [
vim
raspberrypi-eeprom
htop
git
];
services.openssh.enable = true; services.openssh.enable = true;
@@ -52,7 +70,10 @@ in {
users."${user}" = { users."${user}" = {
isNormalUser = true; isNormalUser = true;
initialHashedPassword = password; initialHashedPassword = password;
extraGroups = [ "wheel" "docker" ]; extraGroups = [
"wheel"
"docker"
];
}; };
}; };
@@ -76,6 +97,4 @@ in {
# #
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
} }

View File

@@ -6,7 +6,10 @@
virtualisation.oci-containers.containers."portainer" = { virtualisation.oci-containers.containers."portainer" = {
autoStart = true; autoStart = true;
image = "portainer/portainer-ce"; image = "portainer/portainer-ce";
ports = [ "8000:8000" "9443:9443" ]; ports = [
"8000:8000"
"9443:9443"
];
volumes = [ volumes = [
"/var/run/docker.sock:/var/run/docker.sock" "/var/run/docker.sock:/var/run/docker.sock"
"/media/T5/docker/config/portainer:/data" "/media/T5/docker/config/portainer:/data"
@@ -25,7 +28,8 @@
"/media/T5/tv:/tv" "/media/T5/tv:/tv"
]; ];
ports = [ "8096:8096" ]; ports = [ "8096:8096" ];
environment = { JELLYFIN_LOG_DIR = "/log"; }; environment = {
JELLYFIN_LOG_DIR = "/log";
};
}; };
} }

View File

@@ -1,7 +1,13 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@@ -26,8 +32,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; } ];
[{ device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; }];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.collabora; let
in { cfg = config.nas-apps.collabora;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.collabora = { options.nas-apps.collabora = {
enable = mkEnableOption "collabora docker service"; enable = mkEnableOption "collabora docker service";
@@ -37,6 +38,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,13 +1,23 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.deluge; let
in { cfg = config.nas-apps.deluge;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.deluge-docker = { systemd.services.deluge-docker = {
path = [ pkgs.bash pkgs.docker ]; path = [
pkgs.bash
pkgs.docker
];
script = '' script = ''
set -e set -e
exec docker run \ exec docker run \

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.deluge = { options.nas-apps.deluge = {
enable = mkEnableOption "deluge docker service"; enable = mkEnableOption "deluge docker service";
@@ -47,6 +48,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,8 +1,13 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; with lib;
let let
cfg = config.apps.discover-wrapped; cfg = config.apps.discover-wrapped;
# discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages. # discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages.
discover-wrapped = pkgs.symlinkJoin { discover-wrapped = pkgs.symlinkJoin {
name = "discover-flatpak-backend"; name = "discover-flatpak-backend";
@@ -15,7 +20,7 @@ let
in in
{ {
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
# Configure environment # Configure environment
environment.systemPackages = [ discover-wrapped ]; environment.systemPackages = [ discover-wrapped ];

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.apps.discover-wrapped = { options.apps.discover-wrapped = {
enable = mkEnableOption "enable discover with flatpak"; enable = mkEnableOption "enable discover with flatpak";
}; };

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.homarr; let
in { cfg = config.nas-apps.homarr;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@@ -15,7 +22,7 @@ in {
"${cfg.configPath}/data:/data" "${cfg.configPath}/data:/data"
"/var/run/docker.sock:/var/run/docker.sock" "/var/run/docker.sock:/var/run/docker.sock"
"/var/run/podman/podman.sock:/var/run/podman.sock" "/var/run/podman/podman.sock:/var/run/podman.sock"
]; ];
environment = { environment = {
# PUID = cfg.puid; # PUID = cfg.puid;
# PGID = cfg.pgid; # PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.homarr = { options.nas-apps.homarr = {
enable = mkEnableOption "homarr docker service"; enable = mkEnableOption "homarr docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.homepage; let
in { cfg = config.nas-apps.homepage;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@@ -13,7 +20,7 @@ in {
"${cfg.configPath}:/app/config" "${cfg.configPath}:/app/config"
"/var/run/docker.sock:/var/run/docker.sock" "/var/run/docker.sock:/var/run/docker.sock"
"/var/run/podman/podman.sock:/var/run/podman.sock" "/var/run/podman/podman.sock:/var/run/podman.sock"
]; ];
environment = { environment = {
# PUID = cfg.puid; # PUID = cfg.puid;
# PGID = cfg.pgid; # PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.homepage = { options.nas-apps.homepage = {
enable = mkEnableOption "homepage docker service"; enable = mkEnableOption "homepage docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.jackett; let
in { cfg = config.nas-apps.jackett;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.jackett = { options.nas-apps.jackett = {
enable = mkEnableOption "jackett docker service"; enable = mkEnableOption "jackett docker service";

View File

@@ -1,54 +1,35 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.jellyfin; let
in { cfg = config.nas-apps.jellyfin;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
# systemd.services.jellyfin-nvidia-docker = { virtualisation.oci-containers.containers.${cfg.name} = {
# path = [ pkgs.bash pkgs.docker ]; autoStart = true;
# script = '' image = cfg.image;
# set -e extraOptions = [ "--device=nvidia.com/gpu=0" ];
# exec sudo docker run \ volumes = [
# --rm \ "${cfg.configPath}:/config"
# --gpus all \ "${cfg.moviesPath}:/data/movies"
# --runtime=nvidia \ "${cfg.tvPath}:/data/tv"
# --name=${cfg.name} \ ];
# -e PUID=${cfg.puid} \ ports = [ "${cfg.port}:8096" ];
# -e PGID=${cfg.pgid} \ environment = {
# -e TZ=${cfg.timeZone} \ NVIDIA_VISIBLE_DEVICES = "all";
# -e 'NVIDIA_DRIVER_CAPABILITIES'='all' \ NVIDIA_DRIVER_CAPABILITIES = "all";
# -e 'NVIDIA_VISIBLE_DEVICES'='all' \ PUID = cfg.puid;
# -p ${cfg.port}:8096 \ PGID = cfg.pgid;
# -v '${cfg.configPath}:/config' \ TZ = cfg.timeZone;
# -v '${cfg.moviesPath}:/data/movies' \ };
# -v '${cfg.tvPath}:/data/tv' \ };
# ${cfg.image}:latest
# '';
# wantedBy = [ "multi-user.target" ];
# };
# };
# }
# nix-docker
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/data/movies"
"${cfg.tvPath}:/data/tv"
];
ports = [ "${cfg.port}:8096" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
}; };
};
} }

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.jellyfin = { options.nas-apps.jellyfin = {
enable = mkEnableOption "jellyfin docker service"; enable = mkEnableOption "jellyfin docker service";
@@ -52,6 +53,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.jellyseerr; let
in { cfg = config.nas-apps.jellyseerr;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.jellyseerr = { options.nas-apps.jellyseerr = {
enable = mkEnableOption "jellyseerr docker service"; enable = mkEnableOption "jellyseerr docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.mariadb; let
in { cfg = config.nas-apps.mariadb;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.mariadb = { options.nas-apps.mariadb = {
enable = mkEnableOption "mariadb docker service"; enable = mkEnableOption "mariadb docker service";

View File

@@ -1,15 +1,28 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.nextcloud; let
in { cfg = config.nas-apps.nextcloud;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ]; ports = [
volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ]; "${cfg.httpPort}:80"
"${cfg.httpsPort}:443"
];
volumes = [
"${cfg.configPath}:/config"
"${cfg.dataPath}:/data"
];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.nextcloud = { options.nas-apps.nextcloud = {
enable = mkEnableOption "nextcloud docker service"; enable = mkEnableOption "nextcloud docker service";

View File

@@ -1,13 +1,23 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.ollama; let
in { cfg = config.nas-apps.ollama;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.ollama-docker = { systemd.services.ollama-docker = {
path = [ pkgs.bash pkgs.docker ]; path = [
pkgs.bash
pkgs.docker
];
script = '' script = ''
set -e set -e
exec docker run \ exec docker run \

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.ollama = { options.nas-apps.ollama = {
enable = mkEnableOption "ollama docker service"; enable = mkEnableOption "ollama docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,33 +1,34 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.open-webui; let
in { cfg = config.nas-apps.open-webui;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.open-webui-docker = { virtualisation.oci-containers.containers.${cfg.name} = {
path = [ pkgs.bash pkgs.docker ]; autoStart = true;
script = '' image = cfg.image;
set -e extraOptions = [ "--device=nvidia.com/gpu=0" ];
exec docker run \ volumes = [
--rm \ "${cfg.configPath}:/app/backend/data"
--gpus all \ "${cfg.ollamaPath}:/root/.ollama"
--runtime=nvidia \ ];
--name=${cfg.name} \ ports = [ "${cfg.port}:8080" ];
-e PUID=${cfg.puid} \ environment = {
-e PGID=${cfg.pgid} \ NVIDIA_VISIBLE_DEVICES = "all";
-e TZ=${cfg.timeZone} \ NVIDIA_DRIVER_CAPABILITIES = "all";
-e 'NVIDIA_DRIVER_CAPABILITIES'='all' \ PUID = cfg.puid;
-e 'NVIDIA_VISIBLE_DEVICES'='all' \ PGID = cfg.pgid;
-p ${cfg.port}:8080 \ TZ = cfg.timeZone;
-v '${cfg.configPath}:/app/backend/data' \ };
-v '/mnt/ssd/nix-app-data/ollama:/root/.ollama' \
${cfg.image}
'';
wantedBy = [ "multi-user.target" ];
}; };
}; };
} }
# --add-host=host.docker.internal:host-gateway \
# -e 'OLLAMA_BASE_URL'='http://10.0.1.18:11434' \

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.open-webui = { options.nas-apps.open-webui = {
enable = mkEnableOption "open-webui docker service"; enable = mkEnableOption "open-webui docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,14 +1,24 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.orca-slicer; let
in { cfg = config.nas-apps.orca-slicer;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.httpPort}:3000" "${cfg.httpsPort}:3001" ]; ports = [
"${cfg.httpPort}:3000"
"${cfg.httpsPort}:3001"
];
volumes = [ "${cfg.configPath}:/config" ]; volumes = [ "${cfg.configPath}:/config" ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.orca-slicer = { options.nas-apps.orca-slicer = {
enable = mkEnableOption "orca slicer docker service"; enable = mkEnableOption "orca slicer docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.radarr; let
in { cfg = config.nas-apps.radarr;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.radarr = { options.nas-apps.radarr = {
enable = mkEnableOption "radarr docker service"; enable = mkEnableOption "radarr docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.sabnzbd; let
in { cfg = config.nas-apps.sabnzbd;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.sabnzbd = { options.nas-apps.sabnzbd = {
enable = mkEnableOption "sabnzbd docker service"; enable = mkEnableOption "sabnzbd docker service";
@@ -62,6 +63,5 @@ with lib; {
type = types.str; type = types.str;
default = "America/Chicago"; default = "America/Chicago";
}; };
}; };
} }

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.sonarr; let
in { cfg = config.nas-apps.sonarr;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.sonarr = { options.nas-apps.sonarr = {
enable = mkEnableOption "sonarr docker service"; enable = mkEnableOption "sonarr docker service";

View File

@@ -1,20 +1,39 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.swag; let
in { cfg = config.nas-apps.swag;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking.firewall = { networking.firewall = {
allowedTCPPorts = [ cfg.httpPort cfg.httpsPort 81 ]; allowedTCPPorts = [
allowedUDPPorts = [ cfg.httpPort cfg.httpsPort 81 ]; cfg.httpPort
cfg.httpsPort
81
];
allowedUDPPorts = [
cfg.httpPort
cfg.httpsPort
81
];
}; };
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" "81:81" ]; ports = [
"${toString cfg.httpPort}:80"
"${toString cfg.httpsPort}:443"
"81:81"
];
volumes = [ "${cfg.configPath}:/config" ]; volumes = [ "${cfg.configPath}:/config" ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
@@ -24,7 +43,7 @@ in {
URL = cfg.url; URL = cfg.url;
VALIDATION = cfg.validation; VALIDATION = cfg.validation;
SUBDOMAINS = cfg.subdomains; SUBDOMAINS = cfg.subdomains;
DOCKER_MODS="linuxserver/mods:swag-dashboard"; DOCKER_MODS = "linuxserver/mods:swag-dashboard";
}; };
}; };
}; };

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.swag = { options.nas-apps.swag = {
enable = mkEnableOption "swag docker service"; enable = mkEnableOption "swag docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-apps.vscode; let
in { cfg = config.nas-apps.vscode;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@@ -9,11 +16,11 @@ in {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:8443" ]; ports = [ "${cfg.port}:8443" ];
volumes = [ volumes = [
"${cfg.configPath}:/config" "${cfg.configPath}:/config"
"/mnt/ssd/ssd_app_data:/ssd_app_data" "/mnt/ssd/ssd_app_data:/ssd_app_data"
"/home/admin/nix-config:/nix-config" "/home/admin/nix-config:/nix-config"
]; ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-apps.vscode = { options.nas-apps.vscode = {
enable = mkEnableOption "vscode docker service"; enable = mkEnableOption "vscode docker service";

View File

@@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./samba ./samba
./apps/collabora ./apps/collabora

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.nas-samba; let
in { cfg = config.nas-samba;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@@ -39,24 +46,27 @@ in {
guest account = nobody guest account = nobody
map to guest = bad user map to guest = bad user
''; '';
shares = let shares =
make = name: share: let
nameValuePair "${name}" { make =
path = share.sharePath; name: share:
public = if share.enableTimeMachine then "no" else "yes"; nameValuePair "${name}" {
private = if !share.public || share.enableTimeMachine then "yes" else "no"; path = share.sharePath;
browseable = if share.browseable then "yes" else "no"; public = if share.enableTimeMachine then "no" else "yes";
writable = "yes"; private = if !share.public || share.enableTimeMachine then "yes" else "no";
"read only" = if share.readOnly then "yes" else "no"; browseable = if share.browseable then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no"; writable = "yes";
"create mask" = share.createMask; "read only" = if share.readOnly then "yes" else "no";
"directory mask" = share.directoryMask; "guest ok" = if share.guestOk then "yes" else "no";
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no"; "create mask" = share.createMask;
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no"; "directory mask" = share.directoryMask;
"vfs objects" = "catia fruit streams_xattr"; "fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine max size" = share.timeMachineMaxSize; "fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
}; "vfs objects" = "catia fruit streams_xattr";
in mapAttrs' make cfg.shares; "fruit:time machine max size" = share.timeMachineMaxSize;
};
in
mapAttrs' make cfg.shares;
}; };
}; };
} }

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.nas-samba = { options.nas-samba = {
enable = mkEnableOption "nas samba service"; enable = mkEnableOption "nas samba service";
@@ -21,46 +22,48 @@ with lib; {
}; };
shares = mkOption { shares = mkOption {
type = types.attrsOf (types.submodule { type = types.attrsOf (
options = { types.submodule {
public = mkOption { options = {
type = types.bool; public = mkOption {
default = false; type = types.bool;
default = false;
};
sharePath = mkOption {
type = types.str;
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0774";
};
directoryMask = mkOption {
type = types.str;
default = "0775";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
}; };
sharePath = mkOption { }
type = types.str; );
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0774";
};
directoryMask = mkOption {
type = types.str;
default = "0775";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
};
});
default = { }; default = { };
}; };
}; };

View File

@@ -1,4 +1,5 @@
{inputs, ...}: { { inputs, ... }:
{
nixpkgs-unstable = final: _prev: { nixpkgs-unstable = final: _prev: {
unstable = import inputs.nixpkgs-unstable { unstable = import inputs.nixpkgs-unstable {
@@ -7,4 +8,3 @@
}; };
}; };
} }

View File

@@ -1,13 +1,18 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.share.hardware.amd; let
in { cfg = config.share.hardware.amd;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
boot.kernelParams = [ boot.kernelParams = [ (if cfg.enable then "amdgpu.ppfeaturemask=0xffffffff" else null) ];
(if cfg.enable then "amdgpu.ppfeaturemask=0xffffffff" else null)
];
# Configure programs # Configure programs
programs.corectrl.enable = cfg.corectrl.enable; programs.corectrl.enable = cfg.corectrl.enable;
@@ -47,7 +52,10 @@ in {
# nixpkg is broken so need to manually define # nixpkg is broken so need to manually define
systemd.services.lactd = mkIf cfg.lact.enable { systemd.services.lactd = mkIf cfg.lact.enable {
description = "AMDGPU Control Daemon"; description = "AMDGPU Control Daemon";
path = [ pkgs.bash pkgs.lact ]; path = [
pkgs.bash
pkgs.lact
];
script = '' script = ''
lact daemon lact daemon
''; '';

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.share.hardware.amd = { options.share.hardware.amd = {
enable = mkEnableOption "amd hardware config"; enable = mkEnableOption "amd hardware config";

View File

@@ -1 +1,8 @@
{ ... }: { imports = [ ./amd ./nvidia ./gaming ]; } { ... }:
{
imports = [
./amd
./nvidia
./gaming
];
}

View File

@@ -1,19 +1,26 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.share.gaming; let
in { cfg = config.share.gaming;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
# Network option required using sysctl to let Ubisoft Connect work as of 7-12-2023 # Network option required using sysctl to let Ubisoft Connect work as of 7-12-2023
boot.kernel.sysctl."net.ipv4.tcp_mtu_probing" = 1; boot.kernel.sysctl."net.ipv4.tcp_mtu_probing" = 1;
# Configure programs # Configure programs
programs.steam = { programs.steam = {
enable = true; enable = true;
# Open ports in the firewall for Steam Remote Play # Open ports in the firewall for Steam Remote Play
remotePlay.openFirewall = true; remotePlay.openFirewall = true;
# Open ports in the firewall for Source Dedicated Server # Open ports in the firewall for Source Dedicated Server
dedicatedServer.openFirewall = true; dedicatedServer.openFirewall = true;
}; };
@@ -29,18 +36,18 @@ in {
# Configure nixpkgs # Configure nixpkgs
nixpkgs.config.packageOverrides = pkgs: { nixpkgs.config.packageOverrides = pkgs: {
steam = pkgs.steam.override { steam = pkgs.steam.override {
extraPkgs = pkgs: extraPkgs =
with pkgs; [ pkgs: with pkgs; [
xorg.libXcursor xorg.libXcursor
xorg.libXi xorg.libXi
xorg.libXinerama xorg.libXinerama
xorg.libXScrnSaver xorg.libXScrnSaver
libpng libpng
libpulseaudio libpulseaudio
libvorbis libvorbis
stdenv.cc.cc.lib stdenv.cc.cc.lib
libkrb5 libkrb5
keyutils keyutils
]; ];
}; };
}; };

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.share.gaming = { options.share.gaming = {
enable = mkEnableOption "enable gaming stuffs"; enable = mkEnableOption "enable gaming stuffs";
}; };

View File

@@ -1,4 +1,13 @@
{ pkgs, lib, LT, config, utils, inputs, ... }@args: { {
pkgs,
lib,
LT,
config,
utils,
inputs,
...
}@args:
{
# Set up impernance configuration for things like bluetooth # Set up impernance configuration for things like bluetooth
# In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints. # In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints.
@@ -17,9 +26,13 @@
mode = "u=rwx,g=rx,o="; mode = "u=rwx,g=rx,o=";
} }
]; ];
files = [{ files = [
file = "/etc/nix/id_rsa"; {
parentDirectory = { mode = "u=rwx,g=,o="; }; file = "/etc/nix/id_rsa";
}]; parentDirectory = {
mode = "u=rwx,g=,o=";
};
}
];
}; };
} }

View File

@@ -1,17 +1,25 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let cfg = config.share.hardware.nvidia; let
in { cfg = config.share.hardware.nvidia;
in
{
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
hardware = { hardware = {
# Nvidia # Nvidia
nvidia = { nvidia = {
package = if cfg.enableBeta then package =
config.boot.kernelPackages.nvidiaPackages.beta if cfg.enableBeta then
else config.boot.kernelPackages.nvidiaPackages.beta
config.boot.kernelPackages.nvidiaPackages.latest; else
config.boot.kernelPackages.nvidiaPackages.latest;
# Modesetting is required. # Modesetting is required.
modesetting.enable = true; modesetting.enable = true;

View File

@@ -1,5 +1,6 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib;
{
options.share.hardware.nvidia = { options.share.hardware.nvidia = {
enable = mkEnableOption "nvidia hardware config"; enable = mkEnableOption "nvidia hardware config";