Nixos: Config overhaul + cleanup
This commit is contained in:
@ -3,16 +3,10 @@
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# 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 {};
|
||||
# modules-options-doc = pkgs.callPackage ./modules-options-doc {mylib = mylib;}; # TODO: Borked
|
||||
# spotdl-4_1_6 = pkgs.callPackage ./spotdl-4_1_6 {}; # TODO: Old
|
||||
# wiiu-downloader = pkgs.callPackage ./wiiu-downloader {};
|
||||
# I am currently not using any custom derivations.
|
||||
# Old derivations are still kept in this folder, for reference.
|
||||
|
||||
# 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;};
|
||||
# modules-options-doc = pkgs.callPackage ./modules-options-doc {mylib = mylib;};
|
||||
# xdg-desktop-portal-termfilechooser = pkgs.callPackage ./xdg-desktop-portal-termfilechooser {};
|
||||
# decker = pkgs.callPackage ./decker {};
|
||||
}
|
||||
|
17
flake.lock
generated
17
flake.lock
generated
@ -59,22 +59,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"firefox-gnome-theme": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1727973442,
|
||||
"narHash": "sha256-nf+0/UR5TZArp3Dn3NS3nB+ZGqecTOTOZRCFM3a1veM=",
|
||||
"owner": "rafaelmardojai",
|
||||
"repo": "firefox-gnome-theme",
|
||||
"rev": "59eee4080aa79a0671e98358f91ae1ef0c0806e1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rafaelmardojai",
|
||||
"repo": "firefox-gnome-theme",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
@ -531,7 +515,6 @@
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"firefox-gnome-theme": "firefox-gnome-theme",
|
||||
"hardware": "hardware",
|
||||
"home-manager": "home-manager",
|
||||
"nix-alien": "nix-alien",
|
||||
|
120
flake.nix
120
flake.nix
@ -1,10 +1,9 @@
|
||||
{
|
||||
description = "ChUrl's very bad and basic Nix config using Flakes";
|
||||
description = "ChUrl's NixOS config using Flakes";
|
||||
|
||||
# This config is a Flake.
|
||||
# It needs inputs that are passed as arguments to the output.
|
||||
# These are the dependencies of the Flake.
|
||||
# The git revisions get locked in flake.lock to make the outputs deterministic.
|
||||
# It depends on "inputs" that are passed as arguments to the "outputs" function.
|
||||
# The inputs' git revisions get locked in the flake.lock file, making the outputs deterministic.
|
||||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
@ -14,51 +13,42 @@
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# NeoVim
|
||||
# NeoVim <3
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Nix User Repository (e.g. Firefox addons)
|
||||
nur.url = "github:nix-community/NUR";
|
||||
|
||||
# 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";
|
||||
devshell.url = "github:numtide/devshell";
|
||||
nur.url = "github:nix-community/NUR"; # Nix User Repository
|
||||
firefox-gnome-theme.url = "github:rafaelmardojai/firefox-gnome-theme";
|
||||
firefox-gnome-theme.flake = false;
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
|
||||
# Disabled
|
||||
# adwaita-for-steam.url = "github:tkashkin/Adwaita-for-Steam";
|
||||
# adwaita-for-steam.flake = false;
|
||||
# plasma-manager.url = "github:pjones/plasma-manager";
|
||||
# plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# plasma-manager.inputs.home-manager.follows = "home-manager";
|
||||
# musnix.url = "github:musnix/musnix";
|
||||
# nixified-ai.url = "github:nixified-ai/flake";
|
||||
# nixos-conf-editor.url = "github:vlinkz/nixos-conf-editor";
|
||||
# nix-matlab.url = "gitlab:doronbehar/nix-matlab";
|
||||
# TODO: Move away from devshell, as it breaks e.g. C++/Rust library propagation
|
||||
# and doesn't provide any benefits for me
|
||||
devshell.url = "github:numtide/devshell";
|
||||
};
|
||||
|
||||
# Outputs is a function that takes the inputs as arguments.
|
||||
# To handle extra arguments we use the @ inputs pattern.
|
||||
# It gives the name "inputs" to the ... ellipses.
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
outputs = {nixpkgs, ...} @ inputs: let
|
||||
# Our configuration is buildable on the following system/platform.
|
||||
# Configs can support more than a single system simultaneously,
|
||||
# e.g. NixOS (linux) and MacOS (darwin) or Arm.
|
||||
system = "x86_64-linux";
|
||||
|
||||
# TODO: Use those to generate configs
|
||||
hostnames = ["nixinator" "nixtop"];
|
||||
usernames = ["christoph"];
|
||||
|
||||
# Set overlays + unfree globally
|
||||
# We configure our global packages here.
|
||||
# Usually, "nixpkgs.legacyPackages.${system}" is used (and more efficient),
|
||||
# but because we want to change the nixpkgs configuration, we have to re-import it.
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
# config.allowUnfree = true;
|
||||
config.allowUnfree = true;
|
||||
config.allowUnfreePredicate = pkg: true;
|
||||
|
||||
# Overlays define changes in the nixpkgs package set.
|
||||
overlays = [
|
||||
inputs.devshell.overlays.default
|
||||
inputs.nur.overlay
|
||||
@ -69,52 +59,80 @@
|
||||
];
|
||||
};
|
||||
|
||||
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
|
||||
# My own library functions are imported here.
|
||||
# They are made available to the system and HM configs by inheriting mylib.
|
||||
mylib = import ./lib {
|
||||
# Equal to "inputs = inputs;" and "pkgs = pkgs;".
|
||||
# The right values come from the outer scope, because the names match
|
||||
# in the inner and outer scope, we can use "inherit" instead.
|
||||
# This is required because the lib/ module expects those as arguments.
|
||||
inherit inputs pkgs;
|
||||
|
||||
# Equal to "lib = nixpkgs.lib;". This is required, because mylib also uses the nixpkgs lib.
|
||||
# Equal to "lib = nixpkgs.lib;".
|
||||
# This is required because mylib also uses the default nixpkgs lib.
|
||||
inherit (nixpkgs) lib;
|
||||
};
|
||||
in {
|
||||
# Local shell for NixFlake directory
|
||||
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
|
||||
|
||||
# We give each configuration a name (the hostname) to choose a configuration when rebuilding.
|
||||
# We give each configuration a (host)name 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 = {
|
||||
# TODO: This should probably run using mapAttrs over the hostnames list...
|
||||
nixinator = mylib.nixos.mkNixosSystemConfig {
|
||||
# These configurations include HM as a NixOS module. This has a few benefits:
|
||||
# - The system config is available from within the HM config,
|
||||
# passed as nixosConfig input to each HM module
|
||||
# - This seems to be required for opt-in persistence
|
||||
# - The HM config can be rebuilt separately from the system,
|
||||
# without generating a new boot entry
|
||||
# Downsides:
|
||||
# - The nixd HM options completion doesn't seem to work
|
||||
# - The system needs to be rebuilt with every HM config change
|
||||
nixinator = mylib.nixos.mkNixosConfigWithHomeManagerModule {
|
||||
inherit system mylib;
|
||||
hostname = "nixinator";
|
||||
username = "christoph";
|
||||
extraModules = [];
|
||||
};
|
||||
nixtop = mylib.nixos.mkNixosSystemConfig {
|
||||
nixtop = mylib.nixos.mkNixosConfigWithHomeManagerModule {
|
||||
inherit system mylib;
|
||||
hostname = "nixtop";
|
||||
username = "christoph";
|
||||
extraModules = [];
|
||||
};
|
||||
|
||||
# These configurations don't include HM.
|
||||
# When using those, HM has to be installed separately in homeConfigurations.
|
||||
# nixinator = mylib.nixos.mkNixosSystemConfig {
|
||||
# inherit system mylib;
|
||||
# hostname = "nixinator";
|
||||
# extraModules = [];
|
||||
# };
|
||||
# nixtop = mylib.nixos.mkNixosSystemConfig {
|
||||
# inherit system mylib;
|
||||
# hostname = "nixtop";
|
||||
# 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 = [];
|
||||
};
|
||||
};
|
||||
# homeConfigurations = {
|
||||
# "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 = [];
|
||||
# };
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
@ -32,30 +32,6 @@ rec {
|
||||
google = false;
|
||||
};
|
||||
|
||||
# emacs = {
|
||||
# enable = false;
|
||||
# pgtkNativeComp = false;
|
||||
# nativeComp = false;
|
||||
# nixpkgs = true;
|
||||
|
||||
# doom.enable = true;
|
||||
# doom.autoSync = true;
|
||||
# doom.autoUpgrade = false; # Very volatile as the upgrade fails sometimes with bleeding edge emacs
|
||||
# };
|
||||
|
||||
# TODO: Only sync protonmail using its bridge
|
||||
email = {
|
||||
enable = false;
|
||||
autosync = true;
|
||||
imapnotify = false;
|
||||
|
||||
# Use kmail as viewer for stuff synced by mbsync
|
||||
kmail = {
|
||||
enable = false;
|
||||
autostart = true;
|
||||
};
|
||||
};
|
||||
|
||||
firefox = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
@ -67,8 +43,6 @@ rec {
|
||||
|
||||
fish.enable = true;
|
||||
|
||||
helix.enable = false;
|
||||
|
||||
hyprland = {
|
||||
enable = true;
|
||||
# theme = "Three-Bears";
|
||||
@ -174,19 +148,12 @@ rec {
|
||||
|
||||
nnn.enable = true;
|
||||
|
||||
# ranger = {
|
||||
# enable = false;
|
||||
# preview = true;
|
||||
# };
|
||||
|
||||
rofi = {
|
||||
enable = true;
|
||||
# theme = "Three-Bears";
|
||||
theme = "Foggy-Lake";
|
||||
};
|
||||
|
||||
vscode.enable = false; # TODO: Had broken package ms-vscode-cpptools
|
||||
|
||||
waybar = {
|
||||
enable = true;
|
||||
};
|
||||
|
@ -1,25 +1,29 @@
|
||||
{inputs, ...}: {
|
||||
imports = [
|
||||
# Obsolete modules are kept in this folder for reference.
|
||||
# ./audio
|
||||
# ./emacs
|
||||
# ./email
|
||||
# ./flatpak
|
||||
# ./helix
|
||||
# ./gaming
|
||||
# ./misc
|
||||
# ./nextcloud
|
||||
# ./ranger
|
||||
# ./vscode
|
||||
|
||||
# My own HM modules
|
||||
./chromium
|
||||
./emacs
|
||||
./email
|
||||
./firefox
|
||||
./fish
|
||||
# ./flatpak
|
||||
# ./gaming
|
||||
./helix
|
||||
./hyprland
|
||||
./kitty
|
||||
# ./misc
|
||||
./neovim
|
||||
# ./nextcloud
|
||||
./nnn
|
||||
./ranger
|
||||
./rofi
|
||||
./vscode
|
||||
./waybar
|
||||
|
||||
# HM modules imported from the flake inputs
|
||||
inputs.nix-flatpak.homeManagerModules.nix-flatpak
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
];
|
||||
|
@ -7,19 +7,20 @@
|
||||
mylib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
} @ inputs: let
|
||||
cfg = config.modules.hyprland;
|
||||
in {
|
||||
options.modules.hyprland = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# 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!";
|
||||
# }
|
||||
# ];
|
||||
assertions = [
|
||||
{
|
||||
# This assertion is not possible if HM is used standalone,
|
||||
# because nixosConfig won't be available.
|
||||
assertion = inputs.nixosConfig.programs.hyprland.enable;
|
||||
message = "Can't enable Hyprland module with Hyprland disabled!";
|
||||
}
|
||||
];
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
@ -15,6 +15,9 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
file.".config/neovide/config.toml".source = ./neovide_config.ini;
|
||||
file.".config/vale/.vale.ini".source = ./vale_config.ini;
|
||||
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
VISUAL = "nvim";
|
||||
@ -67,9 +70,6 @@ in {
|
||||
stylua
|
||||
]
|
||||
];
|
||||
|
||||
file.".config/neovide/config.toml".source = ./neovide_config.ini;
|
||||
file.".config/vale/.vale.ini".source = ./vale_config.ini;
|
||||
};
|
||||
|
||||
programs.nixvim = {
|
||||
@ -108,6 +108,7 @@ in {
|
||||
extraConfigLuaPost = builtins.readFile ./extraConfigLuaPost.lua;
|
||||
extraConfigLua = builtins.readFile ./extraConfigLua.lua;
|
||||
|
||||
# Those files will be added to the nvim runtimpath
|
||||
extraFiles = {
|
||||
# For this its probably important to set the default filetype to tex (see extraConfigLua)
|
||||
"ftplugin/tex/mappings.lua".text = mylib.generators.toLuaKeymap (import ./mappings_latex.nix {});
|
||||
@ -907,7 +908,6 @@ in {
|
||||
{name = "clojure_lsp";}
|
||||
{name = "cmake";}
|
||||
{name = "lua_ls";}
|
||||
# {name = "nil_ls";} # TODO: To use together with nixd, its hover functionality needs to be disabled to not conflict
|
||||
{
|
||||
name = "ltex";
|
||||
extraOptions.settings = {
|
||||
@ -916,9 +916,9 @@ in {
|
||||
};
|
||||
};
|
||||
}
|
||||
# {name = "nil_ls";} # Conflicts with nixd's hover
|
||||
{
|
||||
name = "nixd";
|
||||
# TODO: Figure out how to structure this attrset
|
||||
extraOptions.settings = {
|
||||
nixd = {
|
||||
nixpkgs = {
|
||||
@ -931,9 +931,10 @@ in {
|
||||
nixos = {
|
||||
expr = "(builtins.getFlake \"/home/${username}/NixFlake\").nixosConfigurations.${hostname}.options";
|
||||
};
|
||||
home_manager = {
|
||||
expr = "(builtins.getFlake \"/home/${username}/NixFlake\").homeConfigurations.\"${username}@${hostname}\".options";
|
||||
};
|
||||
# When using HM as a NixOS module, nixd's HM option completion doesn't work.
|
||||
# home_manager = {
|
||||
# expr = "(builtins.getFlake \"/home/${username}/NixFlake\").homeConfigurations.\"${username}@${hostname}\".options";
|
||||
# };
|
||||
};
|
||||
diagnostic = {
|
||||
suppress = [
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
# Make our inputs available to the configuration.nix (for importing modules)
|
||||
# specialArgs are propagated to all modules
|
||||
specialArgs = {inherit inputs hostname username mylib system;};
|
||||
specialArgs = {inherit inputs hostname mylib system username;};
|
||||
|
||||
modules = builtins.concatLists [
|
||||
[
|
||||
@ -29,10 +29,7 @@
|
||||
|
||||
extraModules
|
||||
|
||||
# I included the home config statically like this as I am the only user.
|
||||
# I would have liked to make it more flexible (for multiple users on the same host)
|
||||
# but I failed because nix stopped autoinjecting the required arguments and I didn't
|
||||
# know how to handle that...
|
||||
# HM is installed as a system module
|
||||
[
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
@ -88,7 +85,7 @@
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
# Make this stuff available to the hm modules
|
||||
# HM propagates these to every module
|
||||
extraSpecialArgs = {inherit inputs system mylib username hostname;};
|
||||
|
||||
modules = builtins.concatLists [
|
||||
|
Reference in New Issue
Block a user