chore: refactor system modules
This commit is contained in:
14
system/packages/appimage.nix
Normal file
14
system/packages/appimage.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.system.packages.appimage;
|
||||
in {
|
||||
options.system.packages.appimage.enable = mkEnableOption "Enables AppImage support";
|
||||
config.programs.appimage = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
binfmt = true;
|
||||
};
|
||||
}
|
||||
15
system/packages/default.nix
Normal file
15
system/packages/default.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./appimage.nix
|
||||
./flatpak.nix
|
||||
./nano.nix
|
||||
./nix.nix
|
||||
./steam.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
openssl
|
||||
wget
|
||||
];
|
||||
}
|
||||
22
system/packages/flatpak.nix
Normal file
22
system/packages/flatpak.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.system.packages.flatpak;
|
||||
in {
|
||||
options.system.packages.flatpak = {
|
||||
enable = mkEnableOption "Enable Flatpak support";
|
||||
builder.enable = mkEnableOption "Enable Flatpak builder";
|
||||
};
|
||||
config = {
|
||||
services.flatpak = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
};
|
||||
environment.systemPackages = mkIf cfg.builder.enable [
|
||||
pkgs.flatpak-buildR
|
||||
];
|
||||
};
|
||||
}
|
||||
14
system/packages/nano.nix
Normal file
14
system/packages/nano.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
programs.nano = {
|
||||
enable = true;
|
||||
syntaxHighlight = true;
|
||||
nanorc = ''
|
||||
set tabsize 2
|
||||
set autoindent
|
||||
set atblanks
|
||||
set linenumber
|
||||
set smarthome
|
||||
set softwrap
|
||||
'';
|
||||
};
|
||||
}
|
||||
49
system/packages/nix.nix
Normal file
49
system/packages/nix.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.system.packages.nix;
|
||||
in {
|
||||
options.system.packages.nix = {
|
||||
allowUnfree = mkEnableOption "Enable unfree packages";
|
||||
disableSandbox = mkEnableOption "Disable Nix sandbox";
|
||||
gc = {
|
||||
automatic = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
dates = mkOption {
|
||||
type = types.str;
|
||||
default = "Monday 01:00 UTC";
|
||||
};
|
||||
options = mkOption {
|
||||
type = types.str;
|
||||
default = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
nix-ld.enable = mkEnableOption "Enable unpatched binaries support";
|
||||
trusted-users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = ["alice" "bob"];
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
nix = {
|
||||
inherit (cfg) gc;
|
||||
settings = {
|
||||
inherit (cfg) trusted-users;
|
||||
sandbox = cfg.disableSandbox;
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
};
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
programs = {
|
||||
inherit (cfg) nix-ld;
|
||||
};
|
||||
};
|
||||
}
|
||||
34
system/packages/steam.nix
Normal file
34
system/packages/steam.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.system.programs.steam;
|
||||
in {
|
||||
options.system.programs.steam.enable = mkEnableOption "Enables Steam and Steam hardware";
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
steam = {
|
||||
inherit (cfg) enable;
|
||||
protontricks.enable = true;
|
||||
remotePlay.openFirewall = true;
|
||||
localNetworkGameTransfers.openFirewall = true;
|
||||
gamescopeSession.enable = true;
|
||||
extraCompatPackages = [pkgs.proton-ge-bin];
|
||||
};
|
||||
gamescope = {
|
||||
enable = true;
|
||||
capSysNice = true;
|
||||
args = [
|
||||
"--rt"
|
||||
"--expose-wayland"
|
||||
];
|
||||
};
|
||||
};
|
||||
hardware.steam-hardware = {
|
||||
inherit (cfg) enable;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user