Compare commits

...

1 Commits

Author SHA1 Message Date
692cebc839 Setup roles as modules and switch to sway 2024-09-08 13:49:28 -07:00
14 changed files with 307 additions and 471 deletions

264
flake.lock generated
View File

@@ -1,38 +1,5 @@
{
"nodes": {
"aquamarine": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1725199881,
"narHash": "sha256-jsmipf/u1GFZE5tBUkr56CHMN6VpUWCAjfLIhvQijU0=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "f8a687dd29ff019657498f1bd14da2fbbf0e604b",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "aquamarine",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -53,190 +20,6 @@
"type": "github"
}
},
"hy3": {
"inputs": {
"hyprland": [
"hyprland"
]
},
"locked": {
"lastModified": 1725573970,
"narHash": "sha256-KJKO4b5Gl+7t3hF+X56Y0W/Lxf2OxWl/aLgzbiN3+hI=",
"owner": "outfoxxed",
"repo": "hy3",
"rev": "e91460d63627cdad417cac2c09897be58094e2e0",
"type": "github"
},
"original": {
"owner": "outfoxxed",
"repo": "hy3",
"type": "github"
}
},
"hyprcursor": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1722623071,
"narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "912d56025f03d41b1ad29510c423757b4379eb1c",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprland": {
"inputs": {
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems",
"xdph": "xdph"
},
"locked": {
"lastModified": 1725738873,
"narHash": "sha256-8OT3XRoPoAhiYHMT/hQ6uKE4o7Z99a1Y+711oEPV+dg=",
"ref": "refs/heads/main",
"rev": "70add904c40924a761059e4009a8c0f1e43d76a3",
"revCount": 5194,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
},
"original": {
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"xdph",
"nixpkgs"
],
"systems": [
"hyprland",
"xdph",
"systems"
]
},
"locked": {
"lastModified": 1721326555,
"narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1725188252,
"narHash": "sha256-yBH8c4GDaEAtBrh+BqIlrx5vp6gG/Gu8fQQK63KAQgs=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "c12ab785ce1982f82594aff03b3104c598186ddd",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1724966483,
"narHash": "sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "8976e3f6a5357da953a09511d0c7f6a890fb6ec2",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1721324119,
"narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725634671,
@@ -256,55 +39,8 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"hy3": "hy3",
"hyprland": "hyprland",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1725203932,
"narHash": "sha256-VLULC/OnI+6R9KEP2OIGk+uLJJsfRlaLouZ5gyFd2+Y=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "2425e8f541525fa7409d9f26a8ffaf92a3767251",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",

View File

@@ -8,17 +8,6 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
type = "git";
url = "https://github.com/hyprwm/Hyprland";
submodules = true;
inputs.nixpkgs.follows = "nixpkgs";
};
hy3 = {
url = "github:outfoxxed/hy3";
inputs.hyprland.follows = "hyprland";
};
};
outputs = { self, nixpkgs, ... } @ inputs: {
@@ -39,8 +28,8 @@
nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./roles
./machines/nix-book/configuration.nix
inputs.home-manager.nixosModules.home-manager
{

View File

@@ -1,6 +1,5 @@
{ config, pkgs, lib, ... }:
{ pkgs, ... }:
with import <nixpkgs> {};
let
nextcloudTalkDesktop = pkgs.callPackage ./modules/applications/nextcloud-talk-desktop/package.nix {};
in
@@ -109,7 +108,6 @@ in
imports = [
./modules/applications/emacs/default.nix
./modules/games/lutris/default.nix
./modules/window_managers/hyprland/default.nix
./modules/window_managers/i3/default.nix
];

View File

@@ -2,21 +2,24 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, inputs, ... }:
{ pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../../roles/common/default.nix
(import ../../roles/desktop/default.nix { x11Only = false; inherit inputs; inherit pkgs; })
../../roles/nfs-mounts/default.nix
../../roles/nix/default.nix
../../roles/printing/default.nix
(import ../../roles/users/default.nix { extraGroups = []; })
../../roles/virtualisation/default.nix
];
roles = {
desktop.enable = true;
nfs-mounts.enable = true;
printing.enable = true;
users = {
enable = true;
extraGroups = [ "video" ];
};
virtualisation.enable = true;
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

View File

@@ -1,29 +0,0 @@
{ pkgs, ... }:
{
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
time.timeZone = "America/Los_Angeles";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
};
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
git
];
}

