meta: refactor "bits" -> "profiles"

This commit is contained in:
Jez Cope 2021-08-06 12:09:21 +01:00
parent 2bae5a8279
commit cc176135e0
14 changed files with 146 additions and 118 deletions

View File

@ -1,19 +0,0 @@
{ configs, pkgs, libs, ... }:
{
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
hardware.opengl.driSupport = true;
hardware.opengl.extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
amdvlk
];
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ amdvlk ];
nixpkgs.config.packageOverrides = pkgs: {
fahclient = pkgs.fahclient.override {
extraPkgs = with pkgs; [ rocm-opencl-icd rocm-opencl-runtime ];
};
};
}

View File

@ -1,22 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.foldingathome = {
enable = true;
user = "cipherrot";
team = 265265;
extraArgs = [
"--config"
(builtins.toFile "config.xml" ''
<config>
<!-- Network -->
<proxy v=':8080'/>
<!-- Folding Slots -->
<slot id='0' type='CPU'/>
<slot id='1' type='GPU'/>
</config>
'')
];
};
}

View File

@ -1,38 +0,0 @@
{ config, pkgs, lib, ... }:
{
hardware.printers.ensurePrinters = let
commonOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
InputSlot = "Auto";
};
in [
{
name = "Study-Laser";
location = "Study";
description = "Samsung CLX-6260 Laser";
deviceUri =
"dnssd://Samsung%20laser%20printer%20(Study)._printer._tcp.local/";
model = "samsung/CLX-6260.ppd";
ppdOptions = commonOptions // {
ColorMode = "False";
MediaType = "Plain";
};
}
{
name = "Study-Inkjet";
location = "Study";
description = "Epson XP-860 Inkjet";
deviceUri =
"dnssd://EPSON%20XP-860%20Series._ipp._tcp.local/?uuid=cfe92100-67c4-11d4-a45f-44d244241018";
model =
"epson-inkjet-printer-escpr/Epson-XP-860_Series-epson-escpr-en.ppd";
ppdOptions = commonOptions // { MediaType = "PLAIN_NORMAL"; };
}
];
services.printing = {
drivers = with pkgs; [ samsung-unified-linux-driver epson-escpr ];
};
users.groups.lp.members = [ "jez" "elly" ];
}

View File

@ -1,13 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.ipfs = {
enable = true;
autoMount = true;
user = "jez";
group = "jez";
dataDir = "/home/jez/.ipfs";
};
environment.systemPackages = [ pkgs.ipfs-migrator ];
}

View File

@ -1,17 +0,0 @@
{ configs, pkgs, lib, ... }:
{
boot.supportedFilesystems = [ "zfs" ];
services.zfs = {
trim.enable = true;
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
autoScrub = {
enable = true;
interval = "monthly";
};
};
}

View File

@ -22,6 +22,7 @@
nixos.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./profiles
./configuration.nix
(./hosts + "/${hostName}")
(./secrets + "/${hostName}.nix")

View File

@ -1,7 +1,8 @@
{ config, pkgs, lib, ... }:
{
imports = [ ./hardware.nix ../../bits/home-common.nix ../../bits/zfs.nix ];
imports = [ ./hardware.nix ];
profiles = [ "home" "zfs" ];
networking.interfaces.enp0s25.useDHCP = true;
networking.interfaces.wlp2s0.useDHCP = true;

View File

@ -1,14 +1,8 @@
{ config, pkgs, lib, ... }:
{
imports = [
./hardware.nix
../../bits/home-common.nix
../../bits/zfs.nix
../../bits/amdgpu.nix
../../bits/foldingathome.nix
];
imports = [ ./hardware.nix ];
profiles = [ "home" "zfs" "amdgpu" "foldingathome" ];
boot.loader = {
efi = {

View File

@ -0,0 +1,23 @@
{ config, pkgs, lib, ... }:
with lib;
let activeProfiles = config.profiles;
in {
config = mkIf (elem "amdgpu" activeProfiles) {
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
hardware.opengl.driSupport = true;
hardware.opengl.extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
amdvlk
];
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ amdvlk ];
nixpkgs.config.packageOverrides = pkgs: {
fahclient = pkgs.fahclient.override {
extraPkgs = with pkgs; [ rocm-opencl-icd rocm-opencl-runtime ];
};
};
};
}

12
profiles/default.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, lib, pkgs, ... }:
with lib; {
imports = mapAttrsToList (k: _: ./. + ("/" + k))
(filterAttrs (_: v: v == "directory") (builtins.readDir ./.));
options.profiles = mkOption {
default = [ ];
description = "List of configuration profiles to activate";
type = types.listOf types.str;
};
}

View File

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
with lib;
let activeProfiles = config.profiles;
in {
config = mkIf (elem "foldingathome" activeProfiles) {
services.foldingathome = {
enable = true;
user = "cipherrot";
team = 265265;
extraArgs = [
"--config"
(builtins.toFile "config.xml" ''
<config>
<!-- Network -->
<proxy v=':8080'/>
<!-- Folding Slots -->
<slot id='0' type='CPU'/>
<slot id='1' type='GPU'/>
</config>
'')
];
};
};
}

42
profiles/home/default.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, pkgs, lib, ... }:
with lib;
let activeProfiles = config.profiles;
in {
config = mkIf (elem "home" activeProfiles) {
hardware.printers.ensurePrinters = let
commonOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
InputSlot = "Auto";
};
in [
{
name = "Study-Laser";
location = "Study";
description = "Samsung CLX-6260 Laser";
deviceUri =
"dnssd://Samsung%20laser%20printer%20(Study)._printer._tcp.local/";
model = "samsung/CLX-6260.ppd";
ppdOptions = commonOptions // {
ColorMode = "False";
MediaType = "Plain";
};
}
{
name = "Study-Inkjet";
location = "Study";
description = "Epson XP-860 Inkjet";
deviceUri =
"dnssd://EPSON%20XP-860%20Series._ipp._tcp.local/?uuid=cfe92100-67c4-11d4-a45f-44d244241018";
model =
"epson-inkjet-printer-escpr/Epson-XP-860_Series-epson-escpr-en.ppd";
ppdOptions = commonOptions // { MediaType = "PLAIN_NORMAL"; };
}
];
services.printing = {
drivers = with pkgs; [ samsung-unified-linux-driver epson-escpr ];
};
users.groups.lp.members = [ "jez" "elly" ];
};
}

17
profiles/ipfs/default.nix Normal file
View File

@ -0,0 +1,17 @@
{ config, pkgs, lib, ... }:
with lib;
let activeProfiles = config.profiles;
in {
config = mkIf (elem "ipfs" activeProfiles) {
services.ipfs = {
enable = true;
autoMount = true;
user = "jez";
group = "jez";
dataDir = "/home/jez/.ipfs";
};
environment.systemPackages = [ pkgs.ipfs-migrator ];
};
}

21
profiles/zfs/default.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
with lib;
let activeProfiles = config.profiles;
in {
config = mkIf (elem "zfs" activeProfiles) {
boot.supportedFilesystems = [ "zfs" ];
services.zfs = {
trim.enable = true;
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
autoScrub = {
enable = true;
interval = "monthly";
};
};
};
}