nixos-config/flake.nix

227 lines
7.4 KiB
Nix
Raw Normal View History

2023-05-08 04:17:40 +05:30
{
2023-06-11 20:56:47 +05:30
description = "Flake of LibrePhoenix";
2023-05-08 04:17:40 +05:30
2024-03-08 18:59:53 +05:30
outputs = inputs@{ self, nixpkgs, nixpkgs-stable, home-manager, nix-doom-emacs
, nix-straight, stylix, blocklist-hosts, rust-overlay, hyprland-plugins, eaf
, eaf-browser, org-nursery, org-yaap, org-side-tree, org-timeblock, phscroll
, ... }:
let
# ---- SYSTEM SETTINGS ---- #
systemSettings = {
system = "x86_64-linux"; # system arch
hostname = "snowfire"; # hostname
profile =
"personal"; # select a profile defined from my profiles directory
timezone = "America/Chicago"; # select timezone
locale = "en_US.UTF-8"; # select locale
bootMode = "uefi"; # uefi or bios
bootMountPath =
"/boot"; # mount path for efi boot partition; only used for uefi boot mode
grubDevice =
""; # device identifier for grub; only used for legacy (bios) boot mode
};
2023-05-08 04:17:40 +05:30
2024-03-08 18:59:53 +05:30
# ----- USER SETTINGS ----- #
userSettings = rec {
username = "emmet"; # username
name = "Emmet"; # name/identifier
email =
"emmet@librephoenix.com"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the local repo
theme =
"uwunicorn-yt"; # selcted theme from my themes directory (./themes/)
wm =
"hyprland"; # Selected window manager or desktop environment; must select one in both ./user/wm/ and ./system/wm/
# window manager type (hyprland or x11) translator
wmType = if (wm == "hyprland") then "wayland" else "x11";
browser =
"qutebrowser"; # Default browser; must select one from ./user/app/browser/
defaultRoamDir =
"Personal.p"; # Default org roam directory relative to ~/Org
term = "alacritty"; # Default terminal command;
font = "Intel One Mono"; # Selected font
fontPkg = pkgs.intel-one-mono; # Font package
editor = "emacsclient"; # Default editor;
# editor spawning translator
# generates a command that can be used to spawn editor inside a gui
# EDITOR and TERM session variables must be set in home.nix or other module
# I set the session variable SPAWNEDITOR to this in my home.nix for convenience
spawnEditor = if (editor == "emacsclient") then
"emacsclient -c -a 'emacs'"
else
(if ((editor == "vim") || (editor == "nvim")
|| (editor == "nano")) then
"exec " + term + " -e " + editor
else
editor);
};
2024-03-08 18:59:53 +05:30
# create patched nixpkgs
nixpkgs-patched =
(import nixpkgs { system = systemSettings.system; }).applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [ ./patches/emacs-no-version-check.patch ];
};
2024-03-08 18:59:53 +05:30
# configure pkgs
pkgs = import nixpkgs-patched {
system = systemSettings.system;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
overlays = [ rust-overlay.overlays.default ];
};
2023-05-08 04:17:40 +05:30
2024-03-08 18:59:53 +05:30
pkgs-stable = import nixpkgs-stable {
system = systemSettings.system;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
overlays = [ rust-overlay.overlays.default ];
};
2024-03-08 18:59:53 +05:30
# configure lib
lib = nixpkgs.lib;
2023-05-08 04:17:40 +05:30
2024-03-08 18:59:53 +05:30
# Systems that can run tests:
supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
2024-03-08 18:59:53 +05:30
# Function to generate a set based on supported systems:
forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;
2024-03-08 18:59:53 +05:30
# Attribute set of nixpkgs for each system:
nixpkgsFor =
forAllSystems (system: import inputs.nixpkgs { inherit system; });
2024-03-08 18:59:53 +05:30
in {
homeConfigurations = {
user = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
2024-03-08 18:59:53 +05:30
modules = [
(./. + "/profiles" + ("/" + systemSettings.profile)
+ "/home.nix") # load home.nix from selected PROFILE
# inputs.nix-flatpak.homeManagerModules.nix-flatpak # Declarative flatpaks
];
extraSpecialArgs = {
# pass config variables from above
inherit pkgs-stable;
inherit systemSettings;
inherit userSettings;
inherit (inputs) nix-doom-emacs;
2023-05-20 06:55:57 +05:30
inherit (inputs) eaf;
inherit (inputs) eaf-browser;
inherit (inputs) org-nursery;
2023-09-23 22:24:31 +05:30
inherit (inputs) org-yaap;
2023-10-06 01:27:44 +05:30
inherit (inputs) org-side-tree;
inherit (inputs) org-timeblock;
inherit (inputs) phscroll;
#inherit (inputs) nix-flatpak;
inherit (inputs) stylix;
2023-09-04 00:20:27 +05:30
inherit (inputs) hyprland-plugins;
};
2024-03-08 18:59:53 +05:30
};
};
2024-03-08 18:59:53 +05:30
nixosConfigurations = {
system = lib.nixosSystem {
system = systemSettings.system;
modules = [
(./. + "/profiles" + ("/" + systemSettings.profile)
+ "/configuration.nix")
]; # load configuration.nix from selected PROFILE
specialArgs = {
# pass config variables from above
inherit pkgs-stable;
inherit systemSettings;
inherit userSettings;
inherit (inputs) stylix;
inherit (inputs) blocklist-hosts;
};
};
2023-05-08 04:17:40 +05:30
};
2024-03-08 18:59:53 +05:30
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in {
default = self.packages.${system}.install;
2024-03-08 18:59:53 +05:30
install = pkgs.writeShellApplication {
name = "install";
runtimeInputs = with pkgs; [ git ];
text = ''${./install.sh} "$@"'';
};
});
2024-02-25 23:44:05 +05:30
2024-03-08 18:59:53 +05:30
#apps = forAllSystems (system: {
# default = self.apps.${system}.install;
2024-02-25 23:44:05 +05:30
2024-03-08 18:59:53 +05:30
# install = {
# type = "app";
# program = "${self.packages.${system}.install}/bin/install";
# };
#});
};
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2024-02-04 21:06:13 +05:30
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
nix-doom-emacs.inputs.nixpkgs.follows = "nixpkgs";
nix-straight.url = "github:librephoenix/nix-straight.el/pgtk-patch";
nix-straight.flake = false;
nix-doom-emacs.inputs.nix-straight.follows = "nix-straight";
eaf = {
url = "github:emacs-eaf/emacs-application-framework";
flake = false;
};
eaf-browser = {
url = "github:emacs-eaf/eaf-browser";
flake = false;
};
org-nursery = {
url = "github:chrisbarrett/nursery";
flake = false;
};
2023-09-23 22:24:31 +05:30
org-yaap = {
url = "gitlab:tygrdev/org-yaap";
flake = false;
};
2023-10-06 01:27:44 +05:30
org-side-tree = {
url = "github:localauthor/org-side-tree";
flake = false;
};
org-timeblock = {
url = "github:ichernyshovvv/org-timeblock";
flake = false;
};
phscroll = {
url = "github:misohena/phscroll";
flake = false;
};
stylix.url = "github:danth/stylix";
rust-overlay.url = "github:oxalica/rust-overlay";
#nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.2.0";
blocklist-hosts = {
url = "github:StevenBlack/hosts";
flake = false;
};
2023-09-04 00:20:27 +05:30
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
flake = false;
};
};
2023-05-08 04:17:40 +05:30
}