summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock6
-rw-r--r--hosts/default.nix2
-rw-r--r--lib/ci.nix70
-rw-r--r--lib/configs.nix37
-rw-r--r--lib/default.nix18
-rw-r--r--modules/flake/ci.nix2
-rw-r--r--modules/flake/default.nix13
-rw-r--r--users/default.nix2
8 files changed, 8 insertions, 142 deletions
diff --git a/flake.lock b/flake.lock
index 55c5b45..c309461 100644
--- a/flake.lock
+++ b/flake.lock
@@ -206,11 +206,11 @@
]
},
"locked": {
- "lastModified": 1684934359,
- "narHash": "sha256-s/zULvLLUN/dvCrD46OoPHe2Cj9SIBrMjIK3imG8OyY=",
+ "lastModified": 1685041748,
+ "narHash": "sha256-naCyIPXKXhA4sHvgxZ+STWpS8CW9BtzmLEqwhrlLlsQ=",
"owner": "getchoo",
"repo": "nix-exprs",
- "rev": "b7b2ee0e077cb5f69efd3b3d665e73c6ffefd941",
+ "rev": "16589c6ef2cc52f66301a3227f945466942c9b65",
"type": "github"
},
"original": {
diff --git a/hosts/default.nix b/hosts/default.nix
index 1eafe16..863987e 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -7,7 +7,7 @@
}: {
flake = {
nixosConfigurations = let
- inherit (myLib.my) mkNixOS;
+ inherit (myLib.configs) mkNixOS;
profiles = import ./profiles.nix {inherit self inputs;};
in {
diff --git a/lib/ci.nix b/lib/ci.nix
deleted file mode 100644
index 36185f6..0000000
--- a/lib/ci.nix
+++ /dev/null
@@ -1,70 +0,0 @@
-lib: supportedSystems: let
- inherit (builtins) attrNames baseNameOf elem getContext head mapAttrs seq stringLength substring;
- inherit (lib) filterAttrs;
- check = string: elem string supportedSystems;
-in rec {
- # filters systems in basic flake output
- # ex:
- #
- # packages = {
- # x86_64-linux = {};
- # aarch64-linux = {};
- # x86_64-darwin = {};
- # aarch64-darwin = {};
- # };
- # mkCompatible packages -> {x86_64-linux = {}; aarch64-linux = {};}
- mkCompatible = filterAttrs (system: _: check system);
-
- # mkCompatible but for apps, since their attribute
- # also needs to be editied in order to be picked up
- # by hydra
- mkCompatibleApps = apps:
- mkCompatible (mapAttrs (
- _:
- mapAttrs (_: v: {
- program = let
- ctx = getContext v.program;
- drvPath = head (attrNames ctx);
- basename = baseNameOf drvPath;
- hashLength = 33;
- l = stringLength basename;
- in {
- name = substring hashLength (l - hashLength - 4) basename;
- type = "derivation";
- inherit drvPath;
- };
- })
- )
- apps);
-
- # mkCompatible but for formatters
- mkCompatibleFormatters = filterAttrs (system: fmt: check system && elem system (fmt.meta.platforms or []));
-
- # mkComaptible, but maps nixosConfigurations
- # to their toplevel build attribute so they can
- # be picked up by hydra
- mkCompatibleCfg = configs:
- filterAttrs (_: config: check config.system)
- (mapAttrs (_: v: v.config.system.build.toplevel) configs);
-
- # mkCompatibleCfg, but the toplevel build attribute
- # is only evaluated
- mkCompatibleCfg' = configs:
- filterAttrs (_: config: check config.system)
- (mapAttrs (_: v:
- seq
- v.config.system.build.toplevel
- v._module.args.pkgs.emptyFile)
- configs);
-
- # mkCompatible, but maps homeConfigurations
- # to their activationPackage so they can be
- # picked up by hydra
- mkCompatibleHM = configs:
- filterAttrs (system: _: check system)
- (mapAttrs (_: mapAttrs (_: deriv: deriv.activationPackage or {})) configs);
-
- # mkCompatible, but for packages
- # meta.platforms is also checked to ensure compatibility
- mkCompatiblePkgs = mapAttrs (system: filterAttrs (_: deriv: elem system (deriv.meta.platforms or [])));
-}
diff --git a/lib/configs.nix b/lib/configs.nix
deleted file mode 100644
index 8da37bc..0000000
--- a/lib/configs.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-inputs: {
- mkNixOS = {
- name,
- profile,
- modules ? profile.modules,
- system ? profile.system,
- specialArgs ? profile.specialArgs,
- }:
- profile.builder {
- inherit specialArgs system;
- modules =
- [../hosts/${name}]
- ++ (
- if modules == profile.modules
- then modules
- else modules ++ profile.modules
- );
- };
-
- mkHMUser = {
- name,
- modules ? [],
- pkgs ? import inputs.nixpkgs {system = "x86_64-linux";},
- extraSpecialArgs ? inputs,
- }:
- inputs.home-manager.lib.homeManagerConfiguration {
- inherit pkgs extraSpecialArgs;
- modules =
- [
- {
- programs.home-manager.enable = true;
- }
- ]
- ++ [../users/${name}/home.nix]
- ++ modules;
- };
-}
diff --git a/lib/default.nix b/lib/default.nix
deleted file mode 100644
index 67a102e..0000000
--- a/lib/default.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- lib,
- inputs,
-}: let
- configs = import ./configs.nix inputs;
-in
- lib.extend (_: _: {
- my = {
- inherit (configs) mkHMUser mkNixOS;
-
- ci = import ./ci.nix lib;
-
- mkFlakeFns = systems: nixpkgs: rec {
- forAllSystems = lib.genAttrs systems;
- nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
- };
- };
- })
diff --git a/modules/flake/ci.nix b/modules/flake/ci.nix
index 40f6b33..64d4f86 100644
--- a/modules/flake/ci.nix
+++ b/modules/flake/ci.nix
@@ -10,7 +10,7 @@
"aarch64-linux"
];
in
- with (myLib.my.ci supportedSystems); {
+ with (myLib.ci supportedSystems); {
# CA derivations don't work on hydra
#apps = mkCompatibleApps self.apps;
checks = mkCompatible self.checks;
diff --git a/modules/flake/default.nix b/modules/flake/default.nix
index 655ca47..6d0f194 100644
--- a/modules/flake/default.nix
+++ b/modules/flake/default.nix
@@ -1,20 +1,11 @@
-{
- inputs,
- self,
- ...
-}: {
+{inputs, ...}: {
imports = [
./ci.nix
./dev.nix
];
- _module.args.myLib = self.lib {
+ _module.args.myLib = inputs.getchoo.lib {
inherit inputs;
- inherit (inputs.nixpkgs) lib;
- };
-
- flake = {
- lib = import ../../lib;
};
systems = [
diff --git a/users/default.nix b/users/default.nix
index 78e2ee8..5c7c7d6 100644
--- a/users/default.nix
+++ b/users/default.nix
@@ -4,7 +4,7 @@
...
}: {
perSystem = {system, ...}: let
- inherit (myLib.my) mkHMUser;
+ inherit (myLib.configs) mkHMUser;
in {
homeConfigurations = {
seth = mkHMUser {