hosts: add snowy

the Samsung Chromebook thing
This commit is contained in:
Colin 2024-06-07 07:34:35 +00:00
parent 52a0e8cf53
commit 14f4f1e80d
4 changed files with 138 additions and 20 deletions

View File

@ -167,11 +167,11 @@
},
"nixpkgs-next-unpatched": {
"locked": {
"lastModified": 1717480868,
"narHash": "sha256-Lkd/mrL5EEdgVqR3WnmxnYTdhqAKqxupxtRRjqrm4Y8=",
"lastModified": 1717588881,
"narHash": "sha256-2/rbdUjxqMVF7NCKawSZz3ktqnTbiTwDMvLwAjYeX0o=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6a56765581a4dcf961a90faf54d32edb991bd315",
"rev": "f1f4d07f9015e5da5fe416e87c6bbd9f569a5c60",
"type": "github"
},
"original": {
@ -197,6 +197,22 @@
"type": "github"
}
},
"nixpkgs-staging-unpatched": {
"locked": {
"lastModified": 1717588903,
"narHash": "sha256-g/CqYa89nJCbEsP4xiqg8PGXF+aTXRq5zKZl3qB+UxU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d7993cebbcd4f9f3a07a8d418853b586d301be56",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "staging",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unpatched": {
"locked": {
"lastModified": 1717479673,
@ -240,6 +256,7 @@
"inputs": {
"mobile-nixos": "mobile-nixos",
"nixpkgs-next-unpatched": "nixpkgs-next-unpatched",
"nixpkgs-staging-unpatched": "nixpkgs-staging-unpatched",
"nixpkgs-unpatched": "nixpkgs-unpatched",
"nixpkgs-wayland": "nixpkgs-wayland",
"sops-nix": "sops-nix",

View File

@ -44,7 +44,7 @@
# <https://github.com/nixos/nixpkgs/tree/nixos-unstable>
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=master";
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-staging";
nixpkgs-staging-unpatched.url = "github:nixos/nixpkgs?ref=staging";
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-staging-next";
nixpkgs-next-unpatched.url = "github:nixos/nixpkgs?ref=staging-next";
@ -81,6 +81,7 @@
self,
nixpkgs-unpatched,
nixpkgs-next-unpatched ? nixpkgs-unpatched,
nixpkgs-staging-unpatched ? nixpkgs-unpatched,
nixpkgs-wayland,
mobile-nixos,
sops-nix,
@ -97,16 +98,25 @@
# mapAttrs but without the `name` argument
mapAttrValues = f: mapAttrs (_: f);
# TODO: rename the various nixpkgs inputs to make this part more straightforward
unpatchedNixpkgsByBranch = {
master = nixpkgs-unpatched;
staging-next = nixpkgs-next-unpatched;
staging = nixpkgs-staging-unpatched;
};
# rather than apply our nixpkgs patches as a flake input, do that here instead.
# this (temporarily?) resolves the bad UX wherein a subflake residing in the same git
# repo as the main flake causes the main flake to have an unstable hash.
patchNixpkgs = variant: nixpkgs: (import ./nixpatches/flake.nix).outputs {
inherit variant nixpkgs;
self = patchNixpkgs variant nixpkgs;
# TODO: rename `variant` -> `branch`
patchNixpkgs = variant: (import ./nixpatches/flake.nix).outputs {
inherit variant;
nixpkgs = unpatchedNixpkgsByBranch."${variant}";
self = patchNixpkgs variant;
};
nixpkgs' = patchNixpkgs "master" nixpkgs-unpatched;
nixpkgsCompiledBy = system: nixpkgs'.legacyPackages."${system}";
nixpkgs' = patchNixpkgs "master";
nixpkgsCompiledBy = { system, variant ? "master" }:
(patchNixpkgs variant).legacyPackages."${system}";
evalHost = { name, local, target, variant ? null, nixpkgs ? nixpkgs' }: nixpkgs.lib.nixosSystem {
system = target;
@ -117,7 +127,22 @@
(optionalAttrs (local != target) {
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
nixpkgs.hostPlatform.system = target;
# nixpkgs.hostPlatform.system = target;
nixpkgs.hostPlatform = {
system = target;
} // optionalAttrs (target == "armv7a-linux") {
# as i desperately try to shrink the initramfs...
config = "armv7a-unknown-linux-musleabihf";
gcc = {
# arch = "armv7-a";
cpu = "cortex-a15";
fpu = "neon-vfpv4";
float-abi = "hard";
};
linux-kernel = {
target = "zImage";
};
};
})
(optionalAttrs (variant == "light") {
sane.maxBuildCost = 2;
@ -144,18 +169,27 @@
desko-light = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "light"; };
lappy = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; };
lappy-light = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "light"; };
lappy-min = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "min"; };
lappy-min = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "min"; };
moby = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; };
moby-light = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; variant = "light"; };
moby-min = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; variant = "min"; };
moby-min = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; variant = "min"; };
# snowy is technically armv7a, and armv7l uses only a _subset_ of the available ISA.
# but flakes don't expose that as a target.
snowy = { name = "snowy"; local = "x86_64-linux"; target = "armv7l-linux"; };
snowy-min = { name = "snowy"; local = "x86_64-linux"; target = "armv7l-linux"; variant = "min"; };
snowy-musl = { name = "snowy"; local = "x86_64-linux"; target = "armv7a-linux"; variant = "min"; };
rescue = { name = "rescue"; local = "x86_64-linux"; target = "x86_64-linux"; };
};
hostsNext = mapAttrs' (h: v: {
name = "${h}-next";
value = v // { nixpkgs = patchNixpkgs "staging-next" nixpkgs-next-unpatched; };
value = v // { nixpkgs = patchNixpkgs "staging-next"; };
}) hosts;
hostsStaging = mapAttrs' (h: v: {
name = "${h}-staging";
value = v // { nixpkgs = patchNixpkgs "staging"; };
}) hosts;
in mapAttrValues evalHost (
hosts // hostsNext
hosts // hostsNext // hostsStaging
);
# unofficial output
@ -222,12 +256,26 @@
# this includes both our native packages and all the nixpkgs packages.
legacyPackages =
let
allPkgsFor = sys: (nixpkgsCompiledBy sys).appendOverlays [
self.overlays.passthru self.overlays.pkgs
];
allPkgsFor = variant: additionalOverlays: system:
(nixpkgsCompiledBy { inherit system variant; })
.appendOverlays (
[
self.overlays.passthru
self.overlays.pkgs
] ++ additionalOverlays
);
allPkgsFor' = system: allPkgsFor
"master"
[(self: super: {
# build `pkgsNext.FOO` to build the package FOO from nixpkgs staging-next branch
pkgsNext = allPkgsFor "staging-next" [] system;
pkgsStaging = allPkgsFor "staging" [] system;
})]
system
;
in {
x86_64-linux = allPkgsFor "x86_64-linux";
aarch64-linux = allPkgsFor "aarch64-linux";
x86_64-linux = allPkgsFor' "x86_64-linux";
aarch64-linux = allPkgsFor' "aarch64-linux";
};
# extract only our own packages from the full set.
@ -250,7 +298,7 @@
)
# self.legacyPackages;
{
x86_64-linux = (nixpkgsCompiledBy "x86_64-linux").appendOverlays [
x86_64-linux = (nixpkgsCompiledBy { system = "x86_64-linux"; }).appendOverlays [
self.overlays.passthru
];
}

View File

@ -0,0 +1,37 @@
# Samsung chromebook XE303C12
# - <https://wiki.postmarketos.org/wiki/Samsung_Chromebook_(google-snow)>
{ ... }:
{
imports = [
./fs.nix
];
sane.hal.samsung.enable = true;
sane.roles.client = true;
# sane.roles.pc = true;
users.users.colin.initialPassword = "147147";
sane.programs.sway.enableFor.user.colin = true;
sane.programs.calls.enableFor.user.colin = false;
sane.programs.consoleMediaUtils.enableFor.user.colin = true;
sane.programs.epiphany.enableFor.user.colin = true;
sane.programs."gnome.geary".enableFor.user.colin = false;
# sane.programs.firefox.enableFor.user.colin = true;
sane.programs.portfolio-filemanager.enableFor.user.colin = true;
sane.programs.signal-desktop.enableFor.user.colin = false;
sane.programs.wike.enableFor.user.colin = true;
# sane.programs.pcGuiApps.enableFor.user.colin = false; #< errors!
sane.programs.blueberry.enableFor.user.colin = false; # bluetooth manager: doesn't cross compile!
# sane.programs.brave.enableFor.user.colin = false; # 2024/06/03: fails eval if enabled on cross
# sane.programs.firefox.enableFor.user.colin = false; # 2024/06/03: this triggers an eval error in yarn stuff -- i'm doing IFD somewhere!!?
sane.programs.mepo.enableFor.user.colin = false; # 2024/06/04: doesn't cross compile (nodejs)
sane.programs.mercurial.enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.nixpkgs-review.enableFor.user.colin = false; # 2024/06/03: OOMs when cross compiling
sane.programs.ntfy-sh.enableFor.user.colin = false; # 2024/06/04: doesn't cross compile (nodejs)
sane.programs.pwvucontrol.enableFor.user.colin = false; # 2024/06/03: doesn't cross compile (libspa-sys)
sane.programs."sane-scripts.bt-search".enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.sequoia.enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.zathura.enableFor.user.colin = false; # 2024/06/03: does not cross compile
}

View File

@ -0,0 +1,16 @@
{ ... }:
{
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/55555555-0303-0c12-86df-eda9e9311526";
fsType = "btrfs";
options = [
"compress=zstd"
"defaults"
];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/303C-5A37";
fsType = "vfat";
};
}