implement sane.programs.slowToBuild and {moby,desko,lappy}-light targets
i'm not sure this is the exact right abstraction, but it's a starting point
This commit is contained in:
51
flake.nix
51
flake.nix
@@ -111,7 +111,7 @@
|
|||||||
|
|
||||||
nixpkgsCompiledBy = system: nixpkgs.legacyPackages."${system}";
|
nixpkgsCompiledBy = system: nixpkgs.legacyPackages."${system}";
|
||||||
|
|
||||||
evalHost = { name, local, target }: nixpkgs.lib.nixosSystem {
|
evalHost = { name, local, target, light ? false }: nixpkgs.lib.nixosSystem {
|
||||||
system = target;
|
system = target;
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
@@ -124,6 +124,9 @@
|
|||||||
# nixpkgs.buildPlatform = local; # set by instantiate.nix instead
|
# nixpkgs.buildPlatform = local; # set by instantiate.nix instead
|
||||||
# nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
|
# nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
|
||||||
}
|
}
|
||||||
|
(optionalAttrs light {
|
||||||
|
sane.enableSlowPrograms = false;
|
||||||
|
})
|
||||||
(import ./hosts/instantiate.nix { hostName = name; })
|
(import ./hosts/instantiate.nix { hostName = name; })
|
||||||
self.nixosModules.default
|
self.nixosModules.default
|
||||||
self.nixosModules.passthru
|
self.nixosModules.passthru
|
||||||
@@ -139,21 +142,21 @@
|
|||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let
|
let
|
||||||
hosts = {
|
hosts = {
|
||||||
servo = { name = "servo"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
servo = { name = "servo"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
||||||
desko = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
desko = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
||||||
lappy = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
desko-light = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; light = true; };
|
||||||
moby = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; };
|
lappy = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
||||||
rescue = { name = "rescue"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
lappy-light = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; light = true; };
|
||||||
|
moby = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; };
|
||||||
|
moby-light = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; light = true; };
|
||||||
|
rescue = { name = "rescue"; local = "x86_64-linux"; target = "x86_64-linux"; };
|
||||||
};
|
};
|
||||||
# cross-compiled builds: instead of emulating the host, build using a cross-compiler.
|
# cross-compiled builds: instead of emulating the host, build using a cross-compiler.
|
||||||
# - these are faster to *build* than the emulated variants (useful when tweaking packages),
|
# - these are faster to *build* than the emulated variants (useful when tweaking packages),
|
||||||
# - but fewer of their packages can be found in upstream caches.
|
# - but fewer of their packages can be found in upstream caches.
|
||||||
cross = mapAttrValues evalHost hosts;
|
cross = mapAttrValues evalHost hosts;
|
||||||
emulated = mapAttrValues
|
emulated = mapAttrValues
|
||||||
({name, local, target}: evalHost {
|
(args: evalHost (args // { local = null; }))
|
||||||
inherit name target;
|
|
||||||
local = null;
|
|
||||||
})
|
|
||||||
hosts;
|
hosts;
|
||||||
prefixAttrs = prefix: attrs: mapAttrs'
|
prefixAttrs = prefix: attrs: mapAttrs'
|
||||||
(name: value: {
|
(name: value: {
|
||||||
@@ -165,9 +168,9 @@
|
|||||||
(prefixAttrs "cross-" cross) //
|
(prefixAttrs "cross-" cross) //
|
||||||
(prefixAttrs "emulated-" emulated) // {
|
(prefixAttrs "emulated-" emulated) // {
|
||||||
# prefer native builds for these machines:
|
# prefer native builds for these machines:
|
||||||
inherit (emulated) servo desko lappy rescue;
|
inherit (emulated) servo desko desko-light lappy lappy-light rescue;
|
||||||
# prefer cross-compiled builds for these machines:
|
# prefer cross-compiled builds for these machines:
|
||||||
inherit (cross) moby;
|
inherit (cross) moby moby-light;
|
||||||
};
|
};
|
||||||
|
|
||||||
# unofficial output
|
# unofficial output
|
||||||
@@ -332,7 +335,7 @@
|
|||||||
- `nix run '.#update.feeds'`
|
- `nix run '.#update.feeds'`
|
||||||
- updates metadata for all feeds
|
- updates metadata for all feeds
|
||||||
- `nix run '.#init-feed' <url>`
|
- `nix run '.#init-feed' <url>`
|
||||||
- `nix run '.#deploy-{lappy,moby,moby-test,servo}' [nixos-rebuild args ...]`
|
- `nix run '.#deploy.{desko,lappy,moby,servo}[-light][.test]' [nixos-rebuild args ...]`
|
||||||
- `nix run '.#check'`
|
- `nix run '.#check'`
|
||||||
- make sure all systems build; NUR evaluates
|
- make sure all systems build; NUR evaluates
|
||||||
|
|
||||||
@@ -354,22 +357,14 @@
|
|||||||
program = "${pkgs.feeds.init-feed}";
|
program = "${pkgs.feeds.init-feed}";
|
||||||
};
|
};
|
||||||
|
|
||||||
deploy-lappy = {
|
deploy = mapAttrValues (host: {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = ''${deployScript "lappy" "lappy" "switch"}'';
|
program = ''${deployScript host host "switch"}'';
|
||||||
};
|
test = {
|
||||||
deploy-moby-test = {
|
type = "app";
|
||||||
type = "app";
|
program = ''${deployScript host host "test"}'';
|
||||||
program = ''${deployScript "moby" "moby-hn" "test"}'';
|
};
|
||||||
};
|
}) self.nixosConfigurations;
|
||||||
deploy-moby = {
|
|
||||||
type = "app";
|
|
||||||
program = ''${deployScript "moby" "moby-hn" "switch"}'';
|
|
||||||
};
|
|
||||||
deploy-servo = {
|
|
||||||
type = "app";
|
|
||||||
program = ''${deployScript "servo" "servo" "switch"}'';
|
|
||||||
};
|
|
||||||
|
|
||||||
sync-moby = {
|
sync-moby = {
|
||||||
# copy music from the current device to moby
|
# copy music from the current device to moby
|
||||||
|
@@ -59,7 +59,6 @@
|
|||||||
# HACK/TODO: make `programs.P.env.VAR` behave according to `mime.priority`
|
# HACK/TODO: make `programs.P.env.VAR` behave according to `mime.priority`
|
||||||
sane.programs.firefox.env = lib.mkForce {};
|
sane.programs.firefox.env = lib.mkForce {};
|
||||||
sane.programs.epiphany.env.BROWSER = "epiphany";
|
sane.programs.epiphany.env.BROWSER = "epiphany";
|
||||||
sane.programs.firefox.enableFor.user.colin = false; # use epiphany instead
|
|
||||||
|
|
||||||
# note the .conf.d approach: using ~/.config/pipewire/pipewire.conf directly breaks all audio,
|
# note the .conf.d approach: using ~/.config/pipewire/pipewire.conf directly breaks all audio,
|
||||||
# presumably because that deletes the defaults entirely whereas the .conf.d approach selectively overrides defaults
|
# presumably because that deletes the defaults entirely whereas the .conf.d approach selectively overrides defaults
|
||||||
|
@@ -198,6 +198,8 @@ in
|
|||||||
"x-scheme-handler/unknown" = desktop;
|
"x-scheme-handler/unknown" = desktop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
slowToBuild = true; # compared to e.g. epiphany or webkit-based browsers
|
||||||
|
|
||||||
# env.BROWSER = "${package}/bin/${cfg.browser.libName}";
|
# env.BROWSER = "${package}/bin/${cfg.browser.libName}";
|
||||||
env.BROWSER = cfg.browser.libName; # used by misc tools like xdg-email, as fallback
|
env.BROWSER = cfg.browser.libName; # used by misc tools like xdg-email, as fallback
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
slowToBuild = true; # uses webkitgtk 4.1
|
||||||
persist.byStore.private = [
|
persist.byStore.private = [
|
||||||
# attachments, and email -- contained in a sqlite db
|
# attachments, and email -- contained in a sqlite db
|
||||||
".local/share/geary"
|
".local/share/geary"
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
# package = pkgs.libreoffice-still;
|
# package = pkgs.libreoffice-still;
|
||||||
package = pkgs.libreoffice-fresh;
|
package = pkgs.libreoffice-fresh;
|
||||||
|
|
||||||
|
slowToBuild = true;
|
||||||
|
|
||||||
# disable first-run stuff
|
# disable first-run stuff
|
||||||
fs.".config/libreoffice/4/user/registrymodifications.xcu".symlink.text = ''
|
fs.".config/libreoffice/4/user/registrymodifications.xcu".symlink.text = ''
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
@@ -27,6 +27,8 @@ in
|
|||||||
'' + (upstream.preFixup or "");
|
'' + (upstream.preFixup or "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
slowToBuild = true; # only true for cross-compiled tangram
|
||||||
|
|
||||||
persist.byStore.private = [
|
persist.byStore.private = [
|
||||||
".cache/Tangram"
|
".cache/Tangram"
|
||||||
".local/share/Tangram"
|
".local/share/Tangram"
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
|
sane.programs.wireshark.slowToBuild = true;
|
||||||
|
|
||||||
programs.wireshark.enable = config.sane.programs.wireshark.enabled;
|
programs.wireshark.enable = config.sane.programs.wireshark.enabled;
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ in {
|
|||||||
sane.programs.zeal = {
|
sane.programs.zeal = {
|
||||||
# package = pkgs.zeal-qt6; #< TODO: upgrade system to qt6 versions of everything (i.e. jellyfin-media-player, nheko)
|
# package = pkgs.zeal-qt6; #< TODO: upgrade system to qt6 versions of everything (i.e. jellyfin-media-player, nheko)
|
||||||
package = pkgs.zeal-qt5;
|
package = pkgs.zeal-qt5;
|
||||||
|
slowToBuild = true;
|
||||||
persist.byStore.plaintext = [
|
persist.byStore.plaintext = [
|
||||||
".cache/Zeal"
|
".cache/Zeal"
|
||||||
".local/share/Zeal"
|
".local/share/Zeal"
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{ config, lib, options, pkgs, sane-lib, utils, ... }:
|
{ config, lib, options, pkgs, sane-lib, utils, ... }:
|
||||||
let
|
let
|
||||||
|
saneCfg = config.sane;
|
||||||
cfg = config.sane.programs;
|
cfg = config.sane.programs;
|
||||||
|
|
||||||
# create a map:
|
# create a map:
|
||||||
@@ -141,6 +142,14 @@ let
|
|||||||
the type at this level is obscured only to as to allow passthrough to `sane.users` w/ proper option merging
|
the type at this level is obscured only to as to allow passthrough to `sane.users` w/ proper option merging
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
slowToBuild = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
whether this package is very slow, or has unique dependencies which are very slow to build.
|
||||||
|
marking packages like this can be used to achieve faster, but limited, rebuilds/deploys (by omitting the package).
|
||||||
|
'';
|
||||||
|
};
|
||||||
configOption = mkOption {
|
configOption = mkOption {
|
||||||
type = types.raw;
|
type = types.raw;
|
||||||
default = mkOption {
|
default = mkOption {
|
||||||
@@ -156,8 +165,11 @@ let
|
|||||||
config = config.configOption;
|
config = config.configOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = let
|
||||||
enabled = config.enableFor.system || builtins.any (en: en) (lib.attrValues config.enableFor.user);
|
enabledForUser = builtins.any (en: en) (lib.attrValues config.enableFor.user);
|
||||||
|
passesSlowTest = saneCfg.enableSlowPrograms || !config.slowToBuild;
|
||||||
|
in {
|
||||||
|
enabled = (config.enableFor.system || enabledForUser) && passesSlowTest;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
toPkgSpec = with lib; types.coercedTo types.package (p: { package = p; }) pkgSpec;
|
toPkgSpec = with lib; types.coercedTo types.package (p: { package = p; }) pkgSpec;
|
||||||
@@ -169,18 +181,18 @@ let
|
|||||||
}) p.suggestedPrograms;
|
}) p.suggestedPrograms;
|
||||||
|
|
||||||
# conditionally add to system PATH and env
|
# conditionally add to system PATH and env
|
||||||
environment = lib.optionalAttrs p.enableFor.system {
|
environment = lib.optionalAttrs (p.enabled && p.enableFor.system) {
|
||||||
systemPackages = lib.optional (p.package != null) p.package;
|
systemPackages = lib.optional (p.package != null) p.package;
|
||||||
variables = p.env;
|
variables = p.env;
|
||||||
};
|
};
|
||||||
|
|
||||||
# conditionally add to user(s) PATH
|
# conditionally add to user(s) PATH
|
||||||
users.users = lib.mapAttrs (user: en: {
|
users.users = lib.mapAttrs (user: en: {
|
||||||
packages = lib.optional (p.package != null && en) p.package;
|
packages = lib.optional (p.package != null && en && p.enabled) p.package;
|
||||||
}) p.enableFor.user;
|
}) p.enableFor.user;
|
||||||
|
|
||||||
# conditionally persist relevant user dirs and create files
|
# conditionally persist relevant user dirs and create files
|
||||||
sane.users = lib.mapAttrs (user: en: lib.optionalAttrs en {
|
sane.users = lib.mapAttrs (user: en: lib.optionalAttrs (en && p.enabled) {
|
||||||
inherit (p) persist;
|
inherit (p) persist;
|
||||||
services = lib.mapAttrs (_: lib.mkMerge) p.services;
|
services = lib.mapAttrs (_: lib.mkMerge) p.services;
|
||||||
environment = p.env;
|
environment = p.env;
|
||||||
@@ -197,7 +209,7 @@ let
|
|||||||
|
|
||||||
# make secrets available for each user
|
# make secrets available for each user
|
||||||
sops.secrets = lib.concatMapAttrs
|
sops.secrets = lib.concatMapAttrs
|
||||||
(user: en: lib.optionalAttrs en (
|
(user: en: lib.optionalAttrs (en && p.enabled) (
|
||||||
lib.mapAttrs'
|
lib.mapAttrs'
|
||||||
(homePath: src: {
|
(homePath: src: {
|
||||||
# TODO: user the user's *actual* home directory, don't guess.
|
# TODO: user the user's *actual* home directory, don't guess.
|
||||||
@@ -218,10 +230,18 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
|
# TODO: consolidate these options under one umbrella attrset
|
||||||
sane.programs = mkOption {
|
sane.programs = mkOption {
|
||||||
type = types.attrsOf toPkgSpec;
|
type = types.attrsOf toPkgSpec;
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
sane.enableSlowPrograms = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
whether to ship programs which are uniquely slow to build.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
|
Reference in New Issue
Block a user