Skip to content

Commit

Permalink
Add option for hosts to advertise for cuda support
Browse files Browse the repository at this point in the history
Currently blocked by some packages not building with cuda support.
Needs flake update.
  • Loading branch information
billy4479 committed Feb 6, 2025
1 parent 512ef5d commit f7d7183
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
25 changes: 15 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,35 @@
let
system = "x86_64-linux";

pkgs = import nixpkgs {
config.allowUnfree = true;
pkgsForFlake = import nixpkgs {
# config.allowUnfree = true;
inherit system;
};

my-packages = import ./packages { inherit pkgs; } // {
server-tool = server-tool.packages.${system}.default;
};
# TODO: this should definitely be an overlay.
myPackagesFn =
pkgs:
(
import ./packages { inherit pkgs; }
// {
server-tool = server-tool.packages.${system}.default;
}
);

hosts = import ./flake/system.nix {
inherit
pkgs
system
my-packages
myPackagesFn
inputs
;
};

in
{
formatter.${system} = pkgs.nixfmt-rfc-style;
formatter.${system} = pkgsForFlake.nixfmt-rfc-style;

devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
devShells.${system}.default = pkgsForFlake.mkShell {
packages = with pkgsForFlake; [
stylua
shfmt
nixfmt-rfc-style
Expand Down
26 changes: 23 additions & 3 deletions flake/createAndMergeHosts.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
pkgs,
system,
my-packages,
myPackagesFn,
inputs,
}:
let
Expand Down Expand Up @@ -39,6 +38,19 @@ let
defaultedArgs = lib.recursiveUpdate defaultOptions args;
user = defaultedArgs.user;

# This is undocumented like everywhere
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/config.nix
# https://discourse.nixos.org/t/where-are-options-like-config-cudasupport-documented/17805/7
nixpkgsConfig = {
allowUnfree = true;
cudaSupport = defaultedArgs.hasCuda;
};

pkgs = import inputs.nixpkgs {
config = nixpkgsConfig;
inherit system;
};

specialArgs = {
extraConfig = builtins.removeAttrs (lib.recursiveUpdate defaultedArgs {
catppuccinColors = mkCatppuccinColors defaultedArgs.catppuccin;
Expand All @@ -49,7 +61,7 @@ let
vscode-extensions = inputs.nix-vscode-extensions.extensions.${system};
spicetifyPkgs = inputs.spicetify-nix.legacyPackages.${system};
inherit (inputs) catppuccin-vsc;
inherit my-packages;
my-packages = myPackagesFn pkgs;
};
flakeInputs = inputs;
};
Expand All @@ -59,8 +71,16 @@ let
inputs.plasma-manager.homeManagerModules.plasma-manager
inputs.spicetify-nix.homeManagerModules.default
inputs.sops-nix.homeManagerModules.sops

{
# Not sure why we need thise here too
# https://nix-community.github.io/home-manager/options.xhtml#opt-nixpkgs.config
nixpkgs.config = nixpkgsConfig;
}

../user
];

in
{
nixosConfigurations.${hostname} = inputs.nixpkgs.lib.nixosSystem {
Expand Down
5 changes: 3 additions & 2 deletions flake/system.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
pkgs,
system,
my-packages,
myPackagesFn,
inputs,
}@args:
let
Expand All @@ -13,6 +12,7 @@ let
isServer = false;
standaloneHomeManager = true;
rotateMonitor = false; # only for computerone
hasCuda = false;

catppuccin = {
flavor = "frappe";
Expand Down Expand Up @@ -51,6 +51,7 @@ createAndMergeHosts defaultOptions [
wayland = false;
games = true;
rotateMonitor = true;
hasCuda = true;
};
extraSystemModules = [
../system/hosts/computerone
Expand Down
3 changes: 0 additions & 3 deletions user/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ in
home.username = extraConfig.user.username;
home.homeDirectory = "/home/${extraConfig.user.username}";

# Enable unfree - yes, we have to do this here too
nixpkgs.config.allowUnfree = true;

imports = [
./${extraConfig.hostname}.nix
./modules/scripts
Expand Down

0 comments on commit f7d7183

Please sign in to comment.