-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
74 lines (67 loc) · 2.22 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# SPDX-FileCopyrightText: 2024 SoupGlasses <[email protected]>
#
# SPDX-License-Identifier: MIT
{
description = "Run graphics accelerated programs built with Nix on any Linux distribution";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
}: let
systems = ["aarch64-linux" "x86_64-linux"];
eachSystem = f:
nixpkgs.lib.genAttrs systems (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
in {
# -- System Modules --
# Holds re-usable system modules meant for systemConfigs to include.
systemModules = {
default = self.systemModules.graphics;
graphics = import ./system/modules/graphics.nix;
};
# -- System Configurations --
# Holds Nix system configurations for Linux computers.
systemConfigs = let
# Use fetchTarball to import system-manager within the example
# systemConfigs to prevent dependants from needing to override it if it
# instead was imported as a flake input.
system-manager = builtins.fetchTarball {
url = "https://github.com/soupglasses/system-manager-lite/archive/40ec3633e4cf41fa01dbf144cec0b18e03810197.tar.gz";
sha256 = "0gkd1sjffll9il9w3vvyk6ypra6i8x1cvx7wbhy352s3xbp233nm";
};
system-manager-lib = import "${system-manager}/nix/lib.nix" {inherit nixpkgs;};
in {
default = system-manager-lib.makeSystemConfig {
modules = [
self.systemModules.default
({...}: {
config = {
nixpkgs.hostPlatform = "x86_64-linux";
system-manager.allowAnyDistro = true;
system-graphics.enable = true;
};
})
];
};
};
# -- Development Shells --
# Scoped environments including packages and shell-hooks to aid project development.
devShells = eachSystem ({pkgs, ...}: {
default = pkgs.mkShellNoCC {
shellHook = ''
${pkgs.pre-commit}/bin/pre-commit install --install-hooks --overwrite
'';
nativeBuildInputs = with pkgs; [
pre-commit
alejandra
deadnix
editorconfig-checker
reuse
];
};
});
};
}