Skip to content

Commit

Permalink
refactor(tests): use submodule instead
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed May 13, 2024
1 parent f4ccf03 commit 67327a5
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 451 deletions.
21 changes: 14 additions & 7 deletions src/mkHome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
# SPDX-License-Identifier: MIT

{ lib }:
userSet: shell: suites:
{
homeModule ? [ ],
user,
shell,
suites ? [ ],
}:
let
user = lib.head (lib.attrNames userSet);
userName = lib.head (lib.attrNames user);
pathsToLinkShell = lib.elem shell [
"fish"
"zsh"
Expand All @@ -17,8 +22,9 @@ let
in
{
imports =
[
{ users.users = userSet; }
lib.flatten [
homeModule
{ users.users = user; }
(
{ pkgs, lib, ... }:
{
Expand All @@ -29,17 +35,18 @@ in
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.useUserPackages = lib.mkDefault true;

home-manager.users.${user} = {
home-manager.users.${userName} = {
imports = lib.flatten [
suites
{ programs.${shell}.enable = true; }
];
home.stateVersion =
if pkgs.stdenv.isDarwin then pkgs.lib.trivial.release else "24.05";
};
users.users.${user} = {
users.users.${userName} = {
shell = pkgs."${shell}";
home = if pkgs.stdenv.isDarwin then "/Users/${user}" else "/home/${user}";
home =
if pkgs.stdenv.isDarwin then "/Users/${userName}" else "/home/${userName}";
};
}
enableDefaultShellProgram
Expand Down
16 changes: 16 additions & 0 deletions src/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,28 @@
POP,
flops,
haumea,
lib,
}:
(super.homeModules.addLoadExtender {
load = {
src = projectRoot + "/units/nixos/homeProfiles";
type = "nixosProfilesOmnibus";
transformer = [ (_: _: _) ];
inputsTransformer = [
(
self:
self
// (
let
system = if self ? system then self.system else throw "system is required";
in
{
isDarwin = lib.elem system lib.systems.doubles.darwin;
isLinux = lib.elem system lib.systems.doubles.linux;
}
)
)
];
};
}).addExporters
[
Expand Down
16 changes: 16 additions & 0 deletions src/pops/nixosProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@
projectRoot,
POP,
flops,
lib,
}:
(super.nixosModules.addLoadExtender {
load = {
src = projectRoot + "/units/nixos/nixosProfiles";
type = "nixosProfilesOmnibus";
transformer = [ (_: _: _) ];
inputsTransformer = [
(
self:
self
// (
let
system = if self ? system then self.system else throw "system is required";
in
{
isDarwin = lib.elem system lib.systems.doubles.darwin;
isLinux = lib.elem system lib.systems.doubles.linux;
}
)
)
];
};
}).addExporters
[
Expand Down
27 changes: 0 additions & 27 deletions tests/nixos/__fixture/__lock/flake.lock

This file was deleted.

14 changes: 0 additions & 14 deletions tests/nixos/__fixture/__lock/flake.nix

This file was deleted.

10 changes: 0 additions & 10 deletions tests/nixos/__fixture/__nixosProfiles/bootstrap.nix

This file was deleted.

62 changes: 0 additions & 62 deletions tests/nixos/__fixture/layouts.nix

This file was deleted.

20 changes: 0 additions & 20 deletions tests/nixos/__fixture/pops/flake.nix

This file was deleted.

34 changes: 0 additions & 34 deletions tests/nixos/__fixture/pops/homeModules.nix

This file was deleted.

44 changes: 0 additions & 44 deletions tests/nixos/__fixture/pops/homeProfiles.nix

This file was deleted.

46 changes: 0 additions & 46 deletions tests/nixos/__fixture/pops/nixosModules.nix

This file was deleted.

Loading

0 comments on commit 67327a5

Please sign in to comment.