Compare commits

...

10 commits

23 changed files with 225 additions and 160 deletions

102
flake.nix
View file

@ -2,107 +2,7 @@
description = "marleyOS";
outputs = inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
imports = [inputs.easy-hosts.flakeModule];
systems = [
"x86_64-nixos"
"aarch64-darwin"
];
### Nixpkgs Config ###
perSystem = {system, ...}: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = with inputs; [
lix.overlays.default
nur.overlays.default
agenix.overlays.default
niri-flake.overlays.niri
(import ./overlays/ddclient.nix)
(import ./overlays/firefox-addons {
inherit (inputs.nixpkgs) lib;
inherit inputs;
})
(import ./overlays/jetbrains.nix {inherit inputs;})
(import ./overlays/maple-mono-NF.nix)
(import ./overlays/marleyvim.nix {inherit inputs;})
(import ./overlays/wezterm.nix {inherit inputs;})
# Custom packages
(import ./overlays/marleyos.nix)
];
};
};
easyHosts = {
### Module Imports ###
shared.modules = with inputs; [
lix.nixosModules.default
agenix.nixosModules.default
{
home-manager.sharedModules = [
nixcord.homeModules.nixcord
];
}
];
perClass = class: {
modules = with inputs;
(nixpkgs.lib.optionals (class == "nixos") [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
stylix.nixosModules.default
niri-flake.nixosModules.niri
])
++ (nixpkgs.lib.optionals (class == "darwin") [
home-manager.darwinModules.home-manager
agenix.darwinModules.default
]);
};
hosts = {
### Desktop ###
nyx = {
arch = "x86_64";
class = "nixos";
};
### Macbook Air ###
mairley = {
arch = "aarch64";
class = "darwin";
nixpkgs = inputs.nixpkgs-darwin;
};
### Servers ###
marleycentre = {
arch = "x86_64";
class = "nixos";
};
marleynet = {
arch = "x86_64";
class = "nixos";
};
};
};
flake = {
### Custom Library ###
lib.marleyos = {
module = ./lib/module.nix;
};
};
};
inputs.flake-parts.lib.mkFlake {inherit inputs;} {imports = [./flake];};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";

38
flake/config.nix Normal file
View file

@ -0,0 +1,38 @@
{inputs, ...}: {
systems = [
"x86_64-linux"
"aarch64-darwin"
];
### Nixpkgs Config ###
perSystem = {system, ...}: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
# TODO: Move these to custom modules
overlays = with inputs; [
lix.overlays.default
nur.overlays.default
agenix.overlays.default
niri-flake.overlays.niri
(import ./overlays/ddclient.nix)
(import ./overlays/firefox-addons {
inherit (inputs.nixpkgs) lib;
inherit inputs;
})
(import ./overlays/jetbrains.nix {inherit inputs;})
(import ./overlays/maple-mono-NF.nix)
(import ./overlays/marleyvim.nix {inherit inputs;})
(import ./overlays/wezterm.nix {inherit inputs;})
# Custom packages
(import ./overlays/marleyos.nix)
];
};
};
}

7
flake/default.nix Normal file
View file

@ -0,0 +1,7 @@
{
imports = [
./config.nix
../hosts
];
}

68
hosts/default.nix Normal file
View file

@ -0,0 +1,68 @@
{
inputs,
self,
...
}: {
imports = [inputs.easy-hosts.flakeModule];
config.easy-hosts = {
shared.specialArgs.marleylib = import ../lib;
### Module Imports ###
# TODO: Move module imports to custom module
shared.modules = with inputs; [
lix.nixosModules.default
agenix.nixosModules.default
{
home-manager.sharedModules = [
nixcord.homeModules.nixcord
];
}
];
perClass = class: {
modules = ["${self}/modules/${class}/default.nix"];
# modules = with inputs;
# (nixpkgs.lib.optionals (class == "nixos") [
# home-manager.nixosModules.home-manager
# agenix.nixosModules.default
# stylix.nixosModules.stylix
# niri-flake.nixosModules.niri
# ])
# ++ (nixpkgs.lib.optionals (class == "darwin") [
# home-manager.darwinModules.home-manager
# agenix.darwinModules.default
# stylix.darwinModules.stylix
# ]);
};
hosts = {
### Desktop ###
nyx = {
arch = "x86_64";
class = "nixos";
};
### Macbook Air ###
mairley = {
arch = "aarch64";
class = "darwin";
nixpkgs = inputs.nixpkgs-darwin;
};
### Servers ###
marleycentre = {
arch = "x86_64";
class = "nixos";
};
marleynet = {
arch = "x86_64";
class = "nixos";
};
};
};
}

View file

