forked from pub-solar/os
lib: remove devos section
This commit is contained in:
parent
c93e9fda0f
commit
e837aaa875
|
@ -1,30 +0,0 @@
|
|||
{ lib, utils }:
|
||||
{
|
||||
# pkgImport :: Nixpkgs -> Overlays -> System -> Pkgs
|
||||
pkgImport = nixpkgs: overlays: system:
|
||||
import nixpkgs {
|
||||
inherit system overlays;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
|
||||
profileMap = list: map (profile: profile.default) (lib.flatten list);
|
||||
|
||||
mkNodes = import ./mkNodes.nix { inherit lib; };
|
||||
|
||||
mkHosts = import ./mkHosts.nix { inherit lib; };
|
||||
|
||||
mkSuites = import ./mkSuites.nix { inherit lib; };
|
||||
|
||||
mkProfileAttrs = import ./mkProfileAttrs.nix { inherit lib; };
|
||||
|
||||
mkPkgs = import ./mkPkgs.nix { inherit lib utils; };
|
||||
|
||||
recImport = import ./recImport.nix { inherit lib; };
|
||||
|
||||
devosSystem = import ./devosSystem.nix { inherit lib; };
|
||||
|
||||
mkHomeConfigurations = import ./mkHomeConfigurations.nix { inherit lib; };
|
||||
|
||||
mkPackages = import ./mkPackages.nix { inherit lib; };
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
# dependencies to return a builder
|
||||
{ self, inputs }:
|
||||
|
||||
{ modules, specialArgs, ... } @ args:
|
||||
let inherit (specialArgs.channel.input.lib) nixosSystem; in
|
||||
nixosSystem
|
||||
(args // {
|
||||
modules =
|
||||
let
|
||||
fullHostConfig = (nixosSystem (args // { inherit modules; })).config;
|
||||
|
||||
isoConfig = (nixosSystem
|
||||
(args // {
|
||||
modules = modules ++ [
|
||||
(lib.modules.iso { inherit self inputs fullHostConfig; })
|
||||
];
|
||||
})).config;
|
||||
|
||||
hmConfig = (nixosSystem
|
||||
(args // {
|
||||
modules = modules ++ [
|
||||
(lib.modules.hmConfig)
|
||||
];
|
||||
})).config;
|
||||
in
|
||||
modules ++ [{
|
||||
system.build = {
|
||||
iso = isoConfig.system.build.isoImage;
|
||||
homes = hmConfig.home-manager.users;
|
||||
};
|
||||
lib = {
|
||||
inherit specialArgs;
|
||||
testModule = {
|
||||
imports = modules;
|
||||
};
|
||||
};
|
||||
}];
|
||||
})
|
|
@ -1,57 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
{ self, nixos, inputs, dir, extern, suites, overrides, multiPkgs }:
|
||||
let
|
||||
defaultSystem = "x86_64-linux";
|
||||
|
||||
modules = with lib.modules; {
|
||||
modOverrides = modOverrides { inherit overrides; };
|
||||
hmDefaults = hmDefaults {
|
||||
inherit extern;
|
||||
inherit (self) homeModules;
|
||||
userSuites = suites.user;
|
||||
};
|
||||
globalDefaults = globalDefaults {
|
||||
inherit self nixos inputs multiPkgs;
|
||||
};
|
||||
cachix = cachix { inherit self; };
|
||||
flakeModules = flakeModules { inherit self extern; };
|
||||
};
|
||||
|
||||
specialArgs = extern.specialArgs // { suites = suites.system; };
|
||||
|
||||
mkHostConfig = hostName:
|
||||
let
|
||||
local = {
|
||||
require = [
|
||||
"${dir}/${hostName}.nix"
|
||||
];
|
||||
|
||||
networking = { inherit hostName; };
|
||||
|
||||
_module.args = {
|
||||
self = self;
|
||||
hosts = builtins.mapAttrs (_: host: host.config)
|
||||
(removeAttrs hosts [ hostName ]);
|
||||
};
|
||||
|
||||
lib = { inherit specialArgs; };
|
||||
lib.testModule = {
|
||||
imports = builtins.attrValues modules;
|
||||
};
|
||||
|
||||
};
|
||||
in
|
||||
lib.os.devosSystem {
|
||||
inherit self nixos inputs specialArgs;
|
||||
system = defaultSystem;
|
||||
modules = modules // { inherit local; };
|
||||
};
|
||||
|
||||
hosts = lib.os.recImport
|
||||
{
|
||||
inherit dir;
|
||||
_import = mkHostConfig;
|
||||
};
|
||||
in
|
||||
hosts
|
|
@ -1,16 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
/**
|
||||
Synopsis: mkNodes _nixosConfigurations_
|
||||
|
||||
Generate the `nodes` attribute expected by deploy-rs
|
||||
where _nixosConfigurations_ are `nodes`.
|
||||
**/
|
||||
deploy: lib.mapAttrs (_: config: {
|
||||
hostname = config.config.networking.hostName;
|
||||
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
path = deploy.lib.x86_64-linux.activate.nixos config;
|
||||
};
|
||||
})
|
|
@ -1,17 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
{ overlay, overlays, pkgs }:
|
||||
let
|
||||
packagesNames = lib.attrNames (overlay null null)
|
||||
++ lib.attrNames (lib.concatAttrs
|
||||
(lib.attrValues
|
||||
(lib.mapAttrs (_: v: v null null) overlays)
|
||||
)
|
||||
);
|
||||
in
|
||||
lib.fold
|
||||
(key: sum: lib.recursiveUpdate sum {
|
||||
${key} = pkgs.${key};
|
||||
})
|
||||
{ }
|
||||
packagesNames
|
|
@ -1,25 +0,0 @@
|
|||
{ lib, utils }:
|
||||
|
||||
{ self, nixos, inputs, extern, overrides }:
|
||||
(utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
overridePkgs = lib.os.pkgImport inputs.override [ ] system;
|
||||
overridesOverlay = overrides.packages;
|
||||
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
lib = prev.lib.extend (lfinal: lprev: {
|
||||
inherit lib;
|
||||
inherit (lib) nixosSystem;
|
||||
});
|
||||
})
|
||||
(overridesOverlay overridePkgs)
|
||||
self.overlay
|
||||
]
|
||||
++ extern.overlays
|
||||
++ (lib.attrValues self.overlays);
|
||||
in
|
||||
{ pkgs = lib.os.pkgImport nixos overlays system; }
|
||||
)
|
||||
).pkgs
|
|
@ -1,35 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
let mkProfileAttrs =
|
||||
/**
|
||||
Synopsis: mkProfileAttrs _path_
|
||||
|
||||
Recursively collect the subdirs of _path_ containing a default.nix into attrs.
|
||||
This sets a contract, eliminating ambiguity for _default.nix_ living under the
|
||||
profile directory.
|
||||
|
||||
Example:
|
||||
let profiles = mkProfileAttrs ./profiles; in
|
||||
assert profiles ? core.default; 0
|
||||
**/
|
||||
dir:
|
||||
let
|
||||
imports =
|
||||
let
|
||||
files = lib.safeReadDir dir;
|
||||
|
||||
p = n: v:
|
||||
v == "directory"
|
||||
&& n != "profiles";
|
||||
in
|
||||
lib.filterAttrs p files;
|
||||
|
||||
f = n: _:
|
||||
lib.optionalAttrs
|
||||
(lib.pathExists "${dir}/${n}/default.nix")
|
||||
{ default = "${dir}/${n}"; }
|
||||
// mkProfileAttrs "${dir}/${n}";
|
||||
in
|
||||
lib.mapAttrs f imports;
|
||||
in mkProfileAttrs
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
{ suites, profiles } @ args:
|
||||
let
|
||||
inherit (lib) os;
|
||||
|
||||
profileSet = lib.genAttrs' profiles (path: {
|
||||
name = baseNameOf path;
|
||||
value = os.mkProfileAttrs (toString path);
|
||||
});
|
||||
|
||||
definedSuites = suites profileSet;
|
||||
|
||||
allProfiles = lib.collectProfiles profileSet;
|
||||
in
|
||||
lib.mapAttrs (_: v: os.profileMap v) definedSuites // {
|
||||
inherit allProfiles;
|
||||
}
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{ lib }:
|
||||
|
||||
{ dir, _import ? base: import "${dir}/${base}.nix" }:
|
||||
lib.mapFilterAttrs
|
||||
(_: v: v != null)
|
||||
(n: v:
|
||||
if n != "default.nix" && lib.hasSuffix ".nix" n && v == "regular"
|
||||
then
|
||||
let name = lib.removeSuffix ".nix" n; in lib.nameValuePair (name) (_import name)
|
||||
else
|
||||
lib.nameValuePair ("") (null))
|
||||
(lib.safeReadDir dir)
|
Loading…
Reference in a new issue