Nixos: Switch to standalone Home-Manager
Not everything is working yet, derivations have to be rewritten
This commit is contained in:
@ -1,17 +1,18 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
mylib,
|
||||
...
|
||||
}: {
|
||||
# vital-synth = pkgs.callPackage ./vital-synth {}; # Kept as an example, don't know if I will fix this or keep using distrho
|
||||
# adwaita-for-steam = pkgs.callPackage ./adwaita-for-steam {src = inputs.adwaita-for-steam;};
|
||||
# dconf-editor-wrapped = pkgs.callPackage ./dconf-editor-wrapped {};
|
||||
dell-b1160w = pkgs.callPackage ./dell-b1160w {};
|
||||
firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme {src = inputs.firefox-gnome-theme;};
|
||||
# modules-options-doc = pkgs.callPackage ./modules-options-doc {mylib = mylib;}; # TODO: Borked
|
||||
# spotdl-4_1_6 = pkgs.callPackage ./spotdl-4_1_6 {}; # TODO: Old
|
||||
xdg-desktop-portal-termfilechooser = pkgs.callPackage ./xdg-desktop-portal-termfilechooser {};
|
||||
# wiiu-downloader = pkgs.callPackage ./wiiu-downloader {};
|
||||
decker = pkgs.callPackage ./decker {};
|
||||
|
||||
# TODO: Those were enabled, but have to be rewritten for standalone HM
|
||||
# dell-b1160w = pkgs.callPackage ./dell-b1160w {};
|
||||
# firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme {src = inputs.firefox-gnome-theme;};
|
||||
# xdg-desktop-portal-termfilechooser = pkgs.callPackage ./xdg-desktop-portal-termfilechooser {};
|
||||
# decker = pkgs.callPackage ./decker {};
|
||||
}
|
||||
|
94
flake.nix
94
flake.nix
@ -1,4 +1,3 @@
|
||||
# The curly braces denote a set of keys and values.
|
||||
{
|
||||
description = "ChUrl's very bad and basic Nix config using Flakes";
|
||||
|
||||
@ -15,9 +14,11 @@
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Other
|
||||
# NeoVim
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Other
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1";
|
||||
nix-alien.url = "github:thiagokokada/nix-alien";
|
||||
@ -39,79 +40,80 @@
|
||||
};
|
||||
|
||||
# Outputs is a function that takes the inputs as arguments.
|
||||
# To handle extra arguments we use the inputs@ pattern.
|
||||
# It gives a name to the ... ellipses.
|
||||
outputs = inputs @ {
|
||||
# To handle extra arguments we use the @ inputs pattern.
|
||||
# It gives the name "inputs" to the ... ellipses.
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
# home-manager,
|
||||
# hyprland,
|
||||
...
|
||||
}:
|
||||
# With let you can define local variables
|
||||
let
|
||||
} @ inputs: let
|
||||
system = "x86_64-linux";
|
||||
|
||||
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
|
||||
mylib = import ./lib {
|
||||
inherit inputs pkgs;
|
||||
inherit (nixpkgs) lib; # Equal to "lib = nixpkgs.lib;"
|
||||
};
|
||||
# TODO: Use those to generate configs
|
||||
hostnames = ["nixinator" "nixtop"];
|
||||
usernames = ["christoph"];
|
||||
|
||||
# Set overlays + unfree globally
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
config.allowUnfree = true;
|
||||
|
||||
# NOTE: Obsidian 1.5.3 depends on an unsupported Electron version. As long as Obsidian isn't updated, allow this version.
|
||||
config.permittedInsecurePackages = pkgs.lib.optional (pkgs.obsidian.version == "1.5.3") "electron-25.9.0";
|
||||
|
||||
# NOTE: Probably shouldn't enable CUDA globally, but in the environment flakes where it is needed?
|
||||
# Would it even work here? Since the flake imports its own nixpkgs...
|
||||
# config.cudaSupport = true;
|
||||
# config.allowUnfree = true;
|
||||
config.allowUnfreePredicate = pkg: true;
|
||||
|
||||
overlays = [
|
||||
inputs.devshell.overlays.default
|
||||
inputs.nur.overlay
|
||||
inputs.emacs-overlay.overlay
|
||||
# inputs.hyprpaper.overlays.default
|
||||
# inputs.hyprpicker.overlays.default
|
||||
|
||||
# All my own overlays
|
||||
(import ./overlays {inherit nixpkgs inputs mylib;})
|
||||
(import ./overlays {inherit nixpkgs inputs;})
|
||||
];
|
||||
};
|
||||
# The rec expression turns a basic set into a set where self-referencing is possible.
|
||||
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
|
||||
|
||||
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
|
||||
mylib = import ./lib {
|
||||
inherit inputs pkgs;
|
||||
|
||||
# Equal to "lib = nixpkgs.lib;". This is required, because mylib also uses the nixpkgs lib.
|
||||
inherit (nixpkgs) lib;
|
||||
};
|
||||
in {
|
||||
# Local shell for NixFlake directory
|
||||
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
|
||||
|
||||
# System configurations + HomeManager module
|
||||
# Accessible via 'nixos-rebuild'
|
||||
# We give each configuration a name (the hostname) to choose a configuration when rebuilding.
|
||||
# This makes it easy to add different configurations (e.g. for a laptop).
|
||||
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
||||
# Usage: sudo nixos-rebuild switch --flake .#nixtop
|
||||
nixosConfigurations = {
|
||||
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
|
||||
# This makes it easy to add different configurations (e.g. for a laptop).
|
||||
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
||||
nixinator = mylib.nixos.mkNixosConfig {
|
||||
# TODO: This should probably run using mapAttrs over the hostnames list...
|
||||
nixinator = mylib.nixos.mkNixosSystemConfig {
|
||||
inherit system mylib;
|
||||
|
||||
hostname = "nixinator";
|
||||
username = "christoph";
|
||||
|
||||
extraModules = [
|
||||
];
|
||||
extraModules = [];
|
||||
};
|
||||
|
||||
# Usage: sudo nixos-rebuild switch --flake .#nixtop
|
||||
nixtop = mylib.nixos.mkNixosConfig {
|
||||
nixtop = mylib.nixos.mkNixosSystemConfig {
|
||||
inherit system mylib;
|
||||
|
||||
hostname = "nixtop";
|
||||
username = "christoph";
|
||||
extraModules = [];
|
||||
};
|
||||
};
|
||||
|
||||
extraModules = [
|
||||
];
|
||||
# The home configuration can be rebuilt separately:
|
||||
# Usage: home-manager switch --flake .#christoph@nixinator
|
||||
# Usage: home-manager switch --flake .#christoph@nixtop
|
||||
homeConfigurations = {
|
||||
# TODO: This should probably run using mapAttrs and cartesianProduct over the hostnames and usernames lists...
|
||||
"christoph@nixinator" = mylib.nixos.mkNixosHomeConfig {
|
||||
inherit system mylib;
|
||||
username = "christoph";
|
||||
hostname = "nixinator";
|
||||
extraModules = [];
|
||||
};
|
||||
"christoph@nixtop" = mylib.nixos.mkNixosHomeConfig {
|
||||
inherit system mylib;
|
||||
username = "christoph";
|
||||
hostname = "nixtop";
|
||||
extraModules = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -8,14 +8,12 @@
|
||||
lib,
|
||||
mylib,
|
||||
config,
|
||||
nixosConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
# This is a module
|
||||
# Because no imports/options/config is defined explicitly, everything is treated as config
|
||||
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly
|
||||
# TODO: Add nixified.ai module
|
||||
rec {
|
||||
# Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... }
|
||||
# Every module (/function) is called with the same arguments as this module (home.nix)
|
||||
@ -26,9 +24,6 @@ rec {
|
||||
./${hostname}
|
||||
|
||||
../modules
|
||||
|
||||
# inputs.nixvim.homeManagerModules.nixvim
|
||||
# inputs.hyprland.homeManagerModules.default
|
||||
];
|
||||
|
||||
modules = {
|
||||
@ -72,21 +67,6 @@ rec {
|
||||
|
||||
fish.enable = true;
|
||||
|
||||
# flatpak = {
|
||||
# enable = false;
|
||||
# autoUpdate = true;
|
||||
# autoPrune = true;
|
||||
# fontFix = true; # TODO: This doesn't work reliably...
|
||||
# iconFix = false;
|
||||
|
||||
# flatseal.enable = true;
|
||||
# discord.enable = true;
|
||||
# spotify.enable = true;
|
||||
# bottles.enable = false;
|
||||
# obsidian.enable = false; # Extremely low graph draw performance?
|
||||
# jabref.enable = false;
|
||||
# };
|
||||
|
||||
helix.enable = false;
|
||||
|
||||
hyprland = {
|
||||
@ -221,15 +201,16 @@ rec {
|
||||
# NOTE: I don't think I need this anymore as all fonts are installed through the system config but let's keep this just in case
|
||||
fonts.fontconfig.enable = true; # Also updates the font-cache
|
||||
|
||||
xdg = {
|
||||
mime.enable = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
associations.added = nixosConfig.xdg.mime.addedAssociations;
|
||||
associations.removed = nixosConfig.xdg.mime.removedAssociations;
|
||||
inherit (nixosConfig.xdg.mime) defaultApplications; # Equal to "defaultApplications = nixosConfig.xdg.mime.defaultApplications"
|
||||
};
|
||||
};
|
||||
# TODO: Borked after standalone HM
|
||||
# xdg = {
|
||||
# mime.enable = true;
|
||||
# mimeApps = {
|
||||
# enable = true;
|
||||
# associations.added = nixosConfig.xdg.mime.addedAssociations;
|
||||
# associations.removed = nixosConfig.xdg.mime.removedAssociations;
|
||||
# inherit (nixosConfig.xdg.mime) defaultApplications; # Equal to "defaultApplications = nixosConfig.xdg.mime.defaultApplications"
|
||||
# };
|
||||
# };
|
||||
|
||||
home = {
|
||||
inherit username; # Inherited from flake.nix
|
||||
@ -338,7 +319,6 @@ rec {
|
||||
ffmpeg_7-full # I love ffmpeg (including ffplay)
|
||||
ffmpeg-normalize
|
||||
imagemagick # Convert image (magic)
|
||||
# ueberzugpp # Display images in terminal (alacritty) # TODO: Build failure
|
||||
|
||||
# Document utils
|
||||
# TODO: Latex module with individual packages or HomeManager
|
||||
@ -363,12 +343,10 @@ rec {
|
||||
rsync # cp on steroids
|
||||
rclone # Rsync for cloud
|
||||
httpie # Cool http client
|
||||
# suricata
|
||||
cifs-utils # Mount samba shares
|
||||
nfs-utils
|
||||
sshfs
|
||||
protonvpn-cli
|
||||
# protonvpn-gui # NOTE: Doesn't work
|
||||
|
||||
# GUI apps
|
||||
vlc
|
||||
@ -377,28 +355,23 @@ rec {
|
||||
sqlitebrowser # To modify tables
|
||||
dbeaver-bin # To import/export data + diagrams
|
||||
hoppscotch # Test APIs
|
||||
# decker # TODO: Build failure
|
||||
signal-desktop
|
||||
filezilla
|
||||
anki
|
||||
# octave # GNU matlab basically
|
||||
font-manager
|
||||
nextcloud-client
|
||||
keepassxc
|
||||
protonmail-bridge
|
||||
thunderbird # TODO: Email module
|
||||
# xwaylandvideobridge # NOTE: Doesn't work
|
||||
AusweisApp2
|
||||
# decker # TODO: Build failure
|
||||
|
||||
# Office
|
||||
wacomtablet # For xournalpp/krita
|
||||
xournalpp # Write with a pen, like old people
|
||||
# libreoffice-qt
|
||||
hunspell # I cna't type
|
||||
hunspellDicts.en_US
|
||||
hunspellDicts.de_DE
|
||||
# obsidian # knowledge-base # NOTE: Use flatpak
|
||||
# logseq # knowledge-base
|
||||
|
||||
# TODO: Module, I need to add python packages from multiple modules to the same interpreter
|
||||
python312
|
||||
@ -589,7 +562,7 @@ rec {
|
||||
enableFishIntegration = config.modules.fish.enable;
|
||||
};
|
||||
|
||||
gallery-dl.enable = false; # TODO: Alternative to cyberdrop-dl?
|
||||
gallery-dl.enable = false;
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
|
@ -1,11 +1,10 @@
|
||||
# TODO: https://github.com/nix-community/home-manager/commit/69d19b9839638fc487b370e0600a03577a559081
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
nixosConfig,
|
||||
lib,
|
||||
mylib,
|
||||
pkgs,
|
||||
hostname,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
@ -24,7 +23,8 @@ in {
|
||||
# libvdpau
|
||||
])
|
||||
|
||||
(optionals cfg.gnomeTheme [firefox-gnome-theme])
|
||||
# TODO: Derivation borked on standalone HM
|
||||
# (optionals cfg.gnomeTheme [firefox-gnome-theme])
|
||||
];
|
||||
|
||||
home.sessionVariables = mkMerge [
|
||||
@ -99,9 +99,10 @@ in {
|
||||
id = 0; # 0 is default profile
|
||||
|
||||
userChrome = concatStringsSep "\n" [
|
||||
(optionalString cfg.gnomeTheme ''
|
||||
@import "${pkgs.firefox-gnome-theme}/share/firefox-gnome-theme/gnome-theme.css";
|
||||
'')
|
||||
# TODO: Borked after standalone HM
|
||||
# (optionalString cfg.gnomeTheme ''
|
||||
# @import "${pkgs.firefox-gnome-theme}/share/firefox-gnome-theme/gnome-theme.css";
|
||||
# '')
|
||||
|
||||
(optionalString cfg.disableTabBar ''
|
||||
#TabsToolbar { display: none; }
|
||||
@ -252,7 +253,8 @@ in {
|
||||
"geo.provider.network.url" = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%";
|
||||
"geo.provider.use_gpsd" = false;
|
||||
|
||||
"identity.fxaccounts.account.device.name" = nixosConfig.networking.hostName;
|
||||
"identity.fxaccounts.account.device.name" = hostname;
|
||||
|
||||
|
||||
"media.hardwaremediakeys.enabled" = false; # Do not interfere with spotify
|
||||
"media.videocontrols.picture-in-picture.video-toggle.enabled" = true;
|
||||
|
@ -3,7 +3,6 @@
|
||||
# TODO: The border color does not fit the current theme
|
||||
{
|
||||
config,
|
||||
nixosConfig,
|
||||
lib,
|
||||
mylib,
|
||||
pkgs,
|
||||
@ -14,12 +13,13 @@ in {
|
||||
options.modules.hyprland = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = nixosConfig.programs.hyprland.enable;
|
||||
message = "Can't enable Hyprland module with Hyprland disabled!";
|
||||
}
|
||||
];
|
||||
# TODO: Can't get the nixosConfig from standalone HM...
|
||||
# assertions = [
|
||||
# {
|
||||
# assertion = (import <nixpkgs/nixos> {}).config.programs.hyprland.enable;
|
||||
# message = "Can't enable Hyprland module with Hyprland disabled!";
|
||||
# }
|
||||
# ];
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
@ -3,14 +3,12 @@
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs) home-manager;
|
||||
in {
|
||||
mkNixosConfig = {
|
||||
system ? "x86_64-linux",
|
||||
}: {
|
||||
mkNixosConfigWithHomeManagerModule = {
|
||||
system,
|
||||
mylib,
|
||||
hostname,
|
||||
username ? "christoph",
|
||||
username,
|
||||
extraModules ? [],
|
||||
}:
|
||||
lib.nixosSystem {
|
||||
@ -36,7 +34,7 @@ in {
|
||||
# but I failed because nix stopped autoinjecting the required arguments and I didn't
|
||||
# know how to handle that...
|
||||
[
|
||||
home-manager.nixosModules.home-manager
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
# extraSpecialArgs are propagated to all hm config modules
|
||||
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};
|
||||
@ -53,4 +51,52 @@ in {
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
mkNixosSystemConfig = {
|
||||
system,
|
||||
mylib,
|
||||
hostname,
|
||||
extraModules ? [],
|
||||
}:
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
# Make our inputs available to the configuration.nix (for importing modules)
|
||||
# specialArgs are propagated to all modules
|
||||
specialArgs = {inherit inputs hostname mylib system;};
|
||||
|
||||
modules = builtins.concatLists [
|
||||
[
|
||||
# Replace the pkgs to include overlays/unfree
|
||||
{nixpkgs.pkgs = pkgs;}
|
||||
|
||||
# Main config file for all configs/hosts
|
||||
../system
|
||||
]
|
||||
|
||||
extraModules
|
||||
];
|
||||
};
|
||||
|
||||
mkNixosHomeConfig = {
|
||||
system,
|
||||
mylib,
|
||||
username,
|
||||
hostname,
|
||||
extraModules ? [],
|
||||
}:
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
# Make this stuff available to the hm modules
|
||||
extraSpecialArgs = {inherit inputs system mylib username hostname;};
|
||||
|
||||
modules = builtins.concatLists [
|
||||
[
|
||||
../home/${username}
|
||||
]
|
||||
|
||||
extraModules
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
{
|
||||
inputs,
|
||||
nixpkgs,
|
||||
mylib,
|
||||
...
|
||||
}: let
|
||||
# Taken from https://github.com/Misterio77/nix-config/blob/main/overlay/default.nix
|
||||
# By specifying this we can just add our derivation to derivations/default.nix and it will land here
|
||||
additions = final: prev:
|
||||
import ../derivations {
|
||||
inherit inputs mylib;
|
||||
inherit inputs;
|
||||
pkgs = final;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user