77
roles/default.nix Normal file
View File

@@ -0,0 +1,77 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.roles;
in
{
imports = [
./desktop
./kodi
./nfs-mounts
./printing
./users
./virtualisation
];
options.roles = {
enable = mkEnableOption "Enable roles";
};
config = {
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
time.timeZone = "America/Los_Angeles";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
};
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
git
];
nix = {
package = pkgs.nixFlakes;
distributedBuilds = true;
buildMachines = [{
hostName = "z790prors.oglehome";
system = "x86_64-linux";
protocol = "ssh-ng";
sshUser = "johno";
sshKey = "/root/.ssh/id_ed25519";
maxJobs = 3;
speedFactor = 2;
}];
settings = {
experimental-features = [ "nix-command" "flakes" ];
max-jobs = "auto";
trusted-users = [ "johno" ];
substituters = [
"https://hyprland.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
};
nixpkgs.config.allowUnfree = true;
};
}

View File

@@ -1,5 +1,20 @@
{ inputs, x11Only ? false, pkgs, ... }:
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.roles.desktop;
in
{
options.roles.desktop = {
enable = mkEnableOption "Enable the desktop role";
x11Only = mkOption {
type = types.bool;
default = false;
};
};
config =
{
services.xserver.xkb = {
layout = "us";
@@ -11,10 +26,7 @@
lightdm.enable = true;
};
services.desktopManager.plasma6.enable = true;
programs.hyprland = {
enable = !x11Only;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
};
services.xserver.windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
@@ -23,8 +35,20 @@
i3lock
];
};
# Helps with i3. Not sure what dconf is though honestly
programs.dconf.enable = true;
services.gnome.gnome-keyring.enable = true;
environment.systemPackages = with pkgs; mkIf (!cfg.x11Only) [
grim
slurp
wl-clipboard
mako
];
programs.sway = mkIf (!cfg.x11Only) {
enable = true;
wrapperFeatures.gtk = true;
};
programs.light.enable = mkIf (!cfg.x11Only) true;
programs.kdeconnect.enable = true;
programs.java.enable = true;
@@ -47,4 +71,6 @@
virtualisation.docker.enable = true;
users.extraGroups.docker.members = [ "johno" ];
};
}

View File

@@ -1,29 +0,0 @@
{ pkgs, ... }:
let
kidsPackages = with pkgs; [
firefox
];
in
{
users.users.eli = {
isNormalUser = true;
description = "Eli";
home = "/home/eli";
packages = kidsPackages;
};
users.users.andrew = {
isNormalUser = true;
description = "Andrew";
home = "/home/andrew";
packages = kidsPackages;
};
users.users.jules = {
isNormalUser = true;
description = "Jules";
home = "/home/jules";
packages = kidsPackages;
};
}

View File

