fix: import upstream (lovesegfault's) changes to hosts structure

This commit is contained in:
oddlama 2023-01-06 00:16:05 +01:00
parent c5a5cf14ba
commit 7ff57aa6e4
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
9 changed files with 148 additions and 54 deletions

18
flake.lock generated
View file

@ -109,11 +109,11 @@
]
},
"locked": {
"lastModified": 1672780900,
"narHash": "sha256-DxuSn6BdkZapIbg76xzYx1KhVPEZeBexMkt1q/sMVPA=",
"lastModified": 1672954852,
"narHash": "sha256-xkMJs1KTyKwxVErNdbgC4K6GRHU24Uv2DhbcFtfzLrk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "54245e1820caabd8a0b53ce4d47e4d0fefe04cd4",
"rev": "3ecd5305a41b6dd87f6cdf8cfe83ac07bdc47a0f",
"type": "github"
},
"original": {
@ -154,11 +154,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1672617983,
"narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=",
"lastModified": 1672791794,
"narHash": "sha256-mqGPpGmwap0Wfsf3o2b6qHJW1w2kk/I6cGCGIU+3t6o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
"rev": "9813adc7f7c0edd738c6bdd8431439688bb0cb3d",
"type": "github"
},
"original": {
@ -199,11 +199,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1672734157,
"narHash": "sha256-uwUBnv0bN1SO4QVIo8KUx/jxRYCy7cW8kzZa+Qsrw9k=",
"lastModified": 1672912243,
"narHash": "sha256-QnQeKUjco2kO9J4rBqIBPp5XcOMblIMnmyhpjeaJBYc=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "d0ce0a861260493c6c21f16f59d25076f73cb931",
"rev": "a4548c09eac4afb592ab2614f4a150120b29584c",
"type": "github"
},
"original": {

View file

@ -59,11 +59,14 @@
checks = import ./nix/checks.nix inputs localSystem;
devShells.default = import ./nix/dev-shell.nix inputs localSystem;
legacyPackages =
{
default = self.packages.${localSystem}.all;
}
// (import ./nix/host-drvs.nix inputs localSystem);
packages = let
hostDrvs = import ./nix/host-drvs.nix inputs localSystem;
default =
if builtins.hasAttr "${localSystem}" hostDrvs
then {default = self.packages.${localSystem}.${localSystem};}
else {};
in
hostDrvs // default;
pkgs = import nixpkgs {
inherit localSystem;

93
hosts/nom/disko.nix Normal file
View file

@ -0,0 +1,93 @@
{
nom = {
disk = {
"Intenso_SSD_3833430-532201046" = {
type = "disk";
device = "/dev/disk/by-id/ata-Intenso_SSD_3833430-532201046";
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "efi";
start = "2048";
end = "8GiB";
fs-type = "fat32";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
type = "partition";
name = "swap";
start = "8GiB";
end = "100%";
content = {
type = "swap";
randomEncryption = true;
};
}
];
};
};
"Samsung_SSD_980_PRO_1TB_S5GXNX1T325329W" = {
type = "disk";
device = "/dev/disk/by-id/nvme-Samsung_SSD_980_PRO_1TB_S5GXNX1T325329W";
content = {
type = "zfs";
pool = "rpool";
};
};
};
zpool = {
rpool = {
type = "zpool";
mode = "mirror";
rootFsOptions = {
compression = "zstd";
acltype = "posix";
atime = "off";
xattr = "sa";
dnodesize = "auto";
mountpoint = "none";
canmount = "off";
devices = "off";
encryption = "aes-256-gcm";
keyformat = "passphrase";
keylocation = "prompt";
"autobackup:snap" = "true";
"autobackup:home" = "true";
};
options = {
ashift = "12";
bootfs = "rpool/root/nixos";
};
datasets = {
"root" = {
zfs_type = "filesystem";
};
"root/nixos" = {
zfs_type = "filesystem";
options = {
canmount = "on";
mountpoint = "/";
};
};
"home" = {
zfs_type = "filesystem";
};
"home/root" = {
zfs_type = "filesystem";
options = {
canmount = "on";
mountpoint = "/root";
};
};
};
};
};
};
}

View file

