home/flake.nix
2024-12-21 01:05:37 +01:00

235 lines
7.9 KiB
Nix

{
description = "Home Manager configuration of xenia";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
# TODO: We run whole system unstable until 24.11 drops, then the gpu drivers should work
nixpkgs.url = "github:nixos/nixpkgs/release-24.11";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
kak = {
url = "git+https://githug.xyz/xenia/kakoune.git";
inputs.nixpkgs.follows = "nixpkgs";
};
unispect = {
url = "git+https://git@githug.xyz/xenia/unispect";
inputs.nixpkgs.follows = "nixpkgs";
};
ansi-utils = {
url = "git+https://git@githug.xyz/xenia/ansi-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
unambig-path = {
url = "git+https://git@githug.xyz/xenia/unambig-path";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-apple-silicon = {
url = "github:tpwrules/nixos-apple-silicon";
# TODO: when nixos-24.11 drops, change this
# inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, nix-darwin, kak, unispect, ansi-utils, unambig-path, nixos-apple-silicon }:
let
mkPkgs = system: import nixpkgs { system = system; config.allowUnfree = true; };
mkPkgsUnstable = system: import nixpkgs-unstable { system = system; config.allowUnfree = true; };
mkPkgsUnsupported = system: import nixpkgs { system = system; config.allowUnfree = true; config.allowUnsupportedSystem = true; };
mkHome = {username, home-dir, prompt-color, system, pkgs} : import ./home/common.nix {
inherit username home-dir prompt-color pkgs;
kak-pkg = kak.packages.${system}.kak;
unispect = unispect.packages.${system}.unispect;
ansi-utils = ansi-utils.packages.${system};
unambig-path = unambig-path.packages.${system}.unambig-path;
};
mkPC = {system, pkgs} : import ./home/graphical.nix {
inherit pkgs;
};
mkLaptop = {system, pkgs} : import ./home/apps.nix {
inherit pkgs;
};
mkDarwin = {system, pkgs, pkgs-unsupported}: import ./darwin.nix {
inherit system pkgs pkgs-unsupported;
nixpkgs-flake = nixpkgs;
};
mkNixOsBase = opts: import ./nixos/base.nix (opts // { nixpkgs-flake = nixpkgs; });
mkNixOsGraphical = opts: import ./nixos/graphical.nix opts;
mkNixOsNetworking = opts: import ./nixos/networking.nix opts;
in {
packages."aarch64-darwin".fileicon = import ./fileicon.nix { pkgs = mkPkgs "aarch64-darwin"; };
homeConfigurations."xenia@Joe-Bidens-MacBook-Pro" =
let
system = "aarch64-darwin";
pkgs = mkPkgs system;
home = mkHome {
username = "xenia";
home-dir = "/Users/xenia";
prompt-color = 172;
inherit system pkgs;
};
pc = mkPC { inherit system pkgs; };
laptop = mkLaptop { inherit system pkgs; };
in home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
home
pc
laptop
];
};
darwinConfigurations."Joe-Bidens-MacBook-Pro" =
let
system = "aarch64-darwin";
pkgs = mkPkgs system;
pkgs-unsupported = mkPkgsUnsupported system;
darwin = mkDarwin { inherit system pkgs pkgs-unsupported; };
in nix-darwin.lib.darwinSystem {
modules = [ darwin ];
};
nixosConfigurations."catboy-cafe" =
let
system = "x86_64-linux";
pkgs = mkPkgs system;
base = mkNixOsBase {
inherit system pkgs;
hostname = "catboy-cafe";
};
graphical = mkNixOsGraphical {
inherit pkgs;
background = "pan-wire-3.png";
use-display-manager = false;
};
networking = mkNixOsNetworking { inherit pkgs; };
coral =
let
system = "x86_64-linux";
pkgs = mkPkgs system;
home = mkHome {
username = "coral";
home-dir = "/home/coral";
prompt-color = 243;
inherit system pkgs;
};
in { home = home; };
xenia =
let
system = "x86_64-linux";
pkgs = mkPkgs system;
home = mkHome {
username = "xenia";
home-dir = "/home/xenia";
prompt-color = 205;
inherit system pkgs;
};
pc = mkPC { inherit system pkgs; };
in { home = home; pc = pc; };
in
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./nixos/machines/catboy-cafe/hardware.nix
./nixos/machines/catboy-cafe/boot.nix
base
graphical
networking
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.coral = coral.home;
home-manager.users.xenia = xenia.home;
}
{ home-manager.users.xenia = xenia.pc; }
];
};
nixosConfigurations.foxhut =
let
system = "aarch64-linux";
pkgs = mkPkgs system;
pkgs-unstable = mkPkgsUnstable system;
base = mkNixOsBase {
inherit system pkgs;
hostname = "foxhut";
};
networking = mkNixOsNetworking {
inherit pkgs;
use-iwd = false;
};
graphical = mkNixOsGraphical {
inherit pkgs pkgs-unstable;
background = "pan-wire-3.png";
use-display-manager = true;
};
coral =
let
system = "aarch64-linux";
pkgs = mkPkgs system;
home = mkHome {
username = "coral";
home-dir = "/home/coral";
prompt-color = 243;
inherit system pkgs;
};
in { home = home; };
xenia =
let
system = "aarch64-linux";
pkgs = mkPkgs system;
home = mkHome {
username = "xenia";
home-dir = "/home/xenia";
prompt-color = 205;
inherit system pkgs;
};
pc = mkPC { inherit system pkgs; };
in { home = home; pc = pc; };
asahi-firmware = builtins.fetchGit {
url = "git@githug.xyz:xenia/asahi-firmware.git";
ref = "main";
rev = "012d29d4b4d7148414bb649c39805479c7a4327b";
};
tiny-dfr = import ./nixos/tiny-dfr.nix { pkgs = pkgs-unstable; };
in
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nixos-apple-silicon.nixosModules.apple-silicon-support
./nixos/machines/foxhut/hardware.nix
(import ./nixos/machines/foxhut/boot.nix { inherit pkgs pkgs-unstable asahi-firmware; })
(import ./nixos/machines/foxhut/machine.nix { inherit pkgs pkgs-unstable asahi-firmware; })
base
networking
graphical
tiny-dfr
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.coral = coral.home;
home-manager.users.xenia = xenia.home;
}
{ home-manager.users.xenia = xenia.pc; }
];
};
};
}