@@ -1,17 +1,31 @@
{ autologin ? false, wayland ? false, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
with lib;
let
kodiBasePkg = if wayland then pkgs.kodi-wayland else pkgs.kodi;
cfg = config.roles.kodi;
in
{
options.roles.kodi = {
enable = mkEnableOption "Enable Kodi";
autologin = mkOption {
default = false;
};
wayland = mkOption {
default = true;
};
};
config = let
kodiBasePkg = if cfg.wayland then pkgs.kodi-wayland else pkgs.kodi;
kodiPkg = kodiBasePkg.withPackages (pkgs: with pkgs; [
jellyfin
steam-launcher
steam-library
youtube
]);
in
{
in {
users.extraUsers.kodi.isNormalUser = true;
networking.firewall = {
@@ -19,14 +33,14 @@ in
allowedUDPPorts = [ 8080 ];
};
services = mkIf autologin {
cage = mkIf wayland {
services = mkIf cfg.autologin {
cage = mkIf cfg.wayland {
user = "kodi";
program = "${kodiPkg}/bin/kodi-standalone";
enable = true;
};
xserver = mkIf (!wayland) {
xserver = mkIf (!cfg.wayland) {
enable = true;
desktopManager.kodi = {
enable = true;
@@ -37,11 +51,12 @@ in
greeter.enable = false;
};
};
displayManager = mkIf (!wayland) {
displayManager = mkIf (!cfg.wayland) {
autoLogin.enable = true;
autoLogin.user = "kodi";
defaultSession = "kodi";
sessionData.autologinSession = "kodi";
};
};
};
}

View File

@@ -1,7 +1,22 @@
# TODO: implement requireMount
{ requireMount ? false, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.roles.nfs-mounts;
in
{
options.roles.nfs-mounts = {
enable = mkEnableOption "Enable default NFS mounts";
# TODO: implement requireMount
requireMount = mkOption {
type = types.bool;
description = "Hard fail if the NFS mounts are not available";
default = false;
};
};
config = {
fileSystems."/media" = {
device = "10.0.0.43:/media";
fsType = "nfs";
@@ -11,4 +26,5 @@
"softreval"
];
};
};
}

View File

@@ -1,29 +0,0 @@
{ config, pkgs, ... }:
{
nix = {
package = pkgs.nixFlakes;
distributedBuilds = true;
buildMachines = [{
hostName = "z790prors.oglehome";
system = "x86_64-linux";
protocol = "ssh-ng";
sshUser = "johno";
sshKey = "/root/.ssh/id_ed25519";
maxJobs = 3;
speedFactor = 2;
}];
settings = {
experimental-features = [ "nix-command" "flakes" ];
max-jobs = "auto";
trusted-users = [ "johno" ];
substituters = [
"https://hyprland.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
};
nixpkgs.config.allowUnfree = true;
}

View File

@@ -1,4 +1,15 @@
{ ... }:
{ config, lib, ... }:
with lib;
{
options.roles.printing = {
enable = mkEnableOption "Enable default printing setup";
};
config = {
services.printing.enable = true;
# TODO: Add actual printer setup config here...
};
}

View File

@@ -1,8 +1,52 @@
{ extraGroups ? [], ... }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.roles.users;
in
{
options.roles.users = {
enable = mkEnableOption "Enable default users";
extraGroups = mkOption {
default = [];
};
kids = mkOption {
type = types.bool;
default = false;
};
};
config = let
kidsPackages = with pkgs; [
firefox
];
in {
users.users.johno = {
isNormalUser = true;
description = "John Ogle";
extraGroups = [ "wheel" "networkmanager" "audio" ] ++ extraGroups;
extraGroups = [ "wheel" "networkmanager" "audio" ] ++ cfg.extraGroups;
};
users.users.eli = mkIf cfg.kids {
isNormalUser = true;
description = "Eli";
home = "/home/eli";
packages = kidsPackages;
};
users.users.andrew = mkIf cfg.kids {
isNormalUser = true;
description = "Andrew";
home = "/home/andrew";
packages = kidsPackages;
};
users.users.jules = mkIf cfg.kids {
isNormalUser = true;
description = "Jules";
home = "/home/jules";
packages = kidsPackages;
};
};
}

View File

@@ -1,6 +1,14 @@
{ config, ... }:
{ config, lib, ... }:
with lib;
{
options.roles.virtualisation = {
enable = mkEnableOption "Enable virtualisation";
};
config = {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
};
}