@ -1,9 +1,9 @@
{
lib,
marleylib,
config,
...
}: let
inherit (lib.marleyos) enabled;
inherit (marleylib.module) enabled;
in {
networking = {
computerName = "mairley";
@ -12,13 +12,15 @@ in {
};
marleyos = {
appearance = {
base = enabled;
};
programs = {
fish = enabled;
wezterm = enabled;
};
profiles.desktop = enabled;
# appearance = {
# base = enabled;
# };
# programs = {
# fish = enabled;
# wezterm = enabled;
# };
};
users = {

View file

@ -1,12 +1,12 @@
{lib, ...}: let
inherit (lib.marleyos) enabled;
{marleylib, ...}: let
inherit (marleylib.module) enabled;
in {
imports = [./hardware-configuration.nix];
networking.hostName = "marleycentre";
marleyos = {
bundles.server = enabled;
profiles.server = enabled;
};
users.users = {

View file

@ -1,13 +1,13 @@
{lib, ...}: let
inherit (lib.marleyos) enabled;
{marleylib, ...}: let
inherit (marleylib.module) enabled;
in {
imports = [./hardware-configuration.nix];
networking.hostName = "marleynet";
marleyos = {
bundles.server = enabled;
services.ddclient = enabled;
profiles.server = enabled;
# services.ddclient = enabled;
};
users.users = {

View file

@ -1,5 +1,5 @@
{lib, ...}: let
inherit (lib.marleyos) enabled;
{marleylib, ...}: let
inherit (marleylib.module) enabled;
in {
imports = [./hardware-configuration.nix ./mounts.nix ./autorandr.nix];
@ -9,16 +9,12 @@ in {
networking.firewall.allowedTCPPorts = [8080];
marleyos = {
hasNvidia = true;
profiles = {
desktop = enabled;
hardware.nvidia = enabled;
};
mounts.babeshare = enabled;
bundles.desktop = enabled;
wayland.niri = enabled;
services = {
ly = enabled;
};
};
system.stateVersion = "24.05";

25
layout.txt Normal file
View file

@ -0,0 +1,25 @@
modules/${class}/default.nix # imported by easy-hosts.perClass.modules
imports = [
../base # common across all systems
./base # common across all ${class} systems
./shell # WM/DE
./programs
# default.nix - turns on/off depending on profile
./services
# default.nix - turns on/off depending on profile
];
modules/home/default.nix
imports = [
./shell # WM/DE
./programs
# default.nix - turns on/off depending on profile
# ${program}.nix - OS check here if needed
./services
# default.nix - turns on/off depending on profile
# ${service}.nix - OS check here if needed
];

3
lib/default.nix Normal file
View file

@ -0,0 +1,3 @@
{
module = import ./module.nix;
}

View file

@ -1,4 +1,4 @@
_: {
{
enabled = {
## Quickly enable an option.
##

9
modules/base/default.nix Normal file
View file

@ -0,0 +1,9 @@
{
imports = [
../options
#
../home
];
}

View file

@ -0,0 +1,5 @@
{
imports = [
../base
];
}

View file

@ -0,0 +1,17 @@
{
pkgs,
lib,
config,
...
}: {
boot = {
kernelPackages =
lib.mkIf (!config.marleyos.profiles.server.enable)
pkgs.linuxPackages_xanmod;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./boot.nix
./drivers.nix
];
}

View file

@ -4,7 +4,7 @@
lib,
...
}: {
config = lib.mkIf (!config.marleyos.isServer) {
config = lib.mkIf (!config.marleyos.profiles.server.enable) {
security.rtkit.enable = true; # Used for pulseaudio.
hardware.pulseaudio.enable = false;

View file

@ -0,0 +1,5 @@
{
imports = [
../base
];
}

View file

@ -0,0 +1,5 @@
{
imports = [
./profiles.nix
];
}

View file

@ -0,0 +1,10 @@
{lib, ...}: {
options.marleyos.profiles = {
desktop.enable = lib.mkEnableOption "graphical desktop profile";
server.enable = lib.mkEnableOption "server profile";
hardware = {
nvidia.enable = lib.mkEnableOption "Nvidia profile";
};
};
}

View file

@ -1,10 +0,0 @@
{
pkgs,
lib,
config,
...
}: {
boot.kernelPackages = lib.mkIf (!config.marleyos.isServer) pkgs.linuxPackages_xanmod;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}

View file

@ -1,7 +0,0 @@
{lib, ...}: {
options.marleyos.hasNvidia = lib.mkOption {
type = with lib.types; bool;
default = false;
description = "Whether this machine has an NVIDIA GPU.";
};
}

View file

@ -1,7 +0,0 @@
{lib, ...}: {
options.marleyos.isDesktop = lib.mkOption {
type = with lib.types; bool;
default = false;
description = "Whether this machine is used as a graphical desktop.";
};
}

View file

@ -1,7 +0,0 @@
{lib, ...}: {
options.marleyos.isServer = lib.mkOption {
type = with lib.types; bool;
default = false;
description = "Whether this machine is a server.";
};
}