@ -12,33 +12,10 @@ with self.pkgs.${system};
hooks = {
actionlint.enable = true;
luacheck.enable = true;
#nix-linter.enable = true;
alejandra.enable = true;
statix.enable = true;
stylua.enable = true;
};
#settings.nix-linter.checks = [
# "DIYInherit"
# "EmptyInherit"
# "EmptyLet"
# "EtaReduce"
# "LetInInheritRecset"
# "ListLiteralConcat"
# "NegateAtom"
# "SequentialLet"
# "SetLiteralUpdate"
# "UnfortunateArgName"
# "UnneededRec"
# "UnusedArg"
# "UnusedLetBind"
# "UpdateEmptySet"
# "BetaReduction"
# "EmptyVariadicParamSet"
# "UnneededAntiquote"
# "no-FreeLetInFunc"
# "no-AlphabeticalArgs"
# "no-AlphabeticalBindings"
#];
};
}
// (deploy-rs.lib.deployChecks self.deploy)

View file

@ -8,7 +8,6 @@ with self.pkgs.${system};
cachix
deploy-rs.deploy-rs
nix-build-uncached
#nix-linter
alejandra
ragenix
rnix-lsp

View file

@ -6,9 +6,18 @@
...
}: let
inherit (nixpkgs) lib;
hosts = (import ./hosts.nix).homeManager.all;
hosts = let
hostsNix = import ./hosts.nix;
in
if builtins.hasAttr "homeManager" hostsNix
then hostsNix.homeManager
else {};
genModules = hostName: {homeDirectory, ...}: {config, ...}: {
genModules = hostName: {homeDirectory, ...}: {
config,
pkgs,
...
}: {
imports = [(../hosts + "/${hostName}")];
nix.registry = {
nixpkgs.flake = nixpkgs;

View file

@ -9,7 +9,7 @@
structuredHostDrvs =
lib.mapAttrsRecursiveCond
(as: !(as ? "type" && (lib.elem as.type ["home-manager" "nixos"])))
(hostAttr: !(hostAttr ? "type" && (lib.elem hostAttr.type ["homeManager" "nixos"])))
(path: _: hostDrvs.${lib.last path})
hosts;

View file

@ -14,7 +14,7 @@ let
};
};
inherit (builtins) attrNames concatMap listToAttrs;
inherit (builtins) attrNames concatMap listToAttrs filter;
filterAttrs = pred: set:
listToAttrs (concatMap (name: let
@ -24,18 +24,31 @@ let
then [{inherit name value;}]
else []) (attrNames set));
systemPred = system: (_: v: builtins.match ".*${system}.*" v.hostPlatform != null);
removeEmptyAttrs = filterAttrs (_: v: v != {});
genFamily = filter: hosts: rec {
all = filterAttrs filter hosts;
genSystemGroups = hosts: let
systems = ["aarch64-linux" "x86_64-linux"];
systemHostGroup = name: {
inherit name;
value = filterAttrs (_: host: host.hostPlatform == name) hosts;
};
in
removeEmptyAttrs (listToAttrs (map systemHostGroup systems));
nixos = genFamily (_: v: v.type == "nixos") all;
homeManager = genFamily (_: v: v.type == "home-manager") all;
genTypeGroups = hosts: let
types = ["homeManager" "nixos"];
typeHostGroup = name: {
inherit name;
value = filterAttrs (_: host: host.type == name) hosts;
};
in
removeEmptyAttrs (listToAttrs (map typeHostGroup types));
linux = genFamily (systemPred "-linux") all;
aarch64-linux = genFamily (systemPred "aarch64-linux") all;
x86_64-linux = genFamily (systemPred "x86_64-linux") all;
};
genHostGroups = hosts: let
all = hosts;
systemGroups = genSystemGroups all;
typeGroups = genTypeGroups all;
in
all // systemGroups // typeGroups // {inherit all;};
in
genFamily (_: _: true) hosts
genHostGroups hosts

View file

@ -9,7 +9,7 @@
...
}: let
inherit (nixpkgs) lib;
hosts = (import ./hosts.nix).nixos.all;
hosts = (import ./hosts.nix).nixos;
nixRegistry = {
nix.registry = {