mirror of
https://github.com/divnix/digga.git
synced 2025-01-09 01:26:43 +03:00
tree: format all nix code with alejandra
This commit is contained in:
parent
2867f0e8e2
commit
41ac43c7e2
@ -1,22 +1,22 @@
|
|||||||
{ system ? builtins.currentSystem
|
{
|
||||||
, inputs ? (import ../.).inputs
|
system ? builtins.currentSystem,
|
||||||
}:
|
inputs ? (import ../.).inputs,
|
||||||
let
|
}: let
|
||||||
|
|
||||||
inherit (inputs) digga nixpkgs;
|
inherit (inputs) digga nixpkgs;
|
||||||
lib = nixpkgs.lib // digga.lib;
|
lib = nixpkgs.lib // digga.lib;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
in
|
libTests =
|
||||||
{
|
pkgs.runCommandNoCC "devos-lib-tests"
|
||||||
|
|
||||||
libTests = pkgs.runCommandNoCC "devos-lib-tests"
|
|
||||||
{
|
{
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.nix
|
pkgs.nix
|
||||||
(
|
(
|
||||||
let tests = import ./lib { inherit pkgs lib; }; in
|
let
|
||||||
if tests == [ ] then null
|
tests = import ./lib {inherit pkgs lib;};
|
||||||
|
in
|
||||||
|
if tests == []
|
||||||
|
then null
|
||||||
else throw (builtins.toJSON tests)
|
else throw (builtins.toJSON tests)
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -35,5 +35,4 @@ in
|
|||||||
|
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{ pkgs, lib }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
lib.runTests {
|
lib.runTests {
|
||||||
testRakeLeaves = {
|
testRakeLeaves = {
|
||||||
|
16
default.nix
16
default.nix
@ -1,18 +1,24 @@
|
|||||||
let
|
let
|
||||||
inherit (import
|
inherit
|
||||||
(
|
(
|
||||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
import
|
||||||
|
(
|
||||||
|
let
|
||||||
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
in
|
||||||
fetchTarball {
|
fetchTarball {
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
{src = ./.;}
|
{src = ./.;}
|
||||||
) defaultNix;
|
)
|
||||||
|
defaultNix
|
||||||
|
;
|
||||||
in
|
in
|
||||||
# Pass this flake as inputs.digga
|
# Pass this flake as inputs.digga
|
||||||
defaultNix // {
|
defaultNix
|
||||||
|
// {
|
||||||
inputs = defaultNix.inputs // {digga = defaultNix;};
|
inputs = defaultNix.inputs // {digga = defaultNix;};
|
||||||
shell = import ./devShell.nix {};
|
shell = import ./devShell.nix {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
{ lib, flake-utils-plus, internal-modules, importers, nixosModules }:
|
{
|
||||||
|
lib,
|
||||||
|
flake-utils-plus,
|
||||||
|
internal-modules,
|
||||||
|
importers,
|
||||||
|
nixosModules,
|
||||||
|
}:
|
||||||
lib.warn ''
|
lib.warn ''
|
||||||
You are accessing a deprecated item of the digga lib.
|
You are accessing a deprecated item of the digga lib.
|
||||||
Please update timely, it will be remove soon.
|
Please update timely, it will be remove soon.
|
||||||
''
|
''
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
importModules =
|
importModules =
|
||||||
lib.warn ''
|
lib.warn ''
|
||||||
Deprecated Function: lib.importModules.
|
Deprecated Function: lib.importModules.
|
||||||
@ -12,5 +17,4 @@ rec {
|
|||||||
Use lib.importExportableModules instead to set `exportedModules` option
|
Use lib.importExportableModules instead to set `exportedModules` option
|
||||||
''
|
''
|
||||||
importers.importExportableModules;
|
importers.importExportableModules;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
18
devShell.nix
18
devShell.nix
@ -1,8 +1,7 @@
|
|||||||
{ system ? builtins.currentSystem
|
{
|
||||||
, inputs ? (import ./.).inputs
|
system ? builtins.currentSystem,
|
||||||
}:
|
inputs ? (import ./.).inputs,
|
||||||
let
|
}: let
|
||||||
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
devshell = import inputs.devshell {inherit pkgs system;};
|
devshell = import inputs.devshell {inherit pkgs system;};
|
||||||
|
|
||||||
@ -30,10 +29,10 @@ let
|
|||||||
&& cp result "$PRJ_ROOT/doc/api-reference-nixos.md" \
|
&& cp result "$PRJ_ROOT/doc/api-reference-nixos.md" \
|
||||||
&& chmod 755 "$PRJ_ROOT//doc/api-reference-nixos.md"
|
&& chmod 755 "$PRJ_ROOT//doc/api-reference-nixos.md"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
test = type: name: withCategory "tests" {
|
test = type: name:
|
||||||
|
withCategory "tests" {
|
||||||
name = "check-${name}";
|
name = "check-${name}";
|
||||||
help = "Checks ${name} ${type}";
|
help = "Checks ${name} ${type}";
|
||||||
command = ''
|
command = ''
|
||||||
@ -86,7 +85,6 @@ let
|
|||||||
cleanup
|
cleanup
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
devshell.mkShell {
|
devshell.mkShell {
|
||||||
name = "digga";
|
name = "digga";
|
||||||
@ -99,8 +97,7 @@ devshell.mkShell {
|
|||||||
env = [
|
env = [
|
||||||
{
|
{
|
||||||
name = "NIX_CONFIG";
|
name = "NIX_CONFIG";
|
||||||
value =
|
value = '' extra-experimental-features = nix-command flakes
|
||||||
''extra-experimental-features = nix-command flakes
|
|
||||||
extra-substituters = https://nrdxp.cachix.org https://nix-community.cachix.org
|
extra-substituters = https://nrdxp.cachix.org https://nix-community.cachix.org
|
||||||
extra-trusted-public-keys = nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs='';
|
extra-trusted-public-keys = nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs='';
|
||||||
}
|
}
|
||||||
@ -144,6 +141,5 @@ devshell.mkShell {
|
|||||||
(test "examples" "all" // {command = "check-devos && check-groupByConfig && check-hmOnly";})
|
(test "examples" "all" // {command = "check-devos && check-groupByConfig && check-hmOnly";})
|
||||||
(docs {package = pkgs.mdbook;})
|
(docs {package = pkgs.mdbook;})
|
||||||
(docs makeDocs)
|
(docs makeDocs)
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,22 @@ let
|
|||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
filterSystems = lib.filterAttrs
|
filterSystems =
|
||||||
|
lib.filterAttrs
|
||||||
(system: _: lib.elem system ciSystems);
|
(system: _: lib.elem system ciSystems);
|
||||||
|
|
||||||
recurseIntoAttrsRecursive = lib.mapAttrs (_: v:
|
recurseIntoAttrsRecursive = lib.mapAttrs (
|
||||||
|
_: v:
|
||||||
if lib.isAttrs v
|
if lib.isAttrs v
|
||||||
then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v)
|
then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v)
|
||||||
else v
|
else v
|
||||||
);
|
);
|
||||||
|
|
||||||
systemOutputs = lib.filterAttrs
|
systemOutputs =
|
||||||
(name: set: lib.isAttrs set
|
lib.filterAttrs
|
||||||
|
(
|
||||||
|
name: set:
|
||||||
|
lib.isAttrs set
|
||||||
&& lib.any
|
&& lib.any
|
||||||
(system: set ? ${system} && name != "legacyPackages")
|
(system: set ? ${system} && name != "legacyPackages")
|
||||||
ciSystems
|
ciSystems
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
|
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
|
||||||
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
|
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
|
||||||
|
|
||||||
inputs =
|
inputs = {
|
||||||
{
|
|
||||||
# Track channels with commits tested and built by hydra
|
# Track channels with commits tested and built by hydra
|
||||||
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
||||||
latest.url = "github:nixos/nixpkgs/nixos-unstable";
|
latest.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
@ -44,18 +43,18 @@
|
|||||||
nixos-generators.url = "github:nix-community/nixos-generators";
|
nixos-generators.url = "github:nix-community/nixos-generators";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
{ self
|
self,
|
||||||
, digga
|
digga,
|
||||||
, bud
|
bud,
|
||||||
, nixos
|
nixos,
|
||||||
, home
|
home,
|
||||||
, nixos-hardware
|
nixos-hardware,
|
||||||
, nur
|
nur,
|
||||||
, agenix
|
agenix,
|
||||||
, nvfetcher
|
nvfetcher,
|
||||||
, deploy
|
deploy,
|
||||||
, ...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
digga.lib.mkFlake
|
digga.lib.mkFlake
|
||||||
{
|
{
|
||||||
@ -104,11 +103,15 @@
|
|||||||
|
|
||||||
imports = [(digga.lib.importHosts ./hosts)];
|
imports = [(digga.lib.importHosts ./hosts)];
|
||||||
hosts = {
|
hosts = {
|
||||||
/* set host specific properties here */
|
/*
|
||||||
|
set host specific properties here
|
||||||
|
*/
|
||||||
NixOS = {};
|
NixOS = {};
|
||||||
};
|
};
|
||||||
importables = rec {
|
importables = rec {
|
||||||
profiles = digga.lib.rakeLeaves ./profiles // {
|
profiles =
|
||||||
|
digga.lib.rakeLeaves ./profiles
|
||||||
|
// {
|
||||||
users = digga.lib.rakeLeaves ./users;
|
users = digga.lib.rakeLeaves ./users;
|
||||||
};
|
};
|
||||||
suites = with profiles; rec {
|
suites = with profiles; rec {
|
||||||
@ -136,7 +139,5 @@
|
|||||||
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
|
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
|
||||||
|
|
||||||
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {};
|
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {};
|
||||||
|
};
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ suites, ... }:
|
{suites, ...}: {
|
||||||
{
|
|
||||||
### root password is empty by default ###
|
### root password is empty by default ###
|
||||||
imports = suites.base;
|
imports = suites.base;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ profiles, ... }:
|
{profiles, ...}: {
|
||||||
{
|
|
||||||
# build with: `bud build bootstrap bootstrapIso`
|
# build with: `bud build bootstrap bootstrapIso`
|
||||||
# reachable on the local link via ssh root@fe80::47%eno1
|
# reachable on the local link via ssh root@fe80::47%eno1
|
||||||
# where 'eno1' is replaced by your own machine's network
|
# where 'eno1' is replaced by your own machine's network
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
let
|
let
|
||||||
rev = "e7e5d481a0e15dcd459396e55327749989e04ce0";
|
rev = "e7e5d481a0e15dcd459396e55327749989e04ce0";
|
||||||
flake = (import
|
flake =
|
||||||
|
import
|
||||||
(
|
(
|
||||||
fetchTarball {
|
fetchTarball {
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
||||||
@ -9,6 +10,6 @@ let
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
src = ../../.;
|
src = ../../.;
|
||||||
});
|
};
|
||||||
in
|
in
|
||||||
flake
|
flake
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ ... }:
|
{...}: let
|
||||||
let
|
|
||||||
inherit (default.inputs.nixos) lib;
|
inherit (default.inputs.nixos) lib;
|
||||||
|
|
||||||
host = configs.${hostname} or configs.NixOS;
|
host = configs.${hostname} or configs.NixOS;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{ channel, inputs, ... }: {
|
{
|
||||||
|
channel,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
nix.nixPath = [
|
nix.nixPath = [
|
||||||
"nixpkgs=${channel.input}"
|
"nixpkgs=${channel.input}"
|
||||||
"nixos-config=${../lib/compat/nixos}"
|
"nixos-config=${../lib/compat/nixos}"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
channels: final: prev: {
|
channels: final: prev: {
|
||||||
|
|
||||||
__dontExport = true; # overrides clutter up actual creations
|
__dontExport = true; # overrides clutter up actual creations
|
||||||
|
|
||||||
inherit (channels.latest)
|
inherit
|
||||||
|
(channels.latest)
|
||||||
cachix
|
cachix
|
||||||
dhall
|
dhall
|
||||||
discord
|
discord
|
||||||
@ -15,15 +15,17 @@ channels: final: prev: {
|
|||||||
deploy-rs
|
deploy-rs
|
||||||
;
|
;
|
||||||
|
|
||||||
haskellPackages = prev.haskellPackages.override
|
haskellPackages =
|
||||||
|
prev.haskellPackages.override
|
||||||
(old: {
|
(old: {
|
||||||
overrides = prev.lib.composeExtensions (old.overrides or (_: _: { })) (hfinal: hprev:
|
overrides = prev.lib.composeExtensions (old.overrides or (_: _: {})) (hfinal: hprev: let
|
||||||
let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version;
|
version = prev.lib.replaceChars ["."] [""] prev.ghc.version;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
# same for haskell packages, matching ghc versions
|
# same for haskell packages, matching ghc versions
|
||||||
inherit (channels.latest.haskell.packages."ghc${version}")
|
inherit
|
||||||
haskell-language-server;
|
(channels.latest.haskell.packages."ghc${version}")
|
||||||
|
haskell-language-server
|
||||||
|
;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# This file was generated by nvfetcher, please do not modify it manually.
|
# This file was generated by nvfetcher, please do not modify it manually.
|
||||||
{ fetchgit, fetchurl }:
|
|
||||||
{
|
{
|
||||||
|
fetchgit,
|
||||||
|
fetchurl,
|
||||||
|
}: {
|
||||||
manix = {
|
manix = {
|
||||||
pname = "manix";
|
pname = "manix";
|
||||||
version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4";
|
version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4";
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
{ pkgs, lib, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
folder = ./.;
|
folder = ./.;
|
||||||
toImport = name: value: folder + ("/" + name);
|
toImport = name: value: folder + ("/" + name);
|
||||||
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix";
|
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix";
|
||||||
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
|
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
inherit imports;
|
inherit imports;
|
||||||
nix.binaryCaches = ["https://cache.nixos.org/"];
|
nix.binaryCaches = ["https://cache.nixos.org/"];
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
{ self, config, lib, pkgs, ... }:
|
|
||||||
let inherit (lib) fileContents;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) fileContents;
|
||||||
|
in {
|
||||||
# Sets nrdxp.cachix.org binary cache which just speeds up some builds
|
# Sets nrdxp.cachix.org binary cache which just speeds up some builds
|
||||||
imports = [../cachix];
|
imports = [../cachix];
|
||||||
|
|
||||||
@ -15,7 +20,6 @@ in
|
|||||||
nix.systemFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"];
|
nix.systemFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
|
|
||||||
# Selection of sysadmin tools that can come in handy
|
# Selection of sysadmin tools that can come in handy
|
||||||
systemPackages = with pkgs; [
|
systemPackages = with pkgs; [
|
||||||
binutils
|
binutils
|
||||||
@ -51,10 +55,9 @@ in
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shellAliases =
|
shellAliases = let
|
||||||
let ifSudo = lib.mkIf config.security.sudo.enable;
|
ifSudo = lib.mkIf config.security.sudo.enable;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
# quick cd
|
# quick cd
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
"..." = "cd ../..";
|
"..." = "cd ../..";
|
||||||
@ -106,7 +109,6 @@ in
|
|||||||
up = ifSudo "s systemctl start";
|
up = ifSudo "s systemctl start";
|
||||||
dn = ifSudo "s systemctl stop";
|
dn = ifSudo "s systemctl stop";
|
||||||
jtl = "journalctl";
|
jtl = "journalctl";
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -114,16 +116,13 @@ in
|
|||||||
fonts = with pkgs; [powerline-fonts dejavu_fonts];
|
fonts = with pkgs; [powerline-fonts dejavu_fonts];
|
||||||
|
|
||||||
fontconfig.defaultFonts = {
|
fontconfig.defaultFonts = {
|
||||||
|
|
||||||
monospace = ["DejaVu Sans Mono for Powerline"];
|
monospace = ["DejaVu Sans Mono for Powerline"];
|
||||||
|
|
||||||
sansSerif = ["DejaVu Sans"];
|
sansSerif = ["DejaVu Sans"];
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
|
|
||||||
# Improve nix store disk usage
|
# Improve nix store disk usage
|
||||||
autoOptimiseStore = true;
|
autoOptimiseStore = true;
|
||||||
gc.automatic = true;
|
gc.automatic = true;
|
||||||
@ -142,7 +141,6 @@ in
|
|||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
fallback = true
|
fallback = true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
@ -158,5 +156,4 @@ in
|
|||||||
|
|
||||||
# Service that makes Out of Memory Killer more effective
|
# Service that makes Out of Memory Killer more effective
|
||||||
services.earlyoom.enable = true;
|
services.earlyoom.enable = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ let
|
|||||||
system = "";
|
system = "";
|
||||||
user = "";
|
user = "";
|
||||||
allKeys = [system user];
|
allKeys = [system user];
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
"secret.age".publicKeys = allKeys;
|
"secret.age".publicKeys = allKeys;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ self, inputs, ... }:
|
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
modules = with inputs; [
|
modules = with inputs; [
|
||||||
bud.devshellModules.bud
|
bud.devshellModules.bud
|
||||||
];
|
];
|
||||||
@ -7,4 +10,3 @@
|
|||||||
./devos.nix
|
./devos.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
{ pkgs, extraModulesPath, inputs, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
extraModulesPath,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
hooks = import ./hooks;
|
hooks = import ./hooks;
|
||||||
|
|
||||||
pkgWithCategory = category: package: {inherit package category;};
|
pkgWithCategory = category: package: {inherit package category;};
|
||||||
linter = pkgWithCategory "linter";
|
linter = pkgWithCategory "linter";
|
||||||
docs = pkgWithCategory "docs";
|
docs = pkgWithCategory "docs";
|
||||||
devos = pkgWithCategory "devos";
|
devos = pkgWithCategory "devos";
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
_file = toString ./.;
|
_file = toString ./.;
|
||||||
|
|
||||||
imports = ["${extraModulesPath}/git/hooks.nix"];
|
imports = ["${extraModulesPath}/git/hooks.nix"];
|
||||||
@ -30,7 +31,8 @@ in
|
|||||||
unset _PATH
|
unset _PATH
|
||||||
'');
|
'');
|
||||||
|
|
||||||
commands = with pkgs; [
|
commands = with pkgs;
|
||||||
|
[
|
||||||
(devos nixUnstable)
|
(devos nixUnstable)
|
||||||
(devos agenix)
|
(devos agenix)
|
||||||
{
|
{
|
||||||
@ -50,6 +52,5 @@ in
|
|||||||
(devos cachix)
|
(devos cachix)
|
||||||
++ lib.optional
|
++ lib.optional
|
||||||
(system != "aarch64-darwin")
|
(system != "aarch64-darwin")
|
||||||
(devos inputs.nixos-generators.defaultPackage.${pkgs.system})
|
(devos inputs.nixos-generators.defaultPackage.${pkgs.system});
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ hmUsers, ... }:
|
{hmUsers, ...}: {
|
||||||
{
|
|
||||||
home-manager.users = {inherit (hmUsers) nixos;};
|
home-manager.users = {inherit (hmUsers) nixos;};
|
||||||
|
|
||||||
users.users.nixos = {
|
users.users.nixos = {
|
||||||
|
@ -30,12 +30,9 @@
|
|||||||
h1rd = "hard HEAD~1";
|
h1rd = "hard HEAD~1";
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
lg =
|
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||||
"log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
|
||||||
plog =
|
tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
||||||
"log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
|
|
||||||
tlog =
|
|
||||||
"log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
|
||||||
rank = "shortlog -sn --no-merges";
|
rank = "shortlog -sn --no-merges";
|
||||||
|
|
||||||
# delete merged branches
|
# delete merged branches
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
{ self, ... }:
|
{self, ...}: {
|
||||||
{
|
|
||||||
exportedModules = [./python.toml];
|
exportedModules = [./python.toml];
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "A DevOS example. And also a digga test bed.";
|
description = "A DevOS example. And also a digga test bed.";
|
||||||
|
|
||||||
inputs =
|
inputs = {
|
||||||
{
|
|
||||||
# Track channels with commits tested and built by hydra
|
# Track channels with commits tested and built by hydra
|
||||||
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
||||||
|
|
||||||
@ -14,9 +13,13 @@
|
|||||||
home.inputs.nixpkgs.follows = "nixos";
|
home.inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ { self, nixos, digga, home }:
|
outputs = inputs @ {
|
||||||
|
self,
|
||||||
|
nixos,
|
||||||
|
digga,
|
||||||
|
home,
|
||||||
|
}:
|
||||||
digga.lib.mkFlake {
|
digga.lib.mkFlake {
|
||||||
|
|
||||||
inherit self inputs;
|
inherit self inputs;
|
||||||
|
|
||||||
channels.nixos = {};
|
channels.nixos = {};
|
||||||
@ -24,6 +27,5 @@
|
|||||||
nixos = ./nixos;
|
nixos = ./nixos;
|
||||||
home = ./home;
|
home = ./home;
|
||||||
devshell = ./devshell;
|
devshell = ./devshell;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
{ self, ... }:
|
{self, ...}: let
|
||||||
let
|
|
||||||
lib = self.inputs.digga.lib;
|
lib = self.inputs.digga.lib;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = [(lib.importExportableModules ./modules)];
|
imports = [(lib.importExportableModules ./modules)];
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,9 @@
|
|||||||
h1rd = "hard HEAD~1";
|
h1rd = "hard HEAD~1";
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
lg =
|
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||||
"log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
|
||||||
plog =
|
tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
||||||
"log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
|
|
||||||
tlog =
|
|
||||||
"log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
|
||||||
rank = "shortlog -sn --no-merges";
|
rank = "shortlog -sn --no-merges";
|
||||||
|
|
||||||
# delete merged branches
|
# delete merged branches
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
{ lib, pkgs, config, ... }: {
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
fileSystems."/" = {device = "/dev/disk/by-label/One";};
|
fileSystems."/" = {device = "/dev/disk/by-label/One";};
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{ self, inputs, ... }:
|
|
||||||
let
|
|
||||||
inherit (inputs.digga.lib) allProfilesTest;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (inputs.digga.lib) allProfilesTest;
|
||||||
|
in {
|
||||||
hostDefaults.channelName = "nixos";
|
hostDefaults.channelName = "nixos";
|
||||||
hosts = {
|
hosts = {
|
||||||
Morty.modules = [./Morty.nix];
|
Morty.modules = [./Morty.nix];
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "A DevOS example. And also a digga test bed.";
|
description = "A DevOS example. And also a digga test bed.";
|
||||||
|
|
||||||
inputs =
|
inputs = {
|
||||||
{
|
|
||||||
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
nixos.url = "github:nixos/nixpkgs/nixos-21.11";
|
||||||
digga.url = "github:divnix/digga";
|
digga.url = "github:divnix/digga";
|
||||||
digga.inputs.nixpkgs.follows = "nixos";
|
digga.inputs.nixpkgs.follows = "nixos";
|
||||||
@ -11,9 +10,13 @@
|
|||||||
home.inputs.nixpkgs.follows = "nixos";
|
home.inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ { self, nixos, digga, home }:
|
outputs = inputs @ {
|
||||||
|
self,
|
||||||
|
nixos,
|
||||||
|
digga,
|
||||||
|
home,
|
||||||
|
}:
|
||||||
digga.lib.mkFlake {
|
digga.lib.mkFlake {
|
||||||
|
|
||||||
inherit self inputs;
|
inherit self inputs;
|
||||||
|
|
||||||
channels.nixos = {};
|
channels.nixos = {};
|
||||||
@ -21,6 +24,5 @@
|
|||||||
nixos.hostDefaults.channelName = "nixos";
|
nixos.hostDefaults.channelName = "nixos";
|
||||||
|
|
||||||
home = ./home;
|
home = ./home;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{ self, inputs, ... }:
|
|
||||||
let
|
|
||||||
lib = inputs.digga.lib;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
lib = inputs.digga.lib;
|
||||||
|
in {
|
||||||
imports = [(lib.importExportableModules ./modules)];
|
imports = [(lib.importExportableModules ./modules)];
|
||||||
modules = [];
|
modules = [];
|
||||||
importables = rec {
|
importables = rec {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
{ pkgs, suites, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
suites,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
name = "Test User";
|
name = "Test User";
|
||||||
email = "test@example.com";
|
email = "test@example.com";
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = suites.shell;
|
imports = suites.shell;
|
||||||
|
|
||||||
home.packages = [pkgs.hello];
|
home.packages = [pkgs.hello];
|
||||||
@ -15,4 +17,3 @@ in
|
|||||||
userEmail = email;
|
userEmail = email;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
flake.nix
53
flake.nix
@ -5,8 +5,7 @@
|
|||||||
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
|
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
|
||||||
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
|
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
|
||||||
|
|
||||||
inputs =
|
inputs = {
|
||||||
{
|
|
||||||
# Track channels with commits tested and built by hydra
|
# Track channels with commits tested and built by hydra
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
@ -28,18 +27,16 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
{ self
|
self,
|
||||||
, nixlib
|
nixlib,
|
||||||
, nixpkgs
|
nixpkgs,
|
||||||
, deploy
|
deploy,
|
||||||
, devshell
|
devshell,
|
||||||
, flake-utils-plus
|
flake-utils-plus,
|
||||||
, home-manager
|
home-manager,
|
||||||
, ...
|
...
|
||||||
}@inputs:
|
} @ inputs: let
|
||||||
let
|
|
||||||
|
|
||||||
tests = import ./src/tests.nix {inherit (nixlib) lib;};
|
tests = import ./src/tests.nix {inherit (nixlib) lib;};
|
||||||
|
|
||||||
internal-modules = import ./src/modules.nix {
|
internal-modules = import ./src/modules.nix {
|
||||||
@ -55,15 +52,13 @@
|
|||||||
inherit deploy;
|
inherit deploy;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkFlake =
|
mkFlake = let
|
||||||
let
|
|
||||||
mkFlake' = import ./src/mkFlake {
|
mkFlake' = import ./src/mkFlake {
|
||||||
inherit (nixlib) lib;
|
inherit (nixlib) lib;
|
||||||
inherit (flake-utils-plus.inputs) flake-utils;
|
inherit (flake-utils-plus.inputs) flake-utils;
|
||||||
inherit deploy devshell home-manager flake-utils-plus internal-modules tests;
|
inherit deploy devshell home-manager flake-utils-plus internal-modules tests;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
__functor = _: args: (mkFlake' args).flake;
|
__functor = _: args: (mkFlake' args).flake;
|
||||||
options = args: (mkFlake' args).options;
|
options = args: (mkFlake' args).options;
|
||||||
};
|
};
|
||||||
@ -77,25 +72,25 @@
|
|||||||
|
|
||||||
# Pass this flake(self) as "digga"
|
# Pass this flake(self) as "digga"
|
||||||
polyfillInputs = self.inputs // {digga = self;};
|
polyfillInputs = self.inputs // {digga = self;};
|
||||||
polyfillOutput = loc: nixlib.lib.genAttrs supportedSystems (system:
|
polyfillOutput = loc:
|
||||||
import loc { inherit system; inputs = polyfillInputs; }
|
nixlib.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
import loc {
|
||||||
|
inherit system;
|
||||||
|
inputs = polyfillInputs;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
# .. we hope you like this style.
|
# .. we hope you like this style.
|
||||||
# .. it's adopted by a growing number of projects.
|
# .. it's adopted by a growing number of projects.
|
||||||
# Please consider adopting it if you want to help to improve flakes.
|
# Please consider adopting it if you want to help to improve flakes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# DEPRECATED - will be removed timely
|
# DEPRECATED - will be removed timely
|
||||||
deprecated = import ./deprecated.nix {
|
deprecated = import ./deprecated.nix {
|
||||||
inherit (nixlib) lib;
|
inherit (nixlib) lib;
|
||||||
inherit (self) nixosModules;
|
inherit (self) nixosModules;
|
||||||
inherit flake-utils-plus internal-modules importers;
|
inherit flake-utils-plus internal-modules importers;
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
# what you came for ...
|
# what you came for ...
|
||||||
lib = {
|
lib = {
|
||||||
inherit (flake-utils-plus.inputs.flake-utils.lib) defaultSystems eachSystem eachDefaultSystem filterPackages;
|
inherit (flake-utils-plus.inputs.flake-utils.lib) defaultSystems eachSystem eachDefaultSystem filterPackages;
|
||||||
@ -106,10 +101,11 @@
|
|||||||
inherit (generators) mkDeployNodes mkHomeConfigurations;
|
inherit (generators) mkDeployNodes mkHomeConfigurations;
|
||||||
|
|
||||||
# DEPRECATED - will be removed soon
|
# DEPRECATED - will be removed soon
|
||||||
inherit (deprecated)
|
inherit
|
||||||
|
(deprecated)
|
||||||
# Place any deprecated lib functions here
|
# Place any deprecated lib functions here
|
||||||
;
|
|
||||||
|
|
||||||
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
# a little extra service ...
|
# a little extra service ...
|
||||||
@ -129,5 +125,4 @@
|
|||||||
checks = polyfillOutput ./checks;
|
checks = polyfillOutput ./checks;
|
||||||
devShell = polyfillOutput ./devShell.nix;
|
devShell = polyfillOutput ./devShell.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
{ system ? builtins.currentSystem
|
{
|
||||||
, inputs ? (import ../.).inputs
|
system ? builtins.currentSystem,
|
||||||
}:
|
inputs ? (import ../.).inputs,
|
||||||
let
|
}: let
|
||||||
|
|
||||||
inherit (inputs) digga;
|
inherit (inputs) digga;
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
docOptions = digga.lib.mkFlake.options { self = { }; inputs = { }; };
|
docOptions = digga.lib.mkFlake.options {
|
||||||
|
self = {};
|
||||||
|
inputs = {};
|
||||||
|
};
|
||||||
evaledOptions = (pkgs.lib.evalModules {modules = [docOptions];}).options;
|
evaledOptions = (pkgs.lib.evalModules {modules = [docOptions];}).options;
|
||||||
|
|
||||||
mkDocPartMd = part: title: intro:
|
mkDocPartMd = part: title: intro:
|
||||||
@ -16,12 +18,10 @@ let
|
|||||||
|
|
||||||
${(
|
${(
|
||||||
pkgs.nixosOptionsDoc {options = evaledOptions.${part};}
|
pkgs.nixosOptionsDoc {options = evaledOptions.${part};}
|
||||||
).optionsMDDoc}
|
)
|
||||||
|
.optionsMDDoc}
|
||||||
'';
|
'';
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
mkApiReferenceTopLevel = pkgs.writeText "api-reference.md" ''
|
mkApiReferenceTopLevel = pkgs.writeText "api-reference.md" ''
|
||||||
# Top Level API
|
# Top Level API
|
||||||
`digga`'s top level API. API Containers are documented in their respective sub-chapter:
|
`digga`'s top level API. API Containers are documented in their respective sub-chapter:
|
||||||
@ -33,7 +33,8 @@ in
|
|||||||
|
|
||||||
${(pkgs.nixosOptionsDoc {
|
${(pkgs.nixosOptionsDoc {
|
||||||
options = {
|
options = {
|
||||||
inherit (evaledOptions)
|
inherit
|
||||||
|
(evaledOptions)
|
||||||
channelsConfig
|
channelsConfig
|
||||||
self
|
self
|
||||||
inputs
|
inputs
|
||||||
@ -41,7 +42,8 @@ in
|
|||||||
supportedSystems
|
supportedSystems
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
}).optionsMDDoc}
|
})
|
||||||
|
.optionsMDDoc}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkApiReferenceChannels = mkDocPartMd "channels" "Channels API Container" ''
|
mkApiReferenceChannels = mkDocPartMd "channels" "Channels API Container" ''
|
||||||
@ -60,5 +62,4 @@ in
|
|||||||
mkApiReferenceNixos = mkDocPartMd "nixos" "NixOS API Container" ''
|
mkApiReferenceNixos = mkDocPartMd "nixos" "NixOS API Container" ''
|
||||||
Configure your nixos modules, profiles & suites.
|
Configure your nixos modules, profiles & suites.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
let
|
let
|
||||||
getFqdn = config:
|
getFqdn = config: let
|
||||||
let
|
|
||||||
net = config.networking;
|
net = config.networking;
|
||||||
fqdn =
|
fqdn =
|
||||||
if net.domain != null
|
if net.domain != null
|
||||||
@ -9,21 +8,32 @@ let
|
|||||||
in
|
in
|
||||||
fqdn;
|
fqdn;
|
||||||
|
|
||||||
protoModule = fullHostConfig: { config, lib, modulesPath, suites, self, inputs, ... }@args: {
|
protoModule = fullHostConfig: {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
suites,
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
} @ args: {
|
||||||
imports = ["${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"];
|
imports = ["${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"];
|
||||||
|
|
||||||
isoImage.isoBaseName = "bootstrap-" + (getFqdn config);
|
isoImage.isoBaseName = "bootstrap-" + (getFqdn config);
|
||||||
isoImage.contents = [{
|
isoImage.contents = [
|
||||||
|
{
|
||||||
source = self;
|
source = self;
|
||||||
target = "/devos/";
|
target = "/devos/";
|
||||||
}];
|
}
|
||||||
isoImage.storeContents = [
|
];
|
||||||
|
isoImage.storeContents =
|
||||||
|
[
|
||||||
self.devShell.${config.nixpkgs.system}
|
self.devShell.${config.nixpkgs.system}
|
||||||
# include also closures that are "switched off" by the
|
# include also closures that are "switched off" by the
|
||||||
# above profile filter on the local config attribute
|
# above profile filter on the local config attribute
|
||||||
fullHostConfig.system.build.toplevel
|
fullHostConfig.system.build.toplevel
|
||||||
] ++ builtins.attrValues inputs;
|
]
|
||||||
|
++ builtins.attrValues inputs;
|
||||||
# still pull in tools of deactivated profiles
|
# still pull in tools of deactivated profiles
|
||||||
environment.systemPackages = fullHostConfig.environment.systemPackages;
|
environment.systemPackages = fullHostConfig.environment.systemPackages;
|
||||||
|
|
||||||
@ -63,12 +73,16 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{ config, ... }:
|
{config, ...}: {
|
||||||
{
|
|
||||||
system.build = {
|
system.build = {
|
||||||
bootstrapIso = (config.lib.digga.mkBuild
|
bootstrapIso =
|
||||||
|
(
|
||||||
|
config.lib.digga.mkBuild
|
||||||
(protoModule config)
|
(protoModule config)
|
||||||
).config.system.build.isoImage;
|
)
|
||||||
|
.config
|
||||||
|
.system
|
||||||
|
.build
|
||||||
|
.isoImage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
{ lib, ... }:
|
{lib, ...}: let
|
||||||
let
|
|
||||||
|
|
||||||
experimental-features = [
|
experimental-features = [
|
||||||
"flakes"
|
"flakes"
|
||||||
"nix-command"
|
"nix-command"
|
||||||
@ -13,9 +11,7 @@ let
|
|||||||
"nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4="
|
"nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4="
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
];
|
];
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
# package and option is from fup
|
# package and option is from fup
|
||||||
nix.generateRegistryFromInputs = lib.mkDefault true;
|
nix.generateRegistryFromInputs = lib.mkDefault true;
|
||||||
|
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
{inputs}: {
|
{inputs}: {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{ lib, deploy }:
|
{
|
||||||
let
|
lib,
|
||||||
getFqdn = c:
|
deploy,
|
||||||
let
|
}: let
|
||||||
|
getFqdn = c: let
|
||||||
net = c.config.networking;
|
net = c.config.networking;
|
||||||
fqdn =
|
fqdn =
|
||||||
if net.domain != null
|
if net.domain != null
|
||||||
@ -9,36 +10,35 @@ let
|
|||||||
else net.hostName;
|
else net.hostName;
|
||||||
in
|
in
|
||||||
fqdn;
|
fqdn;
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
mkHomeConfigurations = nixosConfigurations:
|
mkHomeConfigurations = nixosConfigurations:
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: mkHomeConfigurations _nixosConfigurations_
|
Synopsis: mkHomeConfigurations _nixosConfigurations_
|
||||||
|
|
||||||
Generate the `homeConfigurations` attribute expected by
|
Generate the `homeConfigurations` attribute expected by
|
||||||
`home-manager` cli from _nixosConfigurations_ in the form
|
`home-manager` cli from _nixosConfigurations_ in the form
|
||||||
_user@hostname_.
|
_user@hostname_.
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
let
|
let
|
||||||
op = attrs: c:
|
op = attrs: c:
|
||||||
attrs
|
attrs
|
||||||
//
|
// (
|
||||||
(
|
|
||||||
lib.mapAttrs'
|
lib.mapAttrs'
|
||||||
(user: v: {
|
(user: v: {
|
||||||
name = "${user}@${getFqdn c}";
|
name = "${user}@${getFqdn c}";
|
||||||
value = v.home;
|
value = v.home;
|
||||||
})
|
})
|
||||||
c.config.home-manager.users
|
c.config.home-manager.users
|
||||||
)
|
);
|
||||||
;
|
|
||||||
mkHmConfigs = lib.foldl op {};
|
mkHmConfigs = lib.foldl op {};
|
||||||
in
|
in
|
||||||
mkHmConfigs (builtins.attrValues nixosConfigurations);
|
mkHmConfigs (builtins.attrValues nixosConfigurations);
|
||||||
|
|
||||||
mkDeployNodes = hosts: extraConfig:
|
mkDeployNodes = hosts: extraConfig:
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: mkNodes _nixosConfigurations_
|
Synopsis: mkNodes _nixosConfigurations_
|
||||||
|
|
||||||
Generate the `nodes` attribute expected by deploy-rs
|
Generate the `nodes` attribute expected by deploy-rs
|
||||||
@ -57,11 +57,12 @@ in
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
lib.recursiveUpdate
|
lib.recursiveUpdate
|
||||||
(lib.mapAttrs
|
(lib.mapAttrs
|
||||||
(_: c:
|
(
|
||||||
{
|
_: c: {
|
||||||
hostname = getFqdn c;
|
hostname = getFqdn c;
|
||||||
profiles.system = {
|
profiles.system = {
|
||||||
user = "root";
|
user = "root";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ lib }:
|
{lib}: let
|
||||||
let
|
|
||||||
flattenTree =
|
flattenTree =
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: flattenTree _tree_
|
Synopsis: flattenTree _tree_
|
||||||
|
|
||||||
Flattens a _tree_ of the shape that is produced by rakeLeaves.
|
Flattens a _tree_ of the shape that is produced by rakeLeaves.
|
||||||
@ -27,39 +27,40 @@ let
|
|||||||
"a.b.c" = <path>;
|
"a.b.c" = <path>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
**/
|
*
|
||||||
tree:
|
*/
|
||||||
let
|
tree: let
|
||||||
op = sum: path: val:
|
op = sum: path: val: let
|
||||||
let
|
|
||||||
pathStr = builtins.concatStringsSep "." path; # dot-based reverse DNS notation
|
pathStr = builtins.concatStringsSep "." path; # dot-based reverse DNS notation
|
||||||
in
|
in
|
||||||
if builtins.isPath val then
|
if builtins.isPath val
|
||||||
|
then
|
||||||
# builtins.trace "${toString val} is a path"
|
# builtins.trace "${toString val} is a path"
|
||||||
(sum // {
|
(sum
|
||||||
|
// {
|
||||||
"${pathStr}" = val;
|
"${pathStr}" = val;
|
||||||
})
|
})
|
||||||
else if builtins.isAttrs val then
|
else if builtins.isAttrs val
|
||||||
|
then
|
||||||
# builtins.trace "${builtins.toJSON val} is an attrset"
|
# builtins.trace "${builtins.toJSON val} is an attrset"
|
||||||
# recurse into that attribute set
|
# recurse into that attribute set
|
||||||
(recurse sum path val)
|
(recurse sum path val)
|
||||||
else
|
else
|
||||||
# ignore that value
|
# ignore that value
|
||||||
# builtins.trace "${toString path} is something else"
|
# builtins.trace "${toString path} is something else"
|
||||||
sum
|
sum;
|
||||||
;
|
|
||||||
|
|
||||||
recurse = sum: path: val:
|
recurse = sum: path: val:
|
||||||
builtins.foldl'
|
builtins.foldl'
|
||||||
(sum: key: op sum (path ++ [key]) val.${key})
|
(sum: key: op sum (path ++ [key]) val.${key})
|
||||||
sum
|
sum
|
||||||
(builtins.attrNames val)
|
(builtins.attrNames val);
|
||||||
;
|
|
||||||
in
|
in
|
||||||
recurse {} [] tree;
|
recurse {} [] tree;
|
||||||
|
|
||||||
rakeLeaves =
|
rakeLeaves =
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: rakeLeaves _path_
|
Synopsis: rakeLeaves _path_
|
||||||
|
|
||||||
Recursively collect the nix files of _path_ into attrs.
|
Recursively collect the nix files of _path_ into attrs.
|
||||||
@ -88,21 +89,20 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
**/
|
*
|
||||||
dirPath:
|
*/
|
||||||
let
|
dirPath: let
|
||||||
seive = file: type:
|
seive = file: type:
|
||||||
# Only rake `.nix` files or directories
|
# Only rake `.nix` files or directories
|
||||||
(type == "regular" && lib.hasSuffix ".nix" file) || (type == "directory")
|
(type == "regular" && lib.hasSuffix ".nix" file) || (type == "directory");
|
||||||
;
|
|
||||||
|
|
||||||
collect = file: type: {
|
collect = file: type: {
|
||||||
name = lib.removeSuffix ".nix" file;
|
name = lib.removeSuffix ".nix" file;
|
||||||
value =
|
value = let
|
||||||
let
|
|
||||||
path = dirPath + "/${file}";
|
path = dirPath + "/${file}";
|
||||||
in
|
in
|
||||||
if (type == "regular")
|
if
|
||||||
|
(type == "regular")
|
||||||
|| (type == "directory" && builtins.pathExists (path + "/default.nix"))
|
|| (type == "directory" && builtins.pathExists (path + "/default.nix"))
|
||||||
then path
|
then path
|
||||||
# recurse on directories that don't contain a `default.nix`
|
# recurse on directories that don't contain a `default.nix`
|
||||||
@ -112,13 +112,10 @@ let
|
|||||||
files = lib.filterAttrs seive (builtins.readDir dirPath);
|
files = lib.filterAttrs seive (builtins.readDir dirPath);
|
||||||
in
|
in
|
||||||
lib.filterAttrs (n: v: v != {}) (lib.mapAttrs' collect files);
|
lib.filterAttrs (n: v: v != {}) (lib.mapAttrs' collect files);
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit rakeLeaves flattenTree;
|
inherit rakeLeaves flattenTree;
|
||||||
|
|
||||||
importOverlays = dir:
|
importOverlays = dir: {
|
||||||
{
|
|
||||||
# Meant to output a module that sets the overlays option
|
# Meant to output a module that sets the overlays option
|
||||||
# overlays order matters. mkAfter ensures those in-house
|
# overlays order matters. mkAfter ensures those in-house
|
||||||
# overlays are loaded later (after external ones), so the latter
|
# overlays are loaded later (after external ones), so the latter
|
||||||
@ -126,19 +123,16 @@ in
|
|||||||
overlays = lib.mkAfter (builtins.attrValues (flattenTree (rakeLeaves dir)));
|
overlays = lib.mkAfter (builtins.attrValues (flattenTree (rakeLeaves dir)));
|
||||||
};
|
};
|
||||||
|
|
||||||
importExportableModules = dir:
|
importExportableModules = dir: {
|
||||||
{
|
|
||||||
# Meant to output a module that sets the modules option
|
# Meant to output a module that sets the modules option
|
||||||
exportedModules = builtins.attrValues (flattenTree (rakeLeaves dir));
|
exportedModules = builtins.attrValues (flattenTree (rakeLeaves dir));
|
||||||
};
|
};
|
||||||
|
|
||||||
importHosts = dir:
|
importHosts = dir: {
|
||||||
{
|
|
||||||
# Meant to output a module that sets the hosts option (including constructed host names)
|
# Meant to output a module that sets the hosts option (including constructed host names)
|
||||||
hosts = lib.mapAttrs
|
hosts =
|
||||||
|
lib.mapAttrs
|
||||||
(n: v: {modules = [v];})
|
(n: v: {modules = [v];})
|
||||||
(flattenTree (rakeLeaves dir));
|
(flattenTree (rakeLeaves dir));
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
{ lib, deploy, devshell, home-manager, flake-utils-plus, flake-utils, internal-modules, tests } @ injectedDeps:
|
{
|
||||||
|
lib,
|
||||||
{ self, inputs, ... } @ args:
|
deploy,
|
||||||
let
|
devshell,
|
||||||
|
home-manager,
|
||||||
|
flake-utils-plus,
|
||||||
|
flake-utils,
|
||||||
|
internal-modules,
|
||||||
|
tests,
|
||||||
|
} @ injectedDeps: {
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
# avoid infinite recursions w.r.t. using self or inputs in imports
|
# avoid infinite recursions w.r.t. using self or inputs in imports
|
||||||
injectedDeps' = injectedDeps // {inherit self inputs;};
|
injectedDeps' = injectedDeps // {inherit self inputs;};
|
||||||
|
|
||||||
@ -14,15 +24,11 @@ let
|
|||||||
defaultOutputsBuilder = defaultOutputsBuilder' evaled.config;
|
defaultOutputsBuilder = defaultOutputsBuilder' evaled.config;
|
||||||
|
|
||||||
extraArgs = removeAttrs args (builtins.attrNames evaled.options);
|
extraArgs = removeAttrs args (builtins.attrNames evaled.options);
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
flake = fupAdapter' {
|
flake = fupAdapter' {
|
||||||
inherit (evaled) config;
|
inherit (evaled) config;
|
||||||
inherit extraArgs defaultOutputsBuilder;
|
inherit extraArgs defaultOutputsBuilder;
|
||||||
};
|
};
|
||||||
|
|
||||||
options = options';
|
options = options';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
# constructor dependencies
|
# constructor dependencies
|
||||||
{ lib, self, inputs, flake-utils-plus, internal-modules, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
flake-utils-plus,
|
||||||
|
internal-modules,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# evaluated digga configuration
|
# evaluated digga configuration
|
||||||
config
|
config,
|
||||||
# extra arguments that are passed down to fup
|
# extra arguments that are passed down to fup
|
||||||
, extraArgs
|
extraArgs,
|
||||||
# pass a custom default fup outputs builder
|
# pass a custom default fup outputs builder
|
||||||
, defaultOutputsBuilder
|
defaultOutputsBuilder,
|
||||||
}:
|
}: let
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
sharedOverlays = [
|
sharedOverlays = [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
__dontExport = true;
|
__dontExport = true;
|
||||||
@ -31,7 +33,9 @@ let
|
|||||||
hmUsers = config.home.users;
|
hmUsers = config.home.users;
|
||||||
})
|
})
|
||||||
({...} @ args: {
|
({...} @ args: {
|
||||||
lib.specialArgs = args.specialArgs or (builtins.trace ''
|
lib.specialArgs =
|
||||||
|
args.specialArgs
|
||||||
|
or (builtins.trace ''
|
||||||
WARNING: specialArgs is not accessibly by the module system which means you
|
WARNING: specialArgs is not accessibly by the module system which means you
|
||||||
are likely using NixOS 20.09. Profiles testing and custom builds (ex: iso)
|
are likely using NixOS 20.09. Profiles testing and custom builds (ex: iso)
|
||||||
are not supported in 20.09 and using them could result in infinite
|
are not supported in 20.09 and using them could result in infinite
|
||||||
@ -41,16 +45,22 @@ let
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
unifyOverlays = channels: map (o: if builtins.isFunction (o null null) then o channels else o);
|
unifyOverlays = channels:
|
||||||
|
map (o:
|
||||||
|
if builtins.isFunction (o null null)
|
||||||
|
then o channels
|
||||||
|
else o);
|
||||||
|
|
||||||
stripChannel = channel: removeAttrs channel [
|
stripChannel = channel:
|
||||||
|
removeAttrs channel [
|
||||||
# arguments in our channels api that shouldn't be passed to fup
|
# arguments in our channels api that shouldn't be passed to fup
|
||||||
"overlays"
|
"overlays"
|
||||||
];
|
];
|
||||||
|
|
||||||
# evalArgs sets channelName and system to null by default
|
# evalArgs sets channelName and system to null by default
|
||||||
# but for proper default handling in fup, null args have to be removed
|
# but for proper default handling in fup, null args have to be removed
|
||||||
stripHost = args: removeAttrs (lib.filterAttrs (_: arg: arg != null) args) [
|
stripHost = args:
|
||||||
|
removeAttrs (lib.filterAttrs (_: arg: arg != null) args) [
|
||||||
# arguments in our hosts/hostDefaults api that shouldn't be passed to fup
|
# arguments in our hosts/hostDefaults api that shouldn't be passed to fup
|
||||||
"externalModules" # TODO: remove deprecated option
|
"externalModules" # TODO: remove deprecated option
|
||||||
"exportedModules"
|
"exportedModules"
|
||||||
@ -58,16 +68,21 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
diggaFupArgs = {
|
diggaFupArgs = {
|
||||||
inherit (config)
|
inherit
|
||||||
|
(config)
|
||||||
channelsConfig
|
channelsConfig
|
||||||
supportedSystems;
|
supportedSystems
|
||||||
|
;
|
||||||
inherit self inputs sharedOverlays;
|
inherit self inputs sharedOverlays;
|
||||||
|
|
||||||
hosts = builtins.mapAttrs (_: stripHost) config.nixos.hosts;
|
hosts = builtins.mapAttrs (_: stripHost) config.nixos.hosts;
|
||||||
|
|
||||||
channels = builtins.mapAttrs
|
channels =
|
||||||
(name: channel:
|
builtins.mapAttrs
|
||||||
stripChannel (channel // {
|
(
|
||||||
|
name: channel:
|
||||||
|
stripChannel (channel
|
||||||
|
// {
|
||||||
# pass channels if "overlay" has three arguments
|
# pass channels if "overlay" has three arguments
|
||||||
overlaysBuilder = channels: unifyOverlays channels channel.overlays;
|
overlaysBuilder = channels: unifyOverlays channels channel.overlays;
|
||||||
})
|
})
|
||||||
@ -96,9 +111,7 @@ let
|
|||||||
|
|
||||||
outputsBuilder = channels:
|
outputsBuilder = channels:
|
||||||
flake-utils-plus.lib.mergeAny (defaultOutputsBuilder channels) (config.outputsBuilder channels);
|
flake-utils-plus.lib.mergeAny (defaultOutputsBuilder channels) (config.outputsBuilder channels);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
flake-utils-plus.lib.mkFlake
|
flake-utils-plus.lib.mkFlake
|
||||||
(
|
(
|
||||||
|
@ -1,63 +1,73 @@
|
|||||||
# constructor dependencies
|
# constructor dependencies
|
||||||
{ lib, devshell, flake-utils, self, inputs, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
devshell,
|
||||||
|
flake-utils,
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
|
{config, ...}: let
|
||||||
{ config, ... }:
|
|
||||||
let
|
|
||||||
cfg = config;
|
cfg = config;
|
||||||
|
|
||||||
# #############
|
# #############
|
||||||
# Resolver
|
# Resolver
|
||||||
# #############
|
# #############
|
||||||
|
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: maybeImport <path|string or obj>
|
Synopsis: maybeImport <path|string or obj>
|
||||||
|
|
||||||
Returns an imported path or string or the object otherwise.
|
Returns an imported path or string or the object otherwise.
|
||||||
|
|
||||||
Use when you want to allow specifying an object directly or a path to it.
|
Use when you want to allow specifying an object directly or a path to it.
|
||||||
It saves the end user the additional import statement.
|
It saves the end user the additional import statement.
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
maybeImport = obj:
|
maybeImport = obj:
|
||||||
if (builtins.isPath obj || builtins.isString obj) then
|
if (builtins.isPath obj || builtins.isString obj)
|
||||||
import obj
|
then import obj
|
||||||
else obj
|
else obj;
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: maybeImportDevshellToml <path|string or obj>
|
Synopsis: maybeImportDevshellToml <path|string or obj>
|
||||||
|
|
||||||
Returns an imported path or string if the filename ends in `toml` or the object or path otherwise.
|
Returns an imported path or string if the filename ends in `toml` or the object or path otherwise.
|
||||||
|
|
||||||
Use only for devshell modules, as an apply function.
|
Use only for devshell modules, as an apply function.
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
maybeImportDevshellToml = obj:
|
maybeImportDevshellToml = obj:
|
||||||
if ((builtins.isPath obj || builtins.isString obj) && lib.hasSuffix ".toml" obj) then
|
if ((builtins.isPath obj || builtins.isString obj) && lib.hasSuffix ".toml" obj)
|
||||||
devshell.lib.importTOML obj
|
then devshell.lib.importTOML obj
|
||||||
else obj
|
else obj;
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: pathToOr <type>
|
Synopsis: pathToOr <type>
|
||||||
|
|
||||||
Type resolver: types maybeImport's <obj>.
|
Type resolver: types maybeImport's <obj>.
|
||||||
|
|
||||||
Use in type declarations.
|
Use in type declarations.
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
pathToOr = elemType: with types; coercedTo path maybeImport elemType;
|
pathToOr = elemType: with types; coercedTo path maybeImport elemType;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
Synopsis: coercedListOf <type>
|
Synopsis: coercedListOf <type>
|
||||||
|
|
||||||
Type resolver & list flattner: flattens a (evtl. arbitrarily nested) list of type <type>.
|
Type resolver & list flattner: flattens a (evtl. arbitrarily nested) list of type <type>.
|
||||||
|
|
||||||
Use in type declarations.
|
Use in type declarations.
|
||||||
**/
|
*
|
||||||
coercedListOf = elemType: with types;
|
*/
|
||||||
|
coercedListOf = elemType:
|
||||||
|
with types;
|
||||||
coercedTo anything (x: flatten (singleton x)) (listOf elemType);
|
coercedTo anything (x: flatten (singleton x)) (listOf elemType);
|
||||||
|
|
||||||
|
|
||||||
# #############
|
# #############
|
||||||
# Custom Types
|
# Custom Types
|
||||||
# #############
|
# #############
|
||||||
@ -82,19 +92,27 @@ let
|
|||||||
description = "valid Nixpkgs overlay";
|
description = "valid Nixpkgs overlay";
|
||||||
});
|
});
|
||||||
|
|
||||||
systemType = (types.enum config.supportedSystems) // {
|
systemType =
|
||||||
|
(types.enum config.supportedSystems)
|
||||||
|
// {
|
||||||
description = "system defined in `supportedSystems`";
|
description = "system defined in `supportedSystems`";
|
||||||
};
|
};
|
||||||
|
|
||||||
channelType = (types.enum (builtins.attrNames config.channels)) // {
|
channelType =
|
||||||
|
(types.enum (builtins.attrNames config.channels))
|
||||||
|
// {
|
||||||
description = "channel defined in `channels`";
|
description = "channel defined in `channels`";
|
||||||
};
|
};
|
||||||
|
|
||||||
flakeType = with types; (addCheck attrs lib.isStorePath) // {
|
flakeType = with types;
|
||||||
|
(addCheck attrs lib.isStorePath)
|
||||||
|
// {
|
||||||
description = "nix flake";
|
description = "nix flake";
|
||||||
};
|
};
|
||||||
|
|
||||||
userType = with types; pathToOr moduleType // {
|
userType = with types;
|
||||||
|
pathToOr moduleType
|
||||||
|
// {
|
||||||
description = "HM user config";
|
description = "HM user config";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,17 +141,19 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
channelNameOpt = required: {
|
channelNameOpt = required: {
|
||||||
channelName = mkOption
|
channelName =
|
||||||
|
mkOption
|
||||||
{
|
{
|
||||||
description = ''
|
description = ''
|
||||||
Channel this host should follow
|
Channel this host should follow
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
//
|
// (
|
||||||
(
|
if required
|
||||||
if required then {
|
then {
|
||||||
type = with types; channelType;
|
type = with types; channelType;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
type = with types; nullOr channelType;
|
type = with types; nullOr channelType;
|
||||||
default = null;
|
default = null;
|
||||||
}
|
}
|
||||||
@ -190,7 +210,8 @@ let
|
|||||||
exportedModulesOpt = name: {exportedModules = mkOption (exportedModulesOpt' name);};
|
exportedModulesOpt = name: {exportedModules = mkOption (exportedModulesOpt' name);};
|
||||||
exportedDevshellModulesOpt = {
|
exportedDevshellModulesOpt = {
|
||||||
exportedModules = mkOption (
|
exportedModules = mkOption (
|
||||||
(exportedModulesOpt' "devshell") // {
|
(exportedModulesOpt' "devshell")
|
||||||
|
// {
|
||||||
type = with types; devshellModulesType;
|
type = with types; devshellModulesType;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -214,7 +235,11 @@ let
|
|||||||
Any modules that should be exported should be defined with the `exportedModules`
|
Any modules that should be exported should be defined with the `exportedModules`
|
||||||
option and all other modules should just go into the `modules` option.
|
option and all other modules should just go into the `modules` option.
|
||||||
'';
|
'';
|
||||||
legacyExternalModulesMod = { config, options, ... }: {
|
legacyExternalModulesMod = {
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
options = {
|
options = {
|
||||||
externalModules = mkOption {
|
externalModules = mkOption {
|
||||||
type = with types; modulesType;
|
type = with types; modulesType;
|
||||||
@ -299,8 +324,10 @@ let
|
|||||||
|
|
||||||
importablesOpt = {
|
importablesOpt = {
|
||||||
importables = mkOption {
|
importables = mkOption {
|
||||||
type = with types; submoduleWith {
|
type = with types;
|
||||||
modules = [{
|
submoduleWith {
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
freeformType = attrs;
|
freeformType = attrs;
|
||||||
options = {
|
options = {
|
||||||
suites = mkOption {
|
suites = mkOption {
|
||||||
@ -311,7 +338,8 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
default = {};
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
@ -334,28 +362,33 @@ let
|
|||||||
# Aggreagate types
|
# Aggreagate types
|
||||||
# #############
|
# #############
|
||||||
|
|
||||||
hostType = with types; attrsOf (submoduleWith {
|
hostType = with types;
|
||||||
|
attrsOf (submoduleWith {
|
||||||
modules = [
|
modules = [
|
||||||
# per-host modules not exported, no external modules
|
# per-host modules not exported, no external modules
|
||||||
{options = systemOpt // (channelNameOpt false) // modulesOpt // nixosTestOpt;}
|
{options = systemOpt // (channelNameOpt false) // modulesOpt // nixosTestOpt;}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
hostDefaultsType = name: with types; submoduleWith {
|
hostDefaultsType = name:
|
||||||
|
with types;
|
||||||
|
submoduleWith {
|
||||||
modules = [
|
modules = [
|
||||||
{options = systemOpt // (channelNameOpt true) // regularModulesOpt // (exportedModulesOpt name);}
|
{options = systemOpt // (channelNameOpt true) // regularModulesOpt // (exportedModulesOpt name);}
|
||||||
legacyExternalModulesMod
|
legacyExternalModulesMod
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosType = with types; submoduleWith {
|
nixosType = with types;
|
||||||
|
submoduleWith {
|
||||||
specialArgs = {inherit self inputs;};
|
specialArgs = {inherit self inputs;};
|
||||||
modules = [
|
modules = [
|
||||||
{options = (hostsOpt "nixos") // (hostDefaultsOpt "nixos") // importablesOpt;}
|
{options = (hostsOpt "nixos") // (hostDefaultsOpt "nixos") // importablesOpt;}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
homeType = with types; submoduleWith {
|
homeType = with types;
|
||||||
|
submoduleWith {
|
||||||
specialArgs = {inherit self inputs;};
|
specialArgs = {inherit self inputs;};
|
||||||
modules = [
|
modules = [
|
||||||
{options = regularModulesOpt // (exportedModulesOpt "home") // importablesOpt // usersOpt;}
|
{options = regularModulesOpt // (exportedModulesOpt "home") // importablesOpt // usersOpt;}
|
||||||
@ -363,7 +396,8 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
devshellType = with types; submoduleWith {
|
devshellType = with types;
|
||||||
|
submoduleWith {
|
||||||
specialArgs = {inherit self inputs;};
|
specialArgs = {inherit self inputs;};
|
||||||
modules = [
|
modules = [
|
||||||
{options = regularModulesOpt // exportedDevshellModulesOpt;}
|
{options = regularModulesOpt // exportedDevshellModulesOpt;}
|
||||||
@ -371,16 +405,15 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
channelsType = with types; attrsOf (submoduleWith {
|
channelsType = with types;
|
||||||
|
attrsOf (submoduleWith {
|
||||||
modules = [
|
modules = [
|
||||||
({name, ...}: {options = overlaysOpt // configOpt // (inputOpt name) // patchesOpt;})
|
({name, ...}: {options = overlaysOpt // configOpt // (inputOpt name) // patchesOpt;})
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
outputsBuilderType = with types; functionTo attrs;
|
outputsBuilderType = with types; functionTo attrs;
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
# this does not get propagated to submodules
|
# this does not get propagated to submodules
|
||||||
# to allow passing flake outputs directly to mkFlake
|
# to allow passing flake outputs directly to mkFlake
|
||||||
config._module.check = false;
|
config._module.check = false;
|
||||||
|
@ -1,20 +1,28 @@
|
|||||||
# constructor dependencies
|
# constructor dependencies
|
||||||
{ lib, self, inputs, deploy, devshell, home-manager, flake-utils-plus, tests, ... }:
|
{
|
||||||
config: channels:
|
lib,
|
||||||
let
|
self,
|
||||||
|
inputs,
|
||||||
|
deploy,
|
||||||
|
devshell,
|
||||||
|
home-manager,
|
||||||
|
flake-utils-plus,
|
||||||
|
tests,
|
||||||
|
...
|
||||||
|
}: config: channels: let
|
||||||
pkgs = channels.${config.nixos.hostDefaults.channelName};
|
pkgs = channels.${config.nixos.hostDefaults.channelName};
|
||||||
system = pkgs.system;
|
system = pkgs.system;
|
||||||
|
|
||||||
mkPortableHomeManagerConfiguration =
|
mkPortableHomeManagerConfiguration = {
|
||||||
{ username
|
username,
|
||||||
, configuration
|
configuration,
|
||||||
, pkgs
|
pkgs,
|
||||||
, system ? pkgs.system
|
system ? pkgs.system,
|
||||||
}:
|
}: let
|
||||||
let
|
|
||||||
homeDirectoryPrefix =
|
homeDirectoryPrefix =
|
||||||
if pkgs.stdenv.hostPlatform.isDarwin then "/Users" else "/home";
|
if pkgs.stdenv.hostPlatform.isDarwin
|
||||||
|
then "/Users"
|
||||||
|
else "/home";
|
||||||
homeDirectory = "${homeDirectoryPrefix}/${username}";
|
homeDirectory = "${homeDirectoryPrefix}/${username}";
|
||||||
in
|
in
|
||||||
home-manager.lib.homeManagerConfiguration {
|
home-manager.lib.homeManagerConfiguration {
|
||||||
@ -23,9 +31,11 @@ let
|
|||||||
extraModules = config.home.modules ++ config.home.exportedModules;
|
extraModules = config.home.modules ++ config.home.exportedModules;
|
||||||
extraSpecialArgs = config.home.importables // {inherit self inputs;};
|
extraSpecialArgs = config.home.importables // {inherit self inputs;};
|
||||||
|
|
||||||
configuration = {
|
configuration =
|
||||||
|
{
|
||||||
imports = [configuration];
|
imports = [configuration];
|
||||||
} // (
|
}
|
||||||
|
// (
|
||||||
if pkgs.stdenv.hostPlatform.isLinux
|
if pkgs.stdenv.hostPlatform.isLinux
|
||||||
then {targets.genericLinux.enable = true;}
|
then {targets.genericLinux.enable = true;}
|
||||||
else {}
|
else {}
|
||||||
@ -34,22 +44,19 @@ let
|
|||||||
|
|
||||||
homeConfigurationsPortable =
|
homeConfigurationsPortable =
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(n: v: mkPortableHomeManagerConfiguration {
|
(n: v:
|
||||||
|
mkPortableHomeManagerConfiguration {
|
||||||
username = n;
|
username = n;
|
||||||
configuration = v;
|
configuration = v;
|
||||||
inherit pkgs system;
|
inherit pkgs system;
|
||||||
})
|
})
|
||||||
config.home.users;
|
config.home.users;
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
inherit homeConfigurationsPortable;
|
inherit homeConfigurationsPortable;
|
||||||
|
|
||||||
packages = flake-utils-plus.lib.exportPackages self.overlays channels;
|
packages = flake-utils-plus.lib.exportPackages self.overlays channels;
|
||||||
|
|
||||||
devShell =
|
devShell = let
|
||||||
let
|
|
||||||
eval = import "${devshell}/modules" pkgs;
|
eval = import "${devshell}/modules" pkgs;
|
||||||
configuration = {
|
configuration = {
|
||||||
name = lib.mkDefault config.nixos.hostDefaults.channelName;
|
name = lib.mkDefault config.nixos.hostDefaults.channelName;
|
||||||
@ -59,56 +66,64 @@ in
|
|||||||
(eval {
|
(eval {
|
||||||
inherit configuration;
|
inherit configuration;
|
||||||
extraSpecialArgs = {inherit self inputs;};
|
extraSpecialArgs = {inherit self inputs;};
|
||||||
}).shell;
|
})
|
||||||
|
.shell;
|
||||||
|
|
||||||
checks =
|
checks =
|
||||||
(
|
(
|
||||||
# for self.homeConfigurations if present & non empty
|
# for self.homeConfigurations if present & non empty
|
||||||
if (
|
if
|
||||||
(builtins.hasAttr "homeConfigurations" self) &&
|
(
|
||||||
(self.homeConfigurations != { })
|
(builtins.hasAttr "homeConfigurations" self)
|
||||||
) then
|
&& (self.homeConfigurations != {})
|
||||||
let
|
)
|
||||||
|
then let
|
||||||
seive = _: v: v.system == system; # only test for the appropriate system
|
seive = _: v: v.system == system; # only test for the appropriate system
|
||||||
collectActivationPackages = n: v: { name = "user-" + n; value = v.activationPackage; };
|
collectActivationPackages = n: v: {
|
||||||
|
name = "user-" + n;
|
||||||
|
value = v.activationPackage;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.filterAttrs seive (lib.mapAttrs' collectActivationPackages self.homeConfigurations)
|
lib.filterAttrs seive (lib.mapAttrs' collectActivationPackages self.homeConfigurations)
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
//
|
// (
|
||||||
(
|
|
||||||
# for portableHomeConfigurations if present & non empty
|
# for portableHomeConfigurations if present & non empty
|
||||||
if (
|
if (homeConfigurationsPortable != {})
|
||||||
(homeConfigurationsPortable != { })
|
then let
|
||||||
) then
|
collectActivationPackages = n: v: {
|
||||||
let
|
name = "user-" + n;
|
||||||
collectActivationPackages = n: v: { name = "user-" + n; value = v.activationPackage; };
|
value = v.activationPackage;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.mapAttrs' collectActivationPackages homeConfigurationsPortable
|
lib.mapAttrs' collectActivationPackages homeConfigurationsPortable
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
//
|
// (
|
||||||
(
|
|
||||||
# for self.deploy if present & non-empty
|
# for self.deploy if present & non-empty
|
||||||
if (
|
if
|
||||||
(builtins.hasAttr "deploy" self) &&
|
(
|
||||||
(self.deploy != { })
|
(builtins.hasAttr "deploy" self)
|
||||||
) then
|
&& (self.deploy != {})
|
||||||
let
|
)
|
||||||
|
then let
|
||||||
deployChecks = deploy.lib.${system}.deployChecks self.deploy;
|
deployChecks = deploy.lib.${system}.deployChecks self.deploy;
|
||||||
renameOp = n: v: { name = "deploy-" + n; value = deployChecks.${n}; };
|
renameOp = n: v: {
|
||||||
|
name = "deploy-" + n;
|
||||||
|
value = deployChecks.${n};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.mapAttrs' renameOp deployChecks
|
lib.mapAttrs' renameOp deployChecks
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
//
|
// (
|
||||||
(
|
|
||||||
# for self.nixosConfigurations if present & non-empty
|
# for self.nixosConfigurations if present & non-empty
|
||||||
if (
|
if
|
||||||
(builtins.hasAttr "nixosConfigurations" self) &&
|
(
|
||||||
(self.nixosConfigurations != { })
|
(builtins.hasAttr "nixosConfigurations" self)
|
||||||
) then
|
&& (self.nixosConfigurations != {})
|
||||||
let
|
)
|
||||||
|
then let
|
||||||
systemSieve = _: host: host.config.nixpkgs.system == system;
|
systemSieve = _: host: host.config.nixpkgs.system == system;
|
||||||
hostConfigsOnThisSystem = lib.filterAttrs systemSieve self.nixosConfigurations;
|
hostConfigsOnThisSystem = lib.filterAttrs systemSieve self.nixosConfigurations;
|
||||||
|
|
||||||
@ -122,8 +137,7 @@ in
|
|||||||
value = tests.mkTest host test;
|
value = tests.mkTest host test;
|
||||||
};
|
};
|
||||||
|
|
||||||
createCustomTestsOp = n: host:
|
createCustomTestsOp = n: host: let
|
||||||
let
|
|
||||||
op = createCustomTestOp n host;
|
op = createCustomTestOp n host;
|
||||||
in
|
in
|
||||||
builtins.listToAttrs (map op config.nixos.hosts.${n}.tests);
|
builtins.listToAttrs (map op config.nixos.hosts.${n}.tests);
|
||||||
@ -132,11 +146,8 @@ in
|
|||||||
if (hostConfigsOnThisSystem != [])
|
if (hostConfigsOnThisSystem != [])
|
||||||
then lib.foldl (a: b: a // b) {} (lib.attrValues (lib.mapAttrs createCustomTestsOp hostConfigsOnThisSystem))
|
then lib.foldl (a: b: a // b) {} (lib.attrValues (lib.mapAttrs createCustomTestsOp hostConfigsOnThisSystem))
|
||||||
else {};
|
else {};
|
||||||
|
|
||||||
in
|
in
|
||||||
customTests
|
customTests
|
||||||
else {}
|
else {}
|
||||||
)
|
);
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{ lib }:
|
{lib}: {
|
||||||
{
|
hmNixosDefaults = {
|
||||||
hmNixosDefaults = { specialArgs, modules }:
|
specialArgs,
|
||||||
{ options, ... }: {
|
modules,
|
||||||
|
}: {options, ...}: {
|
||||||
config = lib.optionalAttrs (options ? home-manager) {
|
config = lib.optionalAttrs (options ? home-manager) {
|
||||||
home-manager = {
|
home-manager = {
|
||||||
# always use the system nixpkgs from the host's channel
|
# always use the system nixpkgs from the host's channel
|
||||||
@ -15,8 +16,12 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
globalDefaults = { hmUsers }:
|
globalDefaults = {hmUsers}: {
|
||||||
{ config, pkgs, self, ... }: {
|
config,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
users.mutableUsers = lib.mkDefault false;
|
users.mutableUsers = lib.mkDefault false;
|
||||||
|
|
||||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||||
|
@ -1,29 +1,22 @@
|
|||||||
{ lib }:
|
{lib}: let
|
||||||
let
|
|
||||||
|
|
||||||
maybeImport = obj:
|
maybeImport = obj:
|
||||||
if (builtins.isPath obj || builtins.isString obj) then
|
if (builtins.isPath obj || builtins.isString obj)
|
||||||
import obj
|
then import obj
|
||||||
else obj
|
else obj;
|
||||||
;
|
|
||||||
|
|
||||||
maybeCallTest = pkgs: obj:
|
maybeCallTest = pkgs: obj:
|
||||||
if lib.isFunction obj then
|
if lib.isFunction obj
|
||||||
pkgs.callPackage obj { }
|
then pkgs.callPackage obj {}
|
||||||
else obj
|
else obj;
|
||||||
;
|
|
||||||
|
|
||||||
|
mkTest = host: test: let
|
||||||
mkTest = host: test:
|
|
||||||
let
|
|
||||||
pkgs = host._module.args.pkgs;
|
pkgs = host._module.args.pkgs;
|
||||||
nixosTesting =
|
nixosTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
||||||
(import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
inherit (host.config.lib) specialArgs;
|
inherit (host.config.lib) specialArgs;
|
||||||
extraConfigurations = host._module.args.modules;
|
extraConfigurations = host._module.args.modules;
|
||||||
});
|
};
|
||||||
in
|
in
|
||||||
nixosTesting.makeTest (maybeCallTest pkgs (maybeImport test));
|
nixosTesting.makeTest (maybeCallTest pkgs (maybeImport test));
|
||||||
|
|
||||||
@ -31,9 +24,9 @@ let
|
|||||||
name = "allProfiles";
|
name = "allProfiles";
|
||||||
|
|
||||||
machine = {suites ? null, ...}: {
|
machine = {suites ? null, ...}: {
|
||||||
imports =
|
imports = let
|
||||||
let
|
allProfiles =
|
||||||
allProfiles = lib.foldl
|
lib.foldl
|
||||||
(lhs: rhs: lhs ++ rhs) []
|
(lhs: rhs: lhs ++ rhs) []
|
||||||
(builtins.attrValues suites);
|
(builtins.attrValues suites);
|
||||||
in
|
in
|
||||||
@ -44,5 +37,4 @@ let
|
|||||||
machines[0].systemctl("is-system-running --wait")
|
machines[0].systemctl("is-system-running --wait")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in {inherit mkTest allProfilesTest;}
|
||||||
{ inherit mkTest allProfilesTest; }
|
|
||||||
|
Loading…
Reference in New Issue
Block a user