Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Dec 5, 2023
1 parent 78fe8a1 commit f3d77a2
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 11 deletions.
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
inputs.nixpkgs.follows = "nixpkgs-unstable";
};

darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};

nix-on-droid = {
url = "github:nix-community/nix-on-droid/release-23.05";
inputs.home-manager.follows = "home-manager";
Expand Down Expand Up @@ -82,7 +87,7 @@
nixcfgLib = import ./lib {
inherit inputs;
};
inherit (inputs.flake-utils.lib.system) x86_64-linux;
inherit (inputs.flake-utils.lib.system) aarch64-darwin aarch64-linux x86_64-linux;
inherit (nixpkgs.lib) listToAttrs;
in
with nixcfgLib;
Expand All @@ -91,16 +96,17 @@
import ./lib { inputs = inputs // self.inputs; };

homeConfigurations = listToAttrs [
(mkHome x86_64-linux "demo@non-nixos-vm")
(mkHome x86_64-linux "christian@non-nixos-vm")
(mkHome aarch64-darwin "christian@macos")
(mkHome x86_64-linux "christian@non-nixos")
(mkHome x86_64-linux "demo@non-nixos")
];

nixosConfigurations = listToAttrs [
(mkNixos x86_64-linux "nixos-vm")
(mkNixos x86_64-linux "nixos")
];

nixOnDroidConfigurations = listToAttrs [
(mkNixOnDroid "aarch64-linux" "nix-on-droid")
(mkNixOnDroid aarch64-linux "nix-on-droid")
];

apps = mkForEachSystem [
Expand Down Expand Up @@ -163,9 +169,10 @@
};
}))

(mkBuild "build-nixos-vm" self.nixosConfigurations.nixos-vm.config.system.build.toplevel)
(mkBuild "build-demo@non-nixos-vm" self.homeConfigurations."demo@non-nixos-vm".activationPackage)
(mkBuild "build-christian@non-nixos-vm" self.homeConfigurations."christian@non-nixos-vm".activationPackage)
(mkBuild "build-christian@macos" self.homeConfigurations."christian@macos".activationPackage)
(mkBuild "build-christian@non-nixos" self.homeConfigurations."christian@non-nixos".activationPackage)
(mkBuild "build-demo@non-nixos" self.homeConfigurations."demo@non-nixos".activationPackage)
(mkBuild "build-nixos" self.nixosConfigurations.nixos.config.system.build.toplevel)
];

devShells = mkForEachSystem [
Expand Down
8 changes: 7 additions & 1 deletion home/base/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{ config, lib, ... }:

let

inherit (config.custom.base.non-nixos) isDarwin;

in

{
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";
Expand All @@ -11,7 +17,7 @@
enableNixpkgsReleaseCheck = true;
};

xdg.userDirs = {
xdg.userDirs = lib.mkIf isDarwin {
enable = true;
createDirectories = true;
};
Expand Down
2 changes: 2 additions & 0 deletions home/base/non-nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ in
enable = mkEnableOption "Config for non NixOS systems";

installNix = mkEnableOption "Nix installation" // { default = true; };

isDarwin = mkEnableOption "Darwin architecture (MacOS)";
};
};

Expand Down
4 changes: 3 additions & 1 deletion home/roles/multimedia/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ let

cfg = config.custom.roles.multimedia;

inherit (config.custom.base.non-nixos) isDarwin;

in

{
Expand All @@ -26,6 +28,6 @@ in
};

programs.mpv.enable = true;
services.easyeffects.enable = true;
services.easyeffects.enable = !isDarwin;
};
}
22 changes: 22 additions & 0 deletions hosts/macos/home-christian.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
custom = {
base.non-nixos = {
enable = true;
isDarwin = true;
};

users.christian.enable = true;

roles = {
dev.enable = true;
graphics.enable = true;
homeage.enable = true;
multimedia.enable = true;
office.enable = true;
ops.enable = true;
web.enable = true;
};
};

home.stateVersion = import ./state-version.nix;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions hosts/non-nixos/state-version.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"23.11"
26 changes: 26 additions & 0 deletions lib/builders/mkNixDarwin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ inputs, system, pkgs, customLib, homeModules, name, ... }:

inputs.darwin.lib.darwinSystem {
inherit system;

specialArgs = {
inherit homeModules inputs;
};

modules = [
"${inputs.self}/hosts/${name}"

{
custom.base.hostname = name;

lib.custom = customLib;

nixpkgs = {
inherit pkgs;
};
}
]
++ customLib.getRecursiveDefaultNixFileList ../../nixos
++ customLib.getRecursiveDefaultNixFileList "${inputs.self}/nixos";
}

5 changes: 4 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ let

forEachSystem =
let
inherit (inputs.flake-utils.lib.system) aarch64-linux x86_64-linux;
inherit (inputs.flake-utils.lib.system) aarch64-darwin aarch64-linux x86_64-darwin x86_64-linux;
in
inputs.nixpkgs.lib.genAttrs [
aarch64-darwin
aarch64-linux
x86_64-darwin
x86_64-linux
];

Expand Down Expand Up @@ -91,5 +93,6 @@ in
mkGeneric = nameValuePairWrapper;
mkHome = simpleWrapper ./builders/mkHome.nix;
mkNixos = simpleWrapper ./builders/mkNixos.nix;
mkNixDarwin = simpleWrapper ./builders/mkNixDarwin.nix;
mkNixOnDroid = simpleWrapper ./builders/mkNixOnDroid.nix;
}

0 comments on commit f3d77a2

Please sign in to comment.