moving towards modules...

This commit is contained in:
Gerg-L 2023-02-20 22:28:01 -05:00
parent 32bf78aa36
commit f911f3f44d
18 changed files with 288 additions and 237 deletions

View file

@ -0,0 +1,6 @@
inputs: {
imports = [
(import ./nix.nix inputs)
(import ./x.nix inputs)
];
}

53
modules/common/nix.nix Normal file
View file

@ -0,0 +1,53 @@
{
nix,
unstable,
...
}: {
inputs,
lib,
self,
settings,
...
}: {
nix = {
# package = nix.packages.${pkgs.system}.nix;
#automatically get registry from input flakes
registry =
(
lib.attrsets.mapAttrs (
_: value: {
flake = value;
}
) (
lib.attrsets.filterAttrs (
_: value: (
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
)
)
inputs
)
// {
nixpkgs.flake = unstable;
system.flake = self;
}
)
// {system = {flake = self;};};
#automatically add registry entries to nixPath
nixPath = (lib.mapAttrsToList (name: value: name + "=" + value) inputs) ++ ["system=${self}" "nixpkgs=${unstable}"];
settings = {
experimental-features = ["nix-command" "flakes" "repl-flake"];
auto-optimise-store = true;
warn-dirty = false;
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}'';
keep-outputs = true;
keep-derivations = true;
trusted-users = [
"root"
"@wheel"
];
allowed-users = [
];
};
};
environment.etc."booted-system".source = self;
}

15
modules/common/x.nix Normal file
View file

@ -0,0 +1,15 @@
_: {
lib,
pkgs,
...
}:
with lib; {
services.xserver = {
exportConfiguration = mkDefault true;
layout = mkDefault "us";
libinput.enable = mkDefault true;
xautolock.enable = mkDefault false;
desktopManager.xterm.enable = mkDefault false;
excludePackages = mkDefault [pkgs.xterm];
};
}